aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/src/test/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src/test/java/org/openecomp')
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java4
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java4
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java4
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java (renamed from asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java)72
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java50
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java64
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java36
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java44
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java50
9 files changed, 133 insertions, 195 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
index e6ae05f493..47952f8d5c 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
@@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock;
import java.util.ArrayList;
import java.util.LinkedList;
import org.junit.Test;
-import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter;
+import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecutor;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
@@ -43,7 +43,7 @@ public class ArtifactToolBLTest {
ArtifactToolBL testSubject = createTestSubject();
testSubject.validators = new LinkedList<>();
- testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock, toscaOperationFacade));
+ testSubject.validators.add(new NodeToscaArtifactsValidatorExecutor(janusGraphDaoMock, toscaOperationFacade));
// Initially no outputFilePath was passed to this function (hence it is set to null)
// TODO: Fix this null and see if the argument is used by this function
testSubject.validateAll(null);
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
index 8c2dffcbc2..ddea391ab1 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
@@ -46,8 +46,6 @@ public class ValidationToolBLTest {
testSubject.validators = new LinkedList<>();
testSubject.validators.add(new ServiceValidatorExecuter(janusGraphDaoMock));
Report report = Report.make();
- // Initially no outputFilePath was passed to this function (hence it is set to null)
- // TODO: Fix this null and see if the argument is used by this function
- testSubject.validateAll(report, makeTxtFile(makeConsoleWriter()), null);
+ testSubject.validateAll(report, makeTxtFile(makeConsoleWriter()));
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
index deadf3250d..1903f0f1e7 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
@@ -23,7 +23,7 @@ package org.openecomp.sdc.asdctool.impl.validator.config;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL;
import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL;
-import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter;
+import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecutor;
import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceToscaArtifactsValidatorExecutor;
import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter;
import org.openecomp.sdc.asdctool.impl.validator.executers.VFToscaArtifactValidatorExecutor;
@@ -227,7 +227,7 @@ public class ValidationToolConfigurationTest {
@Test
public void testNodeToscaArtifactsValidatorValidator() {
ValidationToolConfiguration testSubject;
- NodeToscaArtifactsValidatorExecuter result;
+ NodeToscaArtifactsValidatorExecutor result;
JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java
index 46fae4312d..8564bb8251 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecutorContract.java
@@ -20,7 +20,14 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
-import org.junit.Test;
+import static org.mockito.Mockito.mock;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -29,67 +36,40 @@ import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.testng.Assert;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.Mockito.mock;
+public interface ArtifactValidatorExecutorContract {
-public class ArtifactValidatorExecuterTest {
+ ArtifactValidatorExecutor createTestSubject(
+ JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade
+ );
- private ArtifactValidatorExecuter createTestSubject() {
+ @Test
+ default void testGetVerticesToValidate() {
JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+ final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade);
- return new ArtifactValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
- }
-
- @Test
- public void testGetName() throws Exception {
- ArtifactValidatorExecuter testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test(expected = NullPointerException.class)
- public void testGetVerticesToValidate() throws Exception {
- ArtifactValidatorExecuter testSubject;
VertexTypeEnum type = null;
Map<GraphPropertyEnum, Object> hasProps = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.getVerticesToValidate(type, hasProps);
+ Assertions.assertThrows(NullPointerException.class, () ->
+ testSubject.getVerticesToValidate(type, hasProps)
+ );
}
@Test
- public void testSetName() throws Exception {
- ArtifactValidatorExecuter testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
- }
+ default void testValidate() {
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+ final ArtifactValidatorExecutor testSubject = createTestSubject(janusGraphDaoMock, toscaOperationFacade);
- @Test
- public void testValidate() {
- ArtifactValidatorExecuter testSubject;
- Map<String, List<Component>> vertices = new HashMap<>();
LinkedList<Component> linkedList = new LinkedList<Component>();
linkedList.add(new Resource());
+
+ Map<String, List<Component>> vertices = new HashMap<>();
vertices.put("stam", linkedList);
- boolean result;
- // default test
- testSubject = createTestSubject();
// Initially no outputFilePath was passed to this function (hence it is set to null)
// TODO: Fix this null and see if the argument is used by this function
- result = testSubject.validate(vertices, null);
- Assert.assertFalse(result);
+ Assert.assertFalse(testSubject.validate(vertices, null));
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java
new file mode 100644
index 0000000000..39a1bbef0c
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/IArtifactValidatorExecutorContract.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Bell 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.impl.validator.executers;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+
+import static org.mockito.Mockito.mock;
+
+public abstract class IArtifactValidatorExecutorContract {
+
+ protected abstract IArtifactValidatorExecutor createTestSubject(
+ JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade
+ );
+
+ private IArtifactValidatorExecutor createTestSubject() {
+ return createTestSubject(mock(JanusGraphDao.class), mock(ToscaOperationFacade.class));
+ }
+
+ @Test
+ public void testExecuteValidations() {
+ Assertions.assertThrows(NullPointerException.class, () ->
+ // Initially no outputFilePath was passed to this function (hence it is set to null)
+ // TODO: Fix this null and see if the argument is used by this function
+ createTestSubject().executeValidations(null)
+ );
+ }
+}
+
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java
deleted file mode 100644
index c9c90b2aa4..0000000000
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============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.impl.validator.executers;
-
-import org.junit.Test;
-import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
-
-import static org.mockito.Mockito.mock;
-
-public class NodeToscaArtifactsValidatorExecuterTest {
-
- private NodeToscaArtifactsValidatorExecuter createTestSubject() {
- JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
- ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
-
- return new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
- }
-
- @Test(expected = NullPointerException.class)
- public void testExecuteValidations() {
- // Initially no outputFilePath was passed to this function (hence it is set to null)
- // TODO: Fix this null and see if the argument is used by this function
- createTestSubject().executeValidations(null);
- }
-
- @Test
- public void testGetName() throws Exception {
- NodeToscaArtifactsValidatorExecuter testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test
- public void testSetName() throws Exception {
- NodeToscaArtifactsValidatorExecuter testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
- }
-}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java
new file mode 100644
index 0000000000..3870a98d78
--- /dev/null
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecutorTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Bell 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.impl.validator.executers;
+
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+
+public class NodeToscaArtifactsValidatorExecutorTest
+ extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract {
+
+ @Override
+ public NodeToscaArtifactsValidatorExecutor createTestSubject(
+ JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade
+ ) {
+ return new NodeToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade);
+ }
+}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
index 1e24867358..7998c52ea4 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
@@ -20,45 +20,17 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
-import org.junit.Test;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
-import static org.mockito.Mockito.mock;
+public class ServiceToscaArtifactsValidatorExecutorTest
+ extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract {
-public class ServiceToscaArtifactsValidatorExecutorTest {
-
- private ServiceToscaArtifactsValidatorExecutor createTestSubject() {
- JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
- ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
-
- return new ServiceToscaArtifactsValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
- }
-
- @Test(expected = NullPointerException.class)
- public void testExecuteValidations() {
- // Initially no outputFilePath was passed to this function (hence it is set to null)
- // TODO: Fix this null and see if the argument is used by this function
- createTestSubject().executeValidations(null);
- }
-
- @Test
- public void testGetName() throws Exception {
- ServiceToscaArtifactsValidatorExecutor testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test
- public void testSetName() throws Exception {
- ServiceToscaArtifactsValidatorExecutor testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
+ @Override
+ public ServiceToscaArtifactsValidatorExecutor createTestSubject(
+ JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade
+ ) {
+ return new ServiceToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade);
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
index 783b888dec..ae6dcc1623 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
@@ -20,51 +20,17 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
-import static org.mockito.Mockito.mock;
+public class VFToscaArtifactValidatorExecutorTest
+ extends IArtifactValidatorExecutorContract implements ArtifactValidatorExecutorContract {
-public class VFToscaArtifactValidatorExecutorTest {
-
- private VFToscaArtifactValidatorExecutor createTestSubject() {
- JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
- ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
-
- return new VFToscaArtifactValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
- }
-
- @Test
- public void testExecuteValidations() {
- VFToscaArtifactValidatorExecutor testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- // Initially no outputFilePath was passed to this function (hence it is set to null)
- // TODO: Fix this null and see if the argument is used by this function
- Assertions.assertThrows(NullPointerException.class, () -> testSubject.executeValidations(null));
- }
-
- @Test
- public void testGetName() throws Exception {
- VFToscaArtifactValidatorExecutor testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test
- public void testSetName() throws Exception {
- VFToscaArtifactValidatorExecutor testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
+ @Override
+ public VFToscaArtifactValidatorExecutor createTestSubject(
+ JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade
+ ) {
+ return new VFToscaArtifactValidatorExecutor(janusGraphDao, toscaOperationFacade);
}
}