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);
}
Aggregations