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();
}
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));
}
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);
}
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);
}
Aggregations