@Test public void testClose() throws Exception { final SxpConnection sxpConnection = mock(SxpConnection.class); when(sxpConnection.getDomainName()).thenReturn(SxpNode.DEFAULT_DOMAIN); when(sxpConnection.getDestination()).thenReturn(InetSocketAddress.createUnresolved("127.0.0.2", 64977)); when(sxpConnection.openConnection()).thenReturn(new ImmediateCancelledFuture<>()); node.start().get(); node.addConnection(sxpConnection); verify(sxpConnection).openConnection(); node.close(); verify(sxpConnection).shutdown(); }
@Override public void close() { LOG.debug("Closing SXPDatastoreNode {}", this); final ListenableFuture future = shutdown(); if (Objects.nonNull(future)) { getWorker().addListener(future, () -> getWorker().close()); } else { getWorker().close(); } }
SxpDatastoreNode extends org.opendaylight.sxp.core.SxpNode implements AutoCloseable { @Override public void close() { LOG.debug("Closing SXPDatastoreNode {}", this); final ListenableFuture future = shutdown(); if (Objects.nonNull(future)) { getWorker().addListener(future, () -> getWorker().close()); } else { getWorker().close(); } } }
SxpDatastoreNode extends org.opendaylight.sxp.core.SxpNode implements AutoCloseable { @Override public void close() { LOG.debug("Closing SXPDatastoreNode {}", this); final ListenableFuture future = shutdown(); if (Objects.nonNull(future)) { getWorker().addListener(future, () -> getWorker().close()); } else { getWorker().close(); } } protected  SxpDatastoreNode(NodeId nodeId, DatastoreAccess datastoreAccess, SxpNodeIdentity node); }
SxpDatastoreNode extends org.opendaylight.sxp.core.SxpNode implements AutoCloseable { @Override public void close() { LOG.debug("Closing SXPDatastoreNode {}", this); final ListenableFuture future = shutdown(); if (Objects.nonNull(future)) { getWorker().addListener(future, () -> getWorker().close()); } else { getWorker().close(); } } protected  SxpDatastoreNode(NodeId nodeId, DatastoreAccess datastoreAccess, SxpNodeIdentity node); static InstanceIdentifier<SxpNodeIdentity> getIdentifier(final String nodeId); static SxpDatastoreNode createInstance(NodeId nodeId, DatastoreAccess datastoreAccess,
            SxpNodeIdentity node); @Override boolean addDomain(SxpDomain domain); @Override SxpConnection addConnection(Connection connection, String domain); @Override List<MasterDatabaseBinding> putBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); @Override List<MasterDatabaseBinding> removeBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); DatastoreAccess getDatastoreAccess(); @Override synchronized ListenableFuture<Boolean> shutdown(); @Override void close(); }
SxpDatastoreNode extends org.opendaylight.sxp.core.SxpNode implements AutoCloseable { @Override public void close() { LOG.debug("Closing SXPDatastoreNode {}", this); final ListenableFuture future = shutdown(); if (Objects.nonNull(future)) { getWorker().addListener(future, () -> getWorker().close()); } else { getWorker().close(); } } protected  SxpDatastoreNode(NodeId nodeId, DatastoreAccess datastoreAccess, SxpNodeIdentity node); static InstanceIdentifier<SxpNodeIdentity> getIdentifier(final String nodeId); static SxpDatastoreNode createInstance(NodeId nodeId, DatastoreAccess datastoreAccess,
            SxpNodeIdentity node); @Override boolean addDomain(SxpDomain domain); @Override SxpConnection addConnection(Connection connection, String domain); @Override List<MasterDatabaseBinding> putBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); @Override List<MasterDatabaseBinding> removeBindingsMasterDatabase(List<MasterDatabaseBinding> bindings,
            String domainName); DatastoreAccess getDatastoreAccess(); @Override synchronized ListenableFuture<Boolean> shutdown(); @Override void close();  }