import com.google.common.base.Optional;
import com.google.common.util.concurrent.Futures;
-import java.io.InputStream;
import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.EnumMap;
-import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import javassist.ClassPool;
public class NetconfDeviceTopologyAdapterTest {
- private RemoteDeviceId id = new RemoteDeviceId("test", new InetSocketAddress("localhost", 22));
+ private final RemoteDeviceId id = new RemoteDeviceId("test", new InetSocketAddress("localhost", 22));
@Mock
private DataBroker broker;
@Mock
private NetconfNode data;
- private String txIdent = "test transaction";
+ private final String txIdent = "test transaction";
private SchemaContext schemaContext = null;
- private String sessionIdForReporting = "netconf-test-session1";
+ private final String sessionIdForReporting = "netconf-test-session1";
private BindingTransactionChain transactionChain;
doReturn(txIdent).when(writeTx).getIdentifier();
- this.schemaContext = YangParserTestUtils.parseYangStreams(getYangSchemas());
+ this.schemaContext = YangParserTestUtils.parseYangResources(NetconfDeviceTopologyAdapterTest.class,
+ "/schemas/network-topology@2013-10-21.yang", "/schemas/ietf-inet-types@2013-07-15.yang",
+ "/schemas/yang-ext.yang", "/schemas/netconf-node-topology.yang",
+ "/schemas/network-topology-augment-test@2016-08-08.yang");
schemaContext.getModules();
final SchemaService schemaService = createSchemaService();
datastores.put(LogicalDatastoreType.OPERATIONAL, operStore);
ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
- 16, 16, "CommitFutures");
+ 16, 16, "CommitFutures", NetconfDeviceTopologyAdapterTest.class);
concurrentDOMDataBroker = new ConcurrentDOMDataBroker(datastores, listenableFutureExecutor);
transactionChain = dataBroker.createTransactionChain(new TransactionChainListener() {
@Override
- public void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
- Throwable cause) {
+ public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
+ final AsyncTransaction<?, ?> transaction, final Throwable cause) {
}
@Override
- public void onTransactionChainSuccessful(TransactionChain<?, ?> chain) {
+ public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
}
});
NormalizedNode<?, ?> augmentNode = ImmutableLeafNodeBuilder.create().withValue(dataTestId)
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(netconfTestLeafQname)).build();
- DOMDataWriteTransaction writeTx = concurrentDOMDataBroker.newWriteOnlyTransaction();
- writeTx.put(LogicalDatastoreType.OPERATIONAL, pathToAugmentedLeaf, augmentNode);
- writeTx.submit();
+ DOMDataWriteTransaction wtx = concurrentDOMDataBroker.newWriteOnlyTransaction();
+ wtx.put(LogicalDatastoreType.OPERATIONAL, pathToAugmentedLeaf, augmentNode);
+ wtx.submit();
adapter.updateDeviceData(true, new NetconfDeviceCapabilities());
Optional<NormalizedNode<?, ?>> testNode = concurrentDOMDataBroker.newReadOnlyTransaction()
dataTestId, testNode.get().getValue());
}
- private List<InputStream> getYangSchemas() {
- final List<String> schemaPaths = Arrays.asList("/schemas/network-topology@2013-10-21.yang",
- "/schemas/ietf-inet-types@2013-07-15.yang", "/schemas/yang-ext.yang",
- "/schemas/netconf-node-topology.yang", "/schemas/network-topology-augment-test@2016-08-08.yang");
- final List<InputStream> schemas = new ArrayList<>();
-
- for (String schemaPath : schemaPaths) {
- InputStream resourceAsStream = getClass().getResourceAsStream(schemaPath);
- schemas.add(resourceAsStream);
- }
-
- return schemas;
- }
-
private SchemaService createSchemaService() {
return new SchemaService() {
@Override
- public void addModule(Module module) {
+ public void addModule(final Module module) {
}
@Override
- public void removeModule(Module module) {
+ public void removeModule(final Module module) {
}