当前位置: 首页>>代码示例>>Java>>正文


Java TreeType.OPERATIONAL属性代码示例

本文整理汇总了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());
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:Shard.java

示例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);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:ShardRecoveryCoordinatorTest.java

示例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);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:ShardDataTreeTest.java

示例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();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:43,代码来源:DistributedEntityOwnershipServiceTest.java

示例6: setup

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    shardDataTree = new ShardDataTree(mockShard, SchemaContextHelper.entityOwners(), TreeType.OPERATIONAL);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:CandidateListChangeListenerTest.java

示例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);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:43,代码来源:ShardDataTreeTest.java

示例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();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:SchemaAwareApplyOperation.java


注:本文中的org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType.OPERATIONAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。