summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint')
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/AppconfigTest.java62
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java52
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfigTest.java38
-rw-r--r--mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java62
4 files changed, 0 insertions, 214 deletions
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/AppconfigTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/AppconfigTest.java
deleted file mode 100644
index 173d230..0000000
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/AppconfigTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- */
-
-package org.onap.blueprintgenerator.models.blueprint;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.LinkedHashMap;
-import java.util.TreeMap;
-import java.util.stream.Collectors;
-import org.junit.Test;
-import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-
-public class AppconfigTest {
-
- @Test
- public void createAppconfigShouldReturnExpectedResult() throws FileNotFoundException {
- TreeMap<String, LinkedHashMap<String, Object>> inputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- ComponentSpec cs = new ComponentSpec();
- cs.createComponentSpecFromFile("TestCases/testComponentSpec.json");
-
- TreeMap<String, LinkedHashMap<String, Object>> result = new Appconfig().createAppconfig(inputs, cs, "", false);
-
- assertEquals(getExpectedStringFromFile(), result.toString());
- }
-
- private String getExpectedStringFromFile() throws FileNotFoundException {
- File file = new File("TestCases/expects/createAppConfigResult.txt");
- InputStream inputStream = new FileInputStream(file);
- return readFromInputStream(inputStream);
- }
-
- private String readFromInputStream(InputStream inputStream) {
- return new BufferedReader(
- new InputStreamReader(inputStream, StandardCharsets.UTF_8))
- .lines()
- .collect(Collectors.joining(""));
- }
-}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java
deleted file mode 100644
index 1ce296a..0000000
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ImportsTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- */
-
-package org.onap.blueprintgenerator.models.blueprint;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Test;
-
-public class ImportsTest {
-
- private final List<String> expectedImports = Arrays.asList(
- "https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml",
- "plugin:k8splugin?version=3.4.1",
- "plugin:pgaas?version=1.3.0",
- "plugin:clamppolicyplugin?version=1.1.0",
- "plugin:dmaap?version=1.5.0"
- );
-
- @Test
- public void shouldReadImportsFromFile() {
- ArrayList<String> importsFromFile = Imports.createImportsFromFile("TestCases/imports/imports.yaml");
- assertEquals(expectedImports, importsFromFile);
- }
-
- @Test
- public void shouldRemoveBlankImportsFromFile() {
- ArrayList<String> importsFromFile =
- Imports.createImportsFromFile("TestCases/imports/importsWithBlanks.yaml");
- assertEquals(expectedImports, importsFromFile);
- }
-
-}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfigTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfigTest.java
deleted file mode 100644
index cf12da1..0000000
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfigTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- */
-
-package org.onap.blueprintgenerator.models.blueprint;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.LinkedHashMap;
-import java.util.TreeMap;
-import org.junit.Test;
-
-public class ResourceConfigTest {
-
- @Test
- public void createResourceConfig() {
- TreeMap<String, LinkedHashMap<String, Object>> result = new ResourceConfig()
- .createResourceConfig(new TreeMap<>(), "demo");
-
- String expectedResult = "{demo_cpu_limit={type=string, default=250m}, demo_cpu_request={type=string, default=250m}, demo_memory_limit={type=string, default=128Mi}, demo_memory_request={type=string, default=128Mi}}";
- assertEquals(expectedResult, result.toString());
- }
-}
diff --git a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java b/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java
deleted file mode 100644
index 1cdb58b..0000000
--- a/mod/bpgenerator/src/test/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactoryTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- */
-
-package org.onap.blueprintgenerator.models.blueprint.tls;
-
-import org.junit.Test;
-import org.onap.blueprintgenerator.models.blueprint.tls.impl.ExternalCertificateParameters;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.COMMON_NAME_FIELD;
-import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_COMMON_NAME;
-import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_SANS;
-import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.INPUT_PREFIX;
-import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.SANS_FIELD;
-
-public class ExternalCertificateParametersFactoryTest {
-
- private static final String PREFIXED_COMMON_NAME_FIELD = INPUT_PREFIX + COMMON_NAME_FIELD;
- private static final String PREFIXED_SANS_FIELD = INPUT_PREFIX + SANS_FIELD;
- private static final String DEFAULT = "default";
-
- @Test
- public void shouldCreateExternalCertificatePropertiesObject() {
- // given
- ExternalCertificateParametersFactory cut = new ExternalCertificateParametersFactory();
- // when
- ExternalCertificateParameters result = cut.create();
- // then
- assertEquals(result.getCommonName().getBpInputName(), PREFIXED_COMMON_NAME_FIELD);
- assertEquals(result.getSans().getBpInputName(), PREFIXED_SANS_FIELD);
- }
-
- @Test
- public void shouldCreateCorrectInputListWithDefaultValuesTakenFromComponentSpec() {
- // given
- ExternalCertificateParametersFactory cut = new ExternalCertificateParametersFactory();
- // when
- Map<String, LinkedHashMap<String, Object>> result = cut.createInputList();
- // then
- assertEquals(DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
- assertEquals(DEFAULT_SANS, result.get(PREFIXED_SANS_FIELD).get(DEFAULT));
- }
-}