Search in sources :

Example 6 with GlobalDiscoveryEntryPersisted

use of io.joynr.capabilities.GlobalDiscoveryEntryPersisted in project joynr by bmwcarit.

the class GlobalCapabilitiesDirectoryEjbTest method testTouch.

@Test
public void testTouch() throws InterruptedException {
    long initialLastSeen = testGlobalDiscoveryEntry.getLastSeenDateMs();
    subject.add(testGlobalDiscoveryEntry);
    entityManager.flush();
    entityManager.clear();
    GlobalDiscoveryEntryPersisted persisted = entityManager.find(GlobalDiscoveryEntryPersisted.class, testGlobalDiscoveryEntry.getParticipantId());
    assertNotNull(persisted);
    assertEquals((Long) initialLastSeen, persisted.getLastSeenDateMs());
    Thread.sleep(1L);
    subject.touch(TOPIC_NAME);
    entityManager.flush();
    entityManager.clear();
    persisted = entityManager.find(GlobalDiscoveryEntryPersisted.class, testGlobalDiscoveryEntry.getParticipantId());
    assertNotNull(persisted);
    assertTrue(initialLastSeen < persisted.getLastSeenDateMs());
}
Also used : GlobalDiscoveryEntryPersisted(io.joynr.capabilities.GlobalDiscoveryEntryPersisted) Test(org.junit.Test)

Aggregations

GlobalDiscoveryEntryPersisted (io.joynr.capabilities.GlobalDiscoveryEntryPersisted)6 Address (joynr.system.RoutingTypes.Address)2 ChannelAddress (joynr.system.RoutingTypes.ChannelAddress)2 MqttAddress (joynr.system.RoutingTypes.MqttAddress)2 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)2 Test (org.junit.Test)2 DeferredVoid (io.joynr.provider.DeferredVoid)1 Promise (io.joynr.provider.Promise)1 ProviderRuntimeException (joynr.exceptions.ProviderRuntimeException)1