public void test_systemException_BAD_OPERATION() {
try {
TestObjectServant tos = new TestObjectServant();
TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
servant.setIds(ids);
bindServant(servant, "TestObject");
DynaCorbaRequest request =
new DynaCorbaRequest(bindReference("TestObject"), "methodThatSurelyDoesNotExist");
request.invoke();
fail();
} catch (Exception e) {
if (e instanceof CorbaException) {
assertTrue(true);
} else {
e.printStackTrace();
}
}
try {
InvalidTestObjectServant tos = new InvalidTestObjectServant();
TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
InvocationProxy proxy = new ComponentInvocationProxy((RuntimeEndpoint) service.getEndpoints().get(0), javaClass);
DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
servant.setIds(ids);
bindServant(servant, "InvalidTestObject");
TestObject to = TestObjectHelper.narrow(bindReference("InvalidTestObject"));