diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-09-23 16:39:09 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-09-23 16:41:57 +0200 |
commit | a7147d16c31d9028c6b5dc557264433de0f11c91 (patch) | |
tree | 15816600ab3dfa5eea706ef1b1910b2e13ae66d7 /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java | |
parent | e7a0775b21c2ea6b7bb8efb63b5384df26e27fbb (diff) |
HONEYCOMB-145 - Utility Class Refactoring
problematic mockito-all changed to mockito-core( https://github.com/mockito/mockito/issues/324)
Translate Utils Splitted to multiple Trait Interfaces
Ipv4Translator - Logic for translation of ipv4-based data
Ipv6Translator - Logic for translation of ipv6-based data
MacTranslator - Logic for translation of mac-based data
AddressTranslator - Aggregation trait for Ipv4/Ipv6/Mac
JvppReplyConsumer - Logic for extracting replies from jvpp calls
ByteDataTranslator - any byte-based conversions
Plus some existing utility classes changed to traits
Change-Id: I342b625954223966802e65dca0fabf8456c89345
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java')
-rw-r--r-- | v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java index 0c1d2d72f..a47f5b641 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java @@ -30,8 +30,8 @@ import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; +import io.fd.honeycomb.translate.v3po.util.Ipv4Translator; import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; import org.junit.Test; @@ -53,30 +53,30 @@ import org.openvpp.jvpp.core.dto.DeleteVhostUserIfReply; import org.openvpp.jvpp.core.dto.ModifyVhostUserIf; import org.openvpp.jvpp.core.dto.ModifyVhostUserIfReply; -public class VhostUserCustomizerTest extends WriterCustomizerTest { +public class VhostUserCustomizerTest extends WriterCustomizerTest implements Ipv4Translator { private VhostUserCustomizer customizer; private static final int IFACE_ID = 1; private static final String IFACE_NAME = "eth0"; private static final InstanceIdentifier<VhostUser> ID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME)) - .augmentation(VppInterfaceAugmentation.class).child(VhostUser.class); + InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME)) + .augmentation(VppInterfaceAugmentation.class).child(VhostUser.class); @Override public void setUp() throws Exception { InterfaceTypeTestUtils.setupWriteContext(writeContext, - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class); + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class); customizer = new VhostUserCustomizer(api, new NamingContext("generatedInterfaceName", "test-instance")); } private CreateVhostUserIf verifyCreateVhostUserIfWasInvoked(final VhostUser vhostUser) - throws VppInvocationException { + throws VppInvocationException { ArgumentCaptor<CreateVhostUserIf> argumentCaptor = ArgumentCaptor.forClass(CreateVhostUserIf.class); verify(api).createVhostUserIf(argumentCaptor.capture()); final CreateVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(0, actual.useCustomMac); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); @@ -85,13 +85,13 @@ public class VhostUserCustomizerTest extends WriterCustomizerTest { } private ModifyVhostUserIf verifyModifyVhostUserIfWasInvoked(final VhostUser vhostUser, final int swIfIndex) - throws VppInvocationException { + throws VppInvocationException { ArgumentCaptor<ModifyVhostUserIf> argumentCaptor = ArgumentCaptor.forClass(ModifyVhostUserIf.class); verify(api).modifyVhostUserIf(argumentCaptor.capture()); final ModifyVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(swIfIndex, actual.swIfIndex); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); @@ -122,7 +122,7 @@ public class VhostUserCustomizerTest extends WriterCustomizerTest { customizer.writeCurrentAttributes(ID, vhostUser, writeContext); verifyCreateVhostUserIfWasInvoked(vhostUser); verify(mappingContext).put(eq(ContextTestUtils.getMappingIid(IFACE_NAME, "test-instance")), eq( - ContextTestUtils.getMapping(IFACE_NAME, 0).get())); + ContextTestUtils.getMapping(IFACE_NAME, 0).get())); } @Test |