summaryrefslogtreecommitdiffstats
path: root/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2016-10-15 01:08:28 +0800
committerHongjun Ni <hongjun.ni@intel.com>2016-10-15 01:37:43 +0800
commit74d5f495d67f4e53d88142e9773559b15e0d9807 (patch)
tree3376c2711f61e58a8bd2da9bdcab6023b6ae6fbc /nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
parent6e9cb1fb7f2e808d016e9426142f2b5a78e980d9 (diff)
Raise test coverage of nsh plugin. HONEYCOMB-198
Change-Id: Iaf57bced6f07799e26470dd5c1700a8bbe7960f4 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java')
-rw-r--r--nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
index 61e89bc1c..804346f75 100644
--- a/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
+++ b/nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java
@@ -89,6 +89,7 @@ public class NshEntryReaderCustomizerTest extends
public void setUp() throws VppBaseCallException {
nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME);
defineMapping(mappingContext, ENTRY_NAME_1, ENTRY_INDEX_1, ENTRY_CTX_NAME);
+ defineMapping(mappingContext, ENTRY_NAME_2, ENTRY_INDEX_2, ENTRY_CTX_NAME);
final NshEntryDetailsReplyDump reply = new NshEntryDetailsReplyDump();
final NshEntryDetails nshEntryDetails = new NshEntryDetails();
@@ -124,4 +125,42 @@ public class NshEntryReaderCustomizerTest extends
verify(jvppNsh).nshEntryDump(any(NshEntryDump.class));
}
+
+ @Test
+ public void testGetAllIds() throws ReadFailedException {
+ final NshEntryDetailsReplyDump reply = new NshEntryDetailsReplyDump();
+
+ final NshEntryDetails nshEntryDetails_1 = new NshEntryDetails();
+ nshEntryDetails_1.entryIndex = ENTRY_INDEX_1;
+ nshEntryDetails_1.verOC = 0;
+ nshEntryDetails_1.length = 6;
+ nshEntryDetails_1.mdType = 1;
+ nshEntryDetails_1.nextProtocol = 3;
+ nshEntryDetails_1.nspNsi = (123<<8 | 4);
+ nshEntryDetails_1.c1 = 1;
+ nshEntryDetails_1.c2 = 2;
+ nshEntryDetails_1.c3 = 3;
+ nshEntryDetails_1.c4 = 4;
+ reply.nshEntryDetails = Lists.newArrayList(nshEntryDetails_1);
+
+ final NshEntryDetails nshEntryDetails_2 = new NshEntryDetails();
+ nshEntryDetails_2.entryIndex = ENTRY_INDEX_2;
+ nshEntryDetails_2.verOC = 0;
+ nshEntryDetails_2.length = 6;
+ nshEntryDetails_2.mdType = 1;
+ nshEntryDetails_2.nextProtocol = 2;
+ nshEntryDetails_2.nspNsi = (223<<8 | 24);
+ nshEntryDetails_2.c1 = 21;
+ nshEntryDetails_2.c2 = 22;
+ nshEntryDetails_2.c3 = 23;
+ nshEntryDetails_2.c4 = 24;
+ reply.nshEntryDetails = Lists.newArrayList(nshEntryDetails_2);
+
+ doReturn(future(reply)).when(jvppNsh).nshEntryDump(any(NshEntryDump.class));
+
+ final List<NshEntryKey> allIds = getCustomizer().getAllIds(getNshEntryId(ENTRY_NAME_1), ctx);
+
+ assertEquals(reply.nshEntryDetails.size(), allIds.size());
+
+ }
}