本文整理匯總了Java中org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType.OPERATIONAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java TreeType.OPERATIONAL屬性的具體用法?Java TreeType.OPERATIONAL怎麽用?Java TreeType.OPERATIONAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType
的用法示例。
在下文中一共展示了TreeType.OPERATIONAL屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTreeType
public TreeType getTreeType() {
switch (datastoreContext.getLogicalStoreType()) {
case CONFIGURATION:
return TreeType.CONFIGURATION;
case OPERATIONAL:
return TreeType.OPERATIONAL;
default:
throw new IllegalStateException("Unhandled logical store type "
+ datastoreContext.getLogicalStoreType());
}
}
示例2: setUp
@Before
public void setUp() {
peopleSchemaContext = SchemaContextHelper.select(SchemaContextHelper.PEOPLE_YANG);
carsSchemaContext = SchemaContextHelper.select(SchemaContextHelper.CARS_YANG);
final Shard mockShard = Mockito.mock(Shard.class);
peopleDataTree = new ShardDataTree(mockShard, peopleSchemaContext, TreeType.OPERATIONAL);
coordinator = ShardRecoveryCoordinator.create(peopleDataTree, "foobar", FOO_LOGGER);
coordinator.startLogRecoveryBatch(10);
}
示例3: setUp
@Before
public void setUp() {
doReturn(Ticker.systemTicker()).when(mockShard).ticker();
doReturn(Mockito.mock(ShardStats.class)).when(mockShard).getShardMBean();
fullSchema = SchemaContextHelper.full();
shardDataTree = new ShardDataTree(mockShard, fullSchema, TreeType.OPERATIONAL);
}
示例4: treeTypeForStore
private TreeType treeTypeForStore(final LogicalDatastoreType store) {
return store == LogicalDatastoreType.CONFIGURATION ? TreeType.CONFIGURATION : TreeType.OPERATIONAL;
}
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:3,代碼來源:ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
示例5: testGetOwnershipState
@Test
public void testGetOwnershipState() throws Exception {
DistributedEntityOwnershipService service = spy(DistributedEntityOwnershipService.start(
dataStore.getActorContext(), EntityOwnerSelectionStrategyConfig.newBuilder().build()));
final Shard mockShard = Mockito.mock(Shard.class);
ShardDataTree shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(),
TreeType.OPERATIONAL);
when(service.getLocalEntityOwnershipShardDataTree()).thenReturn(shardDataTree.getDataTree());
DOMEntity entity1 = new DOMEntity(ENTITY_TYPE, "one");
writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, entity1.getIdentifier(), "member-1"),
shardDataTree);
writeNode(ENTITY_OWNERS_PATH, entityOwnersWithEntityTypeEntry(entityTypeEntryWithEntityEntry(entity1.getType(),
entityEntryWithOwner(entity1.getIdentifier(), "member-1"))), shardDataTree);
verifyGetOwnershipState(service, entity1, EntityOwnershipState.IS_OWNER);
writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE,
entity1.getIdentifier(), "member-2"), shardDataTree);
writeNode(entityPath(entity1.getType(), entity1.getIdentifier()),
entityEntryWithOwner(entity1.getIdentifier(), "member-2"), shardDataTree);
verifyGetOwnershipState(service, entity1, EntityOwnershipState.OWNED_BY_OTHER);
writeNode(entityPath(entity1.getType(), entity1.getIdentifier()), entityEntryWithOwner(entity1.getIdentifier(),
""), shardDataTree);
verifyGetOwnershipState(service, entity1, EntityOwnershipState.NO_OWNER);
DOMEntity entity2 = new DOMEntity(ENTITY_TYPE, "two");
Optional<EntityOwnershipState> state = service.getOwnershipState(entity2);
assertEquals("getOwnershipState present", false, state.isPresent());
writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, entity2.getIdentifier(), "member-1"),
shardDataTree);
writeNode(entityPath(entity2.getType(), entity2.getIdentifier()), ImmutableNodes.mapEntry(ENTITY_QNAME,
ENTITY_ID_QNAME, entity2.getIdentifier()), shardDataTree);
verifyGetOwnershipState(service, entity2, EntityOwnershipState.NO_OWNER);
deleteNode(candidatePath(entityPath(entity2.getType(), entity2.getIdentifier()), "member-1"), shardDataTree);
Optional<EntityOwnershipState> state2 = service.getOwnershipState(entity2);
assertEquals("getOwnershipState present", false, state2.isPresent());
service.close();
}
示例6: setup
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(), TreeType.OPERATIONAL);
}
示例7: testListenerNotifiedOnApplySnapshot
@Test
public void testListenerNotifiedOnApplySnapshot() throws Exception {
immediatePayloadReplication(shardDataTree, mockShard);
DOMDataTreeChangeListener listener = mock(DOMDataTreeChangeListener.class);
shardDataTree.registerTreeChangeListener(CarsModel.CAR_LIST_PATH.node(CarsModel.CAR_QNAME), listener,
Optional.absent(), noop -> { });
addCar(shardDataTree, "optima");
verifyOnDataTreeChanged(listener, dtc -> {
assertEquals("getModificationType", ModificationType.WRITE, dtc.getRootNode().getModificationType());
assertEquals("getRootPath", CarsModel.newCarPath("optima"), dtc.getRootPath());
});
addCar(shardDataTree, "sportage");
verifyOnDataTreeChanged(listener, dtc -> {
assertEquals("getModificationType", ModificationType.WRITE, dtc.getRootNode().getModificationType());
assertEquals("getRootPath", CarsModel.newCarPath("sportage"), dtc.getRootPath());
});
ShardDataTree newDataTree = new ShardDataTree(mockShard, fullSchema, TreeType.OPERATIONAL);
immediatePayloadReplication(newDataTree, mockShard);
addCar(newDataTree, "optima");
addCar(newDataTree, "murano");
shardDataTree.applySnapshot(newDataTree.takeStateSnapshot());
Map<YangInstanceIdentifier, ModificationType> expChanges = Maps.newHashMap();
expChanges.put(CarsModel.newCarPath("optima"), ModificationType.WRITE);
expChanges.put(CarsModel.newCarPath("murano"), ModificationType.WRITE);
expChanges.put(CarsModel.newCarPath("sportage"), ModificationType.DELETE);
verifyOnDataTreeChanged(listener, dtc -> {
ModificationType expType = expChanges.remove(dtc.getRootPath());
assertNotNull("Got unexpected change for " + dtc.getRootPath(), expType);
assertEquals("getModificationType", expType, dtc.getRootNode().getModificationType());
});
if (!expChanges.isEmpty()) {
fail("Missing change notifications: " + expChanges);
}
}
示例8: belongsToTree
/**
* Checks if supplied schema node belong to specified Data Tree type. All nodes belong to the operational tree,
* nodes in configuration tree are marked as such.
*
* @param treeType Tree Type
* @param node Schema node
* @return {@code true} if the node matches the tree type, {@code false} otherwise.
*/
static boolean belongsToTree(final TreeType treeType, final DataSchemaNode node) {
return treeType == TreeType.OPERATIONAL || node.isConfiguration();
}