本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top类的典型用法代码示例。如果您正苦于以下问题:Java Top类的具体用法?Java Top怎么用?Java Top使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Top类属于org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701包,在下文中一共展示了Top类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTransactionSchemaUpdate
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的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));
}
示例2: testRegisterDataTreeChangeListener
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Test
public void testRegisterDataTreeChangeListener() {
final BindingToNormalizedNodeCodec codec = new BindingToNormalizedNodeCodec(this.classLoadingStrategy, this.codecRegistry);
final DataTreeChangeService service = BindingDOMDataTreeChangeServiceAdapter.create(codec, this.mockDOMService);
doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
any(DOMDataTreeChangeListener.class));
final DataTreeIdentifier<Top> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, TOP_PATH);
final TestClusteredDataTreeChangeListener mockClusteredListener = new TestClusteredDataTreeChangeListener();
service.registerDataTreeChangeListener(treeId , mockClusteredListener);
verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
isA(ClusteredDOMDataTreeChangeListener.class));
reset(this.mockDOMService);
doReturn(this.mockDOMReg).when(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
any(DOMDataTreeChangeListener.class));
final TestDataTreeChangeListener mockNonClusteredListener = new TestDataTreeChangeListener();
service.registerDataTreeChangeListener(treeId , mockNonClusteredListener);
verify(this.mockDOMService).registerDataTreeChangeListener(domDataTreeIdentifier(this.mockYangID),
not(isA(ClusteredDOMDataTreeChangeListener.class)));
}
示例3: testTopLevelListener
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Test
public void testTopLevelListener() throws Exception {
final EventCapturingListener<Top> listener = new EventCapturingListener<>();
dataBrokerImpl.registerDataTreeChangeListener(TOP_IDENTIFIER, listener);
createAndVerifyTop(listener);
putTx(BAR_PATH, BAR_DATA).submit().checkedGet();
final DataObjectModification<Top> afterBarPutEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
verifyModification(afterBarPutEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
final DataObjectModification<TopLevelList> barPutMod = afterBarPutEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
assertNotNull(barPutMod);
verifyModification(barPutMod, BAR_ARGUMENT, ModificationType.WRITE);
deleteTx(BAR_PATH).submit().checkedGet();
final DataObjectModification<Top> afterBarDeleteEvent = Iterables.getOnlyElement(listener.nextEvent()).getRootNode();
verifyModification(afterBarDeleteEvent, TOP_ARGUMENT, ModificationType.SUBTREE_MODIFIED);
final DataObjectModification<TopLevelList> barDeleteMod = afterBarDeleteEvent.getModifiedChildListItem(TopLevelList.class, TOP_BAR_KEY);
verifyModification(barDeleteMod, BAR_ARGUMENT, ModificationType.DELETE);
}
示例4: createBITllIdentifier
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBITllIdentifier(
final String mount) {
return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
.builder().node(Top.QNAME)
.node(TopLevelList.QNAME)
.nodeWithKey(TopLevelList.QNAME, TLL_NAME_QNAME, mount)
.build();
}
示例5: testPutCreateParentsSuccess
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Test
public void testPutCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
writeTx.submit().checkedGet();
ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
assertTrue("Top node must exists after commit",topNode.isPresent());
Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
assertTrue("List node must exists after commit",listNode.isPresent());
}
示例6: testMergeCreateParentsSuccess
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Test
public void testMergeCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.merge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
writeTx.submit().checkedGet();
ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
assertTrue("Top node must exists after commit",topNode.isPresent());
Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
assertTrue("List node must exists after commit",listNode.isPresent());
}
示例7: createAndVerifyTop
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
private void createAndVerifyTop(final EventCapturingListener<Top> listener) throws Exception {
putTx(TOP_PATH,TOP_INITIAL_DATA).submit().checkedGet();
final Collection<DataTreeModification<Top>> events = listener.nextEvent();
assertFalse("Non empty collection should be received.",events.isEmpty());
final DataTreeModification<Top> initialWrite = Iterables.getOnlyElement(events);
final DataObjectModification<? extends DataObject> initialNode = initialWrite.getRootNode();
verifyModification(initialNode,TOP_PATH.getPathArguments().iterator().next(),ModificationType.WRITE);
assertEquals(TOP_INITIAL_DATA, initialNode.getDataAfter());
}
示例8: top
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
protected static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> top() {
return Builders.containerBuilder().withNodeIdentifier(
new NodeIdentifier(Top.QNAME));
}
示例9: top
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
public static Top top(final TopLevelList... listItems) {
return new TopBuilder().setTopLevelList(Arrays.asList(listItems)).build();
}
示例10: simpleModifyOperation
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Test
public void simpleModifyOperation() throws Exception {
DataBroker dataBroker = testContext.getDataBroker();
Optional<TopLevelList> tllFoo = dataBroker.newReadOnlyTransaction().read(
LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
assertFalse(tllFoo.isPresent());
TopLevelList tllFooData = createTll(TLL_FOO_KEY);
final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
transaction.put(LogicalDatastoreType.CONFIGURATION, FOO_PATH, tllFooData);
transaction.submit().get(5, TimeUnit.SECONDS);
Optional<TopLevelList> readedData = dataBroker.newReadOnlyTransaction().read(
LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
assertTrue(readedData.isPresent());
assertEquals(tllFooData.getKey(), readedData.get().getKey());
TopLevelList nodeBarData = createTll(TLL_BAR_KEY);
TopLevelList nodeBazData = createTll(TLL_BAZ_KEY);
final WriteTransaction insertMoreTr = dataBroker.newWriteOnlyTransaction();
insertMoreTr.put(LogicalDatastoreType.CONFIGURATION, BAR_PATH, nodeBarData);
insertMoreTr.put(LogicalDatastoreType.CONFIGURATION, BAZ_PATH, nodeBazData);
insertMoreTr.submit().get(5, TimeUnit.SECONDS);
Optional<Top> top = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, TOP_PATH)
.checkedGet(5, TimeUnit.SECONDS);
assertTrue(top.isPresent());
assertEquals(3, top.get().getTopLevelList().size());
// We create transaction no 2
final WriteTransaction removalTransaction = dataBroker.newWriteOnlyTransaction();
// We remove node 1
removalTransaction.delete(LogicalDatastoreType.CONFIGURATION, BAR_PATH);
// We commit transaction
removalTransaction.submit().get(5, TimeUnit.SECONDS);
Optional<TopLevelList> readedData2 = dataBroker.newReadOnlyTransaction().read(
LogicalDatastoreType.CONFIGURATION, BAR_PATH).checkedGet(5, TimeUnit.SECONDS);
assertFalse(readedData2.isPresent());
}
示例11: createBATllIdentifier
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
private static InstanceIdentifier<TopLevelList> createBATllIdentifier(
final String mount) {
return InstanceIdentifier.builder(Top.class)
.child(TopLevelList.class, new TopLevelListKey(mount)).build();
}
示例12: createBINodeIdentifier
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(final TopLevelListKey listKey) {
return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder().node(Top.QNAME)
.node(TopLevelList.QNAME)
.nodeWithKey(TopLevelList.QNAME, NODE_ID_QNAME, listKey.getName()).build();
}
示例13: onDataTreeChanged
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
@Override
public void onDataTreeChanged(final Collection<DataTreeModification<Top>> changes) {
}
示例14: writeTopWithListItem
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top; //导入依赖的package包/类
public void writeTopWithListItem(final LogicalDatastoreType store) {
ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction();
Top topItem = top(topLevelList(TOP_FOO_KEY, complexUsesAugment(USES_ONE_KEY, USES_TWO_KEY)));
tx.put(store, TOP_PATH, topItem);
assertCommit(tx.submit());
}