aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/src
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2023-10-12 11:09:43 +0100
committerMichael Morris <michael.morris@est.tech>2023-10-13 08:58:56 +0000
commitd89a5d3cf1ed1f81cdda754464eff07781824053 (patch)
tree14fdb5b10f8eec16de54cf8bf5ae86a701845484 /asdctool/src
parent0d9d05e705a6fbc9c4370fdd3a8ad543d04f8210 (diff)
Increase unit test coverage for backend
Provided some Junit test coverage for backed Issue-ID: SDC-4654 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I91b3f4326256312ab998d32fce9eb13b3e39b8d1
Diffstat (limited to 'asdctool/src')
-rw-r--r--asdctool/src/test/java/com/att/nsa/cambria/client/CambriaConsumerTest.java36
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfigurationTest.java55
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfigurationTest.java53
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/SdcSchemaFileImportConfigurationTest.java53
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfigurationTest.java67
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnumTest.java37
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java46
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java5
8 files changed, 347 insertions, 5 deletions
diff --git a/asdctool/src/test/java/com/att/nsa/cambria/client/CambriaConsumerTest.java b/asdctool/src/test/java/com/att/nsa/cambria/client/CambriaConsumerTest.java
new file mode 100644
index 0000000000..26ba1b4553
--- /dev/null
+++ b/asdctool/src/test/java/com/att/nsa/cambria/client/CambriaConsumerTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 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 com.att.nsa.cambria.client;
+
+import org.junit.Test;
+
+public class CambriaConsumerTest {
+
+ private CambriaConsumer createTestSubject() {
+ return new CambriaConsumer();
+ }
+
+ @Test
+ public void testCtor() throws Exception {
+ new CambriaConsumer();
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfigurationTest.java
new file mode 100644
index 0000000000..aa842e3a0b
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfigurationTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 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.openecomp.sdc.asdctool.configuration;
+
+import org.junit.Test;
+import org.openecomp.sdc.asdctool.impl.internal.tool.CsarGenerator;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
+import static org.mockito.Mockito.mock;
+
+public class CsarGeneratorConfigurationTest {
+
+ private CsarGeneratorConfiguration createTestSubject() {
+ return new CsarGeneratorConfiguration();
+ }
+
+ private static ToscaExportHandler toscaExportHandler;
+ private static CsarUtils csarUtils;
+
+ @Test
+ public void testCsarGenerator() throws Exception {
+ CsarGeneratorConfiguration testSubject;
+ CsarGenerator result;
+
+ // default test
+ testSubject = createTestSubject();
+ JanusGraphDao janusGraphDao = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+ ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+
+ result = testSubject.csarGenerator(janusGraphDao, csarUtils, toscaOperationFacade, artifactCassandraDao, toscaExportHandler);
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfigurationTest.java
new file mode 100644
index 0000000000..a19186d26a
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfigurationTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 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.openecomp.sdc.asdctool.configuration;
+
+import static org.mockito.Mockito.mock;
+
+import org.junit.Test;
+import org.openecomp.sdc.asdctool.impl.internal.tool.DeleteComponentHandler;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+
+public class InternalToolConfigurationTest {
+
+ private InternalToolConfiguration createTestSubject() {
+ return new InternalToolConfiguration();
+ }
+
+ @Test
+ public void testDeleteComponentHandler() throws Exception {
+ InternalToolConfiguration testSubject;
+ DeleteComponentHandler result;
+
+ // default test
+ testSubject = createTestSubject();
+ JanusGraphDao janusGraphDao = mock(JanusGraphDao.class);
+ NodeTypeOperation nodeTypeOperation = mock(NodeTypeOperation.class);
+ TopologyTemplateOperation topologyTemplateOperation = mock(TopologyTemplateOperation.class);
+
+ result = testSubject.deleteComponentHandler(janusGraphDao, nodeTypeOperation, topologyTemplateOperation);
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/SdcSchemaFileImportConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/SdcSchemaFileImportConfigurationTest.java
new file mode 100644
index 0000000000..d63f0bef83
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/SdcSchemaFileImportConfigurationTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.asdctool.configuration;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.dao.cassandra.CassandraClient;
+import org.openecomp.sdc.be.dao.cassandra.SdcSchemaFilesCassandraDao;
+
+public class SdcSchemaFileImportConfigurationTest {
+
+ private SdcSchemaFileImportConfiguration createTestSubject() {
+ return new SdcSchemaFileImportConfiguration();
+ }
+
+ @Test
+ public void testCassandraClient() throws Exception {
+ SdcSchemaFileImportConfiguration testSubject;
+ CassandraClient result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.cassandraClient();
+ }
+
+ @Test
+ public void testCassandraDao() throws Exception {
+ SdcSchemaFileImportConfiguration testSubject;
+ SdcSchemaFilesCassandraDao result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.sdcSchemaFilesCassandraDao();
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfigurationTest.java
new file mode 100644
index 0000000000..ad60652818
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfigurationTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 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.openecomp.sdc.asdctool.configuration;
+
+import static org.mockito.Mockito.mock;
+
+import org.junit.Test;
+import org.openecomp.sdc.asdctool.impl.VrfObjectFixHandler;
+import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
+
+public class VrfObjectFixConfigurationTest {
+
+ private VrfObjectFixConfiguration createTestSubject() {
+ return new VrfObjectFixConfiguration();
+ }
+
+ @Test
+ public void testJanusGraphDao() throws Exception {
+ VrfObjectFixConfiguration testSubject;
+ JanusGraphDao result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.janusGraphDao(mock(JanusGraphClient.class));
+ }
+
+ @Test
+ public void testJanusGraphClientStrategy() throws Exception {
+ VrfObjectFixConfiguration testSubject;
+ JanusGraphClientStrategy result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.janusGraphClientStrategy();
+ }
+
+ @Test
+ public void testVrfObjectFixHandler() throws Exception {
+ VrfObjectFixConfiguration testSubject;
+ VrfObjectFixHandler result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.vrfObjectFixHandler(mock(JanusGraphDao.class));
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnumTest.java
new file mode 100644
index 0000000000..1d5f91569c
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/LifecycleStateEnumTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.asdctool.enums;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class LifecycleStateEnumTest {
+
+ private LifecycleStateEnum createTestSubject() {
+ return LifecycleStateEnum.CERTIFIED;
+ }
+
+ @Test
+ public void testEnumValue() throws Exception {
+ LifecycleStateEnum testSubject = createTestSubject();
+ Assert.assertEquals(LifecycleStateEnum.CERTIFIED,testSubject);
+ }
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java
new file mode 100644
index 0000000000..23f76aa002
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.asdctool.enums;
+
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+
+public class SchemaZipFileEnumTest {
+
+ @Test
+ public void testSchemaZipConstants() throws Exception {
+ SchemaZipFileEnum[] schemaFileList = SchemaZipFileEnum.values();
+ for (SchemaZipFileEnum schemaZipFileEnum : schemaFileList) {
+ switch (schemaZipFileEnum.getFileName()) {
+ case "data" :
+ Assertions.assertArrayEquals(schemaZipFileEnum.getImportFileList(),SchemaZipFileEnum.SchemaZipConstants.EMPTY_IMPORT_LIST);
+ break;
+ case "relationships" :
+ Assertions.assertArrayEquals(schemaZipFileEnum.getImportFileList(),SchemaZipFileEnum.SchemaZipConstants.RELATIONSHIPS_TYPES_IMPORT_LIST);
+ break;
+ default:
+ Assertions.assertArrayEquals(schemaZipFileEnum.getImportFileList(),SchemaZipFileEnum.SchemaZipConstants.DATA_IMPORT_LIST);
+ break;
+ }
+ }
+ }
+
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java
index 89a84462fe..9a7e16b602 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/servlets/ExportImportJanusGraphServletTest.java
@@ -32,11 +32,6 @@ public class ExportImportJanusGraphServletTest {
}
@Test
- @Disabled("Investigate"
- + "org.opentest4j.AssertionFailedError: Expected java.lang.NullPointerException to be thrown, but nothing was thrown."
- + "Possible reason is :"
- + "if (log.isDebugEnabled())"
- + "in ExportImportJanusGraphServlet#printJanusGraphConfigFile")
public void testExport() throws Exception {
ExportImportJanusGraphServlet testSubject;
File janusGraphPropertiesFile = null;