summaryrefslogtreecommitdiffstats
path: root/mod/runtimeapi
diff options
context:
space:
mode:
Diffstat (limited to 'mod/runtimeapi')
-rw-r--r--mod/runtimeapi/runtime-core/pom.xml4
-rw-r--r--mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java69
-rw-r--r--mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/BpGenTestBase.java44
-rw-r--r--mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestFlowGraphParser.java69
-rw-r--r--mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestIntegeration.java9
-rw-r--r--mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestOnapBpGen.java26
-rw-r--r--mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/configuration/BlueprintCreatorConfig.java72
7 files changed, 190 insertions, 103 deletions
diff --git a/mod/runtimeapi/runtime-core/pom.xml b/mod/runtimeapi/runtime-core/pom.xml
index 349e654..8b3741a 100644
--- a/mod/runtimeapi/runtime-core/pom.xml
+++ b/mod/runtimeapi/runtime-core/pom.xml
@@ -45,8 +45,8 @@ limitations under the License.
</dependency>
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
- <artifactId>blueprint-generator</artifactId>
- <version>1.5.2</version>
+ <artifactId>blueprint-generator-onap</artifactId>
+ <version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
diff --git a/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java b/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java
index c45173d..0a53ec0 100644
--- a/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java
+++ b/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java
@@ -1,13 +1,14 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -17,21 +18,37 @@
*/
package org.onap.dcae.runtime.core.blueprint_creator;
-import org.onap.blueprintgenerator.core.Fixes;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.onap.blueprintgenerator.model.base.Blueprint;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.service.BlueprintCreatorService;
+import org.onap.blueprintgenerator.service.base.BlueprintService;
+import org.onap.blueprintgenerator.service.base.FixesService;
+import org.onap.blueprintgenerator.service.common.ComponentSpecService;
import org.onap.dcae.runtime.core.Node;
-import org.onap.blueprintgenerator.models.blueprint.Blueprint;
-import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class BlueprintCreatorOnap implements BlueprintCreator{
+public class BlueprintCreatorOnap implements BlueprintCreator {
private String topicUrl;
private String importFilePath;
private boolean useDmaapPlugin;
+ private final ComponentSpecService componentSpecService;
+ private final BlueprintCreatorService blueprintCreatorService;
+ private final BlueprintService blueprintService;
+ private final FixesService fixesService;
+
+ public BlueprintCreatorOnap(ComponentSpecService componentSpecService,
+ BlueprintCreatorService blueprintCreatorService, BlueprintService blueprintService,
+ FixesService fixesService) {
+ this.componentSpecService = componentSpecService;
+ this.blueprintCreatorService = blueprintCreatorService;
+ this.blueprintService = blueprintService;
+ this.fixesService = fixesService;
+ }
public void setTopicUrl(String topicUrl) {
this.topicUrl = topicUrl;
@@ -42,43 +59,45 @@ public class BlueprintCreatorOnap implements BlueprintCreator{
}
public void setUseDmaapPlugin(boolean useDmaapPlugin) {
- this.useDmaapPlugin = useDmaapPlugin;
+ this.useDmaapPlugin = useDmaapPlugin;
}
@Override
public String createBlueprint(String componentSpecString) {
- ComponentSpec componentSpec = new ComponentSpec();
- componentSpec.createComponentSpecFromString(componentSpecString);
- Blueprint blueprint = new Blueprint().createBlueprint(componentSpec,"",useDmaapPlugin?'d':'o',importFilePath,"");
- return blueprint.blueprintToString();
+ OnapComponentSpec componentSpec = componentSpecService.createComponentSpecFromString(componentSpecString);
+ Input input = new Input();
+ input.setBpType(useDmaapPlugin ? "d" : "o");
+ input.setImportPath(importFilePath);
+ Blueprint blueprint = blueprintCreatorService.createBlueprint(componentSpec, input);
+ return blueprintService.blueprintToString(componentSpec, blueprint, input);
}
@Override
public void resolveDmaapConnection(Node node, String locationPort, String dmaapEntityName) {
- if(node == null || locationPort == null){
+ if (node == null || locationPort == null) {
return;
}
String blueprintContent = node.getBlueprintData().getBlueprint_content();
- locationPort = locationPort.replaceAll("-","_");
+ locationPort = locationPort.replaceAll("-", "_");
Yaml yaml = getYamlInstance();
- Map<String,Object> obj = yaml.load(blueprintContent);
- Map<String,Object> inputsObj = (Map<String, Object>) obj.get("inputs");
- for(Map.Entry<String,Object> entry: inputsObj.entrySet()){
+ Map<String, Object> obj = yaml.load(blueprintContent);
+ Map<String, Object> inputsObj = (Map<String, Object>) obj.get("inputs");
+ for (Map.Entry<String, Object> entry : inputsObj.entrySet()) {
LinkedHashMap<String, Object> modified = retainQuotesForDefault(entry.getValue());
entry.setValue(modified);
- if(entry.getKey().matches(locationPort+".*url")) {
- Map<String,String> inputValue = (Map<String, String>) entry.getValue();
- inputValue.put("default",topicUrl + "/" + dmaapEntityName);
+ if (entry.getKey().matches(locationPort + ".*url")) {
+ Map<String, String> inputValue = (Map<String, String>) entry.getValue();
+ inputValue.put("default", topicUrl + "/" + dmaapEntityName);
}
}
- node.getBlueprintData().setBlueprint_content(Fixes.applyFixes(yaml.dump(obj)));
+ node.getBlueprintData().setBlueprint_content(fixesService.applyFixes(yaml.dump(obj)));
}
private LinkedHashMap<String, Object> retainQuotesForDefault(Object valueOfInputObject) {
LinkedHashMap<String, Object> temp = (LinkedHashMap<String, Object>) valueOfInputObject;
- if(temp.containsKey("type") && temp.get("type").equals("string")) {
+ if (temp.containsKey("type") && temp.get("type").equals("string")) {
String def = (String) temp.get("default");
- if(def != null){
+ if (def != null) {
def = def.replaceAll("\"$", "").replaceAll("^\"", "");
}
def = '"' + def + '"';
diff --git a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/BpGenTestBase.java b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/BpGenTestBase.java
new file mode 100644
index 0000000..ec67d8f
--- /dev/null
+++ b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/BpGenTestBase.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.dcae.runtime.core;
+
+import org.junit.runner.RunWith;
+import org.onap.blueprintgenerator.BlueprintGeneratorConfiguration;
+import org.onap.blueprintgenerator.service.BlueprintCreatorService;
+import org.onap.blueprintgenerator.service.base.BlueprintService;
+import org.onap.blueprintgenerator.service.base.FixesService;
+import org.onap.blueprintgenerator.service.common.ComponentSpecService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@EnableConfigurationProperties
+@SpringBootTest(classes = {BlueprintGeneratorConfiguration.class})
+public class BpGenTestBase {
+ @Autowired
+ BlueprintService blueprintService;
+ @Autowired
+ ComponentSpecService componentSpecService;
+ @Autowired
+ BlueprintCreatorService blueprintCreatorService;
+ @Autowired
+ FixesService fixesService;
+}
diff --git a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestFlowGraphParser.java b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestFlowGraphParser.java
index 25e3e54..1b5a57c 100644
--- a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestFlowGraphParser.java
+++ b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestFlowGraphParser.java
@@ -1,13 +1,14 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -21,14 +22,12 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
-import java.util.Map;
import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.rules.TemporaryFolder;
import org.onap.dcae.runtime.core.blueprint_creator.BlueprintCreatorOnap;
-public class TestFlowGraphParser {
+public class TestFlowGraphParser extends BpGenTestBase {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@@ -36,39 +35,41 @@ public class TestFlowGraphParser {
@Test
public void testFlowGraphParser() throws IOException {
try {
- File importsfile = folder.newFile("imports.yaml");
- try (Writer w = new FileWriter(importsfile)) {
- w.write(
- "imports:\n" +
- " - 'http://www.getcloudify.org/spec/cloudify/3.4/types.yaml'\n" +
- " - 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.5/k8splugin_types.yaml'\n" +
- " - 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml'\n"
- );
- }
- FlowGraph<Node, Edge> mainFlowGraph = new FlowGraph<>("1234", "nifi-main", true, "mock graph");
- mainFlowGraph.addNode(new Node("dummy_id", "dummy_name", "dummy_compspec"));
- BlueprintCreatorOnap bcod = new BlueprintCreatorOnap();
- bcod.setTopicUrl("u.r.l");
- bcod.setImportFilePath(importsfile.getAbsolutePath());
- FlowGraphParser flowGraphParser = new FlowGraphParser(bcod);
- flowGraphParser.parse(mainFlowGraph);
- String compspec = Helper.loadFileContent("src/test/data/compspecs/componentSpec_hello_world.json");
- mainFlowGraph.addNode(new Node("comp5678", "hello-world-2", compspec));
- mainFlowGraph.addNode(new Node("comp1234", "hello-world-1", compspec));
- mainFlowGraph.addEdge(
- flowGraphParser.getNodeFromId("comp1234"),
- flowGraphParser.getNodeFromId("comp5678"),
- new Edge(
- new EdgeLocation("comp1234", "DCAE-HELLO-WORLD-PUB-MR"),
- new EdgeLocation("comp5678", "DCAE-HELLO-WORLD-SUB-MR"),
- new EdgeMetadata("sample_topic_1", "json", "MR")));
- flowGraphParser.createAndProcessBlueprints();
+ File importsfile = folder.newFile("imports.yaml");
+ try (Writer w = new FileWriter(importsfile)) {
+ w.write(
+ "imports:\n" +
+ " - 'http://www.getcloudify.org/spec/cloudify/3.4/types.yaml'\n" +
+ " - 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.5/k8splugin_types.yaml'\n"
+ +
+ " - 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml'\n"
+ );
+ }
+ FlowGraph<Node, Edge> mainFlowGraph = new FlowGraph<>("1234", "nifi-main", true, "mock graph");
+ mainFlowGraph.addNode(new Node("dummy_id", "dummy_name", "dummy_compspec"));
+ BlueprintCreatorOnap bcod = new BlueprintCreatorOnap(componentSpecService, blueprintCreatorService,
+ blueprintService, fixesService);
+ bcod.setTopicUrl("u.r.l");
+ bcod.setImportFilePath(importsfile.getAbsolutePath());
+ FlowGraphParser flowGraphParser = new FlowGraphParser(bcod);
+ flowGraphParser.parse(mainFlowGraph);
+ String compspec = Helper.loadFileContent("src/test/data/compspecs/componentSpec_hello_world.json");
+ mainFlowGraph.addNode(new Node("comp5678", "hello-world-2", compspec));
+ mainFlowGraph.addNode(new Node("comp1234", "hello-world-1", compspec));
+ mainFlowGraph.addEdge(
+ flowGraphParser.getNodeFromId("comp1234"),
+ flowGraphParser.getNodeFromId("comp5678"),
+ new Edge(
+ new EdgeLocation("comp1234", "DCAE-HELLO-WORLD-PUB-MR"),
+ new EdgeLocation("comp5678", "DCAE-HELLO-WORLD-SUB-MR"),
+ new EdgeMetadata("sample_topic_1", "json", "MR")));
+ flowGraphParser.createAndProcessBlueprints();
} catch (RuntimeException rte) {
rte.printStackTrace();
throw rte;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
- }
+ }
}
}
diff --git a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestIntegeration.java b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestIntegeration.java
index 615993a..ac1c9b7 100644
--- a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestIntegeration.java
+++ b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestIntegeration.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -17,13 +18,13 @@
*/
package org.onap.dcae.runtime.core;
-import org.onap.dcae.runtime.core.blueprint_creator.BlueprintCreator;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.onap.dcae.runtime.core.blueprint_creator.BlueprintCreator;
import org.onap.dcae.runtime.core.blueprint_creator.BlueprintCreatorOnap;
-public class TestIntegeration {
+public class TestIntegeration extends BpGenTestBase {
private FlowGraphParser flowGraphParser;
@@ -33,7 +34,9 @@ public class TestIntegeration {
FlowGraph<Node, Edge> flowGraph = Helper.prepareFlowGraph();
//2. Inject graph in FlowGraphParser
- BlueprintCreator blueprintCreator = new BlueprintCreatorOnap();
+ BlueprintCreator blueprintCreator = new BlueprintCreatorOnap(componentSpecService, blueprintCreatorService,
+ blueprintService,
+ fixesService);
flowGraphParser = new FlowGraphParser(blueprintCreator);
flowGraphParser.parse(flowGraph);
}
diff --git a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestOnapBpGen.java b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestOnapBpGen.java
index 60ba323..866d6f6 100644
--- a/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestOnapBpGen.java
+++ b/mod/runtimeapi/runtime-core/src/test/java/org/onap/dcae/runtime/core/TestOnapBpGen.java
@@ -1,13 +1,14 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,18 +19,19 @@
package org.onap.dcae.runtime.core;
import org.junit.Test;
-import org.onap.blueprintgenerator.models.blueprint.Blueprint;
-import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+import org.onap.blueprintgenerator.model.base.Blueprint;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
-public class TestOnapBpGen {
+public class TestOnapBpGen extends BpGenTestBase {
@Test
- public void testOnapBPGeneration() throws Exception{
- ComponentSpec componentSpec = new ComponentSpec();
- componentSpec.createComponentSpecFromString(Helper.loadFileContent(
- "src/test/data/compspecs/componentSpec_hello_world_only_MR.json"));
-
- Blueprint bp = new Blueprint().createBlueprint(componentSpec,"",'d',"","");
- System.out.println(bp.getInputs());
+ public void testOnapBPGeneration() throws Exception {
+ OnapComponentSpec componentSpec = componentSpecService.createComponentSpecFromString(
+ Helper.loadFileContent("src/test/data/compspecs/componentSpec_hello_world_only_MR.json"));
+ Input input = new Input();
+ input.setBpType("d");
+ Blueprint blueprint = blueprintCreatorService.createBlueprint(componentSpec, input);
+ System.out.println(blueprint.getInputs());
}
}
diff --git a/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/configuration/BlueprintCreatorConfig.java b/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/configuration/BlueprintCreatorConfig.java
index 0741bfa..ef34ecd 100644
--- a/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/configuration/BlueprintCreatorConfig.java
+++ b/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/configuration/BlueprintCreatorConfig.java
@@ -1,13 +1,14 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -17,33 +18,42 @@
*/
package org.onap.dcae.runtime.web.configuration;
+import java.io.IOException;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.onap.blueprintgenerator.BlueprintGeneratorConfiguration;
+import org.onap.blueprintgenerator.service.BlueprintCreatorService;
+import org.onap.blueprintgenerator.service.base.BlueprintService;
+import org.onap.blueprintgenerator.service.base.FixesService;
+import org.onap.blueprintgenerator.service.common.ComponentSpecService;
import org.onap.dcae.runtime.core.FlowGraphParser;
import org.onap.dcae.runtime.core.blueprint_creator.BlueprintCreatorOnap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.yaml.snakeyaml.Yaml;
-import java.io.IOException;
-import java.nio.file.FileAlreadyExistsException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
@Configuration
+@Import(BlueprintGeneratorConfiguration.class)
public class BlueprintCreatorConfig {
- @Autowired
- Environment env;
-
+ private final Environment env;
+ private final BlueprintService blueprintService;
+ private final ComponentSpecService componentSpecService;
+ private final BlueprintCreatorService blueprintCreatorService;
+ private final FixesService fixesService;
+
@Value("${onap.topicUrl}")
String onapDublinTopicUrl;
@@ -68,12 +78,24 @@ public class BlueprintCreatorConfig {
@Value("${onap.import.dmaapPlugin}")
String onapDublinImportDmaapPlugin;
+ @Autowired
+ public BlueprintCreatorConfig(Environment env, BlueprintService blueprintService,
+ ComponentSpecService componentSpecService, BlueprintCreatorService blueprintCreatorService,
+ FixesService fixesService) {
+ this.env = env;
+ this.blueprintService = blueprintService;
+ this.componentSpecService = componentSpecService;
+ this.blueprintCreatorService = blueprintCreatorService;
+ this.fixesService = fixesService;
+ }
+
@Profile("onap")
@Primary
@Bean
- public FlowGraphParser getFlowGraphParserForOnapDublin(){
- BlueprintCreatorOnap blueprintCreatorOnap = new BlueprintCreatorOnap();
+ public FlowGraphParser getFlowGraphParserForOnapDublin() {
+ BlueprintCreatorOnap blueprintCreatorOnap = new BlueprintCreatorOnap(componentSpecService,
+ blueprintCreatorService, blueprintService, fixesService);
blueprintCreatorOnap.setImportFilePath(writeImportsTofile());
blueprintCreatorOnap.setUseDmaapPlugin(useDmaapPlugin);
FlowGraphParser flowGraphParser = new FlowGraphParser(blueprintCreatorOnap);
@@ -85,7 +107,7 @@ public class BlueprintCreatorConfig {
String fielPath = "";
try {
Path path = createDataImportDirAndImportFile();
- fielPath = Files.write(path,contentToWrite.getBytes()).toString();
+ fielPath = Files.write(path, contentToWrite.getBytes()).toString();
new String(Files.readAllBytes(path));
} catch (IOException e) {
e.printStackTrace();
@@ -100,17 +122,15 @@ public class BlueprintCreatorConfig {
try {
Files.createDirectories(importDirPath);
Files.createFile(onapImportFilePath);
- }
- catch (FileAlreadyExistsException ignored){
- }
- catch (IOException e) {
+ } catch (FileAlreadyExistsException ignored) {
+ } catch (IOException e) {
e.printStackTrace();
}
return onapImportFilePath;
}
private String getContentToWrite() {
- Map<String,Object> result = new HashMap<String, Object>();
+ Map<String, Object> result = new HashMap<String, Object>();
List<String> importList = new ArrayList<String>();
importList.add(onapDublinImportCloudifyPlugin);
importList.add(onapDublinImportK8sPlugin);
@@ -119,10 +139,8 @@ public class BlueprintCreatorConfig {
importList.add(onapDublinImportPostgresPlugin);
importList.add(onapDublinImportClampPlugin);
importList.add(onapDublinImportDmaapPlugin);
-
-
-
- result.put("imports",importList);
+
+ result.put("imports", importList);
return new Yaml().dump(result);
}