Merge "Refactor, fix code formatting and add unittests"
[dcaegen2/platform.git] / mod / bpgenerator / src / main / java / org / onap / blueprintgenerator / models / blueprint / Properties.java
index 5693f86..4140ea3 100644 (file)
@@ -51,6 +51,8 @@ import org.onap.blueprintgenerator.models.dmaapbp.DmaapStreams;
 @JsonInclude(value = Include.NON_NULL)
 public class Properties {
 
+    ArrayList<DmaapStreams> streams_publishes;
+    ArrayList<DmaapStreams> streams_subscribes;
     private Appconfig application_config;
     private Auxilary docker_config;
     private Object image;
@@ -62,8 +64,6 @@ public class Properties {
     private String name;
     private GetInput topic_name;
     private GetInput feed_name;
-    ArrayList<DmaapStreams> streams_publishes;
-    ArrayList<DmaapStreams> streams_subscribes;
     private TlsInfo tls_info;
     private ExternalTlsInfo external_cert;
     private ResourceConfig resource_config;
@@ -159,8 +159,7 @@ public class Properties {
 
     public TreeMap<String, LinkedHashMap<String, Object>> createDmaapProperties(
         TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
-        TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
-        retInputs = inps;
+        TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
 
         //set the image
         GetInput image = new GetInput();
@@ -175,7 +174,7 @@ public class Properties {
         GetInput location = new GetInput();
         location.setBpInputName("location_id");
         this.setLocation_id(location);
-        LinkedHashMap<String, Object> locMap = new LinkedHashMap();
+        LinkedHashMap<String, Object> locMap = new LinkedHashMap<>();
         locMap.put("type", "string");
         locMap.put("default", "");
         retInputs.put("location_id", locMap);
@@ -223,7 +222,7 @@ public class Properties {
         this.setApplication_config(app);
 
         //set the stream publishes
-        ArrayList<DmaapStreams> pubStreams = new ArrayList();
+        ArrayList<DmaapStreams> pubStreams = new ArrayList<>();
         if (cs.getStreams().getPublishes() != null) {
             for (Publishes publishes : cs.getStreams().getPublishes()) {
                 if (isMessageRouterType(publishes.getType())) {
@@ -245,7 +244,7 @@ public class Properties {
         }
 
         //set the stream subscribes
-        ArrayList<DmaapStreams> subStreams = new ArrayList();
+        ArrayList<DmaapStreams> subStreams = new ArrayList<>();
         if (cs.getStreams().getSubscribes() != null) {
             for (Subscribes subscribes : cs.getStreams().getSubscribes()) {
                 if (isMessageRouterType(subscribes.getType())) {
@@ -266,10 +265,10 @@ public class Properties {
             }
         }
 
-        if (pubStreams.size() != 0) {
+        if (!pubStreams.isEmpty()) {
             this.setStreams_publishes(pubStreams);
         }
-        if (subStreams.size() != 0) {
+        if (!subStreams.isEmpty()) {
             this.setStreams_subscribes(subStreams);
         }