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


Java InstanceIdentifier.create方法代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.binding.InstanceIdentifier.create方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceIdentifier.create方法的具体用法?Java InstanceIdentifier.create怎么用?Java InstanceIdentifier.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yangtools.yang.binding.InstanceIdentifier的用法示例。


在下文中一共展示了InstanceIdentifier.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeDataTree

import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; //导入方法依赖的package包/类
private void initializeDataTree(DataBroker db) {
    LOG.info("Preparing to initialize the greeting registry");
    WriteTransaction transaction = db.newWriteOnlyTransaction();
    InstanceIdentifier<GreetingRegistry> iid = InstanceIdentifier.create(GreetingRegistry.class);
    GreetingRegistry greetingRegistry = new GreetingRegistryBuilder()
            .build();
    transaction.put(LogicalDatastoreType.OPERATIONAL, iid, greetingRegistry);
    CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
    Futures.addCallback(future, new LoggingFuturesCallBack<>("Failed to create greeting registry", LOG));
}
 
开发者ID:lrodrin,项目名称:opendaylight,代码行数:11,代码来源:HelloProvider.java

示例2: ContainerBindingContext

import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
ContainerBindingContext(final Class<? extends DataObject> appConfigBindingClass) {
    super((Class<DataObject>) appConfigBindingClass,
            InstanceIdentifier.create((Class<DataObject>) appConfigBindingClass), ContainerSchemaNode.class);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:BindingContext.java

示例3: testAddRemovePrefixShardReplica

import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; //导入方法依赖的package包/类
@Test
public void testAddRemovePrefixShardReplica() throws Exception {
    String name = "testAddPrefixShardReplica";
    String moduleShardsConfig = "module-shards-default.conf";

    final MemberNode member1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
            .moduleShardsConfig(moduleShardsConfig).build();
    final MemberNode replicaNode2 = MemberNode.builder(memberNodes).akkaConfig("Member2").testName(name)
            .moduleShardsConfig(moduleShardsConfig).build();
    final MemberNode replicaNode3 = MemberNode.builder(memberNodes).akkaConfig("Member3").testName(name)
            .moduleShardsConfig(moduleShardsConfig).build();

    member1.waitForMembersUp("member-2", "member-3");
    replicaNode2.kit().waitForMembersUp("member-1", "member-3");
    replicaNode3.kit().waitForMembersUp("member-1", "member-2");

    final ActorRef shardManager1 = member1.configDataStore().getActorContext().getShardManager();

    shardManager1.tell(new PrefixShardCreated(new PrefixShardConfiguration(
                    new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, CarsModel.BASE_PATH),
                    "prefix", Collections.singleton(MEMBER_1))),
            ActorRef.noSender());

    member1.kit().waitUntilLeader(member1.configDataStore().getActorContext(),
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH));

    final InstanceIdentifier<Cars> identifier = InstanceIdentifier.create(Cars.class);
    final BindingNormalizedNodeSerializer serializer = Mockito.mock(BindingNormalizedNodeSerializer.class);
    Mockito.doReturn(CarsModel.BASE_PATH).when(serializer).toYangInstanceIdentifier(identifier);

    addPrefixShardReplica(replicaNode2, identifier, serializer,
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH), "member-1");

    addPrefixShardReplica(replicaNode3, identifier, serializer,
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH), "member-1", "member-2");

    verifyRaftPeersPresent(member1.configDataStore(), ClusterUtils.getCleanShardName(CarsModel.BASE_PATH),
            "member-2", "member-3");

    removePrefixShardReplica(member1, identifier, "member-3", serializer,
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH), "member-2");

    verifyNoShardPresent(replicaNode3.configDataStore(), ClusterUtils.getCleanShardName(CarsModel.BASE_PATH));
    verifyRaftPeersPresent(replicaNode2.configDataStore(), ClusterUtils.getCleanShardName(CarsModel.BASE_PATH),
            "member-1");

    removePrefixShardReplica(member1, identifier, "member-2", serializer,
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH));

    verifyNoShardPresent(replicaNode2.configDataStore(), ClusterUtils.getCleanShardName(CarsModel.BASE_PATH));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:52,代码来源:ClusterAdminRpcServiceTest.java

示例4: testGetShardRole

import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; //导入方法依赖的package包/类
@Test
public void testGetShardRole() throws Exception {
    String name = "testGetShardRole";
    String moduleShardsConfig = "module-shards-default-member-1.conf";

    final MemberNode member1 = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name)
            .moduleShardsConfig(moduleShardsConfig).build();

    member1.kit().waitUntilLeader(member1.configDataStore().getActorContext(), "default");

    final RpcResult<GetShardRoleOutput> successResult =
            getShardRole(member1, Mockito.mock(BindingNormalizedNodeSerializer.class), "default");
    verifySuccessfulRpcResult(successResult);
    assertEquals("Leader", successResult.getResult().getRole());

    final RpcResult<GetShardRoleOutput> failedResult =
            getShardRole(member1, Mockito.mock(BindingNormalizedNodeSerializer.class), "cars");

    verifyFailedRpcResult(failedResult);

    final ActorRef shardManager1 = member1.configDataStore().getActorContext().getShardManager();

    shardManager1.tell(new PrefixShardCreated(new PrefixShardConfiguration(
                    new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, CarsModel.BASE_PATH),
                    "prefix", Collections.singleton(MEMBER_1))),
            ActorRef.noSender());

    member1.kit().waitUntilLeader(member1.configDataStore().getActorContext(),
            ClusterUtils.getCleanShardName(CarsModel.BASE_PATH));

    final InstanceIdentifier<Cars> identifier = InstanceIdentifier.create(Cars.class);
    final BindingNormalizedNodeSerializer serializer = Mockito.mock(BindingNormalizedNodeSerializer.class);
    Mockito.doReturn(CarsModel.BASE_PATH).when(serializer).toYangInstanceIdentifier(identifier);

    final RpcResult<GetPrefixShardRoleOutput> prefixSuccessResult =
            getPrefixShardRole(member1, identifier, serializer);

    verifySuccessfulRpcResult(prefixSuccessResult);
    assertEquals("Leader", prefixSuccessResult.getResult().getRole());

    final InstanceIdentifier<People> peopleId = InstanceIdentifier.create(People.class);
    Mockito.doReturn(PeopleModel.BASE_PATH).when(serializer).toYangInstanceIdentifier(peopleId);

    final RpcResult<GetPrefixShardRoleOutput> prefixFail =
            getPrefixShardRole(member1, peopleId, serializer);

    verifyFailedRpcResult(prefixFail);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:49,代码来源:ClusterAdminRpcServiceTest.java


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