From a7147d16c31d9028c6b5dc557264433de0f11c91 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 23 Sep 2016 16:39:09 +0200 Subject: 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 --- .../translate/v3po/vppstate/VersionCustomizer.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java index eedf7642f..6c2b1833b 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java @@ -19,8 +19,9 @@ package io.fd.honeycomb.translate.v3po.vppstate; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; +import io.fd.honeycomb.translate.v3po.util.ByteDataTranslator; import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer; -import io.fd.honeycomb.translate.v3po.util.TranslateUtils; +import io.fd.honeycomb.translate.v3po.util.JvppReplyConsumer; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder; @@ -35,8 +36,8 @@ import org.openvpp.jvpp.core.dto.ShowVersionReply; import org.openvpp.jvpp.core.future.FutureJVppCore; public final class VersionCustomizer - extends FutureJVppCustomizer - implements ReaderCustomizer { + extends FutureJVppCustomizer + implements ReaderCustomizer, ByteDataTranslator, JvppReplyConsumer { public VersionCustomizer(@Nonnull final FutureJVppCore futureJVppCore) { super(futureJVppCore); @@ -59,12 +60,12 @@ public final class VersionCustomizer try { // Execute with timeout final CompletionStage showVersionFuture = getFutureJVpp().showVersion(new ShowVersion()); - final ShowVersionReply reply = TranslateUtils.getReplyForRead(showVersionFuture.toCompletableFuture(), id); + final ShowVersionReply reply = getReplyForRead(showVersionFuture.toCompletableFuture(), id); - builder.setBranch(TranslateUtils.toString(reply.version)); - builder.setName(TranslateUtils.toString(reply.program)); - builder.setBuildDate(TranslateUtils.toString(reply.buildDate)); - builder.setBuildDirectory(TranslateUtils.toString(reply.buildDirectory)); + builder.setBranch(toString(reply.version)); + builder.setName(toString(reply.program)); + builder.setBuildDate(toString(reply.buildDate)); + builder.setBuildDirectory(toString(reply.buildDirectory)); } catch (VppBaseCallException e) { throw new ReadFailedException(id, e); } -- cgit 1.2.3-korg