From d93a19d6d95d41f2a6287a737a5582ff12f4a0a7 Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Fri, 14 Dec 2018 09:39:12 +0100 Subject: adapt to string type changes in JVPP Change-Id: Ic3a01740290a2af37c495318f2aa5422f5fe06cd Signed-off-by: Michal Cmarada --- .../main/java/io/fd/hc2vpp/management/rpc/CliInbandService.java | 7 ++----- .../java/io/fd/hc2vpp/management/state/VersionCustomizer.java | 8 ++++---- .../java/io/fd/hc2vpp/management/rpc/CliInbandServiceTest.java | 2 +- .../src/test/java/io/fd/hc2vpp/management/state/VppStateTest.java | 8 ++++---- 4 files changed, 11 insertions(+), 14 deletions(-) (limited to 'vpp-management') diff --git a/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/rpc/CliInbandService.java b/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/rpc/CliInbandService.java index ab55abe3f..fd1b18eee 100644 --- a/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/rpc/CliInbandService.java +++ b/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/rpc/CliInbandService.java @@ -46,12 +46,9 @@ public class CliInbandService implements RpcService invoke(@Nonnull final CliInbandInput input) { final CliInband request = new CliInband(); - request.cmd = input.getCmd().getBytes(StandardCharsets.UTF_8); - request.length = request.cmd.length; + request.cmd = input.getCmd(); return jvpp.cliInband(request) - .thenApply( - reply -> new CliInbandOutputBuilder().setReply(new String(reply.reply)).build() - ); + .thenApply(reply -> new CliInbandOutputBuilder().setReply(reply.reply).build()); } @Nonnull diff --git a/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/state/VersionCustomizer.java b/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/state/VersionCustomizer.java index bfbabcb0c..b162a39a1 100644 --- a/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/state/VersionCustomizer.java +++ b/vpp-management/impl/src/main/java/io/fd/hc2vpp/management/state/VersionCustomizer.java @@ -65,10 +65,10 @@ public final class VersionCustomizer final CompletionStage showVersionFuture = getFutureJVpp().showVersion(new ShowVersion()); final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id); - builder.setBranch(toString(reply.version)); - builder.setName(toString(reply.program)); - builder.setBuildDate(toString(reply.buildDate)); - builder.setBuildDirectory(toString(reply.buildDirectory)); + builder.setBranch(reply.version); + builder.setName(reply.program); + builder.setBuildDate(reply.buildDate); + builder.setBuildDirectory(reply.buildDirectory); builder.setPid(getPid(id)); } diff --git a/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/rpc/CliInbandServiceTest.java b/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/rpc/CliInbandServiceTest.java index dcf0a0186..2677b979b 100644 --- a/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/rpc/CliInbandServiceTest.java +++ b/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/rpc/CliInbandServiceTest.java @@ -42,7 +42,7 @@ public class CliInbandServiceTest implements FutureProducer { final CliInbandService service = new CliInbandService(api); final CliInbandReply reply = new CliInbandReply(); - reply.reply = replyString.getBytes(); + reply.reply = replyString; when(api.cliInband(any())).thenReturn(future(reply)); final CliInbandInput request = new CliInbandInputBuilder().setCmd("cmd").build(); diff --git a/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/state/VppStateTest.java b/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/state/VppStateTest.java index 7e03d8c31..ba69f1785 100644 --- a/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/state/VppStateTest.java +++ b/vpp-management/impl/src/test/java/io/fd/hc2vpp/management/state/VppStateTest.java @@ -98,10 +98,10 @@ public class VppStateTest implements FutureProducer { private void whenShowVersionThenReturn(final Version version) { final ShowVersionReply reply = new ShowVersionReply(); - reply.buildDate = version.getBuildDate().getBytes(); - reply.program = version.getName().getBytes(); - reply.version = version.getBranch().getBytes(); - reply.buildDirectory = version.getBuildDirectory().getBytes(); + reply.buildDate = version.getBuildDate(); + reply.program = version.getName(); + reply.version = version.getBranch(); + reply.buildDirectory = version.getBuildDirectory(); when(api.showVersion(ArgumentMatchers.any(ShowVersion.class))).thenReturn(future(reply)); // Version Customizer uses ControlPing to obtain PID when(api.send(ArgumentMatchers.any(ControlPing.class))).thenReturn(future(new ControlPingReply())); -- cgit 1.2.3-korg