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


Java TestModel.OUTER_LIST_PATH属性代码示例

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


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

示例1: testSerialization

@Test
public void testSerialization() {
    YangInstanceIdentifier writePath = TestModel.TEST_PATH;
    NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create()
            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
            .withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();

    YangInstanceIdentifier mergePath = TestModel.OUTER_LIST_PATH;
    NormalizedNode<?, ?> mergeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(TestModel.OUTER_LIST_QNAME)).build();

    YangInstanceIdentifier deletePath = TestModel.TEST_PATH;

    MutableCompositeModification compositeModification = new MutableCompositeModification();
    compositeModification.addModification(new WriteModification(writePath, writeData));
    compositeModification.addModification(new MergeModification(mergePath, mergeData));
    compositeModification.addModification(new DeleteModification(deletePath));

    MutableCompositeModification clone = (MutableCompositeModification)
            SerializationUtils.clone(compositeModification);

    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, clone.getVersion());

    assertEquals("getModifications size", 3, clone.getModifications().size());

    WriteModification write = (WriteModification)clone.getModifications().get(0);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, write.getVersion());
    assertEquals("getPath", writePath, write.getPath());
    assertEquals("getData", writeData, write.getData());

    MergeModification merge = (MergeModification)clone.getModifications().get(1);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, merge.getVersion());
    assertEquals("getPath", mergePath, merge.getPath());
    assertEquals("getData", mergeData, merge.getData());

    DeleteModification delete = (DeleteModification)clone.getModifications().get(2);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, delete.getVersion());
    assertEquals("getPath", deletePath, delete.getPath());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:39,代码来源:MutableCompositeModificationTest.java

示例2: testSerialization

@Test
public void testSerialization() {
    YangInstanceIdentifier writePath = TestModel.TEST_PATH;
    NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
            .withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();

    YangInstanceIdentifier mergePath = TestModel.OUTER_LIST_PATH;
    NormalizedNode<?, ?> mergeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
            new YangInstanceIdentifier.NodeIdentifier(TestModel.OUTER_LIST_QNAME)).build();

    YangInstanceIdentifier deletePath = TestModel.TEST_PATH;

    final TransactionIdentifier tx1 = nextTransactionId();
    BatchedModifications batched = new BatchedModifications(tx1, DataStoreVersions.CURRENT_VERSION);
    batched.addModification(new WriteModification(writePath, writeData));
    batched.addModification(new MergeModification(mergePath, mergeData));
    batched.addModification(new DeleteModification(deletePath));
    batched.setReady(true);
    batched.setTotalMessagesSent(5);

    BatchedModifications clone = (BatchedModifications) SerializationUtils.clone(
            (Serializable) batched.toSerializable());

    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, clone.getVersion());
    assertEquals("getTransactionID", tx1, clone.getTransactionId());
    assertEquals("isReady", true, clone.isReady());
    assertEquals("getTotalMessagesSent", 5, clone.getTotalMessagesSent());

    assertEquals("getModifications size", 3, clone.getModifications().size());

    WriteModification write = (WriteModification)clone.getModifications().get(0);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, write.getVersion());
    assertEquals("getPath", writePath, write.getPath());
    assertEquals("getData", writeData, write.getData());

    MergeModification merge = (MergeModification)clone.getModifications().get(1);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, merge.getVersion());
    assertEquals("getPath", mergePath, merge.getPath());
    assertEquals("getData", mergeData, merge.getData());

    DeleteModification delete = (DeleteModification)clone.getModifications().get(2);
    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, delete.getVersion());
    assertEquals("getPath", deletePath, delete.getPath());

    // Test with different params.
    final TransactionIdentifier tx2 = nextTransactionId();
    batched = new BatchedModifications(tx2, (short)10000);

    clone = (BatchedModifications) SerializationUtils.clone((Serializable) batched.toSerializable());

    assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, clone.getVersion());
    assertEquals("getTransactionID", tx2, clone.getTransactionId());
    assertEquals("isReady", false, clone.isReady());

    assertEquals("getModifications size", 0, clone.getModifications().size());

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:58,代码来源:BatchedModificationsTest.java

示例3: testModificationOperationBatching

