/**
* This method performs all actions mentioned in class description.
*
*/
public void run() throws Exception {
ValidMainExporter me = new ValidMainExporter();
ValidBootExporter be = new ValidBootExporter();
SPTRemoteObject ro = new SPTRemoteObject();
ProxyTrustExporter pte = createPTE(me, be);
Object res = pte.export(ro);
if (me.getExpNum() != 1) {
// FAIL
throw new TestException(
"Export method of mainExporter was called "
+ me.getExpNum() + " times while 1 was expected.");
}
// PASS
logger.fine("Export method of mainExporter was called 1 time "
+ "as expected.");
if (be.getExpNum() != 1) {
// FAIL
throw new TestException(
"Export method of bootExporter was called "
+ be.getExpNum() + " times while 1 was expected.");
}
// PASS
logger.fine("Export method of bootExporter was called 1 time "
+ "as expected.");
if (!Proxy.isProxyClass(res.getClass())) {
// FAIL
throw new TestException(
"Returned by 'export' method result is not a dynamic "
+ "Proxy class.");
}
// PASS
logger.fine("Returned by 'export' method result is a dynamic "
+ "Proxy class as expected.");
if (!ProxyTrustUtil.sameInterfaces(res, me.getProxy())) {
// FAIL
throw new TestException(
"List of interfaces implemented by class returned by "
+ "'export' method call: "
+ ProxyTrustUtil.interfacesToString(res)
+ " is not equal to the one required: "
+ ProxyTrustUtil.interfacesToString(me.getProxy()));
}
// PASS
logger.fine("List of interfaces implemented by class returned by "
+ "'export' method call is the same as the one for "
+ "main proxy class as expected.");
if (res.getClass().getClassLoader() !=
me.getProxy().getClass().getClassLoader()) {
// FAIL
throw new TestException(
"Returned by 'export' method result is defined in "
+ "class loader other than proxy produced by "
+ "ValidMainExporter's 'export' method.");
}
// PASS
logger.fine("Returned by 'export' method result is defined in "
+ "the same class loader as proxy produced by "
+ "ValidMainExporter's 'export' method as expected.");
ProxyTrustInvocationHandler ptih = new ProxyTrustInvocationHandler(
(RemoteMethodControl) me.getProxy(),
(ProxyTrust) be.getProxy());
if (!ptih.equals(Proxy.getInvocationHandler(res))) {
// FAIL
throw new TestException(