import com.google.common.collect.Lists;
import java.util.Collections;
+import java.util.concurrent.ExecutionException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth;
private ListenerRegistration<NodeChangedListener> listenerRegistration;
@Before
- public void setUp() throws TransactionCommitFailedException {
+ public void setUp() throws InterruptedException, ExecutionException {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder()
.setKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList())
.setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
wTx.put(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder()
.setKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
- wTx.submit().checkedGet();
+ wTx.commit().get();
final NodeChangedListener nodeListener = new NodeChangedListener(getDataBroker(),
PCEP_TOPOLOGY_ID, TUNNEL_TOPO_IID);
this.listenerRegistration = getDataBroker().registerDataTreeChangeListener(new DataTreeIdentifier<>(
}
@Test
- public void testNodeChangedListener() throws ReadFailedException, TransactionCommitFailedException {
+ public void testNodeChangedListener() throws ReadFailedException, InterruptedException, ExecutionException {
// add node -> create two nodes with TPs and link
createNode(NODE1_ID, NODE1_IPV4, LSP1_NAME, LSP1_ID, NODE2_IPV4);
final Topology tunnelTopo = readDataOperational(getDataBroker(), TUNNEL_TOPO_IID, tunnelTopo1 -> {
}
private void createNode(final NodeId nodeId, final String ipv4Address, final String lspName, final long lspId,
- final String dstIpv4Address) throws TransactionCommitFailedException {
+ final String dstIpv4Address) throws InterruptedException, ExecutionException {
final NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setKey(new NodeKey(nodeId));
nodeBuilder.setNodeId(nodeId);
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder().child(Node.class,
new NodeKey(nodeId)).build(), nodeBuilder.build());
- wTx.submit().checkedGet();
+ wTx.commit().get();
}
- private void removeNode(final NodeId nodeId) throws TransactionCommitFailedException {
+ private void removeNode(final NodeId nodeId) throws InterruptedException, ExecutionException {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID.builder()
.child(Node.class, new NodeKey(nodeId)).build());
- wTx.submit().checkedGet();
+ wTx.commit().get();
}
}