summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/onap/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bpgenerator/onap/src/test/java')
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java13
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java28
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java122
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java59
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java481
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java28
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java309
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java150
8 files changed, 851 insertions, 339 deletions
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
index b19a823..d15be4d 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
@@ -28,13 +28,14 @@ import org.junit.runners.Suite;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Test Suite for Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Test Suite for Test Cases
*/
-
-
@RunWith(Suite.class)
-@Suite.SuiteClasses({ OnapComponentSpecTest.class, OnapBlueprintServiceTest.class,ExternalCertificateParametersFactoryServiceTest.class/*, BlueprintJarComparatorTest.class*/})
+@Suite.SuiteClasses({
+ OnapComponentSpecTest.class,
+ OnapBlueprintServiceTest.class,
+ ExternalCertificateParametersFactoryServiceTest.class /*, BlueprintJarComparatorTest.class*/
+})
public class BlueprintGeneratorTestSuite {
+
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
index ea324da..81aaa60 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
@@ -42,24 +42,21 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Test Cases
*/
-
-
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = BlueprintGeneratorMainApplication.class, initializers = ConfigFileApplicationContextInitializer.class)
+@ContextConfiguration(
+ classes = BlueprintGeneratorMainApplication.class,
+ initializers = ConfigFileApplicationContextInitializer.class)
@TestPropertySource(
- properties = {
- "ves=ves.json",
- "testImports=testImports.yaml",
- "useTlsTrueAndUseExternalTlsTrueTest=testComponentSpec_withTlsTrueAndExternalTlsTrue.json",
- "useTlsFalseAndUseExternalTlsFalseTest=testComponentSpec_withTlsFalseAndExternalTlsFalse.json",
- "useTlsTrueAndNoExternalTlsFlagTest=testComponentSpec_withTlsTrueAndNoExternalTls.json",
- "noTlsInfo=testComponentSpec_withoutTlsInfo.json"
- }
-)
+ properties = {
+ "ves=ves.json",
+ "testImports=testImports.yaml",
+ "useTlsTrueAndUseExternalTlsTrueTest=testComponentSpec_withTlsTrueAndExternalTlsTrue.json",
+ "useTlsFalseAndUseExternalTlsFalseTest=testComponentSpec_withTlsFalseAndExternalTlsFalse.json",
+ "useTlsTrueAndNoExternalTlsFlagTest=testComponentSpec_withTlsTrueAndNoExternalTls.json",
+ "noTlsInfo=testComponentSpec_withoutTlsInfo.json"
+ })
@Ignore
public class BlueprintGeneratorTests {
@@ -105,5 +102,4 @@ public class BlueprintGeneratorTests {
protected OnapTestUtils onapTestUtils;
protected OnapComponentSpec onapComponentSpec = null;
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
index d10d3ff..a0cf04a 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
@@ -21,7 +21,6 @@
*
*/
-
package org.onap.blueprintgenerator.test;
import org.apache.commons.io.FileUtils;
@@ -37,15 +36,11 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
-
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Bueprint Jar Comparision with Previos version to make sure Bps are not broken with new changes
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Bueprint Jar Comparision with
+ * Blueprint Comparator using preious and new Jar files to make sure the new code doesnt break previous changes.
*/
-
-
@Ignore
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
@@ -55,15 +50,19 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
private String previousVersion = "0_1";
private String latestVersion = "1_0";
private String latestJarPath = Paths.get("target").toAbsolutePath().toString() + "\\";
- private String previousJarPath = Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
- private String inputPath = Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
- private String inputPolicyPath = Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
- private String outputPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
+ private String previousJarPath =
+ Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
+ private String inputPath =
+ Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
+ private String inputPolicyPath =
+ Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
+ private String outputPath =
+ Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
private String previousJar = "onap-blueprint-generator-" + previousJarVersion + ".jar";
private String latestJar = "onap-blueprint-generator-" + latestJarVersion + ".jar";
@Test
- @Order(value=1)
+ @Order(value = 1)
public void filesCleanup() throws IOException {
FileUtils.deleteDirectory(new File(outputPath));
}
@@ -74,19 +73,54 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
String outputFileName = "dcae-ves-collector-dmaap-";
String inputImportsFileName = testImports;
- String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ String previousJarCommand =
+ "java -jar "
+ + previousJarPath
+ + previousJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + previousVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName
+ + " -d";
Runtime.getRuntime().exec(previousJarCommand);
- String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ String latestJarCommand =
+ "java -jar "
+ + latestJarPath
+ + latestJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + latestVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName
+ + " -d";
Runtime.getRuntime().exec(latestJarCommand);
Thread.sleep(8000);
- Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option don't match!",
- FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
- FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ Assert.assertEquals(
+ "The BluePrint files ("
+ + outputFileName
+ + ") for "
+ + inputFileName
+ + " with -m option don't match!",
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
}
@Test
@@ -95,21 +129,51 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
String outputFileName = "dcae-ves-collector-";
String inputImportsFileName = testImports;
- String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName ;
+ String previousJarCommand =
+ "java -jar "
+ + previousJarPath
+ + previousJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + previousVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName;
Runtime.getRuntime().exec(previousJarCommand);
- String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName ;
+ String latestJarCommand =
+ "java -jar "
+ + latestJarPath
+ + latestJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + latestVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName;
Runtime.getRuntime().exec(latestJarCommand);
Thread.sleep(8000);
- Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option dont match!",
- FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
- FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ Assert.assertEquals(
+ "The BluePrint files ("
+ + outputFileName
+ + ") for "
+ + inputFileName
+ + " with -m option dont match!",
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
}
-
-
}
-
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
index 021bc49..718ea4a 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
@@ -1,22 +1,22 @@
/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
- Copyright (c) 2020 AT&T 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=========================================================
- */
+org.onap.dcae
+================================================================================
+Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
+Copyright (c) 2020 AT&T 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.test;
@@ -26,7 +26,6 @@ import org.onap.blueprintgenerator.service.common.ExternalCertificateParametersF
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-
import java.util.LinkedHashMap;
import java.util.Map;
@@ -34,15 +33,23 @@ import static org.junit.Assert.assertEquals;
import static org.onap.blueprintgenerator.constants.Constants.COMMON_NAME_FIELD;
import static org.onap.blueprintgenerator.constants.Constants.SANS_FIELD;
-public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGeneratorTests{
+/**
+ * Test for External Certificate Parameters Factory Service
+ */
+public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGeneratorTests {
- private static final String PREFIXED_COMMON_NAME_FIELD = Constants.INPUT_PREFIX + COMMON_NAME_FIELD;
+ private static final String PREFIXED_COMMON_NAME_FIELD =
+ Constants.INPUT_PREFIX + COMMON_NAME_FIELD;
private static final String PREFIXED_SANS_FIELD = Constants.INPUT_PREFIX + SANS_FIELD;
private static final String DEFAULT = "default";
@Autowired
private ExternalCertificateParametersFactoryService externalCertificateParametersFactoryService;
+ /**
+ * Test case to create External Certificate Properties
+ *
+ */
@Test
public void shouldCreateExternalCertificatePropertiesObject() {
@@ -51,11 +58,17 @@ public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGe
assertEquals(result.getSans().getBpInputName(), PREFIXED_SANS_FIELD);
}
+ /**
+ * Test case to create Correct Input List with Default Values from Component Spec
+ *
+ */
@Test
public void shouldCreateCorrectInputListWithDefaultValuesTakenFromComponentSpec() {
- Map<String, LinkedHashMap<String, Object>> result = externalCertificateParametersFactoryService.createInputList();
- assertEquals(Constants.DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
+ Map<String, LinkedHashMap<String, Object>> result =
+ externalCertificateParametersFactoryService.createInputList();
+ assertEquals(
+ Constants.DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
assertEquals(Constants.DEFAULT_SANS, result.get(PREFIXED_SANS_FIELD).get(DEFAULT));
}
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
index 351f94e..8f4a1f6 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
@@ -51,207 +51,408 @@ import static org.mockito.Mockito.verify;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Blueprint Test Cases for ONAP and DMAAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Blueprint Test Cases for ONAP and
+ * DMAAP
*/
-
-
public class OnapBlueprintServiceTest extends BlueprintGeneratorTests {
- private String outputfilesPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString();
+ private String outputfilesPath =
+ Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString();
+ /**
+ * Test Case for Service Name Override Component Spec Input File
+ *
+ */
@DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File")
@Test
public void testServiceNameOverrideK8sBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testServiceNameOverrideK8sBlueprint", "", "o", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for Service Name Override Component Spec is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testServiceNameOverrideK8sBlueprint",
+ "",
+ "o",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for Service Name Override Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+ System.out.println(
+ onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
- onapTestUtils.verifyToscaDefVersion("Service Name Override K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImports("Service Name Override K8s",onapBlueprint,false);
+ onapTestUtils.verifyToscaDefVersion(
+ "Service Name Override K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImports("Service Name Override K8s", onapBlueprint, false);
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("Service Name Override K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("Service Name Override K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertTrue(
+ "Service Name Override K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "Service Name Override K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "Service Name Override K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("Service Name Override K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("Service Name Override K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("Service Name Override K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("Service Name Override K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
+ assertNotNull(
+ "Service Name Override K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "Service Name Override K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "Service Name Override K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "Service Name Override K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
- onapTestUtils.verifyArtifacts("Service Name Override K8s",onapComponentSpec,bpInputs,"o");
-
- onapTestUtils.verifyStreamsPublishes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplates);
- onapTestUtils.verifyVolumes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils
+ .verifyArtifacts("Service Name Override K8s", onapComponentSpec, bpInputs, "o");
+
+ onapTestUtils.verifyStreamsPublishes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
}
- @DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File with Import File")
+ /**
+ * Test Case for Service Name Override Component Spec Input File with Import File
+ *
+ */
+ @DisplayName(
+ "Testing K8s Blueprint for Service Name Override Component Spec Input File with Import File")
@Test
public void testServiceNameOverrideImportFileK8sBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "o", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for Service Name Override with Import File Component Spec is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
-
- onapTestUtils.verifyToscaDefVersion("Service Name Override with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImportsFromFile("Service Name Override with Import File K8s",onapBlueprint,input.getImportPath());
-
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ "",
+ "",
+ Paths.get("src", "test", "resources", "componentspecs", testImports)
+ .toFile()
+ .getAbsolutePath(),
+ "o",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for Service Name Override with Import File Component Spec is NULL",
+ onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion(
+ "Service Name Override with Import File K8s", onapBlueprint,
+ Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile(
+ "Service Name Override with Import File K8s", onapBlueprint, input.getImportPath());
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
- assertNotNull("Service Name Override with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("Service Name Override with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Inputs Section is NULL",
+ k8sBpInputs);
+ assertTrue(
+ "Service Name Override with Import File K8s Blueprint Inputs Section is Empty",
+ k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("Service Name Override with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("Service Name Override with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "Service Name Override with Import File K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
- onapTestUtils.verifyArtifacts("Service Name Override with Import File K8s",onapComponentSpec,bpInputs,"o");
-
- onapTestUtils.verifyStreamsPublishes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
- onapTestUtils.verifyVolumes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyArtifacts(
+ "Service Name Override with Import File K8s", onapComponentSpec, bpInputs, "o");
+
+ onapTestUtils.verifyStreamsPublishes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils
+ .verifyAuxilary("Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls(
+ "Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides(
+ "Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "Service Name Override with Import File K8s", onapComponentSpec, k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
}
+ /**
+ * Test Case for K8s Blueprint with DB
+ *
+ */
@DisplayName("Testing K8s Blueprint with DB")
@Test
public void testDMAAPK8sBlueprintWithDB() {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprintWithDB", "", "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testDMAAPK8sBlueprintWithDB",
+ "",
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
}
+ /**
+ * Test Case for K8s Blueprint for DMAAP Component Spec Input File
+ *
+ */
@DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File")
@Test
public void testDMAAPK8sBlueprint() {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprint", "", "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testDMAAPK8sBlueprint",
+ "",
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+ System.out.println(
+ onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
policyModelService.createPolicyModels(onapComponentSpec.getParameters(), "models");
- onapTestUtils.verifyToscaDefVersion("DMAAP K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- //onapTestUtils.verifyBpImports("DMAAP K8s",onapBlueprint,false);
+ onapTestUtils
+ .verifyToscaDefVersion("DMAAP K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("DMAAP K8s Blueprint Inputs Section is NULL", k8sBpInputs);
assertTrue("DMAAP K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
- //assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
- //assertEquals("DMAAP K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
- assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertEquals(
+ "DMAAP K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "DMAAP K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("DMAAP K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("DMAAP K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("DMAAP K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("DMAAP K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
- List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
- assertNotNull("DMAAP K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
-
- onapTestUtils.verifyStreamsPublishes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplates);
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "DMAAP K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "DMAAP K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates:Relationships Section is NULL",
+ bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes(
+ "DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP K8s", onapComponentSpec);
+ onapTestUtils
+ .verifyHealthCheck("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP K8s", onapComponentSpec);
+ onapTestUtils
+ .verifyDockerConfig("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplates);
}
+ /**
+ * Test Case for K8s Blueprint for DMAAP Component Spec Input File with Import File
+ *
+ */
@DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File with Import File")
@Test
public void testDMAAPK8sImportFileBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for DMAAP Component Spec with Import File is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
-
- onapTestUtils.verifyToscaDefVersion("DMAAP with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImportsFromFile("DMAAP with Import File K8s",onapBlueprint,input.getImportPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ "",
+ "",
+ Paths.get("src", "test", "resources", "componentspecs", testImports)
+ .toFile()
+ .getAbsolutePath(),
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for DMAAP Component Spec with Import File is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion(
+ "DMAAP with Import File K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile(
+ "DMAAP with Import File K8s", onapBlueprint, input.getImportPath());
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("DMAAP with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("DMAAP with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- //assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
- //assertEquals("DMAAP with Import File K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
- assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertTrue(
+ "DMAAP with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("DMAAP with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("DMAAP with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
- List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
-
- onapTestUtils.verifyStreamsPublishes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "DMAAP with Import File K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates:Relationships Section is NULL",
+ bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplates);
}
-
}
-
-
-
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
index 633c205..e610bd3 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.test;
-
import org.onap.blueprintgenerator.exception.ComponentSpecException;
import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
import org.junit.Test;
@@ -35,24 +34,35 @@ import static org.junit.Assert.assertEquals;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP ComponentSpec Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP ComponentSpec Test Cases
*/
-
public class OnapComponentSpecTest extends BlueprintGeneratorTests {
+ /**
+ * Test Case for ComponentSpec File Generation for Invalid File
+ *
+ */
@DisplayName("Testing ComponentSpec File Generation for Invalid File")
@Test(expected = ComponentSpecException.class)
public void testComponentSpecForInvalidFile() {
onapComponentSpecService.createComponentSpecFromFile("invalid.json");
}
+ /**
+ * Test Case for ComponentSpec File Generation for Valid DMAAP Fil
+ *
+ */
@DisplayName("Testing ComponentSpec File Generation for Valid DMAAP File")
@Test
- public void testComponentSpecForValidVesFile(){
- ComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath());
- assertEquals("ComponentSpec name not matching for Valid Ves File",onapComponentSpec.getSelf().getName(), "dcae-ves-collector");
+ public void testComponentSpecForValidVesFile() {
+ ComponentSpec onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(
+ Paths.get("src", "test", "resources", "componentspecs", ves)
+ .toFile()
+ .getAbsolutePath());
+ assertEquals(
+ "ComponentSpec name not matching for Valid Ves File",
+ onapComponentSpec.getSelf().getName(),
+ "dcae-ves-collector");
}
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
index 9033fbe..01845ab 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
@@ -53,14 +53,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Test Utilities used in Test Suite and Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Test Utilities used in Test Suite and
+ * Test Cases
*/
-
@Component
@Ignore
public class OnapTestUtils extends BlueprintGeneratorTests {
@@ -83,9 +80,24 @@ public class OnapTestUtils extends BlueprintGeneratorTests {
@Value("${import.Clamp}")
private String importClamp;
-
-
- public Input getInput(String componentSpecPath,String outputPath,String bluePrintName,String importPath,String bpType,String serviceNameOverride){
+ /**
+ * Creates Input
+ *
+ * @param componentSpecPath
+ * @param outputPath
+ * @param bluePrintName
+ * @param importPath
+ * @param bpType
+ * @param serviceNameOverride
+ * @return
+ */
+ public Input getInput(
+ String componentSpecPath,
+ String outputPath,
+ String bluePrintName,
+ String importPath,
+ String bpType,
+ String serviceNameOverride) {
Input input = new Input();
input.setComponentSpecPath(componentSpecPath);
input.setBluePrintName(bluePrintName);
@@ -96,112 +108,285 @@ public class OnapTestUtils extends BlueprintGeneratorTests {
return input;
}
- public Input getInput(String componentSpecPath){
+ /**
+ * Creates Input from Component Spec Path
+ *
+ * @param componentSpecPath
+ * @return
+ */
+ public Input getInput(String componentSpecPath) {
Input input = new Input();
input.setComponentSpecPath(componentSpecPath);
return input;
}
- public void verifyToscaDefVersion(String type,Blueprint blueprint,String toscaDefVersion){
+ /**
+ * Verifies Tosca Def Version
+ *
+ * @param type
+ * @param blueprint
+ * @param toscaDefVersion
+ */
+ public void verifyToscaDefVersion(String type, Blueprint blueprint, String toscaDefVersion) {
String bpToscaDefVersion = blueprint.getTosca_definitions_version();
assertNotNull(type + " TOSCA Definition Version is NULL", bpToscaDefVersion);
- assertEquals(type + " TOSCA Definition Version is not Matching", bpToscaDefVersion, toscaDefVersion);
+ assertEquals(
+ type + " TOSCA Definition Version is not Matching", bpToscaDefVersion, toscaDefVersion);
}
- public void verifyBpImports(String type,Blueprint blueprint, boolean validateimps) {
- String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
+ /**
+ * Verifies Imports
+ *
+ * @param type
+ * @param blueprint
+ * @param validateimps
+ */
+ public void verifyBpImports(String type, Blueprint blueprint, boolean validateimps) {
+ String[] bpImports = blueprint.getImports()
+ .toArray(new String[blueprint.getImports().size()]);
if (validateimps) {
- String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsDmaapDmaapplugin,importPostgres,importClamp};
- assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, testImports);
- }
- else{
- String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsOnapK8sDcaepolicyplugin,importPostgres,importClamp};
- assertArrayEquals(type + " Blueprint Imports is not matching with default Onap K8s Blueprint imports", bpImports, testImports);
+ String[] testImports = {
+ importsOnapTypes,
+ importsOnapK8sPlugintypes,
+ importsDmaapDmaapplugin,
+ importPostgres,
+ importClamp
+ };
+ assertArrayEquals(
+ type
+ + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports",
+ bpImports,
+ testImports);
+ } else {
+ String[] testImports = {
+ importsOnapTypes,
+ importsOnapK8sPlugintypes,
+ importsOnapK8sDcaepolicyplugin,
+ importPostgres,
+ importClamp
+ };
+ assertArrayEquals(
+ type + " Blueprint Imports is not matching with default Onap K8s Blueprint imports",
+ bpImports,
+ testImports);
}
-
}
- public void verifyBpImportsFromFile(String type,Blueprint blueprint, String importPath) throws IOException {
- Blueprint importFileRead = yamlObjectMapper.readValue(new File(importPath), Blueprint.class);
- String[] importFileImports = importFileRead.getImports().toArray(new String[importFileRead.getImports().size()]);
- String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
- assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, importFileImports);
-
+ /**
+ * Verifies Imports from file
+ *
+ * @param type
+ * @param blueprint
+ * @param importPath
+ */
+ public void verifyBpImportsFromFile(String type, Blueprint blueprint, String importPath)
+ throws IOException {
+ Blueprint importFileRead = yamlObjectMapper
+ .readValue(new File(importPath), Blueprint.class);
+ String[] importFileImports =
+ importFileRead.getImports().toArray(new String[importFileRead.getImports().size()]);
+ String[] bpImports = blueprint.getImports()
+ .toArray(new String[blueprint.getImports().size()]);
+ assertArrayEquals(
+ type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports",
+ bpImports,
+ importFileImports);
}
- public void verifyStreamsPublishes(String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
+ /**
+ * Verifies Streams Publishes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyStreamsPublishes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
List<Streams> streamsPublishes = nodeTemplateProperties.getStreams_publishes();
if (!(streamsPublishes == null)) {
- assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is NULL", streamsPublishes);
- assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes Section Size is 0", streamsPublishes.size() > 0);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(0).getType(), Constants.MESSAGEROUTER_VALUE);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(1).getType(), Constants.MESSAGEROUTER_VALUE);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is NULL",
+ streamsPublishes);
+ assertTrue(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes Section Size is 0",
+ streamsPublishes.size() > 0);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching",
+ streamsPublishes.get(0).getType(),
+ Constants.MESSAGEROUTER_VALUE);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching",
+ streamsPublishes.get(1).getType(),
+ Constants.MESSAGEROUTER_VALUE);
}
}
- public void verifyStreamsSubscribes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies Streams Subscribes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyStreamsSubscribes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
List<Streams> streamsSubscribes = nodeTemplateProperties.getStreams_subscribes();
if (!(streamsSubscribes == null)) {
- assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is NULL", streamsSubscribes);
- assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes Section Size is 0", streamsSubscribes.size() > 0);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(0).getType(), Constants.MESSAGE_ROUTER);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(1).getType(), Constants.DATA_ROUTER);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is NULL",
+ streamsSubscribes);
+ assertTrue(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes Section Size is 0",
+ streamsSubscribes.size() > 0);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching",
+ streamsSubscribes.get(0).getType(),
+ Constants.MESSAGE_ROUTER);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching",
+ streamsSubscribes.get(1).getType(),
+ Constants.DATA_ROUTER);
}
}
- public void verifyServicesCalls(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Services Calls
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyServicesCalls(String type, OnapComponentSpec onapComponentSpec) {
Calls[] csServicesCalls = onapComponentSpec.getServices().getCalls();
assertNotNull(type + " ComponentSpec Services Calls is NULL", csServicesCalls);
- //assertTrue(type + " ComponentSpec Services Calls Section Size is 0", csServicesCalls.length > 0);
+ // assertTrue(type + " ComponentSpec Services Calls Section Size is 0", csServicesCalls.length >
+ // 0);
}
- public void verifyServicesProvides(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Services Provides
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyServicesProvides(String type, OnapComponentSpec onapComponentSpec) {
Provides[] csServicesProvides = onapComponentSpec.getServices().getProvides();
assertNotNull(type + " ComponentSpec Services Provides is NULL", csServicesProvides);
- assertTrue(type + " ComponentSpec Services Provides Section Size is 0", csServicesProvides.length > 0);
+ assertTrue(
+ type + " ComponentSpec Services Provides Section Size is 0",
+ csServicesProvides.length > 0);
}
- public void verifyDockerConfig(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
- OnapAuxilary dockerConfig = nodeTemplateProperties.getDocker_config();
- assertNotNull(type +" Blueprint Docker Config Section is NULL", dockerConfig);
+ /**
+ * Verifies Docker Config
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyDockerConfig(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
+ OnapAuxilary dockerConfig = nodeTemplateProperties.getDocker_config();
+ assertNotNull(type + " Blueprint Docker Config Section is NULL", dockerConfig);
}
-
- public void verifyParameters(String type, OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplates) {
+ /**
+ * Verifies Parameters
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplates
+ */
+ public void verifyParameters(
+ String type, OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplates) {
Parameters[] csParameters = onapComponentSpec.getParameters();
- assertNotNull(type +" ComponentSpec Parameters Section is NULL", csParameters);
+ assertNotNull(type + " ComponentSpec Parameters Section is NULL", csParameters);
assertTrue(type + " ComponentSpec Parameters Section Size is 0", csParameters.length > 0);
}
- public void verifyAuxilary(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Auxilary
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyAuxilary(String type, OnapComponentSpec onapComponentSpec) {
OnapAuxilary csAuxilary = onapComponentSpec.getAuxilary();
- assertNotNull(type +" ComponentSpec Auxilary Section is NULL", csAuxilary);
+ assertNotNull(type + " ComponentSpec Auxilary Section is NULL", csAuxilary);
}
- public void verifyHealthCheck(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies HealthCheck
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyHealthCheck(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
HealthCheck csAuxilaryHealthcheck = onapComponentSpec.getAuxilary().getHealthcheck();
- assertNotNull(type +" ComponentSpec Auxilary Health Check Section is NULL", csAuxilaryHealthcheck);
+ assertNotNull(
+ type + " ComponentSpec Auxilary Health Check Section is NULL", csAuxilaryHealthcheck);
HealthCheck healthCheck = nodeTemplateProperties.getDocker_config().getHealthcheck();
- assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck Section is NULL", healthCheck);
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Interval Tag is not matching", healthCheck.getInterval(), csAuxilaryHealthcheck.getInterval());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Timeout Tag is not matching", healthCheck.getTimeout(), csAuxilaryHealthcheck.getTimeout());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Script Tag is not matching", healthCheck.getEndpoint(), csAuxilaryHealthcheck.getEndpoint());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Type Tag is not matching", healthCheck.getType(), csAuxilaryHealthcheck.getType());
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck Section is NULL",
+ healthCheck);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Interval Tag is not matching",
+ healthCheck.getInterval(),
+ csAuxilaryHealthcheck.getInterval());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Timeout Tag is not matching",
+ healthCheck.getTimeout(),
+ csAuxilaryHealthcheck.getTimeout());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Script Tag is not matching",
+ healthCheck.getEndpoint(),
+ csAuxilaryHealthcheck.getEndpoint());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Type Tag is not matching",
+ healthCheck.getType(),
+ csAuxilaryHealthcheck.getType());
}
- public void verifyVolumes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies Volumes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyVolumes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
Volumes[] csAuxilaryVolumes = onapComponentSpec.getAuxilary().getVolumes();
- assertNotNull(type +" ComponentSpec Auxilary Live Health Check Section is NULL", csAuxilaryVolumes);
+ assertNotNull(
+ type + " ComponentSpec Auxilary Live Health Check Section is NULL", csAuxilaryVolumes);
Volumes[] onapVolumes = nodeTemplateProperties.getDocker_config().getVolumes();
- assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:LiveHealthcheck Section is NULL", onapVolumes);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:DockerConfig:LiveHealthcheck Section is NULL",
+ onapVolumes);
}
- public void verifyArtifacts(String type,OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs,String bptype){
+ /**
+ * Verifies Artifacts
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param inputs
+ * @param bptype
+ */
+ public void verifyArtifacts(
+ String type,
+ OnapComponentSpec onapComponentSpec,
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String bptype) {
Artifacts[] csArtifacts = onapComponentSpec.getArtifacts();
assertNotNull(type + " ComponentSpec Artifacts Section is NULL", csArtifacts);
- assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("image").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
- //assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("tag_version").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
+ assertEquals(
+ type + " Blueprint:Artifacts:image is not matching",
+ ((String) inputs.get("image").get("default")),
+ "\"" + csArtifacts[0].getUri() + "\"");
+ // assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String)
+ // inputs.get("tag_version").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
}
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
index 9eb6899..984c262 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
@@ -1,26 +1,25 @@
/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia. All rights reserved.
- Copyright (c) 2020 AT&T. 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=========================================================
- */
+org.onap.dcae
+================================================================================
+Copyright (c) 2020 Nokia. All rights reserved.
+Copyright (c) 2020 AT&T. 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.test;
-
import org.junit.Test;
import org.junit.runners.Parameterized;
import org.onap.blueprintgenerator.model.common.Input;
@@ -30,7 +29,6 @@ import org.onap.blueprintgenerator.model.common.ExternalCertificateParameters;
import org.onap.blueprintgenerator.model.common.ExternalTlsInfo;
import org.onap.blueprintgenerator.model.dmaap.TlsInfo;
-
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -41,8 +39,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
-//@RunWith(Parameterized.class)
+/**
+ * Test Case for Tls Info
+ *
+ */
+// @RunWith(Parameterized.class)
public class TlsInfoTest extends BlueprintGeneratorTests {
@Parameterized.Parameter
@@ -53,89 +54,129 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
return Arrays.asList('o', 'd');
}
-
+ /**
+ * Test Case for Tls True and External TLS True
+ *
+ */
@Test
public void useTlsTrueAndUseExternalTlsTrueTest() {
- //Input input = input.setComponentSpecPath(componentSpecPath + "testComponentSpec_withTlsTrueAndExternalTlsTrue.json");
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndUseExternalTlsTrueTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsTrueAndUseExternalTlsTrueTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, true);
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
}
-
+ /**
+ * Test Case for Tls False and External TLS False
+ *
+ */
@Test
public void useTlsFalseAndUseExternalTlsFalseTest() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsFalseAndUseExternalTlsFalseTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsFalseAndUseExternalTlsFalseTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, false);
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, false);
}
+ /**
+ * Test Case for Tls True and No External TLS Flag
+ *
+ */
@Test
public void useTlsTrueAndNoExternalTlsFlagTest() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndNoExternalTlsFlagTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsTrueAndNoExternalTlsFlagTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
assertBlueprintHasNoExternalTlsInfo(bp);
}
+ /**
+ * Test Case for No Tls Info
+ *
+ */
@Test
public void noTlsInfo() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", noTlsInfo).toFile().getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get("src", "test", "resources", "componentspecs", noTlsInfo)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintHasNoTlsInfo(bp);
assertBlueprintHasNoExternalTlsInfo(bp);
}
- private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
- //should create proper inputs
+ private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(
+ OnapBlueprint bp, boolean useFlagDefault) {
+ // should create proper inputs
assertContainsInputWithDefault(bp, "external_cert_use_external_tls", useFlagDefault);
assertContainsInputWithDefault(bp, "external_cert_ca_name", "\"RA\"");
assertContainsInputWithDefault(bp, "external_cert_cert_type", "\"P12\"");
assertContainsInputWithDefault(bp, "external_cert_common_name", "\"sample.onap.org\"");
- assertContainsInputWithDefault(bp, "external_cert_sans",
- "\"sample.onap.org,component.sample.onap.org\"");
+ assertContainsInputWithDefault(
+ bp, "external_cert_sans", "\"sample.onap.org,component.sample.onap.org\"");
Node node = bp.getNode_templates().get("test.component.spec");
- //should create proper externalTlsInfo object in node properties
+ // should create proper externalTlsInfo object in node properties
ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
assertNotNull(externalTlsInfo);
assertEquals("external_cert_ca_name", externalTlsInfo.getCaName().getBpInputName());
assertEquals("external_cert_cert_type", externalTlsInfo.getCertType().getBpInputName());
- assertEquals("external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getBpInputName());
+ assertEquals(
+ "external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getBpInputName());
assertEquals("/opt/app/dcae-certificate/", externalTlsInfo.getExternalCertDirectory());
- ExternalCertificateParameters extCertParams = externalTlsInfo.getExternalCertificateParameters();
+ ExternalCertificateParameters extCertParams =
+ externalTlsInfo.getExternalCertificateParameters();
assertNotNull(extCertParams);
assertEquals("external_cert_common_name", extCertParams.getCommonName().getBpInputName());
assertEquals("external_cert_sans", extCertParams.getSans().getBpInputName());
}
- private void assertBlueprintContainsTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
- //shold create proper inputs
+ private void assertBlueprintContainsTlsInfoWithUseFlagDefault(
+ OnapBlueprint bp, boolean useFlagDefault) {
+ // shold create proper inputs
assertContainsInputWithDefault(bp, "use_tls", useFlagDefault);
Node node = bp.getNode_templates().get("test.component.spec");
- //should create proper tlsInfo object in node properties
+ // should create proper tlsInfo object in node properties
TlsInfo tlsInfo = node.getProperties().getTls_info();
assertEquals("use_tls", tlsInfo.getUseTls().getBpInputName());
assertEquals("/opt/app/dcae-certificate/", tlsInfo.getCertDirectory());
-
}
private void assertBlueprintHasNoExternalTlsInfo(OnapBlueprint bp) {
- //should not create inputs for external tls
+ // should not create inputs for external tls
assertFalse(bp.getInputs().containsKey("external_cert_use_external_tls"));
assertFalse(bp.getInputs().containsKey("external_cert_common_name"));
assertFalse(bp.getInputs().containsKey("external_cert_ca_name"));
@@ -143,23 +184,23 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
Node node = bp.getNode_templates().get("test.component.spec");
- //should not create externalTlsInfo object in node properties
+ // should not create externalTlsInfo object in node properties
ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
assertNull(externalTlsInfo);
}
-
private void assertBlueprintHasNoTlsInfo(OnapBlueprint bp) {
- //should not create inputs for tls
+ // should not create inputs for tls
assertFalse(bp.getInputs().containsKey("use_tls"));
Node node = bp.getNode_templates().get("test.component.spec");
- //should not create tlsInfo object in node properties
+ // should not create tlsInfo object in node properties
assertNull(node.getProperties().getTls_info());
}
- private void assertContainsInputWithDefault(OnapBlueprint bp, String inputName, Object defaultValue) {
+ private void assertContainsInputWithDefault(
+ OnapBlueprint bp, String inputName, Object defaultValue) {
LinkedHashMap<String, Object> input = bp.getInputs().get(inputName);
assertNotNull(input);
assertEquals(defaultValue, input.get("default"));
@@ -168,7 +209,8 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
private OnapBlueprint createBlueprintFromFile(String path) {
onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(path);
Input input = onapTestUtils.getInput(path, "", "", "", "o", "");
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
return onapBlueprint;
}
}