use of org.onosproject.TestApplicationId in project onos by opennetworkinglab.
the class ObjectiveTest method testEqualsFilteringObjective.
/**
* Tests equality, hash, and toString operations on filtering objectives.
*/
@Test
public void testEqualsFilteringObjective() {
FilteringObjective filter1 = baseFilteringBuilder().add();
FilteringObjective sameAsFilter1 = filter1.copy().add();
FilteringObjective filter2 = baseFilteringBuilder().permit().add();
FilteringObjective filter3 = baseFilteringBuilder().fromApp(new TestApplicationId("foo2")).add();
FilteringObjective filter4 = baseFilteringBuilder().permit().remove();
FilteringObjective filter5 = baseFilteringBuilder().withPriority(55).add();
FilteringObjective filter6 = baseFilteringBuilder().makePermanent().add();
new EqualsTester().addEqualityGroup(filter1, sameAsFilter1).addEqualityGroup(filter2).addEqualityGroup(filter3).addEqualityGroup(filter4).addEqualityGroup(filter5).addEqualityGroup(filter6).testEquals();
}
use of org.onosproject.TestApplicationId in project onos by opennetworkinglab.
the class ObjectiveTest method testEqualsForwardingObjective.
/**
* Tests equality, hash, and toString operations on filtering objectives.
*/
@Test
public void testEqualsForwardingObjective() {
ForwardingObjective forward1 = baseForwardingBuilder().add();
ForwardingObjective sameAsForward1 = forward1.copy().add();
ForwardingObjective forward2 = baseForwardingBuilder().withFlag(VERSATILE).add();
ForwardingObjective forward3 = baseForwardingBuilder().fromApp(new TestApplicationId("foo2")).add();
ForwardingObjective forward4 = baseForwardingBuilder().remove();
ForwardingObjective forward5 = baseForwardingBuilder().withPriority(55).add();
ForwardingObjective forward6 = baseForwardingBuilder().makePermanent().add();
new EqualsTester().addEqualityGroup(forward1, sameAsForward1).addEqualityGroup(forward2).addEqualityGroup(forward3).addEqualityGroup(forward4).addEqualityGroup(forward5).addEqualityGroup(forward6).testEquals();
}
use of org.onosproject.TestApplicationId in project onos by opennetworkinglab.
the class VirtualNetworkMeterManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestStorageService storageService = new TestStorageService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", storageService);
virtualNetworkManagerStore.activate();
meterStore = new SimpleVirtualMeterStore();
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(provider);
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
TestUtils.setField(manager, "coreService", coreService);
eventDeliveryService = new TestEventDispatcher();
NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
// eventDeliveryService.addSink(VirtualEvent.class, listenerRegistryManager);
appId = new TestApplicationId("MeterManagerTest");
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, providerRegistryService).add(EventDeliveryService.class, eventDeliveryService).add(StorageService.class, storageService).add(VirtualNetworkMeterStore.class, meterStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
vnet1 = setupVirtualNetworkTopology(manager, TID1);
vnet2 = setupVirtualNetworkTopology(manager, TID2);
meterManager1 = new VirtualNetworkMeterManager(manager, vnet1.id());
meterManager2 = new VirtualNetworkMeterManager(manager, vnet2.id());
providerService1 = (VirtualMeterProviderService) providerRegistryService.getProviderService(vnet1.id(), VirtualMeterProvider.class);
providerService2 = (VirtualMeterProviderService) providerRegistryService.getProviderService(vnet2.id(), VirtualMeterProvider.class);
assertTrue("provider should be registered", providerRegistryService.getProviders().contains(provider.id()));
setupMeterTestVariables();
}
use of org.onosproject.TestApplicationId in project trellis-control by opennetworkinglab.
the class SegmentRoutingAppConfigTest method setUp.
/**
* Initialize test related variables.
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {
InputStream jsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app.json");
InputStream invalidJsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app-invalid.json");
InputStream mplsEcmpJsonStream = SegmentRoutingAppConfigTest.class.getResourceAsStream("/app-ecmp.json");
String key = APP_NAME;
ApplicationId subject = new TestApplicationId(key);
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(jsonStream);
JsonNode invalidJsonNode = mapper.readTree(invalidJsonStream);
JsonNode mplsEcmpJsonNode = mapper.readTree(mplsEcmpJsonStream);
ConfigApplyDelegate delegate = new MockDelegate();
config = new SegmentRoutingAppConfig();
config.init(subject, key, jsonNode, mapper, delegate);
invalidConfig = new SegmentRoutingAppConfig();
invalidConfig.init(subject, key, invalidJsonNode, mapper, delegate);
mplsEcmpConfig = new SegmentRoutingAppConfig();
mplsEcmpConfig.init(subject, key, mplsEcmpJsonNode, mapper, delegate);
}
Aggregations