Search in sources :

Example 1 with MyServiceSync

use of joynr.jeeintegration.servicelocator.MyServiceSync in project joynr by bmwcarit.

the class JeeJoynrServiceLocatorTest method testProxyUnwrapsApplicationException.

@Test(expected = ApplicationException.class)
public void testProxyUnwrapsApplicationException() throws Exception {
    reset(myJoynrProxy);
    doThrow(new ApplicationException(MyService.CallMeWithExceptionErrorEnum.MY_ERROR)).when(myJoynrProxy).callMeWithException();
    MyServiceSync proxy = subject.get(MyServiceSync.class, "local");
    proxy.callMeWithException();
}
Also used : ApplicationException(joynr.exceptions.ApplicationException) MyServiceSync(joynr.jeeintegration.servicelocator.MyServiceSync) Test(org.junit.Test)

Example 2 with MyServiceSync

use of joynr.jeeintegration.servicelocator.MyServiceSync in project joynr by bmwcarit.

the class JeeJoynrServiceLocatorTest method testGet.

@Test
public void testGet() {
    MyServiceSync result = subject.get(MyServiceSync.class, "local");
    assertNotNull(result);
    String callResult = result.callMe("one");
    assertNotNull(callResult);
    assertEquals("two", callResult);
    verify(myJoynrProxy).callMe("one");
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) MyServiceSync(joynr.jeeintegration.servicelocator.MyServiceSync) Test(org.junit.Test)

Example 3 with MyServiceSync

use of joynr.jeeintegration.servicelocator.MyServiceSync in project joynr by bmwcarit.

the class JeeJoynrServiceLocatorTest method testGetWithTtl.

@Test
public void testGetWithTtl() {
    MyServiceSync result = subject.get(MyServiceSync.class, "local", 10000L);
    assertNotNull(result);
    String callResult = result.callMe("one");
    assertNotNull(callResult);
    assertEquals("two", callResult);
    verify(myJoynrProxy).callMe("one");
    ArgumentCaptor<MessagingQos> messagingQosCaptor = ArgumentCaptor.forClass(MessagingQos.class);
    verify(proxyBuilder).setMessagingQos(messagingQosCaptor.capture());
    MessagingQos messagingQosParam = messagingQosCaptor.getValue();
    assertEquals(10000L, messagingQosParam.getRoundTripTtl_ms());
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) Matchers.anyString(org.mockito.Matchers.anyString) MyServiceSync(joynr.jeeintegration.servicelocator.MyServiceSync) Test(org.junit.Test)

Example 4 with MyServiceSync

use of joynr.jeeintegration.servicelocator.MyServiceSync in project joynr by bmwcarit.

the class JeeJoynrServiceLocatorTest method testGetWithMessagingAndDiscoveryQos.

@Test
public void testGetWithMessagingAndDiscoveryQos() {
    MessagingQos messagingQos = new MessagingQos();
    DiscoveryQos discoveryQos = new DiscoveryQos();
    MyServiceSync result = subject.get(MyServiceSync.class, "local", messagingQos, discoveryQos);
    assertNotNull(result);
    String callResult = result.callMe("one");
    assertNotNull(callResult);
    assertEquals("two", callResult);
    verify(myJoynrProxy).callMe("one");
    verify(proxyBuilder).setMessagingQos(messagingQos);
    verify(proxyBuilder).setDiscoveryQos(discoveryQos);
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) Matchers.anyString(org.mockito.Matchers.anyString) MyServiceSync(joynr.jeeintegration.servicelocator.MyServiceSync) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) Test(org.junit.Test)

Example 5 with MyServiceSync

use of joynr.jeeintegration.servicelocator.MyServiceSync in project joynr by bmwcarit.

the class JeeJoynrServiceLocatorTest method testGetMultiDomain.

@Test
public void testGetMultiDomain() {
    Set<String> domains = Sets.newHashSet("one", "two", "three");
    when(joynrRuntime.getProxyBuilder(domains, MyServiceProxy.class)).thenReturn(proxyBuilder);
    MyServiceSync result = subject.get(MyServiceSync.class, domains);
    assertNotNull(result);
    String callResult = result.callMe("one");
    assertEquals("two", callResult);
    verify(joynrRuntime).getProxyBuilder(domains, MyServiceProxy.class);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) MyServiceSync(joynr.jeeintegration.servicelocator.MyServiceSync) Test(org.junit.Test)

Aggregations

MyServiceSync (joynr.jeeintegration.servicelocator.MyServiceSync)6 Test (org.junit.Test)5 Matchers.anyString (org.mockito.Matchers.anyString)4 MessagingQos (io.joynr.messaging.MessagingQos)2 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)1 ApplicationException (joynr.exceptions.ApplicationException)1