use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class CodecsTest method isMplsEncodable.
/**
* Checks that it's possible to encode a MPLS label.
*/
@Test
public void isMplsEncodable() {
DiscreteResource resource = Resources.discrete(DID, PN, MPLS).resource();
assertThat(sut.isEncodable(resource), is(true));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EmptyDiscreteResourcesTest method testContainsAny.
@Test
public void testContainsAny() {
DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("b")).resource();
assertThat(sut.containsAny(ImmutableSet.of(res1)), is(false));
assertThat(sut.containsAny(ImmutableSet.of(res2)), is(false));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodedDiscreteResourcesTest method testDifference.
@Test
public void testDifference() {
DiscreteResource res1 = Resources.discrete(DID, PN, VID1).resource();
DiscreteResource res2 = Resources.discrete(DID, PN, VID2).resource();
DiscreteResource res3 = Resources.discrete(DID, PN, VID3).resource();
EncodedDiscreteResources sut = EncodedDiscreteResources.of(ImmutableSet.of(res1, res2), new VlanIdCodec());
EncodedDiscreteResources other = EncodedDiscreteResources.of(ImmutableSet.of(res1, res3), new VlanIdCodec());
assertThat(sut.difference(other), is(EncodedDiscreteResources.of(ImmutableSet.of(res2), new VlanIdCodec())));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodedDiscreteResourcesTest method testContains.
@Test
public void testContains() {
DiscreteResource res1 = Resources.discrete(DID, PN, VID1).resource();
DiscreteResource res2 = Resources.discrete(DID, PN, VID2).resource();
DiscreteResource res3 = Resources.discrete(DID, PN, VID3).resource();
Set<DiscreteResource> resources = ImmutableSet.of(res1, res2);
EncodedDiscreteResources sut = EncodedDiscreteResources.of(resources, new VlanIdCodec());
assertThat(sut.contains(res1), is(true));
assertThat(sut.contains(res3), is(false));
}
use of org.onosproject.net.resource.DiscreteResource in project onos by opennetworkinglab.
the class EncodedDiscreteResourcesTest method testAdd.
@Test
public void testAdd() {
DiscreteResource res1 = Resources.discrete(DID, PN, VID1).resource();
DiscreteResource res2 = Resources.discrete(DID, PN, VID2).resource();
DiscreteResource res3 = Resources.discrete(DID, PN, VID3).resource();
EncodedDiscreteResources sut = EncodedDiscreteResources.of(ImmutableSet.of(res1, res2), new VlanIdCodec());
EncodedDiscreteResources other = EncodedDiscreteResources.of(ImmutableSet.of(res1, res3), new VlanIdCodec());
assertThat(sut.add(other), is(EncodedDiscreteResources.of(ImmutableSet.of(res1, res2, res3), new VlanIdCodec())));
}
Aggregations