Search in sources :

Example 11 with DistributedShardRegistration

use of org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration in project controller by opendaylight.

the class DistributedShardedDOMDataTreeTest method testCDSDataTreeProducer.

@Test
public void testCDSDataTreeProducer() throws Exception {
    initEmptyDatastores();
    final DistributedShardRegistration reg1 = waitOnAsyncTask(leaderShardFactory.createDistributedShard(TEST_ID, Lists.newArrayList(AbstractTest.MEMBER_NAME)), DistributedShardedDOMDataTree.SHARD_FUTURE_TIMEOUT_DURATION);
    leaderTestKit.waitUntilLeader(leaderDistributedDataStore.getActorContext(), ClusterUtils.getCleanShardName(TestModel.TEST_PATH));
    assertNotNull(findLocalShard(leaderDistributedDataStore.getActorContext(), ClusterUtils.getCleanShardName(TestModel.TEST_PATH)));
    final DOMDataTreeIdentifier configRoot = new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);
    final DOMDataTreeProducer producer = leaderShardFactory.createProducer(Collections.singleton(configRoot));
    assertTrue(producer instanceof CDSDataTreeProducer);
    final CDSDataTreeProducer cdsProducer = (CDSDataTreeProducer) producer;
    CDSShardAccess shardAccess = cdsProducer.getShardAccess(TEST_ID);
    assertEquals(shardAccess.getShardIdentifier(), TEST_ID);
    shardAccess = cdsProducer.getShardAccess(INNER_LIST_ID);
    assertEquals(TEST_ID, shardAccess.getShardIdentifier());
    shardAccess = cdsProducer.getShardAccess(configRoot);
    assertEquals(configRoot, shardAccess.getShardIdentifier());
    waitOnAsyncTask(reg1.close(), DistributedShardedDOMDataTree.SHARD_FUTURE_TIMEOUT_DURATION);
}
Also used : DistributedShardRegistration(org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration) DOMDataTreeIdentifier(org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier) DOMDataTreeProducer(org.opendaylight.mdsal.dom.api.DOMDataTreeProducer) CDSShardAccess(org.opendaylight.controller.cluster.dom.api.CDSShardAccess) CDSDataTreeProducer(org.opendaylight.controller.cluster.dom.api.CDSDataTreeProducer) Test(org.junit.Test) AbstractTest(org.opendaylight.controller.cluster.datastore.AbstractTest)

Aggregations

DistributedShardRegistration (org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration)11 Test (org.junit.Test)9 AbstractTest (org.opendaylight.controller.cluster.datastore.AbstractTest)9 DOMDataTreeProducer (org.opendaylight.mdsal.dom.api.DOMDataTreeProducer)6 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)6 DOMDataTreeIdentifier (org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier)5 AddressFromURIString (akka.actor.AddressFromURIString)4 DOMDataTreeCursorAwareTransaction (org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction)4 DOMDataTreeWriteCursor (org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor)4 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)4 ActorRef (akka.actor.ActorRef)3 HashSet (java.util.HashSet)3 DOMDataTreeListener (org.opendaylight.mdsal.dom.api.DOMDataTreeListener)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 Matchers.anyCollection (org.mockito.Matchers.anyCollection)2 DOMDataTreeShardingConflictException (org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException)2 RpcError (org.opendaylight.yangtools.yang.common.RpcError)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 MapNode (org.opendaylight.yangtools.yang.data.api.schema.MapNode)2