Search in sources :

Example 1 with PersistedSubscriptionRequest

use of io.joynr.dispatching.subscription.PersistedSubscriptionRequest 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());
}
Also used : SubscriptionRequest(joynr.SubscriptionRequest) PersistedSubscriptionRequest(io.joynr.dispatching.subscription.PersistedSubscriptionRequest) BroadcastSubscriptionRequest(joynr.BroadcastSubscriptionRequest) PersistedSubscriptionRequest(io.joynr.dispatching.subscription.PersistedSubscriptionRequest) OnChangeSubscriptionQos(joynr.OnChangeSubscriptionQos) FileSubscriptionRequestStorage(io.joynr.dispatching.subscription.FileSubscriptionRequestStorage) OnChangeSubscriptionQos(joynr.OnChangeSubscriptionQos) SubscriptionQos(io.joynr.pubsub.SubscriptionQos) OnChangeWithKeepAliveSubscriptionQos(joynr.OnChangeWithKeepAliveSubscriptionQos) File(java.io.File) Test(org.junit.Test)

Aggregations

FileSubscriptionRequestStorage (io.joynr.dispatching.subscription.FileSubscriptionRequestStorage)1 PersistedSubscriptionRequest (io.joynr.dispatching.subscription.PersistedSubscriptionRequest)1 SubscriptionQos (io.joynr.pubsub.SubscriptionQos)1 File (java.io.File)1 BroadcastSubscriptionRequest (joynr.BroadcastSubscriptionRequest)1 OnChangeSubscriptionQos (joynr.OnChangeSubscriptionQos)1 OnChangeWithKeepAliveSubscriptionQos (joynr.OnChangeWithKeepAliveSubscriptionQos)1 SubscriptionRequest (joynr.SubscriptionRequest)1 Test (org.junit.Test)1