diff options
Diffstat (limited to 'controlloop/common/model-impl/trafficgenerator')
5 files changed, 52 insertions, 55 deletions
diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java index d08d9422e..7bbaf3cbf 100644 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java +++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java @@ -22,20 +22,19 @@ package org.onap.policy.vnf.trafficgenerator; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class PGRequest implements Serializable { - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("pg-streams") - public PGStreams pgStreams; + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; - public PGRequest() { - } + @SerializedName("pg-streams") + public PGStreams pgStreams; + public PGRequest() { + //required by author + } } diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java index de5a2c37d..a606eee4c 100644 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java +++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java @@ -26,17 +26,17 @@ import com.google.gson.annotations.SerializedName; public class PGStream implements Serializable { - /** - * - */ - private static final long serialVersionUID = 5567635677419358210L; - - @SerializedName("id") - public String streamId; - @SerializedName("is-enabled") - public String isEnabled; + /** + * + */ + private static final long serialVersionUID = 5567635677419358210L; - public PGStream() { - } + @SerializedName("id") + public String streamId; + @SerializedName("is-enabled") + public String isEnabled; + public PGStream() { + //required by author + } } diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java index dc0d4084f..2264c20a9 100644 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java +++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java @@ -28,15 +28,15 @@ import com.google.gson.annotations.SerializedName; public class PGStreams implements Serializable { - /** - * - */ - private static final long serialVersionUID = 5567635677419358210L; - - @SerializedName("pg-stream") - public List<PGStream> pgStream= new LinkedList<PGStream>(); + /** + * + */ + private static final long serialVersionUID = 5567635677419358210L; - public PGStreams() { - } + @SerializedName("pg-stream") + public List<PGStream> pgStream = new LinkedList<>(); + public PGStreams() { + // required by author + } } diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java index 9bfe2ffe6..3443bfcdf 100644 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java +++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java @@ -25,11 +25,8 @@ import com.google.gson.GsonBuilder; public final class Serialization { - private Serialization(){ - } + public static final Gson gsonPretty = + new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); - final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() -// .registerTypeAdapter(AAIQueryParameters.class, new notificationTypeAdapter()) - .create(); + private Serialization() {} } diff --git a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java b/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java index 4b3599d43..0ae5f134e 100644 --- a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java +++ b/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java @@ -30,24 +30,25 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TestDemo { - private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); - @Test - public void test() { - PGRequest request = new PGRequest(); - request.pgStreams = new PGStreams(); - - PGStream pgStream; - for(int i = 0; i < 5; i++){ - pgStream = new PGStream(); - pgStream.streamId = "fw_udp"+(i+1); - pgStream.isEnabled = "true"; - request.pgStreams.pgStream.add(pgStream); - } - - String body = Serialization.gsonPretty.toJson(request); - logger.debug(body); - - // fail("Not yet implemented"); - } + private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); + + @Test + public void test() { + PGRequest request = new PGRequest(); + request.pgStreams = new PGStreams(); + + PGStream pgStream; + for (int i = 0; i < 5; i++) { + pgStream = new PGStream(); + pgStream.streamId = "fw_udp" + (i + 1); + pgStream.isEnabled = "true"; + request.pgStreams.pgStream.add(pgStream); + } + + String body = Serialization.gsonPretty.toJson(request); + logger.debug(body); + + // fail("Not yet implemented"); + } } |