diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2016-10-15 01:08:28 +0800 |
---|---|---|
committer | Hongjun Ni <hongjun.ni@intel.com> | 2016-10-15 01:37:43 +0800 |
commit | 0a9d6acb44d91fbbedfe4b481dd58d62c7f58e6b (patch) | |
tree | 28a773c98df608b8ac23b7ef5728d367b188d299 /nsh/impl/src/test/java/io/fd/honeycomb/vppnsh/impl/oper/NshEntryReaderCustomizerTest.java | |
parent | 4469dd3495c36d8b63fbae325b951fad694638d0 (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.java | 39 |
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()); + + } } |