summaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/bpgenerator/pom.xml72
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java4
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java15
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java122
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java15
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java4
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java17
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java19
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java13
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java16
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java185
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprintTest.java244
-rw-r--r--mod/bpgenerator/version.properties4
15 files changed, 432 insertions, 314 deletions
diff --git a/mod/bpgenerator/pom.xml b/mod/bpgenerator/pom.xml
index 96ceb41..aaf9713 100644
--- a/mod/bpgenerator/pom.xml
+++ b/mod/bpgenerator/pom.xml
@@ -29,17 +29,12 @@
</parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.5.1-SNAPSHOT</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.core.codeCoveragePlugin>cobertura</sonar.core.codeCoveragePlugin>
- <sonar.java.coveragePlugin>cobertura</sonar.java.coveragePlugin>
<sonar.junit.reportsPath>${project.basedir}/target/surefire-reports</sonar.junit.reportsPath>
<sonar.surefire.reportsPath>${project.basedir}/target/surefire-reports</sonar.surefire.reportsPath>
- <sonar.cobertura.reportPaths>${project.basedir}/target/site/cobertura/coverage.xml</sonar.cobertura.reportPaths>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<shade.main>org.onap.blueprintgenerator.core.App</shade.main>
<shade.transformer>org.apache.maven.plugins.shade.resource.ManifestResourceTransformer</shade.transformer>
</properties>
@@ -70,47 +65,6 @@
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <instrumentation>
- <includes>
- <include>**/*.class</include>
- </includes>
- </instrumentation>
- <encoding>UTF-8</encoding>
- </configuration>
-
- <executions>
-
- <execution>
- <id>clean</id>
- <!-- > <phase>pre-site</phase> -->
- <phase>pre-site</phase>
- <goals>
- <goal>cobertura</goal>
- </goals>
- </execution>
-
-
- <execution>
- <id>instrument</id>
- <phase>site</phase>
- <goals>
- <goal>instrument</goal>
- <goal>cobertura</goal>
- </goals>
- <configuration>
- <encoding>UTF-8</encoding>
- </configuration>
- </execution>
-
- </executions>
-
- </plugin>
-
- <plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.0.2</version>
@@ -141,31 +95,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>8</source>
- <target>8</target>
+ <source>11</source>
+ <target>11</target>
</configuration>
</plugin>
</plugins>
-
</build>
- <reporting>
- <plugins>
- <plugin>
- <!-- use mvn cobertura:cobertura to generate cobertura reports -->
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <formats>
- <format>xml</format>
- </formats>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
-
<dependencies>
<dependency>
<groupId>junit</groupId>
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java
index 16eca51..451988f 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java
@@ -34,4 +34,8 @@ public class BlueprintHelper {
inputMap.put("default", defaultValue);
return inputMap;
}
+
+ public static String joinUnderscore(String firstValue, String secondValue){
+ return firstValue + "_" + secondValue;
+ }
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
index b39a8ec..75864be 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
@@ -52,8 +52,7 @@ public class Appconfig {
public TreeMap<String, LinkedHashMap<String, Object>> createAppconfig(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override,
boolean isDmaap) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
//set service calls
CallsObj[] call = new CallsObj[0];
@@ -83,7 +82,7 @@ public class Appconfig {
}
//set the stream publishes
- TreeMap<String, DmaapObj> streamSubscribes = new TreeMap<String, DmaapObj>();
+ TreeMap<String, DmaapObj> streamSubscribes = new TreeMap<>();
if(cs.getStreams().getSubscribes().length != 0) {
for(Subscribes s: cs.getStreams().getSubscribes()) {
@@ -110,7 +109,7 @@ public class Appconfig {
this.setStreams_subscribes(streamSubscribes);
//set the parameters into the appconfig
- TreeMap<String, Object> parameters = new TreeMap<String, Object>();
+ TreeMap<String, Object> parameters = new TreeMap<>();
for(Parameters p: cs.getParameters()) {
String pName = p.getName();
if(p.isSourced_at_deployment()) {
@@ -119,17 +118,17 @@ public class Appconfig {
parameters.put(pName, paramInput);
if(!p.getValue().equals("")) {
- LinkedHashMap<String, Object> inputs = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> inputs = new LinkedHashMap<>();
inputs.put("type", "string");
inputs.put("default", p.getValue());
retInputs.put(pName, inputs);
} else {
- LinkedHashMap<String, Object> inputs = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> inputs = new LinkedHashMap<>();
inputs.put("type", "string");
retInputs.put(pName, inputs);
}
} else {
- if(p.getType() == "string") {
+ if("string".equals(p.getType())) {
String val =(String) p.getValue();
val = '"' + val + '"';
parameters.put(pName, val);
@@ -143,7 +142,7 @@ public class Appconfig {
GetInput ov = new GetInput();
ov.setBpInputName("service_component_name_override");
parameters.put("service_component_name_override", ov);
- LinkedHashMap<String, Object> over = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> over = new LinkedHashMap<>();
over.put("type", "string");
over.put("default", override);
retInputs.put("service_component_name_override", over);
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
index c043a9e..f2ef7aa 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java
@@ -20,35 +20,27 @@
package org.onap.blueprintgenerator.models.blueprint;
-import java.io.*;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.TreeMap;
import java.util.regex.Pattern;
-
+import lombok.Getter;
+import lombok.Setter;
import org.onap.blueprintgenerator.core.Fixes;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-import org.onap.blueprintgenerator.models.componentspec.Parameters;
-import org.onap.blueprintgenerator.models.componentspec.Publishes;
-import org.onap.blueprintgenerator.models.componentspec.Subscribes;
import org.onap.blueprintgenerator.models.dmaapbp.DmaapBlueprint;
import org.onap.blueprintgenerator.models.onapbp.OnapBlueprint;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.core.JsonProcessingException;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.yaml.snakeyaml.Yaml;
-
-
@Getter @Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -100,93 +92,43 @@ public class Blueprint {
public void blueprintToYaml(String outputPath, String bluePrintName, ComponentSpec cs) {
File outputFile;
-
- if(bluePrintName.equals("")) {
- String name = cs.getSelf().getName();
- if(name.contains(".")) {
- name = name.replaceAll(Pattern.quote("."), "_");
- }
- if(name.contains(" ")) {
- name = name.replaceAll(" ", "");
- }
- String file = name + ".yaml";
-
-
- outputFile = new File(outputPath, file);
- outputFile.getParentFile().mkdirs();
- try {
- outputFile.createNewFile();
- } catch (IOException e) {
-
- throw new RuntimeException(e);
- }
- } else {
- if(bluePrintName.contains(" ") || bluePrintName.contains(".")) {
- bluePrintName = bluePrintName.replaceAll(Pattern.quote("."), "_");
- bluePrintName = bluePrintName.replaceAll(" ", "");
- }
- String file = bluePrintName + ".yaml";
- outputFile = new File(outputPath, file);
- outputFile.getParentFile().mkdirs();
- try {
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ String name = bluePrintName.equals("") ? cs.getSelf().getName() : bluePrintName;
+ if(name.contains(".")) {
+ name = name.replaceAll(Pattern.quote("."), "_");
+ }
+ if(name.contains(" ")) {
+ name = name.replaceAll(" ", "");
+ }
+ String file = name + ".yaml";
+ outputFile = new File(outputPath, file);
+ outputFile.getParentFile().mkdirs();
+ try {
+ outputFile.createNewFile();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
String version = "#blueprint_version: " + cs.getSelf().getVersion() + '\n';
String description = "#description: " + cs.getSelf().getDescription() + '\n';
- BufferedWriter writer = null;
- try {
- writer = new BufferedWriter(new FileWriter(outputFile, false));
+ try(BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, false))) {
+ writer.write(description);
+ writer.write(version);
} catch (IOException e1) {
throw new RuntimeException(e1);
}
- if(writer != null) {
- try {
- writer.write(description);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- try {
- writer.write(version);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- try {
- writer.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
//read the translated blueprint into the file
ObjectMapper blueprintMapper = new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true));
- PrintWriter out = null;
- try {
- out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true)));
+ try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true)))) {
+ blueprintMapper.writeValue(out, this);
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
- if(out != null) {
- blueprintMapper.writeValue(out, this);
- out.close();
- }
- } catch (IOException e) {
-
- throw new RuntimeException(e);
- }
-
-
- Fixes fix = new Fixes();
- try {
- fix.fixSingleQuotes(outputFile);
+ Fixes.fixSingleQuotes(outputFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java
index b17b045..139790a 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java
@@ -21,21 +21,16 @@
package org.onap.blueprintgenerator.models.blueprint;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
-import lombok.AllArgsConstructor;
-import lombok.Getter; import lombok.Setter;
-import lombok.NoArgsConstructor;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import lombok.Getter;
+import lombok.Setter;
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java
index a3404f6..435059e 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java
@@ -31,11 +31,9 @@ import lombok.Getter; import lombok.Setter;
public class Interfaces {
private Start start;
public TreeMap<String, LinkedHashMap<String, Object>> createInterface(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
//create the start object
Start start = new Start();
- retInputs = start.createOnapStart(retInputs, cs);
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = start.createOnapStart(inps, cs);
this.setStart(start);
return retInputs;
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
index d32d6f4..6edbe5c 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
@@ -47,6 +47,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;
@@ -58,8 +60,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;
@@ -155,8 +155,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();
@@ -171,7 +170,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);
@@ -219,7 +218,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 p : cs.getStreams().getPublishes()) {
if (p.getType().equals("message_router") || p.getType().equals("message router")) {
@@ -239,7 +238,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 s : cs.getStreams().getSubscribes()) {
if (s.getType().equals("message_router") || s.getType().equals("message router")) {
@@ -258,10 +257,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);
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
index 13aa0d0..6595a67 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
@@ -71,13 +71,12 @@ public class ResourceConfig {
* @return the tree map
*/
public TreeMap<String, LinkedHashMap<String, Object>> createResourceConfig(TreeMap<String, LinkedHashMap<String, Object>> inps, String name){
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
- LinkedHashMap<String, Object> mi = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> mi = new LinkedHashMap<>();
mi.put("type", "string");
mi.put("default", "128Mi");
- LinkedHashMap<String, Object> m = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> m = new LinkedHashMap<>();
m.put("type", "string");
m.put("default", "250m");
@@ -87,7 +86,7 @@ public class ResourceConfig {
}
//set the limits
- TreeMap<String, GetInput> lim = new TreeMap<String, GetInput>();
+ TreeMap<String, GetInput> lim = new TreeMap<>();
GetInput cpu = new GetInput();
cpu.setBpInputName(name + "cpu_limit");
@@ -97,13 +96,13 @@ public class ResourceConfig {
memL.setBpInputName(name + "memory_limit");
lim.put("memory", memL);
- retInputs.put(name + "cpu_limit", m);
- retInputs.put(name + "memory_limit", mi);
+ inps.put(name + "cpu_limit", m);
+ inps.put(name + "memory_limit", mi);
this.setLimits(lim);
//set the requests
- TreeMap<String, GetInput> req = new TreeMap<String, GetInput>();
+ TreeMap<String, GetInput> req = new TreeMap<>();
GetInput cpuR = new GetInput();
cpuR.setBpInputName(name + "cpu_request");
@@ -113,12 +112,12 @@ public class ResourceConfig {
memR.setBpInputName(name + "memory_request");
req.put("memory", memR);
- retInputs.put(name + "cpu_request", m);
- retInputs.put(name + "memory_request", mi);
+ inps.put(name + "cpu_request", m);
+ inps.put(name + "memory_request", mi);
this.setRequests(req);
- return retInputs;
+ return inps;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java
index d9c885d..0b03777 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java
@@ -36,14 +36,12 @@ public class Start {
private LinkedHashMap<String, Object> envs;
public TreeMap<String, LinkedHashMap<String, Object>> createOnapStart(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
- retInputs = inps;
-
+
//create the start inputs
StartInputs inputs = new StartInputs();
- inputs.createOnapStartInputs(retInputs, cs);
+ inputs.createOnapStartInputs(inps, cs);
this.setInputs(inputs);
- return retInputs;
+ return inps;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
index 1055fbd..a0cfe20 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
@@ -41,10 +41,9 @@ public class StartInputs {
private Object envs;
public TreeMap<String, LinkedHashMap<String, Object>> createOnapStartInputs(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
int count = 0;
- ArrayList<String> portList = new ArrayList();
+ ArrayList<String> portList = new ArrayList<>();
Auxilary aux = cs.getAuxilary();
if (aux.getPorts() != null) {
@@ -56,10 +55,10 @@ public class StartInputs {
, ports[0], count);
portList.add(internal);
- LinkedHashMap<String, Object> portType = new LinkedHashMap();
+ LinkedHashMap<String, Object> portType = new LinkedHashMap<>();
portType.put("type", "string");
portType.put("default", ports[1]);
- retInputs.put("external_port_" + count, portType);
+ inps.put("external_port_" + count, portType);
count++;
}
@@ -98,7 +97,7 @@ public class StartInputs {
// }
//set the envs
- LinkedHashMap<String, Object> eMap = new LinkedHashMap();
+ LinkedHashMap<String, Object> eMap = new LinkedHashMap<>();
if(cs.getAuxilary().getDatabases() != null){
//set db env variables
LinkedHashMap<String, Object> envVars = PgaasNodeBuilder.getEnvVariables(cs.getAuxilary().getDatabases());
@@ -111,9 +110,9 @@ public class StartInputs {
this.setEnvs(env);
eMap.put("default", "{}");
}
- retInputs.put("envs", eMap);
+ inps.put("envs", eMap);
- return retInputs;
+ return inps;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java
index 464fc4a..0cec284 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java
@@ -46,9 +46,7 @@ public class DmaapInfo {
public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRInfo(
TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
stringType.put("type", "string");
config = config.replaceAll("-", "_");
@@ -62,9 +60,9 @@ public class DmaapInfo {
topic.setBpInputName(config);
this.setTopic_url(topic);
- retInputs.put(config, stringType);
+ inps.put(config, stringType);
- return retInputs;
+ return inps;
}
public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRInfo(
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java
index 6af69e5..30f59e2 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java
@@ -40,10 +40,8 @@ public class DmaapObj {
public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRObj(TreeMap<String, LinkedHashMap<String, Object>> inps,
String config, char type, String n, String num, boolean isDmaap) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- LinkedHashMap<String, Object> stringType = new LinkedHashMap();
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
stringType.put("type", "string");
- retInputs = inps;
//set the dmaapinfo
DmaapInfo info = new DmaapInfo();
@@ -58,20 +56,18 @@ public class DmaapObj {
GetInput u = new GetInput();
u.setBpInputName(config + "_" + num +"_aaf_username");
this.setUser(u);
- retInputs.put(config + "_" + num +"_aaf_username", stringType);
+ inps.put(config + "_" + num +"_aaf_username", stringType);
//set password
GetInput p = new GetInput();
p.setBpInputName(config + "_" + num +"_aaf_password");
this.setPass(p);
- retInputs.put(config + "_" + num +"_aaf_password", stringType);
+ inps.put(config + "_" + num +"_aaf_password", stringType);
}
- return retInputs;
+ return inps;
}
public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num, boolean isDmaap) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
-
+
//set the dmaapinfo
DmaapInfo info = new DmaapInfo();
if(!isDmaap){
@@ -82,6 +78,6 @@ public class DmaapObj {
String infoType = "<<" + n + ">>";
this.setDmaap_info(infoType);
}
- return retInputs;
+ return inps;
}
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
index c4cc663..2774abb 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprint.java
@@ -1,4 +1,4 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
@@ -8,16 +8,16 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END=========================================================
-
+
*/
package org.onap.blueprintgenerator.models.dmaapbp;
@@ -28,92 +28,103 @@ import java.util.TreeMap;
import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
import org.onap.blueprintgenerator.models.blueprint.Blueprint;
-import org.onap.blueprintgenerator.models.blueprint.Imports;
import org.onap.blueprintgenerator.models.blueprint.Node;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
-public class DmaapBlueprint extends Blueprint{
- public Blueprint createDmaapBlueprint(ComponentSpec cs, String importPath, String override) {
- Blueprint bp = new Blueprint();
-
- //set tosca definition
- bp.setTosca_definitions_version("cloudify_dsl_1_3");
-
- //set the description
- bp.setDescription(cs.getSelf().getDescription());
-
- //create the inpus object that will be added to over the creation of the blueprint
- TreeMap<String, LinkedHashMap<String, Object>> inps = new TreeMap<String, LinkedHashMap<String, Object>>();
-
- //set the imports
- Imports imps = new Imports();
- if(importPath.equals("")) {
- bp.setImports(imps.createDmaapImports());
- }
- else {
- bp.setImports(imps.createImportsFromFile(importPath));
- }
-
- //bp.setImports(imps.getImports());
-
- //set and create the node templates
- TreeMap<String, Node> nodeTemplate = new TreeMap();
-
- //create and add the main dmaap node
- DmaapNode dmaap = new DmaapNode();
- inps = dmaap.createDmaapNode(cs, inps, override);
- nodeTemplate.put(cs.getSelf().getName(), dmaap);
-
- //create and add the topic/feed nodes
-
- //go through the streams publishes
- if(cs.getStreams().getPublishes() != null) {
- for(Publishes p: cs.getStreams().getPublishes()) {
- if(p.getType().equals("message_router") || p.getType().equals("message router")) {
- String topic = p.getConfig_key() + "_topic";
- DmaapNode topicNode = new DmaapNode();
- inps = topicNode.createTopicNode(cs, inps, topic);
- nodeTemplate.put(topic, topicNode);
- } else if(p.getType().equals("data_router") || p.getType().equals("data router")) {
- String feed = p.getConfig_key() + "_feed";
- DmaapNode feedNode = new DmaapNode();
- inps = feedNode.createFeedNode(cs, inps, feed);
- nodeTemplate.put(feed, feedNode);
- }
- }
- }
- //go through the stream subscribes
- if(cs.getStreams().getSubscribes() != null) {
- for(Subscribes s: cs.getStreams().getSubscribes()) {
- if(s.getType().equals("message_router") || s.getType().equals("message router")) {
- String topic = s.getConfig_key() + "_topic";
- DmaapNode topicNode = new DmaapNode();
- inps = topicNode.createTopicNode(cs, inps, topic);
- nodeTemplate.put(topic, topicNode);
- } else if(s.getType().equals("data_router") || s.getType().equals("data router")) {
- String feed = s.getConfig_key() + "_feed";
- DmaapNode feedNode = new DmaapNode();
- inps = feedNode.createFeedNode(cs, inps, feed);
- nodeTemplate.put(feed, feedNode);
- }
- }
- }
-
- //if present in component spec, populate policyNodes information in the blueprint
- if(cs.getPolicyInfo() != null){
- PolicyNodeBuilder.addPolicyNodesAndInputs(cs, nodeTemplate, inps);
- }
-
- //if present in component spec, populate pgaasNodes information in the blueprint
- if(cs.getAuxilary().getDatabases() != null){
- PgaasNodeBuilder.addPgaasNodesAndInputs(cs, nodeTemplate, inps);
- }
-
- bp.setNode_templates(nodeTemplate);
-
- bp.setInputs(inps);
- return bp;
- }
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.joinUnderscore;
+import static org.onap.blueprintgenerator.models.blueprint.Imports.createDmaapImports;
+import static org.onap.blueprintgenerator.models.blueprint.Imports.createImportsFromFile;
+
+public class DmaapBlueprint extends Blueprint {
+
+ private static final String TOPIC = "topic";
+ private static final String FEED = "feed";
+
+ public Blueprint createDmaapBlueprint(ComponentSpec componentSpec, String importPath, String override) {
+ Blueprint blueprint = new Blueprint();
+
+ //set tosca definition
+ blueprint.setTosca_definitions_version("cloudify_dsl_1_3");
+
+ //set the description
+ blueprint.setDescription(componentSpec.getSelf().getDescription());
+
+ //create the inpus object that will be added to over the creation of the blueprint
+ TreeMap<String, LinkedHashMap<String, Object>> inps = new TreeMap<>();
+
+ //set the imports
+ if (importPath.equals("")) {
+ blueprint.setImports(createDmaapImports());
+ } else {
+ blueprint.setImports(createImportsFromFile(importPath));
+ }
+
+ //set and create the node templates
+ TreeMap<String, Node> nodeTemplate = new TreeMap();
+
+ //create and add the main dmaap node
+ DmaapNode dmaap = new DmaapNode();
+ inps = dmaap.createDmaapNode(componentSpec, inps, override);
+ nodeTemplate.put(componentSpec.getSelf().getName(), dmaap);
+
+ //create and add the topic/feed nodes
+
+ //go through the streams publishes
+ if (componentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publisher : componentSpec.getStreams().getPublishes()) {
+ if (isMessageRouter(publisher.getType())) {
+ String topic = joinUnderscore(publisher.getConfig_key(), TOPIC);
+ DmaapNode topicNode = new DmaapNode();
+ inps = topicNode.createTopicNode(componentSpec, inps, topic);
+ nodeTemplate.put(topic, topicNode);
+ } else if (isDataRouter(publisher.getType())) {
+ String feed = joinUnderscore(publisher.getConfig_key(), FEED);
+ DmaapNode feedNode = new DmaapNode();
+ inps = feedNode.createFeedNode(componentSpec, inps, feed);
+ nodeTemplate.put(feed, feedNode);
+ }
+ }
+ }
+ //go through the stream subscribes
+ if (componentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes subscriber : componentSpec.getStreams().getSubscribes()) {
+ if (isMessageRouter(subscriber.getType())) {
+ String topic = joinUnderscore(subscriber.getConfig_key(), TOPIC);
+ DmaapNode topicNode = new DmaapNode();
+ inps = topicNode.createTopicNode(componentSpec, inps, topic);
+ nodeTemplate.put(topic, topicNode);
+ } else if (isDataRouter(subscriber.getType())) {
+ String feed = joinUnderscore(subscriber.getConfig_key(), FEED);
+ DmaapNode feedNode = new DmaapNode();
+ inps = feedNode.createFeedNode(componentSpec, inps, feed);
+ nodeTemplate.put(feed, feedNode);
+ }
+ }
+ }
+
+ //if present in component spec, populate policyNodes information in the blueprint
+ if (componentSpec.getPolicyInfo() != null) {
+ PolicyNodeBuilder.addPolicyNodesAndInputs(componentSpec, nodeTemplate, inps);
+ }
+
+ //if present in component spec, populate pgaasNodes information in the blueprint
+ if (componentSpec.getAuxilary().getDatabases() != null) {
+ PgaasNodeBuilder.addPgaasNodesAndInputs(componentSpec, nodeTemplate, inps);
+ }
+
+ blueprint.setNode_templates(nodeTemplate);
+
+ blueprint.setInputs(inps);
+ return blueprint;
+ }
+
+ private boolean isDataRouter(String type) {
+ return type.equals("data_router") || type.equals("data router");
+ }
+
+ private boolean isMessageRouter(String type) {
+ return type.equals("message_router") || type.equals("message router");
+ }
}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprintTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprintTest.java
new file mode 100644
index 0000000..820082e
--- /dev/null
+++ b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapBlueprintTest.java
@@ -0,0 +1,244 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.blueprintgenerator.models.dmaapbp;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.blueprintgenerator.models.blueprint.Blueprint;
+import org.onap.blueprintgenerator.models.componentspec.Artifacts;
+import org.onap.blueprintgenerator.models.componentspec.Auxilary;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+import org.onap.blueprintgenerator.models.componentspec.Parameters;
+import org.onap.blueprintgenerator.models.componentspec.Publishes;
+import org.onap.blueprintgenerator.models.componentspec.Self;
+import org.onap.blueprintgenerator.models.componentspec.Streams;
+import org.onap.blueprintgenerator.models.componentspec.Subscribes;
+
+public class DmaapBlueprintTest {
+
+ private static final String MOCKED_NAME = "sample.name";
+ private static final String MESSAGE_ROUTER_TYPE_1 = "message_router";
+ private static final String MESSAGE_ROUTER_TYPE_2 = "message router";
+ private static final String DATA_ROUTER_TYPE_1 = "data_router";
+ private static final String DATA_ROUTER_TYPE_2 = "data router";
+ private static final String CONFIG_KEY_1 = "Configkey1";
+ private static final String CONFIG_KEY_2 = "Configkey2";
+
+ private static final String TOPIC_NODE_1 = CONFIG_KEY_1 + "_topic";
+ private static final String TOPIC_NODE_2 = CONFIG_KEY_2 + "_topic";
+ private static final String FEED_NODE_1 = CONFIG_KEY_1 + "_feed";
+ private static final String FEED_NODE_2 = CONFIG_KEY_2 + "_feed";
+
+ private static final String SAMPLE_FORMAT = "Format";
+ private static final String SAMPLE_VERSION = "1.0.0";
+ private static final String SAMPLE_ROUTE = "SampleRoute";
+ private static final String SAMPLE_DESCRIPTION = "sample description";
+ private static final String SAMPLE_PORTS = "8080:8080";
+ private static final String SAMPLE_ARTIFACT_TYPE = "test";
+ private static final String SAMPLE_ARTIFACT_URI = "test_uri";
+
+ @Test
+ public void dmaapBlueprintShouldHaveNodeTemplateWithDmaapNode() {
+
+ //given
+ ComponentSpec componentSpec = getMockedComponentSpec();
+ DmaapBlueprint dmaapBlueprint = new DmaapBlueprint();
+
+ //when
+ Blueprint resultBlueprint = dmaapBlueprint.createDmaapBlueprint(componentSpec, "", "");
+
+ //then
+ assertTrue(resultBlueprint.getNode_templates().get(MOCKED_NAME) instanceof DmaapNode);
+ }
+
+ @Test
+ public void nodeTemplateHasTopicNodeWhenAddMessageRouterAsPublishes() {
+ //given
+ ComponentSpec componentSpec = getMockedComponentSpec();
+ Streams streams = new Streams();
+ streams.setPublishes(getMessageRouterPublishes());
+ streams.setSubscribes(new Subscribes[0]);
+
+ when(componentSpec.getStreams()).thenReturn(streams);
+ DmaapBlueprint dmaapBlueprint = new DmaapBlueprint();
+
+ //when
+ Blueprint resultBlueprint = dmaapBlueprint.createDmaapBlueprint(componentSpec, "", "");
+
+ //then
+ assertNotNull(resultBlueprint.getNode_templates().get(TOPIC_NODE_1));
+ assertNotNull(resultBlueprint.getNode_templates().get(TOPIC_NODE_2));
+
+ }
+
+ @Test
+ public void nodeTemplateHasTopicNodeWhenAddMessageRouterAsSubscribes() {
+ //given
+ ComponentSpec componentSpec = getMockedComponentSpec();
+ Streams streams = new Streams();
+ streams.setPublishes(new Publishes[0]);
+ streams.setSubscribes(getMessageRouterSubscribes());
+
+ when(componentSpec.getStreams()).thenReturn(streams);
+ DmaapBlueprint dmaapBlueprint = new DmaapBlueprint();
+
+ //when
+ Blueprint resultBlueprint = dmaapBlueprint.createDmaapBlueprint(componentSpec, "", "");
+
+ //then
+ assertNotNull(resultBlueprint.getNode_templates().get(TOPIC_NODE_1));
+ assertNotNull(resultBlueprint.getNode_templates().get(TOPIC_NODE_2));
+
+ }
+
+ @Test
+ public void nodeTemplateHasFeedNodeWhenAddDataRouterAsPublishes() {
+ //given
+ ComponentSpec componentSpec = getMockedComponentSpec();
+ Streams streams = new Streams();
+ streams.setPublishes(getDataRouterPublishes());
+ streams.setSubscribes(new Subscribes[0]);
+
+ when(componentSpec.getStreams()).thenReturn(streams);
+ DmaapBlueprint dmaapBlueprint = new DmaapBlueprint();
+
+ //when
+ Blueprint resultBlueprint = dmaapBlueprint.createDmaapBlueprint(componentSpec, "", "");
+
+ //then
+ assertNotNull(resultBlueprint.getNode_templates().get(FEED_NODE_1));
+ assertNotNull(resultBlueprint.getNode_templates().get(FEED_NODE_2));
+
+ }
+
+ @Test
+ public void nodeTemplateHasFeedNodeWhenAddDataRouterAsSubscribes() {
+ //given
+ ComponentSpec componentSpec = getMockedComponentSpec();
+ Streams streams = new Streams();
+ streams.setPublishes(new Publishes[0]);
+ streams.setSubscribes(getDataRouterSubscribes());
+
+ when(componentSpec.getStreams()).thenReturn(streams);
+ DmaapBlueprint dmaapBlueprint = new DmaapBlueprint();
+
+ //when
+ Blueprint resultBlueprint = dmaapBlueprint.createDmaapBlueprint(componentSpec, "", "");
+
+ //then
+ assertNotNull(resultBlueprint.getNode_templates().get(FEED_NODE_1));
+ assertNotNull(resultBlueprint.getNode_templates().get(FEED_NODE_2));
+
+ }
+
+ private Publishes[] getMessageRouterPublishes() {
+ List<Publishes> publishesList = new ArrayList<>();
+
+ publishesList.add(createSamplePublishes(MESSAGE_ROUTER_TYPE_1, CONFIG_KEY_1));
+ publishesList.add(createSamplePublishes(MESSAGE_ROUTER_TYPE_2, CONFIG_KEY_2));
+ return publishesList.toArray(new Publishes[0]);
+ }
+
+ private Subscribes[] getMessageRouterSubscribes() {
+ List<Subscribes> subscribesList = new ArrayList<>();
+
+ subscribesList.add(createSampleSubscribes(MESSAGE_ROUTER_TYPE_1, CONFIG_KEY_1));
+ subscribesList.add(createSampleSubscribes(MESSAGE_ROUTER_TYPE_2, CONFIG_KEY_2));
+ return subscribesList.toArray(new Subscribes[0]);
+ }
+
+ private Publishes[] getDataRouterPublishes() {
+ List<Publishes> publishesList = new ArrayList<>();
+
+ publishesList.add(createSamplePublishes(DATA_ROUTER_TYPE_1, CONFIG_KEY_1));
+ publishesList.add(createSamplePublishes(DATA_ROUTER_TYPE_2, CONFIG_KEY_2));
+ return publishesList.toArray(new Publishes[0]);
+ }
+
+ private Subscribes[] getDataRouterSubscribes() {
+ List<Subscribes> subscribesList = new ArrayList<>();
+
+ subscribesList.add(createSampleSubscribes(DATA_ROUTER_TYPE_1, CONFIG_KEY_1));
+ subscribesList.add(createSampleSubscribes(DATA_ROUTER_TYPE_2, CONFIG_KEY_2));
+ return subscribesList.toArray(new Subscribes[0]);
+ }
+
+ private Publishes createSamplePublishes(String type, String key) {
+ Publishes publishes = new Publishes();
+
+ publishes.setType(type);
+ publishes.setConfig_key(key);
+ publishes.setFormat(SAMPLE_FORMAT);
+ publishes.setVersion(SAMPLE_VERSION);
+ publishes.setRoute(SAMPLE_ROUTE);
+
+ return publishes;
+ }
+
+ private Subscribes createSampleSubscribes(String type, String key) {
+ Subscribes subscribes = new Subscribes();
+
+ subscribes.setType(type);
+ subscribes.setConfig_key(key);
+ subscribes.setFormat(SAMPLE_FORMAT);
+ subscribes.setVersion(SAMPLE_FORMAT);
+ subscribes.setRoute(SAMPLE_ROUTE);
+
+ return subscribes;
+ }
+
+ private ComponentSpec getMockedComponentSpec() {
+ Self self = mock(Self.class);
+ when(self.getDescription()).thenReturn(SAMPLE_DESCRIPTION);
+ when(self.getName()).thenReturn(MOCKED_NAME);
+
+ Auxilary auxilary = mock(Auxilary.class);
+ ArrayList<Object> ports = new ArrayList<>();
+ ports.add(SAMPLE_PORTS);
+ when(auxilary.getPorts()).thenReturn(ports);
+
+ Streams streams = mock(Streams.class);
+ when(streams.getPublishes()).thenReturn(new Publishes[0]);
+ when(streams.getSubscribes()).thenReturn(new Subscribes[0]);
+
+ Artifacts artifact = new Artifacts();
+ artifact.setType(SAMPLE_ARTIFACT_TYPE);
+ artifact.setUri(SAMPLE_ARTIFACT_URI);
+
+ Artifacts[] arrayArtifacts = new Artifacts[10];
+ arrayArtifacts[0] = artifact;
+
+ ComponentSpec componentSpec = mock(ComponentSpec.class);
+ when(componentSpec.getSelf()).thenReturn(self);
+ when(componentSpec.getAuxilary()).thenReturn(auxilary);
+ when(componentSpec.getStreams()).thenReturn(streams);
+ when(componentSpec.getArtifacts()).thenReturn(arrayArtifacts);
+ when(componentSpec.getParameters()).thenReturn(new Parameters[0]);
+ return componentSpec;
+ }
+}
diff --git a/mod/bpgenerator/version.properties b/mod/bpgenerator/version.properties
index 9e0d73d..303a703 100644
--- a/mod/bpgenerator/version.properties
+++ b/mod/bpgenerator/version.properties
@@ -1,6 +1,6 @@
major=1
-minor=4
-patch=0
+minor=5
+patch=1
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT