use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodableDiscreteResourcesTest method testNotEmpty.
@Test
public void testNotEmpty() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a"), PortNumber.portNumber(1)).resource();
DiscreteResources sut = EncodableDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.isEmpty(), is(false));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodableDiscreteResourcesTest method testIfDifferenceIsNotChanged.
@Test
public void testIfDifferenceIsNotChanged() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a"), PortNumber.portNumber(1)).resource();
DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("a"), PortNumber.portNumber(2)).resource();
DiscreteResources sut = EncodableDiscreteResources.of(ImmutableSet.of(res1));
DiscreteResources other = EncodableDiscreteResources.of(ImmutableSet.of(res2));
DiscreteResources expected = EncodableDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.difference(other), is(expected));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodableDiscreteResourcesTest method testIfResourceIsContained.
@Test
public void testIfResourceIsContained() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a"), PortNumber.portNumber(1)).resource();
DiscreteResources sut = EncodableDiscreteResources.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 EncodableDiscreteResourcesTest method testIfResourceIsFound.
@Test
public void testIfResourceIsFound() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a"), PortNumber.portNumber(1)).resource();
DiscreteResources sut = EncodableDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.lookup(res1.id()), is(Optional.of(res1)));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class GenericDiscreteResourcesTest method testIfResourceIsFound.
@Test
public void testIfResourceIsFound() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1));
assertThat(sut.lookup(res1.id()), is(Optional.of(res1)));
}
Aggregations