aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-04-11 11:16:07 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-04-11 11:46:53 +0000
commitd8210d49cebb6f5d9cb13e0d27b36c378df94c51 (patch)
tree071b43a5ec05d6d4733eae9bd0eb2ae95494b249
parent99241659ac4764c069571551e8b9add6a9a6bd74 (diff)
Migrate TestNG to Junit5
Remove testNG dependency Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Iec178b4b019a4675058e6e90fbfc027796e02823 Issue-ID: SDC-3963
-rw-r--r--sdc-tosca/pom.xml6
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/BaseSetupExtension.java31
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/MyTest.java52
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/SdcToscaParserBasicTest.java249
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserConfigurationTest.java10
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserErrorHandlingTest.java212
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGeneralUtilTest.java8
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGroupTest.java13
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserInterfaceTest.java41
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserMetadataTest.java167
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserNodeTemplateTest.java19
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserPolicyTest.java25
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserReqAndCapTest.java12
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserServiceInputTest.java12
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSimpleYaml12Test.java6
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSubsMappingsTest.java68
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserValidationIssueTest.java157
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/elements/queries/TopologyTemplateQueryTest.java44
-rw-r--r--sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/impl/ToscaParserNodeTemplateMockTest.java2
19 files changed, 574 insertions, 560 deletions
diff --git a/sdc-tosca/pom.xml b/sdc-tosca/pom.xml
index 17289eb..18dd63f 100644
--- a/sdc-tosca/pom.xml
+++ b/sdc-tosca/pom.xml
@@ -54,12 +54,6 @@
<version>1.10.19</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>7.5</version>
- <scope>test</scope>
- </dependency>
<!-- Provides everything you need to write JUnit 5 Jupiter tests. -->
<dependency>
<groupId>org.junit.jupiter</groupId>
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/BaseSetupExtension.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/BaseSetupExtension.java
new file mode 100644
index 0000000..da26995
--- /dev/null
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/BaseSetupExtension.java
@@ -0,0 +1,31 @@
+package org.onap.sdc.impl;
+
+import static org.junit.jupiter.api.extension.ExtensionContext.Namespace.GLOBAL;
+
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
+
+public abstract class BaseSetupExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource {
+
+ @Override
+ public void beforeAll(ExtensionContext context) throws Exception {
+ // We need to use a unique key here, across all usages of this particular extension.
+ String uniqueKey = this.getClass().getName();
+ Object value = context.getRoot().getStore(GLOBAL).get(uniqueKey);
+ if (value == null) {
+ // First test container invocation.
+ context.getRoot().getStore(GLOBAL).put(uniqueKey, this);
+ setup();
+ }
+ }
+
+ // Callback that is invoked <em>exactly once</em>
+ // before the start of <em>all</em> test containers.
+ abstract void setup() throws SdcToscaParserException;
+
+ // Callback that is invoked <em>exactly once</em>
+ // after the end of <em>all</em> test containers.
+ // Inherited from {@code CloseableResource}
+ public abstract void close() throws Throwable;
+}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/MyTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/MyTest.java
index a1dcf5b..f252013 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/MyTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/MyTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,42 +20,30 @@
package org.onap.sdc.impl;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.testng.annotations.Test;
+import java.io.File;
+import java.util.List;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
-import java.io.File;
-
-import static org.onap.sdc.impl.SdcToscaParserBasicTest.getCsarHelper;
-
-public class MyTest {
-
- static SdcToscaParserFactory factory;
- static ISdcCsarHelper fdntCsarHelper;
-
- @Test
- public void testMyCsar() throws SdcToscaParserException {
-
-
-// factory = SdcToscaParserFactory.getInstance();
-// fdntCsarHelper = getCsarHelper("csars/service-Oren1-csar-4.csar");
-//
-//
-// List<NodeTemplate> serviceNodeTemplatesByType = fdntCsarHelper.getServiceNodeTemplatesByType("org.openecomp.nodes.ForwardingPath");
-//
-// String target_range = fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceNodeTemplatesByType.get(0), "target_range");
+class MyTest {
- }
+ @Test
+ @Disabled
+ void testMyCsar() throws SdcToscaParserException {
+ final var fdntCsarHelper = getCsarHelper("csars/resource-Vsp1-csar.csar");
+ List<NodeTemplate> serviceNodeTemplatesByType = fdntCsarHelper.getServiceNodeTemplatesByType("org.openecomp.nodes.ForwardingPath");
+ String target_range = fdntCsarHelper.getNodeTemplatePropertyLeafValue(serviceNodeTemplatesByType.get(0), "target_range");
- protected static ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException {
- System.out.println("Parsing CSAR "+path+"...");
- String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile();
- File file1 = new File(fileStr1);
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath());
- return sdcCsarHelper;
- }
+ }
+ private ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException {
+ System.out.println("Parsing CSAR " + path + "...");
+ final var file = new File(SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile());
+ return SdcToscaParserFactory.getInstance().getSdcCsarHelper(file.getAbsolutePath());
+ }
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/SdcToscaParserBasicTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/SdcToscaParserBasicTest.java
index 0dfe2df..5b3a4d9 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/SdcToscaParserBasicTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/SdcToscaParserBasicTest.java
@@ -7,9 +7,9 @@
* 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,22 +21,16 @@
package org.onap.sdc.impl;
import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.onap.sdc.toscaparser.api.common.JToscaException;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeSuite;
-public abstract class SdcToscaParserBasicTest {
+
+public class SdcToscaParserBasicTest extends BaseSetupExtension {
public static final String VF_CUSTOMIZATION_UUID = "56179cd8-de4a-4c38-919b-bbc4452d2d73";
static SdcToscaParserFactory factory;
@@ -53,138 +47,131 @@ public abstract class SdcToscaParserBasicTest {
static ISdcCsarHelper resolveGetInputCsarFalse;
static ISdcCsarHelper resolveGetInputCsarQA;
static ISdcCsarHelper resolveReqsCapsCsarQA;
- static ISdcCsarHelper portMirroring;
- static ISdcCsarHelper csarHelperServiceWithCrs;
- static ISdcCsarHelper csarHelperServicePolicy;
- static ISdcCsarHelper csarHelperVfPolicy;
- static ISdcCsarHelper csarHelperServiceGroups;
- static ISdcCsarHelper csarHelperServiceGroupsInputs;
- static ISdcCsarHelper csarHelperServiceGroupsCapabilities;
- static ISdcCsarHelper csarHelperVfGroupsPolicies;
- static ISdcCsarHelper csarHelperServiceGroupsPolicies;
- static ISdcCsarHelper csarHelperVfInterfaces;
- static ISdcCsarHelper csarHelperServiceAnnotations;
- static ISdcCsarHelper csarHelperServiceAdiodAnnotations;
- static ISdcCsarHelper csarHelperServiceNetworkCloud;
-
- static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data;
-
- @BeforeSuite
- public static void init() throws SdcToscaParserException, JToscaException, IOException {
+ static ISdcCsarHelper portMirroring;
+ static ISdcCsarHelper csarHelperServiceWithCrs;
+ static ISdcCsarHelper csarHelperServicePolicy;
+ static ISdcCsarHelper csarHelperVfPolicy;
+ static ISdcCsarHelper csarHelperServiceGroups;
+ static ISdcCsarHelper csarHelperServiceGroupsInputs;
+ static ISdcCsarHelper csarHelperServiceGroupsCapabilities;
+ static ISdcCsarHelper csarHelperVfGroupsPolicies;
+ static ISdcCsarHelper csarHelperServiceGroupsPolicies;
+ static ISdcCsarHelper csarHelperVfInterfaces;
+ static ISdcCsarHelper csarHelperServiceAnnotations;
+ static ISdcCsarHelper csarHelperServiceAdiodAnnotations;
+ static ISdcCsarHelper csarHelperServiceNetworkCloud;
+ static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data;
+ @Override
+ void setup() throws SdcToscaParserException {
factory = SdcToscaParserFactory.getInstance();
fdntCsarHelper = getCsarHelper("csars/service-sunny-flow.csar", false);
rainyCsarHelperMultiVfs = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar", false);
rainyCsarHelperSingleVf = getCsarHelper("csars/service-ServiceFdnt-csar.csar", false);
- fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar", false);
- nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar", false);
- ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar", false);
- nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar", false);
- nfodNEWCsarHlper = getCsarHelper("csars/service-Nfod2images-csar.csar", false);
- resolveGetInputCsar = getCsarHelper("csars/service-resolve-get-input-csar.csar");
- resolveGetInputCsarFalse = getCsarHelper("csars/service-resolve-get-input-csar.csar",false);
- resolveGetInputCsarQA = getCsarHelper("csars/service-resolve-get-input-csar_QA.csar");
- QAServiceForToscaParserTests = getCsarHelper("csars/service-ServiceForToscaParserTests-csar.csar");
- resolveReqsCapsCsarQA = getCsarHelper("csars/service-sunny-flow2.csar");
- portMirroring = getCsarHelper("csars/service-PortMirroring.csar");
- csarHelperServiceWithCrs = getCsarHelper("csars/service-CrTestService-csar.csar");
- csarHelperVfPolicy = getCsarHelper("csars/resource-Policy-csar.csar");
- csarHelperServicePolicy = getCsarHelper("csars/service-AlService-csar.csar");
- csarHelperServiceGroups = getCsarHelper("csars/service-Groupstest-csar.csar");
- csarHelperServiceGroupsInputs = getCsarHelper("csars/service-VdbeSrv-csar.csar");
- csarHelperServiceGroupsCapabilities = getCsarHelper("csars/service-VdbePx-csar.csar");
- csarHelperVfGroupsPolicies = getCsarHelper("csars/resource-Vdbe-csar.csar");
- csarHelperServiceGroupsPolicies = getCsarHelper("csars/service-VlanD2dSrv-csar.csar");
- csarHelperServiceAnnotations = getCsarHelper("csars/resource-Sirovinputannotation-csar.csar");
- csarHelperVfInterfaces = getCsarHelper("csars/service-CxSvc-csar.csar");
- csarHelperServiceAdiodAnnotations = getCsarHelper("csars/service-AdiodVmxVpeBvService-csar.csar");
- csarHelperServiceNetworkCloud = getCsarHelper("csars/service-NetworkCloudVnfServiceMock-csar.csar");
+ fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar", false);
+ nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar", false);
+ ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar", false);
+ nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar", false);
+ nfodNEWCsarHlper = getCsarHelper("csars/service-Nfod2images-csar.csar", false);
+ resolveGetInputCsar = getCsarHelper("csars/service-resolve-get-input-csar.csar");
+ resolveGetInputCsarFalse = getCsarHelper("csars/service-resolve-get-input-csar.csar", false);
+ resolveGetInputCsarQA = getCsarHelper("csars/service-resolve-get-input-csar_QA.csar");
+ QAServiceForToscaParserTests = getCsarHelper("csars/service-ServiceForToscaParserTests-csar.csar");
+ resolveReqsCapsCsarQA = getCsarHelper("csars/service-sunny-flow2.csar");
+ portMirroring = getCsarHelper("csars/service-PortMirroring.csar");
+ csarHelperServiceWithCrs = getCsarHelper("csars/service-CrTestService-csar.csar");
+ csarHelperVfPolicy = getCsarHelper("csars/resource-Policy-csar.csar");
+ csarHelperServicePolicy = getCsarHelper("csars/service-AlService-csar.csar");
+ csarHelperServiceGroups = getCsarHelper("csars/service-Groupstest-csar.csar");
+ csarHelperServiceGroupsInputs = getCsarHelper("csars/service-VdbeSrv-csar.csar");
+ csarHelperServiceGroupsCapabilities = getCsarHelper("csars/service-VdbePx-csar.csar");
+ csarHelperVfGroupsPolicies = getCsarHelper("csars/resource-Vdbe-csar.csar");
+ csarHelperServiceGroupsPolicies = getCsarHelper("csars/service-VlanD2dSrv-csar.csar");
+ csarHelperServiceAnnotations = getCsarHelper("csars/resource-Sirovinputannotation-csar.csar");
+ csarHelperVfInterfaces = getCsarHelper("csars/service-CxSvc-csar.csar");
+ csarHelperServiceAdiodAnnotations = getCsarHelper("csars/service-AdiodVmxVpeBvService-csar.csar");
+ csarHelperServiceNetworkCloud = getCsarHelper("csars/service-NetworkCloudVnfServiceMock-csar.csar");
+
+ fdntCsarHelper_Data = new HashMap<>() {
+ {
+ HashMap<String, List<String>> FDNT;
+
+ FDNT = new HashMap<>();
+ FDNT.put("VF Name", Arrays.asList("FDNT 1"));
+ FDNT.put("capabilities", Arrays.asList(
+ "dnt_fw_rhrg.binding_DNT_FW_INT_DNS_TRUSTED_RVMI",
+ "dnt_fw_rhrg.host_DNT_FW_SERVER",
+ "dnt_fw_rhrg.binding_DNT_FW_CORE_DIRECT_RVMI",
+ "dnt_fw_rhrg.scalable_DNT_FW_SERVER",
+ "dnt_fw_rhrg.endpoint_DNT_FW_SERVER",
+ "dnt_fw_rhrg.binding_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
+ "dnt_fw_rhrg.os_DNT_FW_SERVER",
+ "dnt_fw_rhrg.feature",
+ "dnt_fw_rhrg.binding_DNT_FW_OAM_PROTECTED_RVMI",
+ "dnt_fw_rhrg.binding_DNT_FW_SERVER",
+ "dnt_fw_rhrg.binding_DNT_FW_NIMBUS_HSL_RVMI",
+ "dnt_fw_rsg_si_1.feature"));
+ FDNT.put("requirements", Arrays.asList(
+ "DNT_FW_RSG_SI_1.dependency",
+ "DNT_FW_RHRG.dependency",
+ "DNT_FW_RHRG.link_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
+ "DNT_FW_RHRG.link_DNT_FW_CORE_DIRECT_RVMI",
+ "DNT_FW_RHRG.link_DNT_FW_OAM_PROTECTED_RVMI",
+ "DNT_FW_RHRG.link_DNT_FW_INT_DNS_TRUSTED_RVMI",
+ "DNT_FW_RHRG.link_DNT_FW_NIMBUS_HSL_RVMI",
+ "DNT_FW_RSG_SI_1.port",
+ "DNT_FW_RHRG.local_storage_DNT_FW_SERVER"));
+ FDNT.put("capabilitiesTypes", Arrays.asList(
+ "tosca.capabilities.network.Bindable",
+ "tosca.capabilities.OperatingSystem",
+ "tosca.capabilities.network.Bindable",
+ "tosca.capabilities.Scalable",
+ "tosca.capabilities.Endpoint.Admin",
+ "tosca.capabilities.network.Bindable",
+ "tosca.capabilities.network.Bindable",
+ "tosca.capabilities.network.Bindable",
+ "tosca.capabilities.Node",
+ "tosca.capabilities.Container",
+ "tosca.nodes.SoftwareComponent",
+ "tosca.capabilities.network.Bindable"));
+ FDNT.put("capabilityProperties", Arrays.asList(
+ "dnt_fw_rhrg.binding_DNT_FW_INT_DNS_TRUSTED_RVMI:none",
+ "dnt_fw_rhrg.host_DNT_FW_SERVER:num_cpus,integer,false;",
+ "dnt_fw_rhrg.binding_DNT_FW_CORE_DIRECT_RVMI",
+ "dnt_fw_rhrg.scalable_DNT_FW_SERVER",
+ "dnt_fw_rhrg.endpoint_DNT_FW_SERVER",
+ "dnt_fw_rhrg.binding_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
+ "dnt_fw_rhrg.os_DNT_FW_SERVER",
+ "dnt_fw_rhrg.feature",
+ "dnt_fw_rhrg.binding_DNT_FW_OAM_PROTECTED_RVMI",
+ "dnt_fw_rhrg.binding_DNT_FW_SERVER",
+ "dnt_fw_rhrg.binding_DNT_FW_NIMBUS_HSL_RVMI",
+ "dnt_fw_rsg_si_1.feature"));
- fdntCsarHelper_Data = new HashMap<String, HashMap<String, List<String>>>(){
- {
- HashMap<String, List<String>> FDNT ;
-
- FDNT = new HashMap<String, List<String>>();
- FDNT.put("VF Name", Arrays.asList("FDNT 1"));
- FDNT.put("capabilities", Arrays.asList(
- "dnt_fw_rhrg.binding_DNT_FW_INT_DNS_TRUSTED_RVMI",
- "dnt_fw_rhrg.host_DNT_FW_SERVER",
- "dnt_fw_rhrg.binding_DNT_FW_CORE_DIRECT_RVMI",
- "dnt_fw_rhrg.scalable_DNT_FW_SERVER",
- "dnt_fw_rhrg.endpoint_DNT_FW_SERVER",
- "dnt_fw_rhrg.binding_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
- "dnt_fw_rhrg.os_DNT_FW_SERVER",
- "dnt_fw_rhrg.feature",
- "dnt_fw_rhrg.binding_DNT_FW_OAM_PROTECTED_RVMI",
- "dnt_fw_rhrg.binding_DNT_FW_SERVER",
- "dnt_fw_rhrg.binding_DNT_FW_NIMBUS_HSL_RVMI",
- "dnt_fw_rsg_si_1.feature"));
- FDNT.put("requirements", Arrays.asList(
- "DNT_FW_RSG_SI_1.dependency",
- "DNT_FW_RHRG.dependency",
- "DNT_FW_RHRG.link_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
- "DNT_FW_RHRG.link_DNT_FW_CORE_DIRECT_RVMI",
- "DNT_FW_RHRG.link_DNT_FW_OAM_PROTECTED_RVMI",
- "DNT_FW_RHRG.link_DNT_FW_INT_DNS_TRUSTED_RVMI",
- "DNT_FW_RHRG.link_DNT_FW_NIMBUS_HSL_RVMI",
- "DNT_FW_RSG_SI_1.port",
- "DNT_FW_RHRG.local_storage_DNT_FW_SERVER"));
- FDNT.put("capabilitiesTypes", Arrays.asList(
- "tosca.capabilities.network.Bindable",
- "tosca.capabilities.OperatingSystem",
- "tosca.capabilities.network.Bindable",
- "tosca.capabilities.Scalable",
- "tosca.capabilities.Endpoint.Admin",
- "tosca.capabilities.network.Bindable",
- "tosca.capabilities.network.Bindable",
- "tosca.capabilities.network.Bindable",
- "tosca.capabilities.Node",
- "tosca.capabilities.Container",
- "tosca.nodes.SoftwareComponent",
- "tosca.capabilities.network.Bindable"));
- FDNT.put("capabilityProperties", Arrays.asList(
- "dnt_fw_rhrg.binding_DNT_FW_INT_DNS_TRUSTED_RVMI:none",
- "dnt_fw_rhrg.host_DNT_FW_SERVER:num_cpus,integer,false;",
- "dnt_fw_rhrg.binding_DNT_FW_CORE_DIRECT_RVMI",
- "dnt_fw_rhrg.scalable_DNT_FW_SERVER",
- "dnt_fw_rhrg.endpoint_DNT_FW_SERVER",
- "dnt_fw_rhrg.binding_DNT_FW_INTERNET_DNS_DIRECT_RVMI",
- "dnt_fw_rhrg.os_DNT_FW_SERVER",
- "dnt_fw_rhrg.feature",
- "dnt_fw_rhrg.binding_DNT_FW_OAM_PROTECTED_RVMI",
- "dnt_fw_rhrg.binding_DNT_FW_SERVER",
- "dnt_fw_rhrg.binding_DNT_FW_NIMBUS_HSL_RVMI",
- "dnt_fw_rsg_si_1.feature"));
-
-
- put("FDNT", FDNT);
- }
- };
- };
+ put("FDNT", FDNT);
+ }
+ };
- protected static ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException {
- System.out.println("Parsing CSAR "+path+"...");
- String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile();
+ }
+
+ protected ISdcCsarHelper getCsarHelper(String path) throws SdcToscaParserException {
+ System.out.println("Parsing CSAR " + path + "...");
+ String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile();
File file1 = new File(fileStr1);
ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath());
- return sdcCsarHelper;
- }
-
- protected static ISdcCsarHelper getCsarHelper(String path, boolean resolveGetInput) throws SdcToscaParserException {
- System.out.println("Parsing CSAR "+path+"...");
- String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile();
- File file1 = new File(fileStr1);
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath(), resolveGetInput);
- return sdcCsarHelper;
- }
+ return sdcCsarHelper;
+ }
- @BeforeMethod
- public void setupTest(Method method) {
- System.out.println("#### Starting Test " + method.getName() + " ###########");
+ protected ISdcCsarHelper getCsarHelper(String path, boolean resolveGetInput) throws SdcToscaParserException {
+ System.out.println("Parsing CSAR " + path + "...");
+ String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile();
+ File file1 = new File(fileStr1);
+ ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath(), resolveGetInput);
+ return sdcCsarHelper;
}
- @AfterMethod
- public void tearDown(Method method){
- System.out.println("#### Ended test " + method.getName() + " ###########");
+ @Override
+ public void close() {
+ // Your "after all tests" logic goes here
}
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserConfigurationTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserConfigurationTest.java
index 30f85e8..c11600f 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserConfigurationTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserConfigurationTest.java
@@ -20,16 +20,18 @@
package org.onap.sdc.impl;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.config.ErrorConfiguration;
import org.onap.sdc.tosca.parser.config.JtoscaValidationIssueConfiguration;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.tosca.parser.config.Configuration;
import org.onap.sdc.tosca.parser.config.ConfigurationManager;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
-public class ToscaParserConfigurationTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserConfigurationTest extends SdcToscaParserBasicTest {
@Test
public void testConfigurationConformanceLevel() {
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserErrorHandlingTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserErrorHandlingTest.java
index 6c88494..0067377 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserErrorHandlingTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserErrorHandlingTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,121 +20,121 @@
package org.onap.sdc.impl;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
-
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.onap.sdc.toscaparser.api.utils.JToscaErrorCodes;
+@ExtendWith({SdcToscaParserBasicTest.class})
+class ToscaParserErrorHandlingTest extends SdcToscaParserBasicTest {
+ @Test
+ public void testMissingMetadata() {
+ String csarPath = "csars/service-missing-meta-file.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ File file = new File(fileLocationString);
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
-public class ToscaParserErrorHandlingTest extends SdcToscaParserBasicTest {
-
-
- @Test
- public void testMissingMetadata(){
- String csarPath = "csars/service-missing-meta-file.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ @Test
+ public void testInvalidYamlContentMeta() {
+ String csarPath = "csars/service-invalid-yaml-content-meta.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
-
- @Test
- public void testInvalidYamlContentMeta(){
- String csarPath = "csars/service-invalid-yaml-content-meta.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
+
+ @Test
+ public void testEntryDefinitionNotDefined() {
+ String csarPath = "csars/service-entry-definition-not-defined.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
- @Test
- public void testEntryDefinitionNotDefined(){
- String csarPath = "csars/service-entry-definition-not-defined.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
+
+ @Test
+ public void testMissingEntryDefinitionFile() {
+ String csarPath = "csars/service-missing-entry-definition.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
- @Test
- public void testMissingEntryDefinitionFile(){
- String csarPath = "csars/service-missing-entry-definition.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
+
+ //@Test - PA - there are currently no critical erros in JTosca
+ public void tesValidationError() {
+ String csarPath = "csars/service-invalid-input-args.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ File file = new File(fileLocationString);
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
+
+ @Test
+ public void testInValidMinConformanceLevelError() {
+ String csarPath = "csars/service-invalid-conformence-level.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
- //@Test - PA - there are currently no critical erros in JTosca
- public void tesValidationError(){
- String csarPath = "csars/service-invalid-input-args.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0003");
+ }
+
+ @Test
+ public void testIgnoreMaxConformanceLevelNoError() {
+ String csarPath = "csars/service-max-conformence-level.csar";
+ //TODO: Currently, the conformentce level of the csar for this test is 99 (hard coded). Consider to add ability to replace the configuration in run time.
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
- @Test
- public void testInValidMinConformanceLevelError(){
- String csarPath = "csars/service-invalid-conformence-level.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ assertNull(captureThrowable);
+ }
+
+ @Test
+ public void testVerifyConformanceLevelVersion9() {
+ String csarPath = "csars/service-Servicetosca9-csar.csar";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0003");
- }
-
- @Test
- public void testIgnoreMaxConformanceLevelNoError(){
- String csarPath = "csars/service-max-conformence-level.csar";
- //TODO: Currently, the conformentce level of the csar for this test is 99 (hard coded). Consider to add ability to replace the configuration in run time.
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
- File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- assertNull(captureThrowable);
- }
-
- @Test
- public void testVerifyConformanceLevelVersion9(){
- String csarPath = "csars/service-Servicetosca9-csar.csar";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
- File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- assertNull(captureThrowable);
- }
-
- @Test
- public void testFileNotFound(){
- Throwable captureThrowable = captureThrowable("csars/XXX.csar");
- testThrowable(captureThrowable, "TP0001");
- }
-
- @Test
- public void testInvalidCsarFormat(){
- String csarPath = "csars/csar-invalid-zip.zip";
- String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ assertNull(captureThrowable);
+ }
+
+ @Test
+ public void testFileNotFound() {
+ Throwable captureThrowable = captureThrowable("csars/XXX.csar");
+ testThrowable(captureThrowable, "TP0001");
+ }
+
+ @Test
+ public void testInvalidCsarFormat() {
+ String csarPath = "csars/csar-invalid-zip.zip";
+ String fileLocationString = ToscaParserErrorHandlingTest.class.getClassLoader().getResource(csarPath).getFile();
File file = new File(fileLocationString);
- Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
- testThrowable(captureThrowable, "TP0002");
- }
-
- private static void testThrowable(Throwable captureThrowable, String expectedCode) {
- assertNotNull(captureThrowable);
- assertTrue(captureThrowable instanceof SdcToscaParserException, "Error thrown is of type "+captureThrowable.getClass().getSimpleName());
- assertEquals(((SdcToscaParserException)captureThrowable).getCode(), expectedCode);
- }
-
- public static Throwable captureThrowable(String csarPath) {
- Throwable result = null;
- try {
- factory.getSdcCsarHelper(csarPath);
- } catch( Throwable throwable ) {
- result = throwable;
- }
- return result;
- }
+ Throwable captureThrowable = captureThrowable(file.getAbsolutePath());
+ testThrowable(captureThrowable, "TP0002");
+ }
+
+ private void testThrowable(Throwable captureThrowable, String expectedCode) {
+ assertNotNull(captureThrowable);
+ assertTrue(captureThrowable instanceof SdcToscaParserException, "Error thrown is of type " + captureThrowable.getClass().getSimpleName());
+ assertEquals(((SdcToscaParserException) captureThrowable).getCode(), expectedCode);
+ }
+
+ public Throwable captureThrowable(String csarPath) {
+ Throwable result = null;
+ try {
+ factory.getSdcCsarHelper(csarPath);
+ } catch (Throwable throwable) {
+ result = throwable;
+ }
+ return result;
+ }
+
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGeneralUtilTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGeneralUtilTest.java
index c242d85..947a7f1 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGeneralUtilTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGeneralUtilTest.java
@@ -20,12 +20,14 @@
package org.onap.sdc.impl;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.utils.GeneralUtility;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ToscaParserGeneralUtilTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserGeneralUtilTest extends SdcToscaParserBasicTest {
@Test
public void testVersionCompare() {
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGroupTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGroupTest.java
index dc79bb1..c0cd873 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGroupTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserGroupTest.java
@@ -20,16 +20,21 @@
package org.onap.sdc.impl;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import java.util.List;
-import static org.testng.Assert.*;
-
-public class ToscaParserGroupTest extends SdcToscaParserBasicTest{
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserGroupTest extends SdcToscaParserBasicTest{
//region getVfModulesByVf
@Test
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserInterfaceTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserInterfaceTest.java
index a22fd11..9cc9e86 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserInterfaceTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserInterfaceTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,25 +20,21 @@
package org.onap.sdc.impl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import org.mockito.internal.util.collections.Sets;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.InterfacesDef;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-public class ToscaParserInterfaceTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+class ToscaParserInterfaceTest extends SdcToscaParserBasicTest {
- List<NodeTemplate> vfs;
-
- @BeforeClass
- public void setup(){
- vfs = csarHelperVfInterfaces.getServiceVfList();
- }
+ private static List<NodeTemplate> vfs = csarHelperVfInterfaces.getServiceVfList();
@Test
public void testGetInterfaceOf() {
@@ -51,12 +47,13 @@ public class ToscaParserInterfaceTest extends SdcToscaParserBasicTest {
public void testGetInterfaces() {
List<String> interfaceNames = csarHelperVfInterfaces.getInterfaces(vfs.get(0));
assertNotNull(interfaceNames);
- assertEquals(interfaceNames, Sets.newSet("org.openecomp.interfaces.node.lifecycle.CxVnf1", "tosca.interfaces.node.lifecycle.Standard"));
+ assertEquals(interfaceNames, Arrays.asList("org.openecomp.interfaces.node.lifecycle.CxVnf1", "tosca.interfaces.node.lifecycle.Standard"));
}
@Test
public void testGetInterfaceDetails() {
- List<InterfacesDef> interfaceDetails = csarHelperVfInterfaces.getInterfaceDetails(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1");
+ List<InterfacesDef> interfaceDetails = csarHelperVfInterfaces.getInterfaceDetails(vfs.get(0),
+ "org.openecomp.interfaces.node.lifecycle.CxVnf1");
assertNotNull(interfaceDetails);
assertEquals(interfaceDetails.get(0).getOperationName(), "instantiate");
assertEquals(interfaceDetails.get(1).getOperationName(), "upgrade");
@@ -66,23 +63,25 @@ public class ToscaParserInterfaceTest extends SdcToscaParserBasicTest {
public void testGetAllInterfaceOperations() {
List<String> operations = csarHelperVfInterfaces.getAllInterfaceOperations(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1");
assertNotNull(operations);
- assertEquals(operations, Sets.newSet("instantiate", "upgrade", "create", "configure", "start", "stop", "delete"));
+ assertEquals(operations, Arrays.asList("instantiate", "upgrade", "create", "configure", "start", "stop", "delete"));
}
@Test
public void testGetInterfaceOperationDetails() {
- InterfacesDef interfaceDef = csarHelperVfInterfaces.getInterfaceOperationDetails(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1", "instantiate");
+ InterfacesDef interfaceDef = csarHelperVfInterfaces.getInterfaceOperationDetails(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1",
+ "instantiate");
assertNotNull(interfaceDef);
assertEquals(interfaceDef.getOperationName(), "instantiate");
}
@Test
public void testGetInterfaceOperationImplementationDetails() {
- InterfacesDef interfaceDef = csarHelperVfInterfaces.getInterfaceOperationDetails(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1", "upgrade");
+ InterfacesDef interfaceDef = csarHelperVfInterfaces.getInterfaceOperationDetails(vfs.get(0), "org.openecomp.interfaces.node.lifecycle.CxVnf1",
+ "upgrade");
assertNotNull(interfaceDef);
assertNotNull(interfaceDef.getImplementation());
- assertEquals(((Map)interfaceDef.getImplementation()).get("primary"), "Artifacts/Deployment/WORKFLOW/CreateWorkFlow.json");
- assertEquals(((Map)interfaceDef.getImplementation()).get("dependencies"), "TestDependency1");
+ assertEquals(((Map) interfaceDef.getImplementation()).get("primary"), "Artifacts/Deployment/WORKFLOW/CreateWorkFlow.json");
+ assertEquals(((Map) interfaceDef.getImplementation()).get("dependencies"), "TestDependency1");
}
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserMetadataTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserMetadataTest.java
index 2acd5a4..7033da9 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserMetadataTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserMetadataTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,21 +20,23 @@
package org.onap.sdc.impl;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.config.ConfigurationManager;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.testng.annotations.Test;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
+@ExtendWith({SdcToscaParserBasicTest.class})
public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
//region getServiceMetadata
@@ -77,7 +79,7 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
@Test
public void testGetMetadataByEmptyPropertyValue() {
- Metadata metadata = rainyCsarHelperMultiVfs.getServiceMetadata();
+ Metadata metadata = rainyCsarHelperMultiVfs.getServiceMetadata();
String value = rainyCsarHelperMultiVfs.getMetadataPropertyValue(metadata, "");
assertNull(value);
}
@@ -114,8 +116,8 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
public void testServiceMetadataPropertiesMap() {
Map<String, Object> metadata = fdntCsarHelper.getServiceMetadataProperties();
assertNotNull(metadata);
- assertEquals(metadata.size(),9);
- assertEquals(metadata.get("namingPolicy"),"test");
+ assertEquals(metadata.size(), 9);
+ assertEquals(metadata.get("namingPolicy"), "test");
}
//endregion
@@ -130,8 +132,8 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
public void testServiceMetadataAllPropertiesMap() {
Map<String, String> metadata = fdntCsarHelper.getServiceMetadataAllProperties();
assertNotNull(metadata);
- assertEquals(metadata.size(),9);
- assertEquals(metadata.get("namingPolicy"),"test");
+ assertEquals(metadata.size(), 9);
+ assertEquals(metadata.get("namingPolicy"), "test");
}
//endregion
@@ -151,54 +153,54 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
assertNull(metadata);
}
//endregion
-
+
//QA tests region for US 319197 -port mirroring
-
- //getNodeTemplateMetadata (All Types)
- @Test
+
+ //getNodeTemplateMetadata (All Types)
+ @Test
public void GetServiceNodeTemplateMetadataTypeVF() {
- NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("VF_1_V_port_1 0");
- Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
- assertNotNull(nodeTemplateMetadata);
- assertEquals(nodeTemplateMetadata.getValue("resourceVendorRelease"), "12-12-12");
- assertEquals(nodeTemplateMetadata.getValue("type"), "VF");
- }
-
- @Test
+ NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("VF_1_V_port_1 0");
+ Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
+ assertNotNull(nodeTemplateMetadata);
+ assertEquals(nodeTemplateMetadata.getValue("resourceVendorRelease"), "12-12-12");
+ assertEquals(nodeTemplateMetadata.getValue("type"), "VF");
+ }
+
+ @Test
public void GetServiceNodeTemplateMetadataTypeVL() {
- NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("ExtVL 0");
- Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
- assertNotNull(nodeTemplateMetadata);
- assertEquals(nodeTemplateMetadata.getValue("resourceVendorRelease"), "1.0.0.wd03");
- assertEquals(nodeTemplateMetadata.getValue("type"), "VL");
- }
-
- @Test
+ NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("ExtVL 0");
+ Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
+ assertNotNull(nodeTemplateMetadata);
+ assertEquals(nodeTemplateMetadata.getValue("resourceVendorRelease"), "1.0.0.wd03");
+ assertEquals(nodeTemplateMetadata.getValue("type"), "VL");
+ }
+
+ @Test
public void GetServiceNodeTemplateMetadataTypeCP() {
- NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("ExtCP 0");
- Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
- assertNotNull(nodeTemplateMetadata);
- assertEquals(nodeTemplateMetadata.getValue("UUID"), "7a883088-5cab-4bfb-8d55-307d3ffd0758");
- assertEquals(nodeTemplateMetadata.getValue("type"), "CP");
- }
-
- @Test
+ NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("ExtCP 0");
+ Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
+ assertNotNull(nodeTemplateMetadata);
+ assertEquals(nodeTemplateMetadata.getValue("UUID"), "7a883088-5cab-4bfb-8d55-307d3ffd0758");
+ assertEquals(nodeTemplateMetadata.getValue("type"), "CP");
+ }
+
+ @Test
public void GetServiceNodeTemplateMetadataTypePNF() {
- NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("PNF TEST 0");
- Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
- assertNotNull(nodeTemplateMetadata);
- assertEquals(nodeTemplateMetadata.getValue("resourceVendorModelNumber"), "");
- assertEquals(nodeTemplateMetadata.getValue("type"), "PNF");
- }
-
- //QA end region for US 319197 -port mirroring
-
+ NodeTemplate nodeTemplate = QAServiceForToscaParserTests.getServiceNodeTemplateByNodeName("PNF TEST 0");
+ Metadata nodeTemplateMetadata = QAServiceForToscaParserTests.getNodeTemplateMetadata(nodeTemplate);
+ assertNotNull(nodeTemplateMetadata);
+ assertEquals(nodeTemplateMetadata.getValue("resourceVendorModelNumber"), "");
+ assertEquals(nodeTemplateMetadata.getValue("type"), "PNF");
+ }
+
+ //QA end region for US 319197 -port mirroring
+
// Added by QA //region getServiceMetadataAllProperties
@Test
public void testGetAllMetadataProperties() {
- Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata();
- assertNotNull(serviceMetadata);
+ Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata();
+ assertNotNull(serviceMetadata);
Map<String, String> allProperties = serviceMetadata.getAllProperties();
assertNotNull(allProperties);
String invariantUUID = allProperties.get("invariantUUID");
@@ -223,33 +225,32 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
}
//endregion
- @Test
- public void testCSARMissingConformanceLevelWithCustomErrorConfig() throws
- SdcToscaParserException {
-
- ConfigurationManager configurationManager = ConfigurationManager.getInstance();
- try {
- configurationManager.setErrorConfiguration("error-configuration-test.yaml");
- SdcToscaParserFactory.setConfigurationManager(configurationManager);
- ISdcCsarHelper missingCSARMetaCsarCustomConfig = getCsarHelper
- ("csars/service-missing-csar-meta-file.csar");
- String conformanceLevel = missingCSARMetaCsarCustomConfig.getConformanceLevel();
- assertNotNull(conformanceLevel);
- assertEquals(conformanceLevel, configurationManager.getConfiguration().getConformanceLevel()
- .getMaxVersion());
- }
- finally {
- configurationManager.setErrorConfiguration("error-configuration.yaml");
- SdcToscaParserFactory.setConfigurationManager(configurationManager);
- }
-
- }
-
- @Test(expectedExceptions = SdcToscaParserException.class)
- public void testCSARMissingConformanceLevelWithDefaultErrorConfig() throws
- SdcToscaParserException {
- ISdcCsarHelper missingCSARMetaCsarDefaultConfig = getCsarHelper("csars/service-missing-csar-meta-file.csar");
- missingCSARMetaCsarDefaultConfig.getConformanceLevel();
- }
-
+ @Test
+ public void testCSARMissingConformanceLevelWithCustomErrorConfig() throws SdcToscaParserException {
+
+ ConfigurationManager configurationManager = ConfigurationManager.getInstance();
+ try {
+ configurationManager.setErrorConfiguration("error-configuration-test.yaml");
+ SdcToscaParserFactory.setConfigurationManager(configurationManager);
+ ISdcCsarHelper missingCSARMetaCsarCustomConfig = getCsarHelper
+ ("csars/service-missing-csar-meta-file.csar");
+ String conformanceLevel = missingCSARMetaCsarCustomConfig.getConformanceLevel();
+ assertNotNull(conformanceLevel);
+ assertEquals(conformanceLevel, configurationManager.getConfiguration().getConformanceLevel()
+ .getMaxVersion());
+ } finally {
+ configurationManager.setErrorConfiguration("error-configuration.yaml");
+ SdcToscaParserFactory.setConfigurationManager(configurationManager);
+ }
+
+ }
+
+ @Test
+ void testCSARMissingConformanceLevelWithDefaultErrorConfig() {
+ assertThrows(SdcToscaParserException.class, () -> {
+ ISdcCsarHelper missingCSARMetaCsarDefaultConfig = getCsarHelper("csars/service-missing-csar-meta-file.csar");
+ missingCSARMetaCsarDefaultConfig.getConformanceLevel();
+ });
+ }
+
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserNodeTemplateTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserNodeTemplateTest.java
index 1a36506..408693b 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserNodeTemplateTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserNodeTemplateTest.java
@@ -20,16 +20,19 @@
package org.onap.sdc.impl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.*;
import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.tuple.Pair;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.enums.FilterType;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
@@ -41,9 +44,9 @@ import org.onap.sdc.toscaparser.api.Policy;
import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.parameters.Annotation;
import org.onap.sdc.toscaparser.api.parameters.Input;
-import org.testng.annotations.Test;
-public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
//region getServiceVfList
@Test
@@ -1327,5 +1330,3 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
}
}
-
-
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserPolicyTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserPolicyTest.java
index ea5212a..e87b54a 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserPolicyTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserPolicyTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,30 +20,29 @@
package org.onap.sdc.impl;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.net.URL;
+import java.util.List;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Policy;
-import java.net.URL;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
public class ToscaParserPolicyTest {
private static ISdcCsarHelper helper = null;
- @BeforeClass
+ @BeforeAll
public static void setUpClass() {
try {
URL resource = GetEntityPortMirroringTest.class.getClassLoader()
- .getResource("csars/service-CgnatFwVnfNc-csar.csar");
+ .getResource("csars/service-CgnatFwVnfNc-csar.csar");
if (resource != null) {
helper = SdcToscaParserFactory.getInstance().getSdcCsarHelper(resource.getFile());
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserReqAndCapTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserReqAndCapTest.java
index 7d4aaf3..a326b61 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserReqAndCapTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserReqAndCapTest.java
@@ -20,20 +20,22 @@
package org.onap.sdc.impl;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.toscaparser.api.CapabilityAssignments;
import org.onap.sdc.toscaparser.api.CapabilityAssignment;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.RequirementAssignments;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
-public class ToscaParserReqAndCapTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserReqAndCapTest extends SdcToscaParserBasicTest {
//region getCapabilitiesOf
@Test
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserServiceInputTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserServiceInputTest.java
index d6bbc93..56338b8 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserServiceInputTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserServiceInputTest.java
@@ -20,16 +20,18 @@
package org.onap.sdc.impl;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.toscaparser.api.parameters.Input;
import java.util.List;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
-public class ToscaParserServiceInputTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserServiceInputTest extends SdcToscaParserBasicTest {
//region getServiceInputs
@Test
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSimpleYaml12Test.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSimpleYaml12Test.java
index e1b16c1..21c6f2d 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSimpleYaml12Test.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSimpleYaml12Test.java
@@ -20,14 +20,14 @@
package org.onap.sdc.impl;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
public class ToscaParserSimpleYaml12Test {
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSubsMappingsTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSubsMappingsTest.java
index c9ad332..83ee5bd 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSubsMappingsTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserSubsMappingsTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,24 +20,20 @@
package org.onap.sdc.impl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import java.util.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
-import org.onap.sdc.toscaparser.api.elements.CapabilityTypeDef;
-//import org.testng.ReporterConfig.Property;
-import org.testng.annotations.Test;
-import org.onap.sdc.toscaparser.api.Property;
-
-//import static org.junit.Assert.assertEquals;
-//import static org.junit.Assert.assertNull;
-public class ToscaParserSubsMappingsTest extends SdcToscaParserBasicTest {
+@ExtendWith({SdcToscaParserBasicTest.class})
+ class ToscaParserSubsMappingsTest extends SdcToscaParserBasicTest {
//region getServiceSubstitutionMappingsTypeName
@Test
@@ -52,9 +48,9 @@ public class ToscaParserSubsMappingsTest extends SdcToscaParserBasicTest {
assertNull(substitutionMappingsTypeName);
}
//endregion
-
- //Added by QA - Check for Capabilities in VF level (Capabilities QTY and Names).
- //@Test // - BUG 283369
+
+ //Added by QA - Check for Capabilities in VF level (Capabilities QTY and Names).
+ //@Test // - BUG 283369
// public void testCapabilitiesofVFNames_QTY() throws SdcToscaParserException {
// List<NodeTemplate> serviceVfList = fdntCsarHelper.getServiceVfList();
// String sName = serviceVfList.get(0).getName();
@@ -82,9 +78,9 @@ public class ToscaParserSubsMappingsTest extends SdcToscaParserBasicTest {
//
// assertEquals(fdntCsarHelper_Data.get("FDNT").get("capabilities").size(), CapabilitiesNames.size()); // Compare capabilities qty expected vs actual
// }
-
- //Added by QA - Check for Capabilities in VF level (Capabilities Types and Properties).
- //@Test
+
+ //Added by QA - Check for Capabilities in VF level (Capabilities Types and Properties).
+ //@Test
// public void testCapabilitiesofVFTypes_Properties() throws SdcToscaParserException {
// List<NodeTemplate> serviceVfList = fdntCsarHelper.getServiceVfList();
// String sName = serviceVfList.get(0).getName();
@@ -130,20 +126,20 @@ public class ToscaParserSubsMappingsTest extends SdcToscaParserBasicTest {
//
// assertEquals(fdntCsarHelper_Data.get("FDNT").get("capabilitiesTypes").size(), CapabilitiesTypes.size()); // Compare capabilities qty expected vs actual
// }
-
- //@Test // - BUG 283387
- public void testRequirmentsofVF() throws SdcToscaParserException {
- List<NodeTemplate> serviceVfList = fdntCsarHelper.getServiceVfList();
- String sName = serviceVfList.get(0).getName();
- assertEquals(sName,"FDNT 1");
-
- List<String> ActualReqsValues = new ArrayList<>(Arrays.asList( ));
-
- List<RequirementAssignment> lRequirements = serviceVfList.get(0).getRequirements().getAll();
-
- assertEquals(fdntCsarHelper_Data.get("FDNT").get("requirements").size(),lRequirements.size()); //
-
- // Continue from here after bug is fixed ! ! ! ! - Test the Requirements values
- }
+
+ //@Test // - BUG 283387
+ public void testRequirmentsofVF() throws SdcToscaParserException {
+ List<NodeTemplate> serviceVfList = fdntCsarHelper.getServiceVfList();
+ String sName = serviceVfList.get(0).getName();
+ assertEquals(sName, "FDNT 1");
+
+ List<String> ActualReqsValues = new ArrayList<>(Arrays.asList());
+
+ List<RequirementAssignment> lRequirements = serviceVfList.get(0).getRequirements().getAll();
+
+ assertEquals(fdntCsarHelper_Data.get("FDNT").get("requirements").size(), lRequirements.size()); //
+
+ // Continue from here after bug is fixed ! ! ! ! - Test the Requirements values
+ }
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserValidationIssueTest.java b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserValidationIssueTest.java
index e74643f..bd11c9a 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserValidationIssueTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/impl/ToscaParserValidationIssueTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,94 +20,99 @@
package org.onap.sdc.impl;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.config.ConfigurationManager;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.toscaparser.api.common.JToscaValidationIssue;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import java.io.IOException;
-import java.util.List;
-import java.util.stream.Collectors;
+@ExtendWith({SdcToscaParserBasicTest.class})
+class ToscaParserValidationIssueTest extends SdcToscaParserBasicTest {
-import static org.testng.Assert.assertEquals;
+ protected static ConfigurationManager configurationManager = ConfigurationManager.getInstance();
-public class ToscaParserValidationIssueTest extends SdcToscaParserBasicTest {
- protected static ConfigurationManager configurationManager = ConfigurationManager.getInstance();
+ @BeforeAll
+ public static void loadJtoscaValidationIssueConfiguration() throws IOException {
+ //load the tests dedicated configuration
+ configurationManager.setJtoscaValidationIssueConfiguration("jtosca-validation-issue-configuration-test.yaml");
+ factory.setConfigurationManager(configurationManager);
+ }
- @BeforeClass
- public void loadJtoscaValidationIssueConfiguration() throws IOException {
- //load the tests dedicated configuration
- configurationManager.setJtoscaValidationIssueConfiguration( "jtosca-validation-issue-configuration-test.yaml");
- factory.setConfigurationManager(configurationManager);
- }
+ @AfterAll
+ public static void loadJtoscaValidationIssueOriginalConfiguration() throws IOException {
+ //load the tests dedicated configuration
+ configurationManager.setJtoscaValidationIssueConfiguration("jtosca-validation-issue-configuration.yaml");
+ factory.setConfigurationManager(configurationManager);
- @AfterClass
- public void loadJtoscaValidationIssueOriginalConfiguration() throws IOException {
- //load the tests dedicated configuration
- configurationManager.setJtoscaValidationIssueConfiguration("jtosca-validation-issue-configuration.yaml");
- factory.setConfigurationManager(configurationManager);
+ }
- }
+ @Test
+ public void testNoValidationIssues() throws SdcToscaParserException {
+ ISdcCsarHelper rainyCsarHelper = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar");//conformance level 3.0
+ //List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
+ //assertEquals( notAnalyzedReport.size(),0);
+ List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
+ assertEquals(warningsReport.size(), 0);
+ List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
+ assertEquals(criticalsReport.size(), 0);
+ }
- @Test
- public void testNoValidationIssues() throws SdcToscaParserException {
- ISdcCsarHelper rainyCsarHelper = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar");//conformance level 3.0
-
- //List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
- //assertEquals( notAnalyzedReport.size(),0);
- List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
- assertEquals( warningsReport.size(),0);
- List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
- assertEquals( criticalsReport.size(),0);
- }
- @Test
+ @Test
public void testGetLowSinceConformanceLevel() throws SdcToscaParserException {
- ISdcCsarHelper fdntCsarHelperWithInputs = getCsarHelper("csars/service-NfodService-csar.csar");//conformance level 3.0
- //Service level
-
- List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
- assertEquals( notAnalyzedReport.size(),10);
- //JE003 high CL 4.0
- assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE003")).collect(Collectors.toList()).size(), 2);
- assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE235")).collect(Collectors.toList()).size(), 7);
- assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE236")).collect(Collectors.toList()).size(), 1);
- List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
- assertEquals( warningsReport.size(),14);
- assertEquals( warningsReport.stream().filter(w->w.getCode().equals("JE006")).collect(Collectors.toList()).size(), 13);
- //JE004 low CL 2.0
- assertEquals( warningsReport.stream().filter(w->w.getCode().equals("JE004")).collect(Collectors.toList()).size(), 1);
- List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
- assertEquals( criticalsReport.size(),0);
- }
-
- @Test(expectedExceptions = SdcToscaParserException.class)
- public void testCriticalIssueThrowsSdcToscaParserException() throws SdcToscaParserException {
- getCsarHelper("csars/service-Nfod2images-csar.csar");//conformance level 4.0
- }
-
- @Test
+ ISdcCsarHelper fdntCsarHelperWithInputs = getCsarHelper("csars/service-NfodService-csar.csar");//conformance level 3.0
+ //Service level
+
+ List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
+ assertEquals(notAnalyzedReport.size(), 10);
+ //JE003 high CL 4.0
+ assertEquals(notAnalyzedReport.stream().filter(n -> n.getCode().equals("JE003")).collect(Collectors.toList()).size(), 2);
+ assertEquals(notAnalyzedReport.stream().filter(n -> n.getCode().equals("JE235")).collect(Collectors.toList()).size(), 7);
+ assertEquals(notAnalyzedReport.stream().filter(n -> n.getCode().equals("JE236")).collect(Collectors.toList()).size(), 1);
+ List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
+ assertEquals(warningsReport.size(), 14);
+ assertEquals(warningsReport.stream().filter(w -> w.getCode().equals("JE006")).collect(Collectors.toList()).size(), 13);
+ //JE004 low CL 2.0
+ assertEquals(warningsReport.stream().filter(w -> w.getCode().equals("JE004")).collect(Collectors.toList()).size(), 1);
+ List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
+ assertEquals(criticalsReport.size(), 0);
+ }
+
+ @Test
+ void testCriticalIssueThrowsSdcToscaParserException() {
+ assertThrows(SdcToscaParserException.class, () -> {
+ getCsarHelper("csars/service-Nfod2images-csar.csar");//conformance level 4.0
+ });
+ }
+
+ @Test
public void testMultiSinceConformanceLevelIssues() {
- try {
- ISdcCsarHelper Nfod2images = getCsarHelper("csars/service-Nfod2images-csar.csar");//conformance level 4.0
- } catch (SdcToscaParserException e) {
- System.out.println("SdcToscaParserException is caught here - this is WAD in this specific test.");
- }
- List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
- assertEquals(3, notAnalyzedReport.size());
- List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
- assertEquals( 0, warningsReport.size());
- List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
- assertEquals( 22, criticalsReport.size());
- //JE006 multy values sinceCsarConformanceLevel
- assertEquals( criticalsReport.stream().filter(c->c.getCode().equals("JE006")).collect
- (Collectors.toList()).size(), 18);
- assertEquals( criticalsReport.stream().filter(c->c.getCode().equals("JE003")).collect
- (Collectors.toList()).size(), 4);
- }
+ try {
+ ISdcCsarHelper Nfod2images = getCsarHelper("csars/service-Nfod2images-csar.csar");//conformance level 4.0
+ } catch (SdcToscaParserException e) {
+ System.out.println("SdcToscaParserException is caught here - this is WAD in this specific test.");
+ }
+ List<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
+ assertEquals(3, notAnalyzedReport.size());
+ List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
+ assertEquals(0, warningsReport.size());
+ List<JToscaValidationIssue> criticalsReport = factory.getCriticalExceptions();
+ assertEquals(22, criticalsReport.size());
+ //JE006 multy values sinceCsarConformanceLevel
+ assertEquals(criticalsReport.stream().filter(c -> c.getCode().equals("JE006")).collect
+ (Collectors.toList()).size(), 18);
+ assertEquals(criticalsReport.stream().filter(c -> c.getCode().equals("JE003")).collect
+ (Collectors.toList()).size(), 4);
+ }
}
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/elements/queries/TopologyTemplateQueryTest.java b/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/elements/queries/TopologyTemplateQueryTest.java
index 68c4329..5a30255 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/elements/queries/TopologyTemplateQueryTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/elements/queries/TopologyTemplateQueryTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,6 +20,10 @@
package org.onap.sdc.tosca.parser.elements.queries;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.mockito.Mockito.when;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -29,10 +33,6 @@ import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertFalse;
-
@RunWith(MockitoJUnitRunner.class)
public class TopologyTemplateQueryTest {
@@ -42,16 +42,16 @@ public class TopologyTemplateQueryTest {
@Mock
private NodeTemplate nodeTemplate;
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected = IllegalArgumentException.class)
public void objectIsNotTopologyTemplate() {
- TopologyTemplateQuery.newBuilder(SdcTypes.CP)
- .build();
+ TopologyTemplateQuery.newBuilder(SdcTypes.CP)
+ .build();
}
@Test
public void templateIsFoundByTypeOnly() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE)
- .build();
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn("345");
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.SERVICE.getValue());
@@ -61,7 +61,7 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsNotFoundWhenMetadataIsNull() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
- .build();
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(null);
assertFalse(topologyTemplateQuery.isMatchingSearchCriteria(nodeTemplate));
}
@@ -69,7 +69,7 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsFoundIfItIsService() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE)
- .build();
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.SERVICE.getValue());
assertTrue(topologyTemplateQuery.isMatchingSearchCriteria(nodeTemplate));
@@ -78,8 +78,8 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsFoundByTypeAndCUUID() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC)
- .customizationUUID("345")
- .build();
+ .customizationUUID("345")
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.CVFC.getValue());
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn("345");
@@ -89,7 +89,7 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsNotFoundWhenTypeIsNotMatchedAndCuuidIsNotSet() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC)
- .build();
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.VF.getValue());
assertFalse(topologyTemplateQuery.isMatchingSearchCriteria(nodeTemplate));
@@ -98,8 +98,8 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsFoundWhenTypeIsMatchedCuuidIsProvidedAndCuuidIsNullInMetadata() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
- .customizationUUID("2345")
- .build();
+ .customizationUUID("2345")
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn(null);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.VF.getValue());
@@ -109,7 +109,7 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsFoundWhenTypeIsMatchedAndCuuidIsNullInMetadata() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
- .build();
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn(null);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.VF.getValue());
@@ -119,8 +119,8 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsNotFoundWhenTypeIsMatchedAndCuuidIsSet() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC)
- .customizationUUID("345")
- .build();
+ .customizationUUID("345")
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.CVFC.getValue());
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn("345");
@@ -130,8 +130,8 @@ public class TopologyTemplateQueryTest {
@Test
public void templateIsNotFoundWhenTypeIsNotMatchedAndCuuidIsSet() {
TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.CR)
- .customizationUUID("345")
- .build();
+ .customizationUUID("345")
+ .build();
when(nodeTemplate.getMetaData()).thenReturn(metadata);
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn(SdcTypes.CVFC.getValue());
when(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)).thenReturn("345");
diff --git a/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/impl/ToscaParserNodeTemplateMockTest.java b/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/impl/ToscaParserNodeTemplateMockTest.java
index 76b1735..ada63d4 100644
--- a/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/impl/ToscaParserNodeTemplateMockTest.java
+++ b/sdc-tosca/src/test/java/org/onap/sdc/tosca/parser/impl/ToscaParserNodeTemplateMockTest.java
@@ -38,8 +38,8 @@ import java.util.LinkedHashMap;
import java.util.NoSuchElementException;
import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertFalse;
@RunWith(MockitoJUnitRunner.class)
public class ToscaParserNodeTemplateMockTest {