/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4251010
* @summary equals does not works on stub objects created with
* custom socket AndFactory
* @author Laird Dornin
*
* @library ../../../testlibrary
* @build TestLibrary
*/
/**
* Test ensures that a stub that has never been serialized and one
* that has can be .equals(). Test also ensures that stubs with
* custom socket factories can be .equals() with equivalent stubs.
*/
public class VerifyRemoteEquals {
/**
* Remote interface.
*/
}
/**
* Implementation of Remote interface passing custom socket
* factories
*/
public static final class TestImpl
extends UnicastRemoteObject implements Test
{
super();
}
throws RemoteException
{
}
throws RemoteException
{
}
}
/**
* Remote interface for retrieving Test object.
*/
}
/**
* Implementation of interface TestHome.
*/
public static final class TestHomeImpl
extends UnicastRemoteObject implements TestHome
{
throws RemoteException {
super();
}
return test;
}
}
/**
* Custom server socket factory.
*/
public static final class ServerSocketAndFactory
{
// I am forced to do something useless with the parent
// constructor
super(0);
}
{
super(port);
}
throws IOException
{
return new ServerSocketAndFactory(port);
}
public int hashCode() {
return getLocalPort();
}
if (obj instanceof ServerSocketAndFactory) {
return true;
}
}
return false;
}
}
/**
* Custom socket factory.
*/
public static final class ClientSocketAndFactory
{
}
}
throws IOException {
}
public int hashCode() {
return getPort();
}
if (obj instanceof ClientSocketAndFactory) {
return true;
}
}
return false;
}
}
try {
new ServerSocketAndFactory());
} else {
}
} else {
}
// explicitly compare an unmarshalled object with toStub
// return
} else {
}
} catch (Exception e) {
}
}
}