use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testIfDifferenceIsNotEmpty.
@Test
public void testIfDifferenceIsNotEmpty() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("b")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1, res2));
DiscreteResources other = GenericDiscreteResources.of(ImmutableSet.of(res1));
DiscreteResources expected = GenericDiscreteResources.of(ImmutableSet.of(res2));
assertThat(sut.difference(other), is(expected));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testIfDifferenceIsEmpty.
@Test
public void testIfDifferenceIsEmpty() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("b")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1, res2));
DiscreteResources other = GenericDiscreteResources.of(ImmutableSet.of(res1, res2));
DiscreteResources expected = GenericDiscreteResources.of(ImmutableSet.of());
assertThat(sut.difference(other), is(expected));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testIfResourceIsNotContained.
@Test
public void testIfResourceIsNotContained() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("b")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.containsAny(ImmutableSet.of(res2)), is(false));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testIfResourceIsContained.
@Test
public void testIfResourceIsContained() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.containsAny(ImmutableSet.of(res1)), is(true));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testDifferenceFromEmpty.
@Test
public void testDifferenceFromEmpty() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1));
DiscreteResources other = GenericDiscreteResources.of(ImmutableSet.of());
DiscreteResources expected = GenericDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.difference(other), is(expected));
}
Aggregations