summaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/bpgenerator/TestCases/imports/imports.yaml2
-rw-r--r--mod/bpgenerator/TestCases/imports/importsWithBlanks.yaml3
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/TestComponentSpec.java148
-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.java46
-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/componentspec/Artifacts.java9
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java15
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/CallsObj.java5
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ConstraintsObj.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Container.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/EntrySchemaObj.java6
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/HealthCheck.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Host.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Parameters.java11
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Policy.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/PolicySchemaObj.java6
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ProvidesObj.java6
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Publishes.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ReconfigsObj.java9
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/RequestResponseObj.java5
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Self.java10
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Services.java6
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Streams.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Subscribes.java8
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Volumes.java10
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/core/BlueprintGeneratorTest.java244
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java52
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java2
-rw-r--r--mod/runtimeapi/pom.xml2
-rw-r--r--mod/runtimeapi/runtime-core/pom.xml6
-rw-r--r--mod/runtimeapi/runtime-web/pom.xml6
39 files changed, 400 insertions, 495 deletions
diff --git a/mod/bpgenerator/TestCases/imports/imports.yaml b/mod/bpgenerator/TestCases/imports/imports.yaml
new file mode 100644
index 0000000..4b52b8a
--- /dev/null
+++ b/mod/bpgenerator/TestCases/imports/imports.yaml
@@ -0,0 +1,2 @@
+imports: ['https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml', 'plugin:k8splugin?version=3.4.1',
+ 'plugin:pgaas?version=1.3.0', 'plugin:clamppolicyplugin?version=1.1.0', 'plugin:dmaap?version=1.5.0']
diff --git a/mod/bpgenerator/TestCases/imports/importsWithBlanks.yaml b/mod/bpgenerator/TestCases/imports/importsWithBlanks.yaml
new file mode 100644
index 0000000..242c2a9
--- /dev/null
+++ b/mod/bpgenerator/TestCases/imports/importsWithBlanks.yaml
@@ -0,0 +1,3 @@
+imports: ['https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml', 'plugin:k8splugin?version=3.4.1',
+ '', ' ', ' ', 'plugin:pgaas?version=1.3.0', 'plugin:clamppolicyplugin?version=1.1.0',
+ 'plugin:dmaap?version=1.5.0']
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/TestComponentSpec.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/TestComponentSpec.java
index 5d4131b..f9fa2cb 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/TestComponentSpec.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/TestComponentSpec.java
@@ -18,18 +18,32 @@
*/
-
package org.onap.blueprintgenerator.core;
-
-
-
+import java.util.ArrayList;
+import java.util.TreeMap;
import lombok.Getter;
import lombok.Setter;
+import org.onap.blueprintgenerator.models.componentspec.Artifacts;
+import org.onap.blueprintgenerator.models.componentspec.Auxilary;
+import org.onap.blueprintgenerator.models.componentspec.CallsObj;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+import org.onap.blueprintgenerator.models.componentspec.Container;
+import org.onap.blueprintgenerator.models.componentspec.HealthCheck;
+import org.onap.blueprintgenerator.models.componentspec.Host;
+import org.onap.blueprintgenerator.models.componentspec.Parameters;
+import org.onap.blueprintgenerator.models.componentspec.Policy;
+import org.onap.blueprintgenerator.models.componentspec.ProvidesObj;
+import org.onap.blueprintgenerator.models.componentspec.Publishes;
+import org.onap.blueprintgenerator.models.componentspec.Self;
+import org.onap.blueprintgenerator.models.componentspec.Services;
+import org.onap.blueprintgenerator.models.componentspec.Streams;
+import org.onap.blueprintgenerator.models.componentspec.Subscribes;
+import org.onap.blueprintgenerator.models.componentspec.Volumes;
@Getter @Setter
public class TestComponentSpec {
- private String cs = "{\r\n" +
+ private String componentSpecAsString = "{\r\n" +
" \"self\": {\r\n" +
" \"component_type\": \"docker\",\r\n" +
" \"description\": \"Test component spec\",\r\n" +
@@ -129,4 +143,128 @@ public class TestComponentSpec {
" }] \r\n" +
"\r\n" +
"}";
+ private ComponentSpec componentSpec;
+
+ public TestComponentSpec() {
+ this.componentSpec = createComponentSpec();
+ }
+
+ private ComponentSpec createComponentSpec(){
+ //Manually fill a component spec object with the values from the file itself
+ ComponentSpec manualSpec = new ComponentSpec();
+
+ Self self = new Self();
+ self.setComponent_type("docker");
+ self.setDescription("Test component spec");
+ self.setName("test.component.spec");
+ self.setVersion("1.0.1");
+ manualSpec.setSelf(self);
+
+ Services services = new Services();
+ CallsObj[] calls = new CallsObj[0];
+ ProvidesObj[] provides = new ProvidesObj[0];
+ services.setCalls(calls);
+ services.setProvides(provides);
+ manualSpec.setServices(null);
+
+ Streams streams = new Streams();
+ Publishes[] publishes = new Publishes[2];
+ Publishes pub1 = new Publishes();
+ pub1.setConfig_key("TEST-PUB-DR");
+ pub1.setFormat("dataformat_Hello_World_PM");
+ pub1.setType("data_router");
+ pub1.setVersion("1.0.0");
+
+ Publishes pub2 = new Publishes();
+ pub2.setConfig_key("TEST-PUB-MR");
+ pub2.setFormat("dataformat_Hello_World_PM");
+ pub2.setType("message_router");
+ pub2.setVersion("1.0.0");
+ publishes[0] = pub1;
+ publishes[1] = pub2;
+ streams.setPublishes(publishes);
+
+ Subscribes[] subscribes = new Subscribes[2];
+ Subscribes sub1 = new Subscribes();
+ sub1.setConfig_key("TEST-SUB-MR");
+ sub1.setFormat("dataformat_Hello_World_PM");
+ sub1.setRoute("/TEST_HELLO_WORLD_SUB_MR");
+ sub1.setType("message_router");
+ sub1.setVersion("1.0.0");
+
+ Subscribes sub2 = new Subscribes();
+ sub2.setConfig_key("TEST-SUB-DR");
+ sub2.setFormat("dataformat_Hello_World_PM");
+ sub2.setRoute("/TEST-HELLO-WORLD-SUB-DR");
+ sub2.setType("data_router");
+ sub2.setVersion("1.0.0");
+ subscribes[0] = sub1;
+ subscribes[1] = sub2;
+ streams.setSubscribes(subscribes);
+
+ manualSpec.setStreams(streams);
+
+ Parameters[] parameters = new Parameters[1];
+ Parameters par1 = new Parameters();
+ par1.setName("testParam1");
+ par1.setValue("test-param-1");
+ par1.setDescription("test parameter 1");
+ par1.setSourced_at_deployment(true);
+ par1.setDesigner_editable(true);
+ par1.setPolicy_editable(true);
+ par1.setPolicy_group("Test_Parameters");
+ par1.setRequired(true);
+ par1.setType("string");
+ parameters[0] = par1;
+
+ manualSpec.setParameters(parameters);
+
+ Auxilary auxilary = new Auxilary();
+ HealthCheck healthcheck = new HealthCheck();
+ healthcheck.setInterval("300s");
+ healthcheck.setTimeout("120s");
+ healthcheck.setScript("/etc/init.d/nagios status");
+ healthcheck.setType("docker");
+ auxilary.setHealthcheck(healthcheck);
+
+ Volumes[] volumes = new Volumes[1];
+ Volumes vol1 = new Volumes();
+ Container con1 = new Container();
+ con1.setBind("/opt/app/manager/config/hostname");
+ Host host1 = new Host();
+ host1.setPath("/etc/hostname");
+ host1.setMode("ro");
+ vol1.setContainer(con1);
+ vol1.setHost(host1);
+
+ volumes[0] = vol1;
+
+ auxilary.setVolumes(volumes);
+
+ ArrayList<Object> ports = new ArrayList();
+ ports.add("80:80");
+
+ TreeMap<String, String> dataBases = new TreeMap<>();
+ dataBases.put("TestDB1", "PGaaS");
+ dataBases.put("TestDB2", "PGaaS");
+ auxilary.setDatabases(dataBases);
+
+ Policy pol = new Policy();
+ pol.setTrigger_type("docker");
+ pol.setScript_path("/opt/app/manager/bin/reconfigure.sh");
+ auxilary.setPolicy(pol);
+
+ auxilary.setPorts(ports);
+
+ manualSpec.setAuxilary(auxilary);
+
+ Artifacts[] artifacts = new Artifacts[1];
+ Artifacts art = new Artifacts();
+ art.setType("docker image");
+ art.setUri("test.tester");
+
+ artifacts[0] = art;
+ manualSpec.setArtifacts(artifacts);
+ return manualSpec;
+ }
}
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..7b55e17 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
@@ -20,24 +20,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;
@Getter @Setter
@JsonInclude(value=Include.NON_NULL)
@@ -46,32 +38,30 @@ public class Imports {
private ArrayList<String> imports;
public static ArrayList<String> createOnapImports() {
- ArrayList<String> imps = new ArrayList<String>();
- imps.add("http://www.getcloudify.org/spec/cloudify/3.4/types.yaml");
- imps.add("https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml");
- imps.add("https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml");
+ ArrayList<String> imps = new ArrayList<>();
+ imps.add("https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml");
+ imps.add("plugin:k8splugin?version=3.4.2");
+ imps.add("plugin:dcaepolicyplugin?version=2.4.0");
return imps;
}
+
public static ArrayList<String> createDmaapImports(){
- ArrayList<String> imps = new ArrayList<String>();
- imps.add("http://www.getcloudify.org/spec/cloudify/3.4/types.yaml");
- imps.add("https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R5/k8splugin/1.6.0/k8splugin_types.yaml");
- imps.add("https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml");
+ ArrayList<String> imps = new ArrayList<>();
+ imps.add("https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml");
+ imps.add("plugin:k8splugin?version=3.4.2");
+ imps.add("plugin:dmaap?version=1.5.0");
return imps;
}
+
public static ArrayList<String> createImportsFromFile(String path) {
- Imports imports = new Imports();
ObjectMapper importMapper = new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true));
File importPath = new File(path);
try {
- imports = importMapper.readValue(importPath, Imports.class);
+ Imports imports = importMapper.readValue(importPath, Imports.class);
+ imports.getImports().removeIf(String::isBlank);
+ return imports.getImports();
} catch (IOException e) {
throw new RuntimeException(e);
}
- ArrayList<String> imps = new ArrayList<String>();
- for(String s: imports.getImports()) {
- imps.add(s);
- }
- return imps;
}
}
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 5693f86..4140ea3 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
@@ -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);
}
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/componentspec/Artifacts.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Artifacts.java
index f7f5a03..198dc19 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Artifacts.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Artifacts.java
@@ -21,13 +21,11 @@
package org.onap.blueprintgenerator.models.componentspec;
-
import com.fasterxml.jackson.annotation.JsonInclude;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -53,6 +51,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
+@EqualsAndHashCode
//Called in Component Spec Object
public class Artifacts {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
index a36deb5..58e1e0c 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Auxilary.java
@@ -22,19 +22,15 @@
package org.onap.blueprintgenerator.models.componentspec;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.TreeMap;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import java.util.ArrayList;
+import java.util.TreeMap;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -64,6 +60,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
//Called in component Spec Object
public class Auxilary {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/CallsObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/CallsObj.java
index 0b7dcee..d130632 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/CallsObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/CallsObj.java
@@ -24,11 +24,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
-import lombok.NoArgsConstructor;
-
// TODO: Auto-generated Javadoc
/**
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ConstraintsObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ConstraintsObj.java
index 3615605..785df35 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ConstraintsObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ConstraintsObj.java
@@ -20,18 +20,10 @@
package org.onap.blueprintgenerator.models.componentspec;
-import java.util.HashMap;
-
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
-import lombok.NoArgsConstructor;
-
// TODO: Auto-generated Javadoc
/**
* The Class ConstraintsObj.
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Container.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Container.java
index d94e2bb..cbe02dc 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Container.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Container.java
@@ -22,11 +22,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -50,6 +49,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
public class Container {
/** The bind. */
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/EntrySchemaObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/EntrySchemaObj.java
index 45f9091..ef33aaf 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/EntrySchemaObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/EntrySchemaObj.java
@@ -24,11 +24,9 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/**
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/HealthCheck.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/HealthCheck.java
index acc9379..76e1036 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/HealthCheck.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/HealthCheck.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -53,6 +52,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
//Called in Auxillary Object
public class HealthCheck {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Host.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Host.java
index 91734ad..f178c94 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Host.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Host.java
@@ -22,11 +22,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -46,6 +45,7 @@ import lombok.NoArgsConstructor;
* @param mode the mode
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
public class Host{
/** The path. */
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Parameters.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Parameters.java
index 515ecc7..eb95202 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Parameters.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Parameters.java
@@ -20,17 +20,13 @@
package org.onap.blueprintgenerator.models.componentspec;
-import java.util.ArrayList;
-
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/**
@@ -68,6 +64,7 @@ import lombok.NoArgsConstructor;
* @param constraints the constraints
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
//Called in component Spec Object
public class Parameters {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Policy.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Policy.java
index 3cc14fe..d295ca4 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Policy.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Policy.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -51,6 +50,7 @@ import lombok.NoArgsConstructor;
* @param script_path the script path
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
//called in auxilary
public class Policy {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/PolicySchemaObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/PolicySchemaObj.java
index 7af16d6..aa38271 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/PolicySchemaObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/PolicySchemaObj.java
@@ -24,11 +24,9 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/**
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ProvidesObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ProvidesObj.java
index ad9c87d..9ad24c3 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ProvidesObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ProvidesObj.java
@@ -21,11 +21,9 @@
package org.onap.blueprintgenerator.models.componentspec;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Publishes.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Publishes.java
index 3ee47b9..4f46313 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Publishes.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Publishes.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -54,6 +53,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
//Called in Streams Object
public class Publishes {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ReconfigsObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ReconfigsObj.java
index 6c389d6..6d78805 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ReconfigsObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/ReconfigsObj.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -50,7 +49,7 @@ import lombok.NoArgsConstructor;
* @param policy the policy
*/
@JsonInclude(value=Include.NON_NULL)
-
+@EqualsAndHashCode
public class ReconfigsObj {
/** The dti. */
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/RequestResponseObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/RequestResponseObj.java
index 2aaf60b..7ca1830 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/RequestResponseObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/RequestResponseObj.java
@@ -25,11 +25,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
-import lombok.NoArgsConstructor;
-
// TODO: Auto-generated Javadoc
/**
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Self.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Self.java
index a566661..8b5f35e 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Self.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Self.java
@@ -20,16 +20,13 @@
package org.onap.blueprintgenerator.models.componentspec;
-import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -55,6 +52,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
//called in Component Spec object
public class Self {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Services.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Services.java
index afe0904..772d859 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Services.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Services.java
@@ -24,11 +24,9 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Streams.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Streams.java
index 1b7dcd3..500f32d 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Streams.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Streams.java
@@ -24,11 +24,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -52,6 +51,7 @@ import lombok.NoArgsConstructor;
*/
@JsonInclude(value=Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
//Called in Component Spec Object
public class Streams {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Subscribes.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Subscribes.java
index 14485a0..ec4aa41 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Subscribes.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Subscribes.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -57,6 +56,7 @@ import lombok.NoArgsConstructor;
@JsonInclude(value=Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
+@EqualsAndHashCode
//Called in Streams Object
public class Subscribes {
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Volumes.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Volumes.java
index 1034242..777bdeb 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Volumes.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/componentspec/Volumes.java
@@ -23,11 +23,10 @@ package org.onap.blueprintgenerator.models.componentspec;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter; import lombok.Setter;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
import lombok.NoArgsConstructor;
+import lombok.Setter;
// TODO: Auto-generated Javadoc
/* (non-Javadoc)
@@ -50,6 +49,7 @@ import lombok.NoArgsConstructor;
* @param host the host
*/
@JsonInclude(value=Include.NON_NULL)
+@EqualsAndHashCode
//Called in Auxillary Object
public class Volumes {
@@ -58,4 +58,4 @@ public class Volumes {
/** The host. */
private Host host;
-} \ No newline at end of file
+}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/core/BlueprintGeneratorTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/core/BlueprintGeneratorTest.java
index 1c7e592..b978701 100644
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/core/BlueprintGeneratorTest.java
+++ b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/core/BlueprintGeneratorTest.java
@@ -21,15 +21,14 @@
package org.onap.blueprintgenerator.core;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -39,22 +38,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.onap.blueprintgenerator.models.blueprint.Blueprint;
import org.onap.blueprintgenerator.models.blueprint.GetInput;
-import org.onap.blueprintgenerator.models.componentspec.Artifacts;
-import org.onap.blueprintgenerator.models.componentspec.Auxilary;
-import org.onap.blueprintgenerator.models.componentspec.CallsObj;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-import org.onap.blueprintgenerator.models.componentspec.Container;
-import org.onap.blueprintgenerator.models.componentspec.HealthCheck;
-import org.onap.blueprintgenerator.models.componentspec.Host;
-import org.onap.blueprintgenerator.models.componentspec.Parameters;
-import org.onap.blueprintgenerator.models.componentspec.Policy;
-import org.onap.blueprintgenerator.models.componentspec.ProvidesObj;
-import org.onap.blueprintgenerator.models.componentspec.Publishes;
-import org.onap.blueprintgenerator.models.componentspec.Self;
-import org.onap.blueprintgenerator.models.componentspec.Services;
-import org.onap.blueprintgenerator.models.componentspec.Streams;
-import org.onap.blueprintgenerator.models.componentspec.Subscribes;
-import org.onap.blueprintgenerator.models.componentspec.Volumes;
import org.onap.blueprintgenerator.models.dmaapbp.DmaapNode;
import org.onap.blueprintgenerator.models.onapbp.OnapNode;
import org.onap.blueprintgenerator.models.policymodel.PolicyModel;
@@ -70,146 +54,20 @@ public class BlueprintGeneratorTest {
/**
* Component spec test.
*
- * @throws JsonParseException the json parse exception
- * @throws JsonMappingException the json mapping exception
- * @throws IOException Signals that an I/O exception has occurred.
*/
-
@Test
- public void componentSpecTest() throws JsonParseException, JsonMappingException, IOException {
-
+ public void componentSpecTest() {
ComponentSpec spec = new ComponentSpec();
TestComponentSpec test = new TestComponentSpec();
- spec.createComponentSpecFromString(test.getCs());
-
- //Manually fill a component spec object with the values from the file itself
- ComponentSpec manualSpec = new ComponentSpec();
-
- Self self = new Self();
- self.setComponent_type("docker");
- self.setDescription("Test component spec");
- self.setName("test.component.spec");
- self.setVersion("1.0.1");
- manualSpec.setSelf(self);
-
- //assertEquals(manualSpec.getSelf(), spec.getSelf());
-
- Services services = new Services();
- CallsObj[] calls = new CallsObj[0];
- ProvidesObj[] provides = new ProvidesObj[0];
- services.setCalls(calls);
- services.setProvides(provides);
- manualSpec.setServices(null);
-
- //assertEquals(manualSpec.getServices(), spec.getServices());
-
- Streams streams = new Streams();
- Publishes[] publishes = new Publishes[2];
- Publishes pub1 = new Publishes();
- pub1.setConfig_key("TEST-PUB-DR");
- pub1.setFormat("dataformat_Hello_World_PM");
- pub1.setType("data_router");
- pub1.setVersion("1.0.0");
-
- Publishes pub2 = new Publishes();
- pub2.setConfig_key("TEST-PUB-MR");
- pub2.setFormat("dataformat_Hello_World_PM");
- pub2.setType("message_router");
- pub2.setVersion("1.0.0");
- publishes[0] = pub1;
- publishes[1] = pub2;
- streams.setPublishes(publishes);
-
- Subscribes[] subscribes = new Subscribes[2];
- Subscribes sub1 = new Subscribes();
- sub1.setConfig_key("TEST-SUB-MR");
- sub1.setFormat("dataformat_Hello_World_PM");
- sub1.setRoute("/TEST_HELLO_WORLD_SUB_MR");
- sub1.setType("message_router");
- sub1.setVersion("1.0.0");
-
- Subscribes sub2 = new Subscribes();
- sub2.setConfig_key("TEST-SUB-DR");
- sub2.setFormat("dataformat_Hello_World_PM");
- sub2.setRoute("/TEST-HELLO-WORLD-SUB-DR");
- sub2.setType("data_router");
- sub2.setVersion("1.0.0");
- subscribes[0] = sub1;
- subscribes[1] = sub2;
- streams.setSubscribes(subscribes);
-
- manualSpec.setStreams(streams);
-
- //assertEquals(manualSpec.getStreams(), spec.getStreams());
-
- Parameters[] parameters = new Parameters[1];
- Parameters par1 = new Parameters();
- par1.setName("testParam1");
- par1.setValue("test-param-1");
- par1.setDescription("test parameter 1");
- par1.setSourced_at_deployment(true);
- par1.setDesigner_editable(true);
- par1.setPolicy_editable(true);
- par1.setPolicy_group("Test_Parameters");
- par1.setRequired(true);
- par1.setType("string");
- parameters[0] = par1;
-
- manualSpec.setParameters(parameters);
-
- //assertEquals(manualSpec.getParameters(), spec.getParameters());
-
- Auxilary auxilary = new Auxilary();
- HealthCheck healthcheck = new HealthCheck();
- healthcheck.setInterval("300s");
- healthcheck.setTimeout("120s");
- healthcheck.setScript("/etc/init.d/nagios status");
- healthcheck.setType("docker");
- auxilary.setHealthcheck(healthcheck);
-
- Volumes[] volumes = new Volumes[1];
- Volumes vol1 = new Volumes();
- Container con1 = new Container();
- con1.setBind("/opt/app/manager/config/hostname");
- Host host1 = new Host();
- host1.setPath("/etc/hostname");
- host1.setMode("ro");
- vol1.setContainer(con1);
- vol1.setHost(host1);
-
- volumes[0] = vol1;
-
- auxilary.setVolumes(volumes);
-
- ArrayList<Object> ports = new ArrayList();
- ports.add("80:90");
- ports.add("99:99");
-
- TreeMap<String, String> dataBases = new TreeMap<String, String>();
- dataBases.put("TestDB1", "PGaaS");
- dataBases.put("TestDB2", "PGaaS");
- auxilary.setDatabases(dataBases);
-
- Policy pol = new Policy();
- pol.setTrigger_type("docker");
- pol.setScript_path("/opt/app/manager/bin/reconfigure.sh");
- auxilary.setPolicy(pol);
-
- auxilary.setPorts(ports);
-
- manualSpec.setAuxilary(auxilary);
-
- //assertEquals(manualSpec.getAuxilary(), spec.getAuxilary());
-
- Artifacts[] artifacts = new Artifacts[1];
- Artifacts art = new Artifacts();
- art.setType("docker image");
- art.setUri("test.tester");
-
- artifacts[0] = art;
- manualSpec.setArtifacts(artifacts);
-
- //assertEquals(manualSpec.getArtifacts(), spec.getArtifacts());
+ spec.createComponentSpecFromString(test.getComponentSpecAsString());
+ ComponentSpec expectedSpec = test.getComponentSpec();
+
+ assertEquals(expectedSpec.getSelf(), spec.getSelf());
+ assertEquals(expectedSpec.getServices(), spec.getServices());
+ assertEquals(expectedSpec.getStreams(), spec.getStreams());
+ assertArrayEquals(expectedSpec.getParameters(), spec.getParameters());
+ assertEquals(expectedSpec.getAuxilary(), spec.getAuxilary());
+ assertArrayEquals(expectedSpec.getArtifacts(), spec.getArtifacts());
}
/**
@@ -219,11 +77,11 @@ public class BlueprintGeneratorTest {
public void toscaDefinitionTest() {
ComponentSpec cs = new ComponentSpec();
TestComponentSpec test = new TestComponentSpec();
- cs.createComponentSpecFromString(test.getCs());
+ cs.createComponentSpecFromString(test.getComponentSpecAsString());
Blueprint bp = new Blueprint();
bp = bp.createBlueprint(cs, "", 'o', "", "");
- assertEquals(bp.getTosca_definitions_version(), "cloudify_dsl_1_3");
+ assertEquals("cloudify_dsl_1_3", bp.getTosca_definitions_version());
}
/**
@@ -233,19 +91,16 @@ public class BlueprintGeneratorTest {
public void importsTest() {
ComponentSpec cs = new ComponentSpec();
TestComponentSpec test = new TestComponentSpec();
- cs.createComponentSpecFromString(test.getCs());
+ cs.createComponentSpecFromString(test.getComponentSpecAsString());
Blueprint bp = new Blueprint();
bp = bp.createBlueprint(cs, "", 'o', "", "");
- ArrayList<String> imps = new ArrayList<String>();
-
- imps.add("http://www.getcloudify.org/spec/cloudify/3.4/types.yaml");
- imps.add(
- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml");
- imps.add(
- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml");
- assertEquals(bp.getImports(), imps);
+ ArrayList<String> imps = new ArrayList<>();
+ imps.add("https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml");
+ imps.add("plugin:k8splugin?version=3.4.2");
+ imps.add("plugin:dcaepolicyplugin?version=2.4.0");
+ assertEquals(imps, bp.getImports());
}
@Test
@@ -256,50 +111,49 @@ public class BlueprintGeneratorTest {
Blueprint bp = new Blueprint();
bp = bp.createBlueprint(cs, "", 'o', "", "");
- TreeMap<String, LinkedHashMap<String, Object>> inputs = new TreeMap<String, LinkedHashMap<String, Object>>();
+ TreeMap<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
//mr inputs
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
stringType.put("type", "string");
//necessary inputs
- LinkedHashMap<String, Object> tag = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> tag = new LinkedHashMap<>();
tag.put("type", "string");
String tester = "test.tester";
tag.put("default", '"' + tester + '"');
- String tagVersion = "tag_version";
inputs.put("tag_version", tag);
inputs.put("log_directory", stringType);
- LinkedHashMap cert = new LinkedHashMap();
+ LinkedHashMap<String, Object> cert = new LinkedHashMap<>();
cert.put("type", "string");
cert.put("default", "");
inputs.put("cert_directory", cert);
- LinkedHashMap<String, Object> env = new LinkedHashMap();
+ LinkedHashMap<String, Object> env = new LinkedHashMap<>();
env.put("default", "{}");
inputs.put("envs", env);
- LinkedHashMap port = new LinkedHashMap();
+ LinkedHashMap<String, Object> port = new LinkedHashMap<>();
port.put("type", "string");
port.put("description", "Kubernetes node port on which collector is exposed");
port.put("default", "99");
inputs.put("external_port", port);
- LinkedHashMap<String, Object> rep = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> rep = new LinkedHashMap<>();
rep.put("type", "integer");
rep.put("description", "number of instances");
rep.put("default", 1);
inputs.put("replicas", rep);
- LinkedHashMap<String, Object> aaf = new LinkedHashMap();
+ LinkedHashMap<String, Object> aaf = new LinkedHashMap<>();
aaf.put("type", "boolean");
aaf.put("default", false);
inputs.put("use_tls", aaf);
//parmaeter input
- LinkedHashMap<String, Object> test = new LinkedHashMap<String, Object>();
+ LinkedHashMap<String, Object> test = new LinkedHashMap<>();
test.put("type", "string");
String testParam = "test-param-1";
test.put("default", '"' + testParam + '"');
@@ -325,19 +179,17 @@ public class BlueprintGeneratorTest {
inputs.put("topic0_name", stringType);
inputs.put("topic1_name", stringType);
- LinkedHashMap<String, Object> cpu = new LinkedHashMap();
+ LinkedHashMap<String, Object> cpu = new LinkedHashMap<>();
cpu.put("type", "string");
cpu.put("default", "250m");
inputs.put("test.component.spec_cpu_limit", cpu);
inputs.put("test.component.spec_cpu_request", cpu);
- LinkedHashMap<String, Object> mem = new LinkedHashMap();
+ LinkedHashMap<String, Object> mem = new LinkedHashMap<>();
mem.put("type", "string");
mem.put("default", "128Mi");
inputs.put("test.component.spec_memory_limit", mem);
inputs.put("test.component.spec_memory_request", mem);
-
- assertEquals(true, true);
}
@Test
@@ -355,10 +207,9 @@ public class BlueprintGeneratorTest {
//set the type
testNode.setType("dcae.nodes.ContainerizedServiceComponent");
- ArrayList<String> ports = new ArrayList<String>();
+ ArrayList<String> ports = new ArrayList<>();
ports.add("concat: [\"80:\", {get_input: external_port }]");
ports.add("concat: [\"99:\", {get_input: external_port }]");
- assertEquals(true, true);
}
@Test
@@ -372,7 +223,7 @@ public class BlueprintGeneratorTest {
OnapNode node = (OnapNode) bp.getNode_templates().get("test.component.spec");
GetInput par = (GetInput) node.getProperties().getApplication_config().getParams().get("testParam1");
- assertEquals(par.getBpInputName(), "testParam1");
+ assertEquals("testParam1", par.getBpInputName());
}
@Test
@@ -385,13 +236,7 @@ public class BlueprintGeneratorTest {
OnapNode node = (OnapNode) bp.getNode_templates().get("test.component.spec");
- boolean test = false;
- if (!node.getProperties().getApplication_config().getStreams_publishes().isEmpty()) {
- test = true;
- System.out.println("tst");
- }
-
- assertEquals(true, test);
+ assertFalse(node.getProperties().getApplication_config().getStreams_publishes().isEmpty());
}
@Test
@@ -405,13 +250,8 @@ public class BlueprintGeneratorTest {
DmaapNode dmaap = (DmaapNode) bp.getNode_templates().get("test.component.spec");
//check if the stream publishes and subscribes are not null to see if the dmaap plugin was invoked properly
- boolean d = false;
-
- if (dmaap.getProperties().getStreams_publishes() != null
- || dmaap.getProperties().getStreams_subscribes() != null) {
- d = true;
- }
- assertEquals(true, d);
+ assertNotNull(dmaap.getProperties().getStreams_publishes());
+ assertNotNull(dmaap.getProperties().getStreams_subscribes());
}
@Test
@@ -442,17 +282,5 @@ public class BlueprintGeneratorTest {
PolicyModel p = new PolicyModel();
p.createPolicyModels(cs, "TestModels");
-
- assertEquals(true, true);
- }
-
- private void assertContainsInputWithDefault(Blueprint bp, String inputName, Object defaultValue) {
- LinkedHashMap<String, Object> input = bp.getInputs().get(inputName);
- assertNotNull(input);
- assertEquals(defaultValue, input.get("default"));
- }
-
- private String inQuotes(String filedName) {
- return String.format("\"%s\"", filedName);
}
}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java
new file mode 100644
index 0000000..1ce296a
--- /dev/null
+++ b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java
@@ -0,0 +1,52 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia Intellectual Property. 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.blueprint;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Test;
+
+public class ImportsTest {
+
+ private final List<String> expectedImports = Arrays.asList(
+ "https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml",
+ "plugin:k8splugin?version=3.4.1",
+ "plugin:pgaas?version=1.3.0",
+ "plugin:clamppolicyplugin?version=1.1.0",
+ "plugin:dmaap?version=1.5.0"
+ );
+
+ @Test
+ public void shouldReadImportsFromFile() {
+ ArrayList<String> importsFromFile = Imports.createImportsFromFile("TestCases/imports/imports.yaml");
+ assertEquals(expectedImports, importsFromFile);
+ }
+
+ @Test
+ public void shouldRemoveBlankImportsFromFile() {
+ ArrayList<String> importsFromFile =
+ Imports.createImportsFromFile("TestCases/imports/importsWithBlanks.yaml");
+ assertEquals(expectedImports, importsFromFile);
+ }
+
+}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java
index e854b19..1cdb58b 100644
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java
+++ b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java
@@ -25,7 +25,7 @@ import org.onap.blueprintgenerator.models.blueprint.tls.impl.ExternalCertificate
import java.util.LinkedHashMap;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.COMMON_NAME_FIELD;
import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_COMMON_NAME;
import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_SANS;
diff --git a/mod/runtimeapi/pom.xml b/mod/runtimeapi/pom.xml
index 75b68ce..112a9d7 100644
--- a/mod/runtimeapi/pom.xml
+++ b/mod/runtimeapi/pom.xml
@@ -34,7 +34,7 @@ limitations under the License.
</parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtimeapi</artifactId>
- <version>1.0.2</version>
+ <version>1.1.0</version>
<name>dcaegen2-platform-mod-runtimeapi</name>
<description>MOD Runtime API</description>
<properties>
diff --git a/mod/runtimeapi/runtime-core/pom.xml b/mod/runtimeapi/runtime-core/pom.xml
index 226d4e8..15eda39 100644
--- a/mod/runtimeapi/runtime-core/pom.xml
+++ b/mod/runtimeapi/runtime-core/pom.xml
@@ -25,12 +25,12 @@ limitations under the License.
<parent>
<artifactId>runtimeapi</artifactId>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
- <version>1.0.2</version>
+ <version>1.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>runtime-core</artifactId>
- <version>1.0.1</version>
+ <version>1.1.0</version>
<dependencies>
<dependency>
@@ -46,7 +46,7 @@ limitations under the License.
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator</artifactId>
- <version>1.4.0</version>
+ <version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
diff --git a/mod/runtimeapi/runtime-web/pom.xml b/mod/runtimeapi/runtime-web/pom.xml
index c8ce84a..6842cba 100644
--- a/mod/runtimeapi/runtime-web/pom.xml
+++ b/mod/runtimeapi/runtime-web/pom.xml
@@ -24,10 +24,10 @@ limitations under the License.
<parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtimeapi</artifactId>
- <version>1.0.2</version>
+ <version>1.1.0</version>
</parent>
<artifactId>runtime-web</artifactId>
- <version>1.0.6-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>runtime-web</name>
<description>MOD Runtime Web Module</description>
@@ -35,7 +35,7 @@ limitations under the License.
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtime-core</artifactId>
- <version>1.0.1</version>
+ <version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>