use of io.joynr.jeeintegration.ProviderWrapper in project joynr by bmwcarit.
the class ProviderWrapperTest method testInvokeMethodWithParams.
@Test
public void testInvokeMethodWithParams() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testServiceMethod", new Class[] { Integer.TYPE, String.class });
Object result = subject.invoke(proxy, method, new Object[] { 1, "one" });
assertTrue(result instanceof Promise);
assertPromiseEquals(result, new TestServiceImpl().testServiceMethod(1, "one"));
}
use of io.joynr.jeeintegration.ProviderWrapper in project joynr by bmwcarit.
the class ProviderWrapperTest method testInvokeMethodNoArgs.
@Test
public void testInvokeMethodNoArgs() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testServiceMethodNoArgs");
Object result = subject.invoke(proxy, method, new Object[0]);
assertTrue(result instanceof Promise);
assertPromiseEquals(result, "test");
}
use of io.joynr.jeeintegration.ProviderWrapper in project joynr by bmwcarit.
the class ProviderWrapperTest method testInvokeMethodThrowingProviderRuntimeException.
@Test
public void testInvokeMethodThrowingProviderRuntimeException() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testThrowsProviderRuntimeException");
Object result = subject.invoke(proxy, method, new Object[0]);
assertNotNull(result);
assertTrue(result instanceof Promise);
assertTrue(((Promise<?>) result).isRejected());
((Promise<?>) result).then(new PromiseListener() {
@Override
public void onFulfillment(Object... values) {
fail("Should never get here");
}
@Override
public void onRejection(JoynrException error) {
assertTrue(error instanceof ProviderRuntimeException);
}
});
}
use of io.joynr.jeeintegration.ProviderWrapper in project joynr by bmwcarit.
the class ProviderWrapperTest method testPrincipalCopied.
@Test
public void testPrincipalCopied() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testServiceMethodNoArgs");
subject.invoke(proxy, method, new Object[0]);
verify(joynrCallingPincipal).setUsername(USERNAME);
}
use of io.joynr.jeeintegration.ProviderWrapper in project joynr by bmwcarit.
the class ProviderWrapperTest method testInvokeMethodThrowingApplicationException.
@Test
public void testInvokeMethodThrowingApplicationException() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testThrowsApplicationException");
Object result = subject.invoke(proxy, method, new Object[0]);
assertNotNull(result);
assertTrue(result instanceof Promise);
assertTrue(((Promise<?>) result).isRejected());
((Promise<?>) result).then(new PromiseListener() {
@Override
public void onFulfillment(Object... values) {
fail("Should never get here");
}
@Override
public void onRejection(JoynrException error) {
assertTrue(error instanceof ApplicationException);
}
});
}
Aggregations