Search in sources :

Example 6 with TestApplicationId

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();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) TestApplicationId(org.onosproject.TestApplicationId) Test(org.junit.Test)

Example 7 with TestApplicationId

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();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) TestApplicationId(org.onosproject.TestApplicationId) Test(org.junit.Test)

Example 8 with TestApplicationId

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();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) SimpleVirtualMeterStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualMeterStore) EventDeliveryService(org.onosproject.event.EventDeliveryService) CoreService(org.onosproject.core.CoreService) TestApplicationId(org.onosproject.TestApplicationId) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) VirtualNetworkMeterStore(org.onosproject.incubator.net.virtual.VirtualNetworkMeterStore) VirtualProviderManager(org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager) Before(org.junit.Before)

Example 9 with TestApplicationId

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);
}
Also used : InputStream(java.io.InputStream) TestApplicationId(org.onosproject.TestApplicationId) JsonNode(com.fasterxml.jackson.databind.JsonNode) TestApplicationId(org.onosproject.TestApplicationId) ApplicationId(org.onosproject.core.ApplicationId) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Aggregations

TestApplicationId (org.onosproject.TestApplicationId)9 Before (org.junit.Before)7 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)4 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)4 CoreService (org.onosproject.core.CoreService)4 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)4 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Test (org.junit.Test)3 ApplicationId (org.onosproject.core.ApplicationId)3 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)3 ConfigApplyDelegate (org.onosproject.net.config.ConfigApplyDelegate)3 TestStorageService (org.onosproject.store.service.TestStorageService)3 EqualsTester (com.google.common.testing.EqualsTester)2 InputStream (java.io.InputStream)2 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)2 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ImmutableSet (com.google.common.collect.ImmutableSet)1