本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode类的典型用法代码示例。如果您正苦于以下问题:Java NormalizedNode类的具体用法?Java NormalizedNode怎么用?Java NormalizedNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NormalizedNode类属于org.opendaylight.yangtools.yang.data.api.schema包,在下文中一共展示了NormalizedNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: searchForEntities
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private void searchForEntities(final EntityWalker walker) {
Optional<NormalizedNode<?, ?>> possibleEntityTypes = getDataStore().readNode(ENTITY_TYPES_PATH);
if (!possibleEntityTypes.isPresent()) {
return;
}
for (MapEntryNode entityType: ((MapNode) possibleEntityTypes.get()).getValue()) {
Optional<DataContainerChild<?, ?>> possibleEntities = entityType.getChild(ENTITY_NODE_ID);
if (!possibleEntities.isPresent()) {
// shouldn't happen but handle anyway
continue;
}
for (MapEntryNode entity: ((MapNode) possibleEntities.get()).getValue()) {
walker.onEntity(entityType, entity);
}
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:EntityOwnershipShard.java
示例2: setUpReadData
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private void setUpReadData(final String shardName, final NormalizedNode<?, ?> expectedNode) {
ActorSystem actorSystem = getSystem();
ActorRef shardActorRef = getSystem().actorOf(Props.create(DoNothingActor.class));
doReturn(getSystem().actorSelection(shardActorRef.path())).when(mockActorContext)
.actorSelection(shardActorRef.path().toString());
doReturn(primaryShardInfoReply(getSystem(), shardActorRef)).when(mockActorContext)
.findPrimaryShardAsync(eq(shardName));
ActorRef txActorRef = actorSystem.actorOf(Props.create(DoNothingActor.class));
doReturn(actorSystem.actorSelection(txActorRef.path())).when(mockActorContext)
.actorSelection(txActorRef.path().toString());
doReturn(Futures.successful(createTransactionReply(txActorRef, DataStoreVersions.CURRENT_VERSION)))
.when(mockActorContext).executeOperationAsync(eq(actorSystem.actorSelection(shardActorRef.path())),
eqCreateTransaction(memberName, TransactionType.READ_ONLY), any(Timeout.class));
doReturn(readDataReply(expectedNode)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(txActorRef)), eqReadData(YangInstanceIdentifier.EMPTY), any(Timeout.class));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:TransactionProxyTest.java
示例3: testCreateChainedTransactionAfterEmptyTxReadied
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Test
public void testCreateChainedTransactionAfterEmptyTxReadied() throws Exception {
new IntegrationTestKit(getSystem(), datastoreContextBuilder) {
{
try (AbstractDataStore dataStore = setupAbstractDataStore(
testParameter, "testCreateChainedTransactionAfterEmptyTxReadied", "test-1")) {
final DOMStoreTransactionChain txChain = dataStore.createTransactionChain();
final DOMStoreReadWriteTransaction rwTx1 = txChain.newReadWriteTransaction();
rwTx1.ready();
final DOMStoreReadWriteTransaction rwTx2 = txChain.newReadWriteTransaction();
final Optional<NormalizedNode<?, ?>> optional = rwTx2.read(TestModel.TEST_PATH).get(
5, TimeUnit.SECONDS);
assertEquals("isPresent", false, optional.isPresent());
txChain.close();
}
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DistributedDataStoreIntegrationTest.java
示例4: onDataTreeChanged
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Override
public void onDataTreeChanged(Collection<DataTreeCandidate> arg0) {
ModificationType mt = arg0.iterator().next().getRootNode().getModificationType();
if (mt == ModificationType.DELETE) {
close();
} else {
Optional<NormalizedNode<?,?>> node = arg0.iterator().next().getRootNode().getDataAfter();
if (node.isPresent()) {
Object val = node.get().getValue();
try {
long l = Long.parseLong(val.toString());
Long lo = ((ThresholdConfig)this.smb.getEventConfigValue()).getLoThresh();
Long hi = ((ThresholdConfig)this.smb.getEventConfigValue()).getHiThresh();
if (((lo != null) && (l < lo)) || ((hi != null) && (l > hi))) {
issueNotification();
}
} catch (NumberFormatException e) {
// Do Nothing.
}
}
}
}
开发者ID:opendaylight,项目名称:fpc,代码行数:24,代码来源:ChangeMonitor.java
示例5: executeList
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
final org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
final YangInstanceIdentifier pid =
YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
try (DOMDataReadOnlyTransaction tx = domDataBroker.newReadOnlyTransaction()) {
for (int l = 0; l < outerListElem; l++) {
YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
Optional<NormalizedNode<?,?>> optionalDataObject;
CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture = tx.read(dsType, yid);
try {
optionalDataObject = submitFuture.checkedGet();
if (optionalDataObject != null && optionalDataObject.isPresent()) {
txOk++;
}
} catch (final ReadFailedException e) {
LOG.warn("failed to ....", e);
txError++;
}
}
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:TxchainDomRead.java
示例6: parseDataElement
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
public NormalizedNode<?, ?> parseDataElement(final Element element, final DataSchemaNode dataSchema,
final SchemaContext schemaContext) throws XMLStreamException, IOException, ParserConfigurationException,
SAXException, URISyntaxException {
final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
final XmlParserStream xmlParser = XmlParserStream.create(writer, schemaContext, dataSchema);
xmlParser.traverse(new DOMSource(element));
final NormalizedNode<?, ?> result = resultHolder.getResult();
if (result instanceof MapNode) {
final MapNode mapNode = (MapNode) result;
final MapEntryNode mapEntryNode = mapNode.getValue().iterator().next();
return mapEntryNode;
}
return result;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:BindingContext.java
示例7: transform
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private DOMRpcResult transform(final RpcResult<?> input) {
if (input.isSuccessful()) {
final Object inputData = input.getResult();
if (inputData instanceof DataContainer) {
return new DefaultDOMRpcResult(codec.toNormalizedNodeRpcData((DataContainer) inputData));
} else {
return new DefaultDOMRpcResult((NormalizedNode<?, ?>) null);
}
}
return new DefaultDOMRpcResult(input.getErrors());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:LazyDOMRpcResultFuture.java
示例8: testApply
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Test
public void testApply() throws Exception {
//TODO : Need to write a better test for this
//Write something into the datastore
DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
MergeModification writeModification = new MergeModification(TestModel.TEST_PATH,
ImmutableNodes.containerNode(TestModel.TEST_QNAME));
writeModification.apply(writeTransaction);
commitTransaction(writeTransaction);
//Check if it's in the datastore
Optional<NormalizedNode<?,?>> data = readData(TestModel.TEST_PATH);
Assert.assertTrue(data.isPresent());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:MergeModificationTest.java
示例9: verifyEntityCandidate
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
protected void verifyEntityCandidate(NormalizedNode<?, ?> node, String entityType,
YangInstanceIdentifier entityId, String candidateName, boolean expectPresent) {
try {
assertNotNull("Missing " + EntityOwners.QNAME.toString(), node);
assertTrue(node instanceof ContainerNode);
ContainerNode entityOwnersNode = (ContainerNode) node;
MapEntryNode entityTypeEntry = getMapEntryNodeChild(entityOwnersNode, EntityType.QNAME,
ENTITY_TYPE_QNAME, entityType, true);
MapEntryNode entityEntry = getMapEntryNodeChild(entityTypeEntry, ENTITY_QNAME, ENTITY_ID_QNAME,
entityId, true);
getMapEntryNodeChild(entityEntry, Candidate.QNAME, CANDIDATE_NAME_QNAME, candidateName, expectPresent);
} catch (AssertionError e) {
throw new AssertionError("Verification of entity candidate failed - returned data was: " + node, e);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:AbstractEntityOwnershipTest.java
示例10: navigateNormalizedNodeContainerMixin
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private void navigateNormalizedNodeContainerMixin(int level, final String parentPath,
NormalizedNodeContainer<?, ?, ?> node) {
visitor.visitNode(level, parentPath, node);
String newParentPath = parentPath + "/" + node.getIdentifier().toString();
final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
for (NormalizedNode<?, ?> normalizedNode : value) {
if (normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer) {
navigateNormalizedNodeContainerMixin(level + 1, newParentPath,
(NormalizedNodeContainer<?, ?, ?>) normalizedNode);
} else {
navigateNormalizedNode(level, newParentPath, normalizedNode);
}
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:NormalizedNodeNavigator.java
示例11: merge
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Override
public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
checkNotReady();
final DataTreeModification tree = mutableTree;
LOG.debug("Tx: {} Merge: {}:{}", getIdentifier(), path, data);
try {
tree.merge(path, data);
// FIXME: Add checked exception
} catch (Exception e) {
LOG.error("Tx: {}, failed to write {}:{} in {}", getIdentifier(), path, data, tree, e);
// Rethrow original ones if they are subclasses of RuntimeException
// or Error
Throwables.propagateIfPossible(e);
// FIXME: Introduce proper checked exception
throw new IllegalArgumentException("Illegal input data.", e);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:20,代码来源:SnapshotBackedWriteTransaction.java
示例12: testReadWriteMessageSlicing
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Test
public void testReadWriteMessageSlicing() throws Exception {
// The slicing is only implemented for tell-based protocol
Assume.assumeTrue(testParameter.equals(ClientBackedDataStore.class));
leaderDatastoreContextBuilder.maximumMessageSliceSize(100);
followerDatastoreContextBuilder.maximumMessageSliceSize(100);
initDatastoresWithCars("testLargeReadReplySlicing");
final DOMStoreReadWriteTransaction rwTx = followerDistributedDataStore.newReadWriteTransaction();
final NormalizedNode<?, ?> carsNode = CarsModel.create();
rwTx.write(CarsModel.BASE_PATH, carsNode);
verifyNode(rwTx, CarsModel.BASE_PATH, carsNode);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:DistributedDataStoreRemotingIntegrationTest.java
示例13: checkChange
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private static void checkChange(final NormalizedNode<?, ?> expectedBefore,
final NormalizedNode<?, ?> expectedAfter,
final ModificationType expectedMod,
final DataTreeCandidateNode candidateNode) {
if (expectedBefore != null) {
assertTrue(candidateNode.getDataBefore().isPresent());
assertEquals(expectedBefore, candidateNode.getDataBefore().get());
} else {
assertFalse(candidateNode.getDataBefore().isPresent());
}
if (expectedAfter != null) {
assertTrue(candidateNode.getDataAfter().isPresent());
assertEquals(expectedAfter, candidateNode.getDataAfter().get());
} else {
assertFalse(candidateNode.getDataAfter().isPresent());
}
assertEquals(expectedMod, candidateNode.getModificationType());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:DOMDataTreeListenerTest.java
示例14: assertDataTreeCandidate
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private static void assertDataTreeCandidate(DOMDataTreeCandidate candidate, DOMDataTreeIdentifier expTreeId,
ModificationType expType, Optional<NormalizedNode<?, ?>> expDataAfter,
Optional<NormalizedNode<?, ?>> expDataBefore) {
assertNotNull("Expected candidate for path " + expTreeId.getRootIdentifier(), candidate);
assertEquals("rootPath", expTreeId, candidate.getRootPath());
assertEquals("modificationType", expType, candidate.getRootNode().getModificationType());
assertEquals("dataAfter present", expDataAfter.isPresent(), candidate.getRootNode().getDataAfter().isPresent());
if (expDataAfter.isPresent()) {
assertEquals("dataAfter", expDataAfter.get(), candidate.getRootNode().getDataAfter().get());
}
assertEquals("dataBefore present", expDataBefore.isPresent(),
candidate.getRootNode().getDataBefore().isPresent());
if (expDataBefore.isPresent()) {
assertEquals("dataBefore", expDataBefore.get(), candidate.getRootNode().getDataBefore().get());
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:DataTreeCohortIntegrationTest.java
示例15: bug4359AddRemoveCarTwice
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Test
public void bug4359AddRemoveCarTwice() throws ExecutionException, InterruptedException {
immediatePayloadReplication(shardDataTree, mockShard);
final List<DataTreeCandidate> candidates = new ArrayList<>();
candidates.add(addCar(shardDataTree));
candidates.add(removeCar(shardDataTree));
candidates.add(addCar(shardDataTree));
candidates.add(removeCar(shardDataTree));
final NormalizedNode<?, ?> expected = getCars(shardDataTree);
applyCandidates(shardDataTree, candidates);
final NormalizedNode<?, ?> actual = getCars(shardDataTree);
assertEquals(expected, actual);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:ShardDataTreeTest.java
示例16: testInnerListNodeWithParentPathPrunedWhenSchemaMissing
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的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
示例17: existingTopWriteSibling
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
@Override
protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent();
assertContains(change.getCreatedData(), path(FOO_SIBLING));
assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
assertEmpty(change.getRemovedPaths());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:WildcardedScopeBaseTest.java
示例18: verifyCars
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
private static void verifyCars(final DOMStoreReadTransaction readTx, final MapEntryNode... entries)
throws Exception {
final Optional<NormalizedNode<?, ?>> optional = readTx.read(CarsModel.CAR_LIST_PATH).get(5, TimeUnit.SECONDS);
assertEquals("isPresent", true, optional.isPresent());
final CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder = ImmutableNodes.mapNodeBuilder(
CarsModel.CAR_QNAME);
for (final NormalizedNode<?, ?> entry: entries) {
listBuilder.withChild((MapEntryNode) entry);
}
assertEquals("Car list node", listBuilder.build(), optional.get());
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:DistributedDataStoreRemotingIntegrationTest.java
示例19: readAsPair
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
/**
* Reads Cache and returns the read object as InstanceIdentifier/DataObject pair.
* @param iid - Yang Instance ID
* @return A Map Entry (pair) that holds the Instance Identifier / DataObject pair.
*/
public Map.Entry<InstanceIdentifier<?>, DataObject> readAsPair(YangInstanceIdentifier iid) {
DOMStoreReadTransaction rTrans = memoryCache.newReadOnlyTransaction();
try {
Optional<NormalizedNode<?,?>> val =
rTrans.read(iid).get();
if (val.isPresent()) {
return codecs.getCodecRegistry().fromNormalizedNode(iid, val.get());
}
} catch (InterruptedException | ExecutionException e) {
ErrorLog.logError(e.getStackTrace());
}
return null;
}
开发者ID:opendaylight,项目名称:fpc,代码行数:19,代码来源:StorageCache.java
示例20: writeMonitor
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; //导入依赖的package包/类
/**
* Writes a Monitor to a Storage Cache.
* @param cache - Storage Cache to be updated
* @param monitorId - Monitor Identity
* @param target - Target of the Monitor
* @param value - Monitor Configuration
*/
static public void writeMonitor(StorageCache cache,
FpcIdentity monitorId,
FpcIdentity target,
EventConfigValue value) {
MonitorsBuilder mb = new MonitorsBuilder()
.setKey(new MonitorsKey(monitorId))
.setMonitorId(monitorId)
.setTarget(target)
.setEventConfigValue(value);
Map.Entry<YangInstanceIdentifier,NormalizedNode<?,?>> node = cache.codecs.getCodecRegistry().toNormalizedNode(
cache.mobilityIid.child(Monitors.class, mb.getKey()), mb.build());
cache.write(monitorId.toString(), node.getKey(), node.getValue());
}
开发者ID:opendaylight,项目名称:fpc,代码行数:21,代码来源:StorageCacheUtils.java
注:本文中的org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论