diff options
Diffstat (limited to 'nsh/impl')
-rw-r--r-- | nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java | 38 | ||||
-rw-r--r-- | nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java | 42 |
2 files changed, 40 insertions, 40 deletions
diff --git a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java index d519122cb..c91360eb6 100644 --- a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java +++ b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java @@ -22,9 +22,9 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; +import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.vpp.jvpp.VppBaseCallException; import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry; import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply; @@ -54,14 +54,6 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest { private NshEntryWriterCustomizer customizer; - @Override - public void setUp() throws Exception { - nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME); - defineMapping(mappingContext, ENTRY_NAME, ENTRY_INDEX, ENTRY_CTX_NAME); - - customizer = new NshEntryWriterCustomizer(jvppNsh, nshContext); - } - private static NshEntry generateNshEntry(final String name) { final NshEntryBuilder builder = new NshEntryBuilder(); builder.setName(name); @@ -88,16 +80,6 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest { .child(NshEntry.class, new NshEntryKey(name)); } - private void whenNshAddDelEntryThenSuccess() { - final NshAddDelEntryReply reply = new NshAddDelEntryReply(); - reply.entryIndex = ENTRY_INDEX; - doReturn(future(reply)).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class)); - } - - private void whenNshAddDelEntryThenFailure() { - doReturn(failedFuture()).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class)); - } - private static NshAddDelEntry generateNshAddDelEntry(final byte isAdd) { final NshAddDelEntry request = new NshAddDelEntry(); request.isAdd = isAdd; @@ -114,6 +96,24 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest { return request; } + @Override + public void setUpTest() throws Exception { + nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME); + defineMapping(mappingContext, ENTRY_NAME, ENTRY_INDEX, ENTRY_CTX_NAME); + + customizer = new NshEntryWriterCustomizer(jvppNsh, nshContext); + } + + private void whenNshAddDelEntryThenSuccess() { + final NshAddDelEntryReply reply = new NshAddDelEntryReply(); + reply.entryIndex = ENTRY_INDEX; + doReturn(future(reply)).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class)); + } + + private void whenNshAddDelEntryThenFailure() { + doReturn(failedFuture()).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class)); + } + @Test public void testCreate() throws Exception { final NshEntry nshEntry = generateNshEntry(ENTRY_NAME); diff --git a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java index 3794d805e..e5f82b3a7 100644 --- a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java +++ b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java @@ -22,9 +22,9 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; +import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.vpp.jvpp.VppBaseCallException; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply; @@ -58,16 +58,6 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { private NshMapWriterCustomizer customizer; - @Override - public void setUp() throws Exception { - nshContext = new NamingContext("nsh_map", MAP_CTX_NAME); - defineMapping(mappingContext, MAP_NAME, MAP_INDEX, MAP_CTX_NAME); - interfaceContext = new NamingContext("interface", INT_CTX_NAME); - defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME); - - customizer = new NshMapWriterCustomizer(jvppNsh, nshContext, interfaceContext); - } - private static NshMap generateNshMap(final String name) { final NshMapBuilder builder = new NshMapBuilder(); builder.setName(name); @@ -88,16 +78,6 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { .child(NshMap.class, new NshMapKey(name)); } - private void whenNshAddDelMapThenSuccess() { - final NshAddDelMapReply reply = new NshAddDelMapReply(); - reply.mapIndex = MAP_INDEX; - doReturn(future(reply)).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); - } - - private void whenNshAddDelMapThenFailure() { - doReturn(failedFuture()).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); - } - private static NshAddDelMap generateNshAddDelMap(final byte isAdd) { final NshAddDelMap request = new NshAddDelMap(); request.isAdd = isAdd; @@ -110,6 +90,26 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { return request; } + @Override + public void setUpTest() throws Exception { + nshContext = new NamingContext("nsh_map", MAP_CTX_NAME); + defineMapping(mappingContext, MAP_NAME, MAP_INDEX, MAP_CTX_NAME); + interfaceContext = new NamingContext("interface", INT_CTX_NAME); + defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME); + + customizer = new NshMapWriterCustomizer(jvppNsh, nshContext, interfaceContext); + } + + private void whenNshAddDelMapThenSuccess() { + final NshAddDelMapReply reply = new NshAddDelMapReply(); + reply.mapIndex = MAP_INDEX; + doReturn(future(reply)).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); + } + + private void whenNshAddDelMapThenFailure() { + doReturn(failedFuture()).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); + } + @Test public void testCreate() throws Exception { final NshMap nshMap = generateNshMap(MAP_NAME); |