本文整理汇总了Java中org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableNodes类的具体用法?Java ImmutableNodes怎么用?Java ImmutableNodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableNodes类属于org.opendaylight.yangtools.yang.data.impl.schema包,在下文中一共展示了ImmutableNodes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testReadyWithImmediateCommit
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
private void testReadyWithImmediateCommit(final boolean readWrite) throws Exception {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testReadyWithImmediateCommit-" + readWrite);
waitUntilLeader(shard);
final TransactionIdentifier transactionID = nextTransactionId();
final NormalizedNode<?, ?> containerNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
if (readWrite) {
shard.tell(prepareForwardedReadyTransaction(shard, transactionID, TestModel.TEST_PATH,
containerNode, true), getRef());
} else {
shard.tell(prepareBatchedModifications(transactionID, TestModel.TEST_PATH, containerNode, true),
getRef());
}
expectMsgClass(duration("5 seconds"), CommitTransactionReply.class);
final NormalizedNode<?, ?> actualNode = readStore(shard, TestModel.TEST_PATH);
assertEquals(TestModel.TEST_QNAME.getLocalName(), containerNode, actualNode);
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:ShardTest.java
示例2: testRejectedCommit
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test(expected=TransactionCommitFailedException.class)
public void testRejectedCommit() throws Exception {
commitExecutor.delegate = Mockito.mock( ExecutorService.class );
Mockito.doThrow( new RejectedExecutionException( "mock" ) )
.when( commitExecutor.delegate ).execute( Mockito.any( Runnable.class ) );
Mockito.doNothing().when( commitExecutor.delegate ).shutdown();
Mockito.doReturn( Collections.emptyList() ).when( commitExecutor.delegate ).shutdownNow();
Mockito.doReturn( "" ).when( commitExecutor.delegate ).toString();
Mockito.doReturn( true ).when( commitExecutor.delegate )
.awaitTermination( Mockito.anyLong(), Mockito.any( TimeUnit.class ) );
DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
writeTx.put( OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME) );
writeTx.submit().checkedGet( 5, TimeUnit.SECONDS );
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:DOMBrokerTest.java
示例3: testTransactionSchemaUpdate
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
/**
* Test suite tests allocating transaction when schema context
* does not contain module necessary for client write,
* then triggering update of global schema context
* and then performing write (according to new module).
*
* If transaction between allocation and schema context was
* unmodified, it is safe to change its schema context
* to new one (e.g. it will be same as if allocated after
* schema context update.)
*
* @throws InterruptedException
* @throws ExecutionException
*/
@Test
public void testTransactionSchemaUpdate() throws InterruptedException, ExecutionException {
assertNotNull(this.domStore);
// We allocate transaction, initial schema context does not
// contain Lists model
final DOMStoreReadWriteTransaction writeTx = this.domStore.newReadWriteTransaction();
assertNotNull(writeTx);
// we trigger schema context update to contain Lists model
loadSchemas(RockTheHouseInput.class, Top.class);
/**
*
* Writes /test in writeTx, this write should not fail
* with IllegalArgumentException since /test is in
* schema context.
*
*/
writeTx.write(TOP_PATH, ImmutableNodes.containerNode(Top.QNAME));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:38,代码来源:SchemaUpdateForTransactionTest.java
示例4: testApply
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testApply() throws Exception {
MutableCompositeModification compositeModification = new MutableCompositeModification();
compositeModification.addModification(new WriteModification(TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
DOMStoreReadWriteTransaction transaction = store.newReadWriteTransaction();
compositeModification.apply(transaction);
commitTransaction(transaction);
Optional<NormalizedNode<?, ?>> data = readData(TestModel.TEST_PATH);
assertNotNull(data.get());
assertEquals(TestModel.TEST_QNAME, data.get().getNodeType());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:MutableCompositeModificationTest.java
示例5: execWrite
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Override
ListenableFuture<Void> execWrite(final long txId) {
final int i = nextInt(MAX_ITEM + 1);
final YangInstanceIdentifier entryId =
idListItem.node(ITEM).node(new YangInstanceIdentifier.NodeIdentifierWithPredicates(ITEM, NUMBER, i));
final DOMDataWriteTransaction tx = createTransaction();
if (usedValues.contains(i)) {
LOG.debug("Deleting item: {}", i);
deleteTx++;
tx.delete(LogicalDatastoreType.CONFIGURATION, entryId);
usedValues.remove(i);
} else {
LOG.debug("Inserting item: {}", i);
insertTx++;
final MapEntryNode entry = ImmutableNodes.mapEntry(ITEM, NUMBER, i);
tx.put(LogicalDatastoreType.CONFIGURATION, entryId, entry);
usedValues.add(i);
}
return tx.submit();
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:WriteTransactionsHandler.java
示例6: testTransactionAbort
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testTransactionAbort() throws Exception {
new IntegrationTestKit(getSystem(), datastoreContextBuilder) {
{
try (AbstractDataStore dataStore = setupAbstractDataStore(
testParameter, "transactionAbortIntegrationTest", "test-1")) {
final DOMStoreWriteTransaction writeTx = dataStore.newWriteOnlyTransaction();
assertNotNull("newWriteOnlyTransaction returned null", writeTx);
writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
final DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
cohort.canCommit().get(5, TimeUnit.SECONDS);
cohort.abort().get(5, TimeUnit.SECONDS);
testWriteTransaction(dataStore, TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME));
}
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DistributedDataStoreIntegrationTest.java
示例7: testInnerListNodeWithParentPathPrunedWhenSchemaMissing
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testInnerListNodeWithParentPathPrunedWhenSchemaMissing() throws IOException {
YangInstanceIdentifier path = YangInstanceIdentifier.builder().node(TestModel.TEST_QNAME)
.node(TestModel.OUTER_LIST_QNAME).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
.build();
NormalizedNodePruner pruner = prunerFullSchema(path);
MapNode innerList = mapNodeBuilder(TestModel.INVALID_QNAME).withChild(mapEntryBuilder(
TestModel.INVALID_QNAME, TestModel.NAME_QNAME, "one").withChild(
ImmutableNodes.containerNode(TestModel.INNER_CONTAINER_QNAME)).build()).build();
NormalizedNode<?, ?> input = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
.withChild(innerList).build();
NormalizedNodeWriter.forStreamWriter(pruner).write(input);
NormalizedNode<?, ?> expected = mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1);
NormalizedNode<?, ?> actual = pruner.normalizedNode();
assertEquals("normalizedNode", expected, actual);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:NormalizedNodePrunerTest.java
示例8: testInitialChangeListenerEventWithContainerPath
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testInitialChangeListenerEventWithContainerPath() throws Exception {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> actor = actorFactory.createTestActor(
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testInitialChangeListenerEventWithContainerPath");
waitUntilLeader(actor);
final Shard shard = actor.underlyingActor();
writeToStore(shard.getDataStore(), TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME));
final MockDataChangeListener listener = new MockDataChangeListener(1);
final ActorRef dclActor = actorFactory.createActor(DataChangeListener.props(listener, TEST_PATH),
"testInitialChangeListenerEventWithContainerPath-DataChangeListener");
final DataChangeListenerSupport support = new DataChangeListenerSupport(shard);
support.onMessage(new RegisterChangeListener(TEST_PATH, dclActor, DataChangeScope.ONE, false),
true,true);
listener.waitForChangeEvents(TEST_PATH);
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:26,代码来源:DataChangeListenerSupportTest.java
示例9: testSerialization
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testSerialization() {
NormalizedNode<?, ?> data = ImmutableContainerNodeBuilder.create()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
.withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();
ReadDataReply expected = new ReadDataReply(data, DataStoreVersions.CURRENT_VERSION);
Object serialized = expected.toSerializable();
assertEquals("Serialized type", ReadDataReply.class, serialized.getClass());
ReadDataReply actual = ReadDataReply.fromSerializable(SerializationUtils.clone(
(Serializable) serialized));
assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
assertEquals("getNormalizedNode", expected.getNormalizedNode(), actual.getNormalizedNode());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:ReadDataReplyTest.java
示例10: testInitialChangeListenerEventWithContainerPath
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testInitialChangeListenerEventWithContainerPath() throws DataValidationFailedException {
writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
Entry<MockDataTreeChangeListener, ActorSelection> entry = registerChangeListener(TEST_PATH, 1);
MockDataTreeChangeListener listener = entry.getKey();
listener.waitForChangeEvents();
listener.verifyNotifiedData(TEST_PATH);
listener.reset(1);
writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
listener.waitForChangeEvents();
listener.verifyNotifiedData(TEST_PATH);
listener.reset(1);
JavaTestKit kit = new JavaTestKit(getSystem());
entry.getValue().tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
kit.expectMsgClass(JavaTestKit.duration("5 seconds"), CloseDataTreeNotificationListenerRegistrationReply.class);
writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
listener.verifyNoNotifiedData(TEST_PATH);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DataTreeChangeListenerSupportTest.java
示例11: testReadyWithLocalTransaction
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testReadyWithLocalTransaction() throws Exception {
ActorRef shardActorRef = getSystem().actorOf(Props.create(DoNothingActor.class));
doReturn(getSystem().actorSelection(shardActorRef.path())).when(mockActorContext)
.actorSelection(shardActorRef.path().toString());
doReturn(Futures.successful(newPrimaryShardInfo(shardActorRef, createDataTree()))).when(mockActorContext)
.findPrimaryShardAsync(eq(DefaultShardStrategy.DEFAULT_SHARD));
TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
expectReadyLocalTransaction(shardActorRef, true);
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
DOMStoreThreePhaseCommitCohort ready = transactionProxy.ready();
assertTrue(ready instanceof SingleCommitCohortProxy);
verifyCohortFutures((SingleCommitCohortProxy)ready, new CommitTransactionReply().toSerializable());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:22,代码来源:TransactionProxyTest.java
示例12: buildOuterList
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
public static List<MapEntryNode> buildOuterList(final int outerElements, final int innerElements) {
List<MapEntryNode> outerList = new ArrayList<>(outerElements);
for (int j = 0; j < outerElements; j++) {
outerList.add(ImmutableNodes.mapEntryBuilder()
.withNodeIdentifier(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, j))
.withChild(ImmutableNodes.leafNode(OL_ID, j))
.withChild(buildInnerList(j, innerElements))
.build());
}
return outerList;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:DomListBuilder.java
示例13: testWriteThrottlingWhenShardFound
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testWriteThrottlingWhenShardFound() {
throttleOperation(transactionProxy -> {
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
expectIncompleteBatchedModifications();
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
});
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:TransactionProxyTest.java
示例14: newDefaultNode
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Override
public NormalizedNode<?, ?> newDefaultNode(final DataSchemaNode dataSchema) {
// We assume there's only one key for the list.
List<QName> keys = ((ListSchemaNode)dataSchema).getKeyDefinition();
Preconditions.checkArgument(keys.size() == 1, "Expected only 1 key for list %s", appConfigBindingClass);
QName listKeyQName = keys.get(0);
return ImmutableNodes.mapEntryBuilder(bindingQName, listKeyQName, appConfigListKeyValue).build();
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:BindingContext.java
示例15: initInnerListItems
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
private static MapNode initInnerListItems(final int count) {
final CollectionNodeBuilder<MapEntryNode, MapNode> mapEntryBuilder = ImmutableNodes
.mapNodeBuilder(BenchmarkModel.INNER_LIST_QNAME);
for (int i = 1; i <= count; ++i) {
mapEntryBuilder
.withChild(ImmutableNodes.mapEntry(BenchmarkModel.INNER_LIST_QNAME, BenchmarkModel.NAME_QNAME, i));
}
return mapEntryBuilder.build();
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:AbstractInMemoryWriteTransactionBenchmark.java
示例16: initOuterListItems
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
private static NormalizedNode<?, ?>[] initOuterListItems(final int outerListItemsCount, final MapNode innerList) {
final NormalizedNode<?, ?>[] outerListItems = new NormalizedNode[outerListItemsCount];
for (int i = 0; i < outerListItemsCount; ++i) {
int outerListKey = i;
outerListItems[i] = ImmutableNodes
.mapEntryBuilder(BenchmarkModel.OUTER_LIST_QNAME, BenchmarkModel.ID_QNAME, outerListKey)
.withChild(innerList).build();
}
return outerListItems;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:AbstractInMemoryWriteTransactionBenchmark.java
示例17: testReadyLocalTransactionWithImmediateCommit
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testReadyLocalTransactionWithImmediateCommit() throws Exception {
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testReadyLocalTransactionWithImmediateCommit");
waitUntilLeader(shard);
final ShardDataTree dataStore = shard.underlyingActor().getDataStore();
final DataTreeModification modification = dataStore.newModification();
final ContainerNode writeData = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
new WriteModification(TestModel.TEST_PATH, writeData).apply(modification);
final MapNode mergeData = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build();
new MergeModification(TestModel.OUTER_LIST_PATH, mergeData).apply(modification);
final TransactionIdentifier txId = nextTransactionId();
modification.ready();
final ReadyLocalTransaction readyMessage = new ReadyLocalTransaction(txId, modification, true);
shard.tell(readyMessage, getRef());
expectMsgClass(CommitTransactionReply.class);
final NormalizedNode<?, ?> actualNode = readStore(shard, TestModel.OUTER_LIST_PATH);
assertEquals(TestModel.OUTER_LIST_QNAME.getLocalName(), mergeData, actualNode);
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:33,代码来源:ShardTest.java
示例18: testTransactionCommitWithPriorExpiredCohortEntries
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testTransactionCommitWithPriorExpiredCohortEntries() throws Exception {
dataStoreContextBuilder.shardTransactionCommitTimeoutInSeconds(1);
new ShardTestKit(getSystem()) {
{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testTransactionCommitWithPriorExpiredCohortEntries");
waitUntilLeader(shard);
final FiniteDuration duration = duration("5 seconds");
final TransactionIdentifier transactionID1 = nextTransactionId();
shard.tell(newBatchedModifications(transactionID1, TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME), true, false, 1), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
final TransactionIdentifier transactionID2 = nextTransactionId();
shard.tell(newBatchedModifications(transactionID2, TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME), true, false, 1), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
final TransactionIdentifier transactionID3 = nextTransactionId();
shard.tell(newBatchedModifications(transactionID3, TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME), true, false, 1), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
// All Tx's are readied. We'll send canCommit for the last one
// but not the others. The others
// should expire from the queue and the last one should be
// processed.
shard.tell(new CanCommitTransaction(transactionID3, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, CanCommitTransactionReply.class);
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:39,代码来源:ShardTest.java
示例19: testWriteCompletion
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testWriteCompletion() {
completeOperation(transactionProxy -> {
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
expectBatchedModifications(2);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
});
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:TransactionProxyTest.java
示例20: testReadCompletionForLocalShard
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; //导入依赖的package包/类
@Test
public void testReadCompletionForLocalShard() {
final NormalizedNode<?, ?> nodeToRead = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
completeOperationLocal(transactionProxy -> {
transactionProxy.read(TestModel.TEST_PATH);
transactionProxy.read(TestModel.TEST_PATH);
}, createDataTree(nodeToRead));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:TransactionProxyTest.java
注:本文中的org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论