summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-05-23 15:22:24 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-06-02 10:10:21 +0000
commitb475c0760ae397d2d485a37931f508820d88cce0 (patch)
treeebab26c53814449d6c897983d50291be51744c9c /v3po/v3po2vpp/src/test
parentaa3a931cd81d3576dbac40825c3d7b920b7dc76a (diff)
HONEYCOMB-61: Detect VPP disconnect using keepalives
Change-Id: Ic664dbf452504d0fff97e8c766d735d9c5d95c72 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizerTest.java10
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java11
2 files changed, 8 insertions, 13 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizerTest.java
index 03b923102..0ddef2248 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VersionCustomizerTest.java
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.when;
import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.test.ChildReaderCustomizerTest;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionStage;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version;
@@ -54,20 +53,17 @@ public class VersionCustomizerTest extends ChildReaderCustomizerTest<Version, Ve
@Test
public void testReadCurrentAttributes() throws Exception {
- final CompletionStage<ShowVersionReply> replyCS = mock(CompletionStage.class);
- final CompletableFuture<ShowVersionReply> replyFuture = mock(CompletableFuture.class);
- when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
+ final CompletableFuture<ShowVersionReply> replyFuture = new CompletableFuture<>();
final ShowVersionReply reply = new ShowVersionReply();
reply.retval = 0;
reply.version = new byte[]{};
reply.program = new byte[]{};
reply.buildDate = new byte[]{};
reply.buildDirectory = new byte[]{};
- when(replyFuture.get()).thenReturn(reply);
- when(api.showVersion(any(ShowVersion.class))).thenReturn(replyCS);
+ replyFuture.complete(reply);
+ when(api.showVersion(any(ShowVersion.class))).thenReturn(replyFuture);
getCustomizer().readCurrentAttributes(InstanceIdentifier.create(Version.class), new VersionBuilder(), ctx);
-
verify(api).showVersion(any(ShowVersion.class));
}
} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
index 3d75d09e2..5ac108560 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
@@ -113,17 +113,16 @@ public class VppStateTest {
}
private void whenShowVersionThenReturn(int retval, Version version) throws ExecutionException, InterruptedException {
- final CompletionStage<ShowVersionReply> replyCS = mock(CompletionStage.class);
- final CompletableFuture<ShowVersionReply> replyFuture = mock(CompletableFuture.class);
- when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
+ final CompletableFuture<ShowVersionReply> replyFuture = new CompletableFuture<>();
final ShowVersionReply reply = new ShowVersionReply();
reply.retval = 0; // success
reply.buildDate = version.getBuildDate().getBytes();
reply.program = version.getName().getBytes();
reply.version = version.getBranch().getBytes();
reply.buildDirectory = version.getBuildDirectory().getBytes();
- when(replyFuture.get()).thenReturn(reply);
- when(api.showVersion(any(ShowVersion.class))).thenReturn(replyCS);
+
+ replyFuture.complete(reply);
+ when(api.showVersion(any(ShowVersion.class))).thenReturn(replyFuture);
}
private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) throws ExecutionException, InterruptedException {
@@ -305,7 +304,7 @@ public class VppStateTest {
@Test(expected = IllegalArgumentException.class)
public void testReadBridgeDomainNotExisting() throws Exception {
doReturn(Optional.absent()).when(mappingContext).read(getMappingIid("NOT EXISTING", "bd-test-instance"));
-
+
final Optional<? extends DataObject> read =
readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
BridgeDomain.class, new BridgeDomainKey("NOT EXISTING")), ctx);