Search in sources :

Example 31 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class PreCommitPortManagerTest method setUp.

/**
 * Initializes this unit test.
 */
@Before
public void setUp() {
    target = new PreCommitPortManager();
    TestUtils.setField(target, "coreService", new TestCoreService());
    TestUtils.setField(target, "storageService", new TestStorageService());
    target.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) Before(org.junit.Before)

Example 32 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class InstancePortManagerTest method setUp.

/**
 * Initial setup for this unit test.
 */
@Before
public void setUp() {
    store = new DistributedInstancePortStore();
    TestUtils.setField(store, "coreService", new TestCoreService());
    TestUtils.setField(store, "storageService", new TestStorageService());
    TestUtils.setField(store, "eventExecutor", MoreExecutors.newDirectExecutorService());
    store.activate();
    target = new InstancePortManager();
    TestUtils.setField(target, "coreService", new TestCoreService());
    TestUtils.setField(target, "hostService", new TestHostService());
    TestUtils.setField(target, "leadershipService", new TestLeadershipService());
    TestUtils.setField(target, "clusterService", new TestClusterService());
    target.instancePortStore = store;
    target.addListener(testInstancePortListener);
    target.activate();
    HostLocation location1 = new HostLocation(DEV_ID_1, PORT_NUM_1, TIME_1);
    HostLocation location2 = new HostLocation(DEV_ID_2, PORT_NUM_2, TIME_2);
    DefaultAnnotations.Builder annotations1 = DefaultAnnotations.builder().set(ANNOTATION_NETWORK_ID, NETWORK_ID_1).set(ANNOTATION_PORT_ID, PORT_ID_1).set(ANNOTATION_CREATE_TIME, String.valueOf(TIME_1));
    DefaultAnnotations.Builder annotations2 = DefaultAnnotations.builder().set(ANNOTATION_NETWORK_ID, NETWORK_ID_2).set(ANNOTATION_PORT_ID, PORT_ID_2).set(ANNOTATION_CREATE_TIME, String.valueOf(TIME_2));
    Host host1 = new DefaultHost(PROVIDER_ID, HOST_ID_1, MAC_ADDRESS_1, VLAN_ID, location1, ImmutableSet.of(IP_ADDRESS_1), annotations1.build());
    Host host2 = new DefaultHost(PROVIDER_ID, HOST_ID_2, MAC_ADDRESS_2, VLAN_ID, location2, ImmutableSet.of(IP_ADDRESS_2), annotations2.build());
    instancePort1 = DefaultInstancePort.from(host1, ACTIVE);
    instancePort2 = DefaultInstancePort.from(host2, INACTIVE);
}
Also used : DefaultHost(org.onosproject.net.DefaultHost) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) TestStorageService(org.onosproject.store.service.TestStorageService) HostLocation(org.onosproject.net.HostLocation) Host(org.onosproject.net.Host) DefaultHost(org.onosproject.net.DefaultHost) Before(org.junit.Before)

Example 33 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class OpenstackRouterManagerTest method setUp.

@Before
public void setUp() throws Exception {
    osRouterStore = new DistributedOpenstackRouterStore();
    TestUtils.setField(osRouterStore, "coreService", new TestCoreService());
    TestUtils.setField(osRouterStore, "storageService", new TestStorageService());
    TestUtils.setField(osRouterStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
    osRouterStore.activate();
    target = new OpenstackRouterManager();
    target.coreService = new TestCoreService();
    target.osRouterStore = osRouterStore;
    target.addListener(testListener);
    target.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) Before(org.junit.Before)

Example 34 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class VirtualNetworkDeviceManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    coreService = new VirtualNetworkDeviceManagerTest.TestCoreService();
    TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
    TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
    virtualNetworkManagerStore.activate();
    manager = new VirtualNetworkManager();
    manager.store = virtualNetworkManagerStore;
    manager.coreService = coreService;
    NetTestTools.injectEventDispatcher(manager, dispatcher);
    testDirectory = new TestServiceDirectory();
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
}
Also used : DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 35 with TestStorageService

use of org.onosproject.store.service.TestStorageService in project onos by opennetworkinglab.

the class DistributedMeterStoreTest method setup.

@Before
public void setup() {
    meterStore = new DistributedMeterStore();
    TestUtils.setField(meterStore, "storageService", new TestStorageService());
    TestUtils.setField(meterStore, "driverService", new TestDriverService());
    KryoNamespace.Builder testKryoBuilder = TestUtils.getField(meterStore, "APP_KRYO_BUILDER");
    testKryoBuilder.register(TestApplicationId.class);
    Serializer testSerializer = Serializer.using(Lists.newArrayList(testKryoBuilder.build()));
    TestUtils.setField(meterStore, "serializer", testSerializer);
    meterStore.activate();
}
Also used : TestStorageService(org.onosproject.store.service.TestStorageService) KryoNamespace(org.onlab.util.KryoNamespace) Serializer(org.onosproject.store.service.Serializer) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)75 TestStorageService (org.onosproject.store.service.TestStorageService)75 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)18 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)12 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)12 CoreService (org.onosproject.core.CoreService)8 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)6 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)5 TestApplicationId (org.onosproject.TestApplicationId)3 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)3 ClusterService (org.onosproject.cluster.ClusterService)3 LeadershipServiceAdapter (org.onosproject.cluster.LeadershipServiceAdapter)3 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)3 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)3 Semaphore (java.util.concurrent.Semaphore)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)2 KryoNamespace (org.onlab.util.KryoNamespace)2 NodeId (org.onosproject.cluster.NodeId)2