diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-05-26 10:42:51 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-05-26 14:01:57 +0200 |
commit | e6f05b4529b7832249ac131e32008c12a5a7d0da (patch) | |
tree | 77f5bd07d450fdaaab3f64b9cf6d0170ba4d715f /v3po/v3po2vpp/src/test | |
parent | d3e4ed3d5cd563ea20ae06dc4c6997f135d5d446 (diff) |
Move V3poUtils for vpp-translate-utils
Change-Id: Id6218d5136e0e4c0f1848da20bba784b71feee13
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test')
2 files changed, 3 insertions, 64 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java index a14718124..a6fb64331 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VhostUserCustomizerTest.java @@ -36,7 +36,7 @@ import io.fd.honeycomb.v3po.translate.MappingContext; import io.fd.honeycomb.v3po.translate.ModificationCache; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; -import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.concurrent.CompletableFuture; @@ -152,7 +152,7 @@ public class VhostUserCustomizerTest { final CreateVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(0, actual.useCustomMac); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); @@ -166,7 +166,7 @@ public class VhostUserCustomizerTest { final ModifyVhostUserIf actual = argumentCaptor.getValue(); assertEquals(0, actual.customDevInstance); - assertEquals(V3poUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); + assertEquals(TranslateUtils.booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole())), actual.isServer); assertEquals(0, actual.renumber); assertEquals(swIfIndex, actual.swIfIndex); assertArrayEquals(vhostUser.getSocket().getBytes(), actual.sockFilename); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtilsTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtilsTest.java deleted file mode 100644 index fcdca49b0..000000000 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/utils/V3poUtilsTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.fd.honeycomb.v3po.translate.v3po.utils; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class V3poUtilsTest { - - @Test - public void testToString() { - final byte[] expected = "test".getBytes(); - final byte[] cString = new byte[expected.length+10]; - System.arraycopy(expected, 0, cString, 0, expected.length); - final String jString = V3poUtils.toString(cString); - assertArrayEquals(expected, jString.getBytes()); - } - - @Test - public void testParseMac() throws Exception { - byte[] bytes = V3poUtils.parseMac("00:fF:7f:15:5e:A9"); - assertMac(bytes); - } - - private void assertMac(final byte[] bytes) { - assertEquals(6, bytes.length); - assertEquals((byte)0, bytes[0]); - assertEquals((byte)255, bytes[1]); - assertEquals((byte)127, bytes[2]); - assertEquals((byte)21, bytes[3]); - assertEquals((byte)94, bytes[4]); - assertEquals((byte)169, bytes[5]); - } - - @Test(expected = IllegalArgumentException.class) - public void testParseMacLonger() throws Exception { - byte[] bytes = V3poUtils.parseMac("00:fF:7f:15:5e:A9:88:77"); - assertMac(bytes); - } - - @Test(expected = IllegalArgumentException.class) - public void testParseMacShorter() throws Exception { - V3poUtils.parseMac("00:fF:7f"); - } - - @Test(expected = IllegalArgumentException.class) - public void testParseRandomString() throws Exception { - V3poUtils.parseMac("random{}}@$*&*!"); - } - - @Test(expected = NumberFormatException.class) - public void testParseMacNumberFormatEx() throws Exception { - V3poUtils.parseMac("00:XX:7f:15:5e:77\""); - } - - public void testBooleanToByte() { - assertEquals(0, V3poUtils.booleanToByte(null)); - assertEquals(0, V3poUtils.booleanToByte(false)); - assertEquals(1, V3poUtils.booleanToByte(true)); - } -}
\ No newline at end of file |