Search in sources :

Example 46 with Version

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

the class DiscoveryEntryVersionFilterTest method testEmptySetUnchanged.

@Test
public void testEmptySetUnchanged() {
    Version callerVersion = new Version(0, 0);
    Set<DiscoveryEntryWithMetaInfo> discoveryEntries = new HashSet<>();
    Set<DiscoveryEntryWithMetaInfo> result = subject.filter(callerVersion, discoveryEntries, null);
    assertNotNull(result);
    assertEquals(discoveryEntries, result);
}
Also used : Version(joynr.types.Version) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 47 with Version

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

the class DiscoveryEntryVersionFilterTest method testIncompatibleVersionFilteredOut.

@Test
public void testIncompatibleVersionFilteredOut() {
    Version callerVersion = new Version(1, 0);
    DiscoveryEntryWithMetaInfo discoveryEntry = mock(DiscoveryEntryWithMetaInfo.class);
    Version providerVersion = new Version(2, 0);
    when(discoveryEntry.getProviderVersion()).thenReturn(providerVersion);
    Set<DiscoveryEntryWithMetaInfo> discoveryEntries = Sets.newHashSet(discoveryEntry);
    Set<DiscoveryEntryWithMetaInfo> result = subject.filter(callerVersion, discoveryEntries, null);
    assertNotNull(result);
    assertTrue(result.isEmpty());
}
Also used : Version(joynr.types.Version) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) Test(org.junit.Test)

Example 48 with Version

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

the class DiscoveryEntryVersionFilterTest method testCompatibleVersionLeftIn.

@Test
public void testCompatibleVersionLeftIn() {
    Version callerVersion = new Version(1, 0);
    DiscoveryEntryWithMetaInfo discoveryEntry = mock(DiscoveryEntryWithMetaInfo.class);
    Version providerVersion = new Version(1, 0);
    when(discoveryEntry.getProviderVersion()).thenReturn(providerVersion);
    Set<DiscoveryEntryWithMetaInfo> discoveryEntries = Sets.newHashSet(discoveryEntry);
    when(versionCompatibilityChecker.check(eq(callerVersion), eq(providerVersion))).thenReturn(true);
    Set<DiscoveryEntryWithMetaInfo> result = subject.filter(callerVersion, discoveryEntries, null);
    assertNotNull(result);
    assertEquals(1, result.size());
    assertEquals(discoveryEntries, result);
}
Also used : Version(joynr.types.Version) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) Test(org.junit.Test)

Example 49 with Version

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

the class VersionCompatibilityCheckerTest method testProviderIsNull.

@Test(expected = IllegalArgumentException.class)
public void testProviderIsNull() {
    Version caller = new Version(0, 0);
    Version provider = null;
    subject.check(caller, provider);
}
Also used : Version(joynr.types.Version) Test(org.junit.Test)

Example 50 with Version

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

the class VersionCompatibilityCheckerTest method testDifferentMajorVersionsIncompatible.

@Test
public void testDifferentMajorVersionsIncompatible() {
    Version caller = new Version(2, 0);
    Version provider = new Version(3, 0);
    boolean result = subject.check(caller, provider);
    assertFalse(result);
}
Also used : Version(joynr.types.Version) Test(org.junit.Test)

Aggregations

Version (joynr.types.Version)65 Test (org.junit.Test)47 ProviderQos (joynr.types.ProviderQos)43 DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)29 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)24 DiscoveryEntry (joynr.types.DiscoveryEntry)22 ArrayList (java.util.ArrayList)13 ChannelAddress (joynr.system.RoutingTypes.ChannelAddress)13 Matchers.anyString (org.mockito.Matchers.anyString)12 Callback (io.joynr.proxy.Callback)11 HashSet (java.util.HashSet)11 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)10 InvocationOnMock (org.mockito.invocation.InvocationOnMock)10 JoynrVersion (io.joynr.JoynrVersion)9 Address (joynr.system.RoutingTypes.Address)9 HashMap (java.util.HashMap)8 MqttAddress (joynr.system.RoutingTypes.MqttAddress)8 DiscoveryException (io.joynr.exceptions.DiscoveryException)7 Set (java.util.Set)7 DeferredVoid (io.joynr.provider.DeferredVoid)6