}
// inherit javadoc
public void run() throws Exception {
try {
BasicInvocationHandler handler;
RemoteMethodControl proxy, newProxy;
FakeMethodConstraints clientConstraints = new FakeMethodConstraints(
new InvocationConstraint[] {Integrity.YES});
FakeMethodConstraints serverConstraints = new FakeMethodConstraints(
new InvocationConstraint[] {Confidentiality.YES});
FakeObjectEndpoint oe = new FakeObjectEndpoint();
logger.log(Level.FINE,"=================================");
logger.log(Level.FINE,"test case 1: setConstraints(null)");
logger.log(Level.FINE,"");
handler = new BasicInvocationHandler(
new BasicInvocationHandler(oe,serverConstraints),
clientConstraints);
proxy = (RemoteMethodControl) Proxy.newProxyInstance(
this.getClass().getClassLoader(),
new Class[] {RemoteMethodControl.class}, handler);
newProxy =
(RemoteMethodControl) proxy.setConstraints(null);
handler =
(BasicInvocationHandler) Proxy.getInvocationHandler(newProxy);
assertion(handler.getObjectEndpoint() == oe);
assertion(handler.getClientConstraints() == null);
assertion(handler.getServerConstraints() == serverConstraints);
assertion(proxy.getConstraints() == clientConstraints);
assertion(newProxy.getConstraints() == null);
logger.log(Level.FINE,"=================================");
logger.log(Level.FINE,"test case 2: "
+ "setConstraints(MethodConstraints)");
logger.log(Level.FINE,"");
handler = new BasicInvocationHandler(
new BasicInvocationHandler(oe,serverConstraints),
null);
proxy = (RemoteMethodControl) Proxy.newProxyInstance(
this.getClass().getClassLoader(),
new Class[] {RemoteMethodControl.class}, handler);
newProxy =
(RemoteMethodControl) proxy.setConstraints(clientConstraints);
handler =
(BasicInvocationHandler) Proxy.getInvocationHandler(newProxy);
assertion(handler.getObjectEndpoint() == oe);
assertion(handler.getClientConstraints() == clientConstraints);
assertion(handler.getServerConstraints() == serverConstraints);
assertion(proxy.getConstraints() == null);
assertion(newProxy.getConstraints() == clientConstraints);
logger.log(Level.FINE,"=================================");
logger.log(Level.FINE,"test case 3: bad proxy arg");
logger.log(Level.FINE,"");
handler = new BasicInvocationHandler(oe,serverConstraints);
Method m = RemoteMethodControl.class.getMethod(
"setConstraints",new Class[] {MethodConstraints.class});
try {
handler.invoke(new Object(),m,new Object[] {clientConstraints});
assertion(false);
} catch (Exception ignore) {
}
} catch (Throwable t) {