use of org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore in project controller by opendaylight.
the class NormalizedNodeAggregatorTest method getRootNode.
public static NormalizedNode<?, ?> getRootNode(NormalizedNode<?, ?> moduleNode, SchemaContext schemaContext) throws ReadFailedException, ExecutionException, InterruptedException {
try (InMemoryDOMDataStore store = new InMemoryDOMDataStore("test", Executors.newSingleThreadExecutor())) {
store.onGlobalContextUpdated(schemaContext);
DOMStoreWriteTransaction writeTransaction = store.newWriteOnlyTransaction();
writeTransaction.merge(YangInstanceIdentifier.of(moduleNode.getNodeType()), moduleNode);
DOMStoreThreePhaseCommitCohort ready = writeTransaction.ready();
ready.canCommit().get();
ready.preCommit().get();
ready.commit().get();
DOMStoreReadTransaction readTransaction = store.newReadOnlyTransaction();
CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read = readTransaction.read(YangInstanceIdentifier.EMPTY);
Optional<NormalizedNode<?, ?>> nodeOptional = read.checkedGet();
return nodeOptional.get();
}
}
use of org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore in project controller by opendaylight.
the class ConcurrentDOMDataBrokerTest method setup.
@Before
public void setup() {
doReturn("tx").when(transaction).getIdentifier();
DOMStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
coordinator = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, store), futureExecutor);
}
Aggregations