use of io.joynr.dispatching.subscription.FileSubscriptionRequestStorage in project joynr by bmwcarit.
the class SerializationTest method serializeDeserializeSubscriptionRequests.
@Test
public void serializeDeserializeSubscriptionRequests() throws Exception {
String persistenceFileName = "target/test_persistenceSubscriptionRequests_" + UUID.randomUUID().toString();
String proxyPid = "proxyPid";
String providerPid = "providerPid";
String subscriptionId = "subscriptionId";
String subscribedToName = "subscribedToName";
SubscriptionQos qos = new OnChangeSubscriptionQos();
SubscriptionRequest subscriptionRequest = new SubscriptionRequest(subscriptionId, subscribedToName, qos);
new File(persistenceFileName).delete();
FileSubscriptionRequestStorage fileSubscriptionRequestStorage = new FileSubscriptionRequestStorage(persistenceFileName);
fileSubscriptionRequestStorage.persistSubscriptionRequest(proxyPid, providerPid, subscriptionRequest);
SetMultimap<String, PersistedSubscriptionRequest> savedSubscriptionRequests = fileSubscriptionRequestStorage.getSavedSubscriptionRequests();
assertEquals(1, savedSubscriptionRequests.get(providerPid).size());
PersistedSubscriptionRequest persistedSubscriptionRequest = savedSubscriptionRequests.get(providerPid).iterator().next();
assertEquals(subscriptionRequest, persistedSubscriptionRequest.getSubscriptonRequest());
assertEquals(proxyPid, persistedSubscriptionRequest.getProxyParticipantId());
}
Aggregations