Search in sources :

Example 51 with DiscoveryEntryWithMetaInfo

use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.

the class CapabilitiesUtilsTest method testConvertDiscoveryEntryWithMetaInfoToDiscoveryEntry.

@Test
public void testConvertDiscoveryEntryWithMetaInfoToDiscoveryEntry() {
    boolean isLocal = true;
    DiscoveryEntryWithMetaInfo discoveryEntry = new DiscoveryEntryWithMetaInfo(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId", isLocal);
    DiscoveryEntry convertedEntry = CapabilityUtils.convertToDiscoveryEntry(discoveryEntry);
    assertTrue(DiscoveryEntry.class.equals(convertedEntry.getClass()));
    compareDiscoveryEntries(isLocal, convertedEntry, discoveryEntry);
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) Version(joynr.types.Version) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) ProviderQos(joynr.types.ProviderQos) Test(org.junit.Test)

Example 52 with DiscoveryEntryWithMetaInfo

use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.

the class CapabilitiesUtilsTest method testConvertGlobalDiscoveryEntryToDiscoveryEntryWithMetaInfo.

@Test
public void testConvertGlobalDiscoveryEntryToDiscoveryEntryWithMetaInfo() {
    boolean isLocal = false;
    DiscoveryEntry discoveryEntry = new DiscoveryEntry(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId");
    GlobalDiscoveryEntry globalDiscoveryEntry = CapabilityUtils.discoveryEntry2GlobalDiscoveryEntry(discoveryEntry, new MqttAddress());
    DiscoveryEntryWithMetaInfo convertedEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, discoveryEntry);
    compareDiscoveryEntries(isLocal, discoveryEntry, convertedEntry);
    DiscoveryEntryWithMetaInfo convertedGlobalEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, globalDiscoveryEntry);
    compareDiscoveryEntries(isLocal, globalDiscoveryEntry, convertedGlobalEntry);
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) Version(joynr.types.Version) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) ProviderQos(joynr.types.ProviderQos) MqttAddress(joynr.system.RoutingTypes.MqttAddress) Test(org.junit.Test)

Example 53 with DiscoveryEntryWithMetaInfo

use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.

the class CapabilitiesUtilsTest method compareCollectionOfDiscoveryEntries.

private void compareCollectionOfDiscoveryEntries(Collection<DiscoveryEntry> convertedEntries, Collection<DiscoveryEntryWithMetaInfo> discoveryEntries) {
    int numberOfValidConversions = 0;
    assertEquals(discoveryEntries.size(), convertedEntries.size());
    for (DiscoveryEntryWithMetaInfo discoveryEntry : discoveryEntries) {
        for (DiscoveryEntry convertedEntry : convertedEntries) {
            if (convertedEntry.getParticipantId().equals(discoveryEntry.getParticipantId())) {
                assertTrue(DiscoveryEntry.class.equals(convertedEntry.getClass()));
                compareDiscoveryEntries(discoveryEntry.getIsLocal(), convertedEntry, discoveryEntry);
                numberOfValidConversions++;
                break;
            }
            continue;
        }
    }
    assertEquals(discoveryEntries.size(), numberOfValidConversions);
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo)

Example 54 with DiscoveryEntryWithMetaInfo

use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.

the class CapabilitiesUtilsTest method compareCollectionOfDiscoveryEntriesWithMetaInfo.

private void compareCollectionOfDiscoveryEntriesWithMetaInfo(boolean isLocal, Collection<DiscoveryEntry> discoveryEntries, Collection<DiscoveryEntryWithMetaInfo> convertedEntries) {
    int numberOfValidConversions = 0;
    assertEquals(discoveryEntries.size(), convertedEntries.size());
    for (DiscoveryEntry discoveryEntry : discoveryEntries) {
        for (DiscoveryEntryWithMetaInfo convertedEntry : convertedEntries) {
            if (convertedEntry.getParticipantId().equals(discoveryEntry.getParticipantId())) {
                assertTrue(DiscoveryEntryWithMetaInfo.class.equals(convertedEntry.getClass()));
                compareDiscoveryEntries(isLocal, discoveryEntry, convertedEntry);
                numberOfValidConversions++;
                break;
            }
            continue;
        }
    }
    assertEquals(discoveryEntries.size(), numberOfValidConversions);
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo)

Example 55 with DiscoveryEntryWithMetaInfo

use of joynr.types.DiscoveryEntryWithMetaInfo in project joynr by bmwcarit.

the class CapabilitiesUtilsTest method testConvertLocalDiscoveryEntryToDiscoveryEntryWithMetaInfo.

@Test
public void testConvertLocalDiscoveryEntryToDiscoveryEntryWithMetaInfo() {
    boolean isLocal = true;
    DiscoveryEntry discoveryEntry = new DiscoveryEntry(new Version(42, 23), "testDomain", "testInterfaceName", "testParticipantId", new ProviderQos(), 4711l, 4712l, "testPublicKeyId");
    DiscoveryEntryWithMetaInfo convertedDiscoveryEntry = CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(isLocal, discoveryEntry);
    compareDiscoveryEntries(isLocal, discoveryEntry, convertedDiscoveryEntry);
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) Version(joynr.types.Version) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) ProviderQos(joynr.types.ProviderQos) Test(org.junit.Test)

Aggregations

DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)66 Test (org.junit.Test)32 Version (joynr.types.Version)29 ProviderQos (joynr.types.ProviderQos)24 DiscoveryEntry (joynr.types.DiscoveryEntry)16 HashSet (java.util.HashSet)14 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)13 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)11 Matchers.anyString (org.mockito.Matchers.anyString)10 InvocationOnMock (org.mockito.invocation.InvocationOnMock)10 ChannelAddress (joynr.system.RoutingTypes.ChannelAddress)9 Before (org.junit.Before)9 DiscoveryException (io.joynr.exceptions.DiscoveryException)7 MessagingQos (io.joynr.messaging.MessagingQos)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 Set (java.util.Set)7 Callback (io.joynr.proxy.Callback)6 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)5 Collection (java.util.Collection)5