diff options
Diffstat (limited to 'src/vpp-api/java/jvpp-core')
4 files changed, 32 insertions, 16 deletions
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java index 986993b854f..8fcef967b1d 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java @@ -30,6 +30,7 @@ import io.fd.vpp.jvpp.core.dto.ShowVersion; import io.fd.vpp.jvpp.core.dto.ShowVersionReply; import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails; import io.fd.vpp.jvpp.core.dto.SwInterfaceDump; +import java.nio.charset.StandardCharsets; public class CallbackApiTest { @@ -49,13 +50,13 @@ public class CallbackApiTest { System.out.println("Sending GetNodeIndex request..."); GetNodeIndex getNodeIndexRequest = new GetNodeIndex(); - getNodeIndexRequest.nodeName = "non-existing-node".getBytes(); + getNodeIndexRequest.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8); jvpp.send(getNodeIndexRequest); System.out.println("Sending SwInterfaceDump request..."); SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump(); swInterfaceDumpRequest.nameFilterValid = 0; - swInterfaceDumpRequest.nameFilter = "".getBytes(); + swInterfaceDumpRequest.nameFilter = "".getBytes(StandardCharsets.UTF_8); jvpp.send(swInterfaceDumpRequest); Thread.sleep(1000); @@ -75,15 +76,18 @@ public class CallbackApiTest { public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("Received ShowVersionReply: context=%d, program=%s, version=%s, " + "buildDate=%s, buildDirectory=%s%n", - msg.context, new String(msg.program), new String(msg.version), - new String(msg.buildDate), new String(msg.buildDirectory)); + msg.context, + new String(msg.program, StandardCharsets.UTF_8), + new String(msg.version, StandardCharsets.UTF_8), + new String(msg.buildDate, StandardCharsets.UTF_8), + new String(msg.buildDirectory, StandardCharsets.UTF_8)); } @Override public void onSwInterfaceDetails(final SwInterfaceDetails msg) { System.out.printf("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, " + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n", - new String(msg.interfaceName), msg.l2AddressLength, msg.adminUpDown, + new String(msg.interfaceName, StandardCharsets.UTF_8), msg.l2AddressLength, msg.adminUpDown, msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu); } diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java index 9f7cb8deadc..cf6b0bb3141 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java @@ -26,6 +26,7 @@ import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade; import io.fd.vpp.jvpp.core.dto.GetNodeIndex; import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply; import io.fd.vpp.jvpp.core.dto.ShowVersionReply; +import java.nio.charset.StandardCharsets; /** * CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request. @@ -37,8 +38,11 @@ public class CallbackJVppFacadeTest { @Override public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("ShowVersionCallback1 received ShowVersionReply: context=%d, program=%s," - + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program), - new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory)); + + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, + new String(msg.program, StandardCharsets.UTF_8), + new String(msg.version, StandardCharsets.UTF_8), + new String(msg.buildDate, StandardCharsets.UTF_8), + new String(msg.buildDirectory, StandardCharsets.UTF_8)); } @Override @@ -52,8 +56,11 @@ public class CallbackJVppFacadeTest { @Override public void onShowVersionReply(final ShowVersionReply msg) { System.out.printf("ShowVersionCallback2 received ShowVersionReply: context=%d, program=%s," - + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program), - new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory)); + + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, + new String(msg.program, StandardCharsets.UTF_8), + new String(msg.version, StandardCharsets.UTF_8), + new String(msg.buildDate, StandardCharsets.UTF_8), + new String(msg.buildDirectory, StandardCharsets.UTF_8)); } @Override @@ -88,7 +95,7 @@ public class CallbackJVppFacadeTest { callbackFacade.showVersion(showVersionCallback2); GetNodeIndex getNodeIndexRequest = new GetNodeIndex(); - getNodeIndexRequest.nodeName = "dummyNode".getBytes(); + getNodeIndexRequest.nodeName = "dummyNode".getBytes(StandardCharsets.UTF_8); callbackFacade.getNodeIndex(getNodeIndexRequest, getNodeIndexCallback); Thread.sleep(2000); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java index a96258f4302..7684721f388 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java @@ -26,6 +26,7 @@ import io.fd.vpp.jvpp.core.dto.CreateSubifReply; import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.SwInterfaceDump; import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade; +import java.nio.charset.StandardCharsets; /** * <p>Tests sub-interface creation.<br> Equivalent to:<br> @@ -45,7 +46,7 @@ public class CreateSubInterfaceTest { private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) { SwInterfaceDump request = new SwInterfaceDump(); - request.nameFilter = ifaceName.getBytes(); + request.nameFilter = ifaceName.getBytes(StandardCharsets.UTF_8); request.nameFilterValid = 1; return request; } diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java index f478bab442f..0d7c7471df7 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java @@ -29,6 +29,7 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails; import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.SwInterfaceDump; import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade; +import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; @@ -46,8 +47,10 @@ public class FutureApiTest { LOG.info( String.format( "Received ShowVersionReply: context=%d, program=%s, version=%s, buildDate=%s, buildDirectory=%s%n", - reply.context, new String(reply.program), new String(reply.version), new String(reply.buildDate), - new String(reply.buildDirectory))); + reply.context, new String(reply.program, StandardCharsets.UTF_8), + new String(reply.version, StandardCharsets.UTF_8), + new String(reply.buildDate, StandardCharsets.UTF_8), + new String(reply.buildDirectory, StandardCharsets.UTF_8))); } private static void testEmptyBridgeDomainDump(final FutureJVppCoreFacade jvpp) throws Exception { @@ -72,7 +75,7 @@ public class FutureApiTest { private static void testGetNodeIndex(final FutureJVppCoreFacade jvpp) { LOG.info("Sending GetNodeIndex request..."); final GetNodeIndex request = new GetNodeIndex(); - request.nodeName = "non-existing-node".getBytes(); + request.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8); final Future<GetNodeIndexReply> replyFuture = jvpp.getNodeIndex(request).toCompletableFuture(); try { final GetNodeIndexReply reply = replyFuture.get(); @@ -88,7 +91,7 @@ public class FutureApiTest { LOG.info("Sending SwInterfaceDump request..."); final SwInterfaceDump request = new SwInterfaceDump(); request.nameFilterValid = 0; - request.nameFilter = "".getBytes(); + request.nameFilter = "".getBytes(StandardCharsets.UTF_8); final Future<SwInterfaceDetailsReplyDump> replyFuture = jvpp.swInterfaceDump(request).toCompletableFuture(); final SwInterfaceDetailsReplyDump reply = replyFuture.get(); @@ -97,7 +100,8 @@ public class FutureApiTest { LOG.info( String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, " + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n", - new String(details.interfaceName), details.l2AddressLength, details.adminUpDown, + new String(details.interfaceName, StandardCharsets.UTF_8), + details.l2AddressLength, details.adminUpDown, details.linkUpDown, details.linkSpeed, (int) details.linkMtu)); } } |