Search in sources :

Example 1 with TStringKeyMap

use of joynr.types.TestTypes.TStringKeyMap in project joynr by bmwcarit.

the class AbstractProviderProxyEnd2EndTest method testBroadcastWithMapParameter.

@Ignore
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void testBroadcastWithMapParameter() throws DiscoveryException, JoynrIllegalStateException, InterruptedException {
    final Semaphore broadcastReceived = new Semaphore(0);
    ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domain, testProxy.class);
    testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    final TStringKeyMap mapParam = new TStringKeyMap();
    mapParam.put("key", "value");
    proxy.subscribeToBroadcastWithMapParametersBroadcast(new BroadcastWithMapParametersBroadcastAdapter() {

        @Override
        public void onReceive(TStringKeyMap receivedMapParam) {
            assertEquals(mapParam, receivedMapParam);
            broadcastReceived.release();
        }
    }, new MulticastSubscriptionQos());
    // wait to allow the subscription request to arrive at the provider
    getSubscriptionTestsPublisher().waitForBroadcastSubscription();
    provider.fireBroadcastWithMapParameters(mapParam);
    broadcastReceived.acquire();
}
Also used : TStringKeyMap(joynr.types.TestTypes.TStringKeyMap) BroadcastWithMapParametersBroadcastAdapter(joynr.tests.testBroadcastInterface.BroadcastWithMapParametersBroadcastAdapter) joynr.tests.testProxy(joynr.tests.testProxy) Semaphore(java.util.concurrent.Semaphore) MulticastSubscriptionQos(joynr.MulticastSubscriptionQos) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with TStringKeyMap

use of joynr.types.TestTypes.TStringKeyMap in project joynr by bmwcarit.

the class AbstractProviderProxyEnd2EndTest method methodWithMapParameters.

@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void methodWithMapParameters() throws Exception {
    ProxyBuilder<testProxy> proxyBuilder = consumerRuntime.getProxyBuilder(domainAsync, testProxy.class);
    testProxy proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
    TStringKeyMap inMap = new TStringKeyMap();
    String key = "inkey";
    String value = "invalue";
    inMap.put(key, value);
    TStringKeyMap result1 = proxy.mapParameters(inMap);
    assertEquals(value, result1.get(key));
    assertEquals(OUT_VALUE, result1.get(OUT_KEY));
}
Also used : TStringKeyMap(joynr.types.TestTypes.TStringKeyMap) joynr.tests.testProxy(joynr.tests.testProxy) Test(org.junit.Test)

Example 3 with TStringKeyMap

use of joynr.types.TestTypes.TStringKeyMap in project joynr by bmwcarit.

the class SerializationTest method serializeDeserializeSimpleMapTest.

@Test
public void serializeDeserializeSimpleMapTest() throws Exception {
    TStringKeyMap tStringMap = new TStringKeyMap();
    tStringMap.put("key1", "value1");
    tStringMap.put("key2", "value2");
    String valueAsString = objectMapper.writeValueAsString(tStringMap);
    TStringKeyMap readValue = objectMapper.readValue(valueAsString, TStringKeyMap.class);
    assertEquals(tStringMap, readValue);
}
Also used : TStringKeyMap(joynr.types.TestTypes.TStringKeyMap) Test(org.junit.Test)

Example 4 with TStringKeyMap

use of joynr.types.TestTypes.TStringKeyMap in project joynr by bmwcarit.

the class SerializationTest method serializeDeserializeMapWithEnumKeyTest.

@Test
public void serializeDeserializeMapWithEnumKeyTest() throws Exception {
    TEverythingMap tmap = new TEverythingMap();
    Byte tInt8 = 1;
    Byte tUInt8 = 2;
    Short tInt16 = 3;
    Short tUInt16 = 4;
    Integer tInt32 = 5;
    Integer tUInt32 = 6;
    Long tInt64 = 7L;
    Long tUInt64 = 8L;
    Double tDouble = 9.0;
    Float tFloat = 10.0f;
    Boolean tBoolean = false;
    String tString = "tString";
    Byte[] tByteBuffer = { 1, 2, 3 };
    Byte[] tUInt8Array = { 4, 5, 6 };
    TEnum tEnum = TEnum.TLITERALA;
    TEnum[] tEnumArray = { TEnum.TLITERALA, TEnum.TLITERALB };
    String[] tStringArray = { "tStringArray1", "tStringArray2" };
    Word word = new Word(new Vowel[] { Vowel.A, Vowel.E });
    Word[] wordArray = { word, word };
    Boolean tBooleanExtended = true;
    String tStringExtended = "tStringExtended";
    TStringKeyMap tStringMap = new TStringKeyMap();
    tStringMap.put("key1", "value1");
    tStringMap.put("key2", "value2");
    TStruct typeDefForTStruct = new TStruct();
    TEverythingExtendedStruct value = new TEverythingExtendedStruct(tInt8, tUInt8, tInt16, tUInt16, tInt32, tUInt32, tInt64, tUInt64, tDouble, tFloat, tString, tBoolean, tByteBuffer, tUInt8Array, tEnum, tEnumArray, tStringArray, word, wordArray, tStringMap, typeDefForTStruct, tBooleanExtended, tStringExtended);
    tmap.put(TEnum.TLITERALA, value);
    tmap.put(TEnum.TLITERALB, value);
    String valueAsString = objectMapper.writeValueAsString(tmap);
    TEverythingMap readValue = objectMapper.readValue(valueAsString, TEverythingMap.class);
    assertEquals(tmap, readValue);
}
Also used : TStringKeyMap(joynr.types.TestTypes.TStringKeyMap) Word(joynr.types.TestTypes.Word) TStruct(joynr.types.TestTypes.TStruct) TEverythingMap(joynr.types.TestTypes.TEverythingMap) TEnum(joynr.types.TestTypes.TEnum) TEverythingExtendedStruct(joynr.types.TestTypes.TEverythingExtendedStruct) Test(org.junit.Test)

Aggregations

TStringKeyMap (joynr.types.TestTypes.TStringKeyMap)4 Test (org.junit.Test)4 joynr.tests.testProxy (joynr.tests.testProxy)2 Semaphore (java.util.concurrent.Semaphore)1 MulticastSubscriptionQos (joynr.MulticastSubscriptionQos)1 BroadcastWithMapParametersBroadcastAdapter (joynr.tests.testBroadcastInterface.BroadcastWithMapParametersBroadcastAdapter)1 TEnum (joynr.types.TestTypes.TEnum)1 TEverythingExtendedStruct (joynr.types.TestTypes.TEverythingExtendedStruct)1 TEverythingMap (joynr.types.TestTypes.TEverythingMap)1 TStruct (joynr.types.TestTypes.TStruct)1 Word (joynr.types.TestTypes.Word)1 Ignore (org.junit.Ignore)1