Search in sources :

Example 6 with TestEnum

use of joynr.tests.testTypes.TestEnum in project joynr by bmwcarit.

the class AbstractProviderProxyEnd2EndTest method asyncMethodCallWithEnumListReturned.

@Ignore
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void asyncMethodCallWithEnumListReturned() throws DiscoveryException, JoynrIllegalStateException, InterruptedException {
    ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
    testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    TestEnum[] enums = proxy.methodWithEnumListReturn(2);
    assertArrayEquals(new TestEnum[] { TestEnum.TWO }, enums);
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) TestEnum(joynr.tests.testTypes.TestEnum) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with TestEnum

use of joynr.tests.testTypes.TestEnum in project joynr by bmwcarit.

the class AbstractProviderProxyEnd2EndTest method testMethodWithNullEnumInputReturnsSomethingSensible.

@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void testMethodWithNullEnumInputReturnsSomethingSensible() throws DiscoveryException, JoynrIllegalStateException, InterruptedException {
    TestEnum input = null;
    ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
    testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    int result = proxy.methodWithEnumParameter(input);
    assertEquals(42, result);
}
Also used : joynr.tests.testProxy(joynr.tests.testProxy) TestEnum(joynr.tests.testTypes.TestEnum) Test(org.junit.Test)

Example 8 with TestEnum

use of joynr.tests.testTypes.TestEnum in project joynr by bmwcarit.

the class AbstractProviderProxyEnd2EndTest method calledMethodReturnsMultipleOutputParametersAsyncFuture.

@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void calledMethodReturnsMultipleOutputParametersAsyncFuture() throws Exception {
    ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
    testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    Future<MethodWithMultipleOutputParametersReturned> future = proxy.methodWithMultipleOutputParameters(new MethodWithMultipleOutputParametersCallback() {

        @Override
        public void onFailure(JoynrRuntimeException error) {
            logger.error("error in calledMethodReturnsMultipleOutputParametersAsyncCallback", error);
        }

        @Override
        public void onSuccess(String aString, Integer aNumber, GpsLocation aComplexDataType, TestEnum anEnumResult) {
            assertEquals(TEST_INTEGER, aNumber);
            assertEquals(TEST_STRING, aString);
            assertEquals(TEST_COMPLEXTYPE, aComplexDataType);
            assertEquals(TEST_ENUM, anEnumResult);
        }
    });
    MethodWithMultipleOutputParametersReturned reply = future.get();
    assertEquals(TEST_INTEGER, reply.aNumber);
    assertEquals(TEST_STRING, reply.aString);
    assertEquals(TEST_COMPLEXTYPE, reply.aComplexDataType);
    assertEquals(TEST_ENUM, reply.anEnumResult);
}
Also used : MethodWithMultipleOutputParametersReturned(joynr.tests.testSync.MethodWithMultipleOutputParametersReturned) joynr.tests.testProxy(joynr.tests.testProxy) GpsLocation(joynr.types.Localisation.GpsLocation) TestEnum(joynr.tests.testTypes.TestEnum) MethodWithMultipleOutputParametersCallback(joynr.tests.testAsync.MethodWithMultipleOutputParametersCallback) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) Test(org.junit.Test)

Example 9 with TestEnum

use of joynr.tests.testTypes.TestEnum in project joynr by bmwcarit.

the class SerializationTest method serializeEnumTest.

@Test
public void serializeEnumTest() throws Exception {
    String valueAsString = objectMapper.writeValueAsString(TestEnum.TWO);
    System.out.println(valueAsString);
    TestEnum readValue = objectMapper.readValue(valueAsString, TestEnum.class);
    assertEquals(TestEnum.TWO, readValue);
}
Also used : TestEnum(joynr.tests.testTypes.TestEnum) Test(org.junit.Test)

Example 10 with TestEnum

use of joynr.tests.testTypes.TestEnum in project joynr by bmwcarit.

the class AbstractBroadcastEnd2EndTest method subscribeToBroadcastWithEnumOutput.

@Ignore
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void subscribeToBroadcastWithEnumOutput() throws InterruptedException {
    final Semaphore broadcastReceived = new Semaphore(0);
    final TestEnum expectedTestEnum = TestEnum.TWO;
    proxy.subscribeToBroadcastWithEnumOutputBroadcast(new testBroadcastInterface.BroadcastWithEnumOutputBroadcastAdapter() {

        @Override
        public void onReceive(TestEnum testEnum) {
            assertEquals(expectedTestEnum, testEnum);
            broadcastReceived.release();
        }

        @Override
        public void onError(SubscriptionException error) {
            fail("Error subscribing to broadcast");
        }
    }, new MulticastSubscriptionQos());
    Thread.sleep(300);
    provider.fireBroadcastWithEnumOutput(expectedTestEnum);
    broadcastReceived.acquire();
}
Also used : SubscriptionException(io.joynr.exceptions.SubscriptionException) TestEnum(joynr.tests.testTypes.TestEnum) Semaphore(java.util.concurrent.Semaphore) joynr.tests.testBroadcastInterface(joynr.tests.testBroadcastInterface) MulticastSubscriptionQos(joynr.MulticastSubscriptionQos) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

TestEnum (joynr.tests.testTypes.TestEnum)10 Test (org.junit.Test)10 joynr.tests.testProxy (joynr.tests.testProxy)7 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)2 Semaphore (java.util.concurrent.Semaphore)2 MethodWithMultipleOutputParametersCallback (joynr.tests.testAsync.MethodWithMultipleOutputParametersCallback)2 GpsLocation (joynr.types.Localisation.GpsLocation)2 Ignore (org.junit.Ignore)2 SubscriptionException (io.joynr.exceptions.SubscriptionException)1 HashMap (java.util.HashMap)1 MulticastSubscriptionQos (joynr.MulticastSubscriptionQos)1 PeriodicSubscriptionQos (joynr.PeriodicSubscriptionQos)1 joynr.tests.testBroadcastInterface (joynr.tests.testBroadcastInterface)1 MethodWithMultipleOutputParametersReturned (joynr.tests.testSync.MethodWithMultipleOutputParametersReturned)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1