import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitReply;
import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
masterActor = new TestProbe(system);
final RemoteDeviceId id = new RemoteDeviceId("dev1", InetSocketAddress.createUnresolved("localhost", 17830));
node = Builders.containerBuilder()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("cont")))
+ .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create("", "cont")))
.build();
tx = new ProxyWriteTransaction(masterActor.ref(), id, system, Timeout.apply(5, TimeUnit.SECONDS));
}
@Test
public void testCancelSubmitted() throws Exception {
- final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = tx.submit();
+ final ListenableFuture<Void> submitFuture = tx.submit();
masterActor.expectMsgClass(SubmitRequest.class);
masterActor.reply(new SubmitReply());
- submitFuture.checkedGet();
+ submitFuture.get();
final Future<Boolean> submit = Executors.newSingleThreadExecutor().submit(() -> tx.cancel());
masterActor.expectNoMsg();
Assert.assertFalse(submit.get());
@Test
public void testSubmit() throws Exception {
- final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = tx.submit();
+ final ListenableFuture<Void> submitFuture = tx.submit();
masterActor.expectMsgClass(SubmitRequest.class);
masterActor.reply(new SubmitReply());
- submitFuture.checkedGet();
+ submitFuture.get();
}
@Test
public void testDoubleSubmit() throws Exception {
- final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = tx.submit();
+ final ListenableFuture<Void> submitFuture = tx.submit();
masterActor.expectMsgClass(SubmitRequest.class);
masterActor.reply(new SubmitReply());
- submitFuture.checkedGet();
+ submitFuture.get();
try {
tx.submit().checkedGet();
Assert.fail("Should throw IllegalStateException");
}
}
- @Test
- public void testCommit() throws Exception {
- final ListenableFuture<RpcResult<TransactionStatus>> submitFuture = tx.commit();
- masterActor.expectMsgClass(SubmitRequest.class);
- masterActor.reply(new SubmitReply());
- Assert.assertEquals(TransactionStatus.SUBMITED, submitFuture.get().getResult());
- }
-
@Test
public void testDelete() throws Exception {
tx.delete(STORE, PATH);
submit.checkedGet();
}
-}
\ No newline at end of file
+}