use of io.joynr.provider.JoynrProvider in project joynr by bmwcarit.
the class ProviderWrapperTest method testMessageScopeActivated.
@Test
public void testMessageScopeActivated() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("assertMessageContextActive");
assertFalse(JoynrJeeMessageContext.getInstance().isActive());
subject.invoke(proxy, method, new Object[0]);
assertFalse(JoynrJeeMessageContext.getInstance().isActive());
}
use of io.joynr.provider.JoynrProvider in project joynr by bmwcarit.
the class ProviderWrapperTest method testSetSubscriptionPublisherDoesNotActivateScope.
@Test
public void testSetSubscriptionPublisherDoesNotActivateScope() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceSubscriptionPublisherInjection.class.getMethod("setSubscriptionPublisher", new Class[] { SubscriptionPublisher.class });
subject.invoke(proxy, method, new Object[] { mock(MySubscriptionPublisher.class) });
assertFalse(JoynrJeeMessageContext.getInstance().isActive());
}
use of io.joynr.provider.JoynrProvider in project joynr by bmwcarit.
the class ProviderWrapperTest method testInvokeMultiOutMethod.
@Test
public void testInvokeMultiOutMethod() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceProviderInterface.class.getMethod("testMultiOutMethod");
Object result = subject.invoke(proxy, method, new Object[0]);
assertTrue(result instanceof Promise);
Promise<?> promise = (Promise<?>) result;
assertTrue(promise.isFulfilled());
promise.then(new PromiseListener() {
@Override
public void onFulfillment(Object... values) {
assertArrayEquals(new Object[] { "one", "two" }, values);
}
@Override
public void onRejection(JoynrException error) {
fail("Shouldn't be here.");
}
});
}
use of io.joynr.provider.JoynrProvider in project joynr by bmwcarit.
the class ProviderWrapperTest method testSetSubscriptionPublisherRegistersWithProducer.
@Test
public void testSetSubscriptionPublisherRegistersWithProducer() throws Throwable {
ProviderWrapper subject = createSubject();
JoynrProvider proxy = createProxy(subject);
Method method = TestServiceSubscriptionPublisherInjection.class.getMethod("setSubscriptionPublisher", new Class[] { SubscriptionPublisher.class });
subject.invoke(proxy, method, new Object[] { mock(MySubscriptionPublisher.class) });
verify(subscriptionPublisherProducer).add(any(), eq(TestServiceImpl.class));
}
use of io.joynr.provider.JoynrProvider 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"));
}
Aggregations