/*
* 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 4472769
* @summary Stubs and skeletons used to implement the RMI registry
* implementation and the bootstrap stubs must always follow certain
* "well known" protocols so that they otherwise need not be in sync--
* in other words, a registry stub from any arbitrary J2SE vendor and
* version must be able to communicate with a registry skeleton from
* any other arbitrary J2SE vendor and version. In addition to
* protocol, with its unevolvable operation number scheme, they must
* "interface hash": 4905912898345647071L.
*
* @author Peter Jones
* @library ../../testlibrary
* @build TestLibrary ReferenceRegistryStub
*/
public class InterfaceHash {
"\n=== verifying that J2SE registry's skeleton uses" +
"\ncorrect interface hash and operation numbers:");
throw new RuntimeException(
"TEST FAILED: unexpected list contents");
}
result);
throw new RuntimeException(
"TEST FAILED: unexpected lookup result");
}
throw new RuntimeException("TEST FAILED: list not empty");
}
"correct interface hash:");
class FakeRemoteRef implements RemoteRef {
long hash;
int opnum;
{
throw new UnsupportedOperationException();
}
{
throw new UnsupportedOperationException();
}
return "FakeRemoteRef";
}
public int remoteHashCode() { return 1013; }
}
FakeRemoteRef f = new FakeRemoteRef();
new Object[] { f });
testStub);
try {
} catch (UnsupportedOperationException e) {
}
if (f.hash != 4905912898345647071L) {
throw new RuntimeException("TEST FAILED: wrong interface hash");
} else if (f.opnum != 0) {
throw new RuntimeException("TEST FAILED: wrong operation number");
}
try {
} catch (UnsupportedOperationException e) {
}
if (f.hash != 4905912898345647071L) {
throw new RuntimeException("TEST FAILED: wrong interface hash");
} else if (f.opnum != 1) {
throw new RuntimeException("TEST FAILED: wrong operation number");
}
try {
} catch (UnsupportedOperationException e) {
}
if (f.hash != 4905912898345647071L) {
throw new RuntimeException("TEST FAILED: wrong interface hash");
} else if (f.opnum != 2) {
throw new RuntimeException("TEST FAILED: wrong operation number");
}
try {
} catch (UnsupportedOperationException e) {
}
if (f.hash != 4905912898345647071L) {
throw new RuntimeException("TEST FAILED: wrong interface hash");
} else if (f.opnum != 3) {
throw new RuntimeException("TEST FAILED: wrong operation number");
}
try {
} catch (UnsupportedOperationException e) {
}
if (f.hash != 4905912898345647071L) {
throw new RuntimeException("TEST FAILED: wrong interface hash");
} else if (f.opnum != 4) {
throw new RuntimeException("TEST FAILED: wrong operation number");
}
}
}