private void testModificationOperationBatching(final TransactionType type) throws Exception {
    int shardBatchedModificationCount = 3;
    dataStoreContextBuilder.shardBatchedModificationCount(shardBatchedModificationCount);

    ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), type);

    expectBatchedModifications(actorRef, shardBatchedModificationCount);

    YangInstanceIdentifier writePath1 = TestModel.TEST_PATH;
    NormalizedNode<?, ?> writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);

    YangInstanceIdentifier writePath2 = TestModel.OUTER_LIST_PATH;
    NormalizedNode<?, ?> writeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);

    YangInstanceIdentifier writePath3 = TestModel.INNER_LIST_PATH;
    NormalizedNode<?, ?> writeNode3 = ImmutableNodes.containerNode(TestModel.INNER_LIST_QNAME);

    YangInstanceIdentifier mergePath1 = TestModel.TEST_PATH;
    NormalizedNode<?, ?> mergeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);

    YangInstanceIdentifier mergePath2 = TestModel.OUTER_LIST_PATH;
    NormalizedNode<?, ?> mergeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);

    YangInstanceIdentifier mergePath3 = TestModel.INNER_LIST_PATH;
    NormalizedNode<?, ?> mergeNode3 = ImmutableNodes.containerNode(TestModel.INNER_LIST_QNAME);

    YangInstanceIdentifier deletePath1 = TestModel.TEST_PATH;
    YangInstanceIdentifier deletePath2 = TestModel.OUTER_LIST_PATH;

    TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, type);

    transactionProxy.write(writePath1, writeNode1);
    transactionProxy.write(writePath2, writeNode2);
    transactionProxy.delete(deletePath1);
    transactionProxy.merge(mergePath1, mergeNode1);
    transactionProxy.merge(mergePath2, mergeNode2);
    transactionProxy.write(writePath3, writeNode3);
    transactionProxy.merge(mergePath3, mergeNode3);
    transactionProxy.delete(deletePath2);

    // This sends the last batch.
    transactionProxy.ready();

    List<BatchedModifications> batchedModifications = captureBatchedModifications(actorRef);
    assertEquals("Captured BatchedModifications count", 3, batchedModifications.size());

    verifyBatchedModifications(batchedModifications.get(0), false, new WriteModification(writePath1, writeNode1),
            new WriteModification(writePath2, writeNode2), new DeleteModification(deletePath1));

    verifyBatchedModifications(batchedModifications.get(1), false, new MergeModification(mergePath1, mergeNode1),
            new MergeModification(mergePath2, mergeNode2), new WriteModification(writePath3, writeNode3));

    verifyBatchedModifications(batchedModifications.get(2), true, true,
            new MergeModification(mergePath3, mergeNode3), new DeleteModification(deletePath2));

    assertEquals("getTotalMessageCount", 3, batchedModifications.get(2).getTotalMessagesSent());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:57,代码来源:TransactionProxyTest.java

示例4: testOnReceiveBatchedModifications

@Test
public void testOnReceiveBatchedModifications() throws Exception {
    new JavaTestKit(getSystem()) {
        {
            ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class);
            DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
            ReadWriteShardDataTreeTransaction mockWriteTx = new ReadWriteShardDataTreeTransaction(parent,
                    nextTransactionId(), mockModification);
            final ActorRef transaction = newTransactionActor(RW, mockWriteTx, "testOnReceiveBatchedModifications");

            YangInstanceIdentifier writePath = TestModel.TEST_PATH;
            NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create()
                    .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
                    .withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();

            YangInstanceIdentifier mergePath = TestModel.OUTER_LIST_PATH;
            NormalizedNode<?, ?> mergeData = ImmutableContainerNodeBuilder.create()
                    .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.OUTER_LIST_QNAME))
                    .build();

            YangInstanceIdentifier deletePath = TestModel.TEST_PATH;

            BatchedModifications batched = new BatchedModifications(nextTransactionId(),
                    DataStoreVersions.CURRENT_VERSION);
            batched.addModification(new WriteModification(writePath, writeData));
            batched.addModification(new MergeModification(mergePath, mergeData));
            batched.addModification(new DeleteModification(deletePath));

            transaction.tell(batched, getRef());

            BatchedModificationsReply reply = expectMsgClass(duration("5 seconds"),
                    BatchedModificationsReply.class);
            assertEquals("getNumBatched", 3, reply.getNumBatched());

            InOrder inOrder = Mockito.inOrder(mockModification);
            inOrder.verify(mockModification).write(writePath, writeData);
            inOrder.verify(mockModification).merge(mergePath, mergeData);
            inOrder.verify(mockModification).delete(deletePath);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:41,代码来源:ShardTransactionTest.java


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