summaryrefslogtreecommitdiffstats
path: root/asdctool/src/test/java
diff options
context:
space:
mode:
authorPiotr Darosz <piotr.darosz@nokia.com>2019-07-01 08:23:51 +0200
committerTomasz Golabek <tomasz.golabek@nokia.com>2019-07-16 10:56:33 +0000
commitaf504ed5e03899ebf214d0fec6bd78ac4adb1b77 (patch)
tree65c925464a84f0a9cb0873d0e446b971cebcf632 /asdctool/src/test/java
parenta2b6793397b5cd14e7eb636198ff13ddeee920bf (diff)
Constructor injection in asdctool
Use constructor injection where possible Change-Id: Ibc80850166406a6e3230f555818988109e6ca776 Issue-ID: SDC-2403 Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
Diffstat (limited to 'asdctool/src/test/java')
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java16
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java12
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java10
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java88
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java15
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java11
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java8
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java8
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java7
16 files changed, 152 insertions, 77 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
index ac394f500c..1ee1c4a700 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
@@ -20,9 +20,16 @@
package org.openecomp.sdc.asdctool.configuration;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix;
import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.jsongraph.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 org.springframework.beans.factory.config.PropertiesFactoryBean;
public class ArtifactUUIDFixConfigurationTest {
@@ -38,7 +45,14 @@ public class ArtifactUUIDFixConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.artifactUuidFix();
+ JanusGraphDao janusGraphDao = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+ ToscaExportHandler toscaExportHandler = mock(ToscaExportHandler.class);
+ ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+ CsarUtils csarUtils = mock(CsarUtils.class);
+
+ result = testSubject.artifactUuidFix(janusGraphDao, toscaOperationFacade,
+ toscaExportHandler, artifactCassandraDao, csarUtils);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
index d99a831903..3472721dc6 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
@@ -53,6 +53,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.schema.Table;
import org.openecomp.sdc.be.resources.data.auditing.*;
import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
@@ -63,6 +65,7 @@ import java.util.Date;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import static org.openecomp.sdc.common.datastructure.AuditingFieldsKey.*;
@RunWith(MockitoJUnitRunner.class)
@@ -103,7 +106,11 @@ public class DataMigrationTest {
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern);
- private static DataMigration dataMigration = new DataMigration();
+ private static ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+
+ private static AuditCassandraDao auditCassandraDaoMock = mock(AuditCassandraDao.class);
+
+ private static DataMigration dataMigration = new DataMigration(auditCassandraDaoMock, artifactCassandraDao);
private final static String ES_STRING = "{\"" + AuditingFieldsKey.AUDIT_ACTION + "\":\"%s\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_NAME + "\":\"" + RESOURCE_NAME + "\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_TOSCA_NODE_TYPE + "\":\"" + TOSCA_NODE_TYPE +
"\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_PREV_VERSION + "\":\"" + PREV_VERSION + "\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_PREV_STATE + "\":\"" + PREV_STATE +
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
index 1b907142fd..f1f161b2db 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.asdctool.impl;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
@@ -38,10 +40,12 @@ public class EsToCassandraDataMigrationConfigTest {
public void testDataMigration() throws Exception {
EsToCassandraDataMigrationConfig testSubject;
DataMigration result;
+ AuditCassandraDao auditCassandraDaoMock = mock(AuditCassandraDao.class);
+ ArtifactCassandraDao artifactCassandraDaoMock = mock(ArtifactCassandraDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.dataMigration();
+ result = testSubject.dataMigration(auditCassandraDaoMock, artifactCassandraDaoMock);
}
@Test
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 a353612332..da3c858170 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
@@ -20,15 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter;
import java.util.LinkedList;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ArtifactToolBLTest {
private ArtifactToolBL createTestSubject() {
- return new ArtifactToolBL();
+ return new ArtifactToolBL(new ArrayList<>());
}
//Generated test
@@ -38,9 +43,12 @@ public class ArtifactToolBLTest {
boolean result;
// default test
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
testSubject = createTestSubject();
testSubject.validators = new LinkedList();
- testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter());
+ testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock,toscaOperationFacade));
result = testSubject.validateAll();
}
}
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 071d6373f2..57c4d9c02e 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
@@ -20,15 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter;
import java.util.LinkedList;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ValidationToolBLTest {
private ValidationToolBL createTestSubject() {
- return new ValidationToolBL();
+ return new ValidationToolBL(new ArrayList<>());
}
@Test(expected=NullPointerException.class)
@@ -37,9 +42,10 @@ public class ValidationToolBLTest {
boolean result;
// default test
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
testSubject = createTestSubject();
testSubject.validators = new LinkedList<>();
- testSubject.validators.add(new ServiceValidatorExecuter());
+ testSubject.validators.add(new ServiceValidatorExecuter(janusGraphDaoMock));
result = testSubject.validateAll();
}
}
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 fb2e29848d..a6ae4d2492 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
@@ -20,6 +20,9 @@
package org.openecomp.sdc.asdctool.impl.validator.config;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL;
import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL;
@@ -48,40 +51,44 @@ public class ValidationToolConfigurationTest {
public void testBasicServiceValidator() {
ValidationToolConfiguration testSubject;
ServiceValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.basicServiceValidator();
+ result = testSubject.basicServiceValidator(janusGraphDaoMock);
}
@Test
public void testVfArtifactValidationTask() {
ValidationToolConfiguration testSubject;
VfArtifactValidationTask result;
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
// default test
testSubject = createTestSubject();
- result = testSubject.vfArtifactValidationTask();
+ result = testSubject.vfArtifactValidationTask(artifactValidationUtilsMock);
}
@Test
public void testServiceArtifactValidationTask() {
ValidationToolConfiguration testSubject;
ServiceArtifactValidationTask result;
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
// default test
testSubject = createTestSubject();
- result = testSubject.serviceArtifactValidationTask();
+ result = testSubject.serviceArtifactValidationTask(artifactValidationUtilsMock);
}
@Test
public void testModuleJsonTask() {
ValidationToolConfiguration testSubject;
ModuleJsonTask result;
+ TopologyTemplateOperation topologyTemplateOperationMock = mock(TopologyTemplateOperation.class);
// default test
testSubject = createTestSubject();
- result = testSubject.moduleJsonTask();
+ result = testSubject.moduleJsonTask(topologyTemplateOperationMock);
}
@Test
@@ -91,17 +98,18 @@ public class ValidationToolConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.validationToolBL();
+ result = testSubject.validationToolBL(new ArrayList<>());
}
@Test
public void testBasicVfValidator() {
ValidationToolConfiguration testSubject;
VfValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.basicVfValidator();
+ result = testSubject.basicVfValidator(new ArrayList<>(), janusGraphDaoMock);
}
@Test
@@ -118,10 +126,12 @@ public class ValidationToolConfigurationTest {
public void testArtifactValidationUtils() {
ValidationToolConfiguration testSubject;
ArtifactValidationUtils result;
+ ArtifactCassandraDao artifactCassandraDaoMock = mock(ArtifactCassandraDao.class);
+ TopologyTemplateOperation topologyTemplateOperationMock = mock(TopologyTemplateOperation.class);
// default test
testSubject = createTestSubject();
- result = testSubject.artifactValidationUtils();
+ result = testSubject.artifactValidationUtils(artifactCassandraDaoMock, topologyTemplateOperationMock);
}
@Test
@@ -203,86 +213,52 @@ public class ValidationToolConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.janusGraphDao(janusGraphClient);
- }
-
- @Test
- public void testCategoryOperation() {
- ValidationToolConfiguration testSubject;
- CategoryOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.categoryOperation();
- }
-
- @Test
- public void testArtifactsOperation() {
- ValidationToolConfiguration testSubject;
- ArtifactsOperations result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.artifactsOperation();
- }
-
- @Test
- public void testToscaDataOperation() {
- ValidationToolConfiguration testSubject;
- ToscaDataOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toscaDataOperation();
- }
-
- @Test
- public void testToscaElementLifecycleOperation() {
- ValidationToolConfiguration testSubject;
- ToscaElementLifecycleOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toscaElementLifecycleOperation();
+ result = testSubject.healingJanusGraphDao(janusGraphClient);
}
@Test
- public void testNodeToscaArtifactsValidatorValidator() throws Exception {
+ public void testNodeToscaArtifactsValidatorValidator() {
ValidationToolConfiguration testSubject;
NodeToscaArtifactsValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.NodeToscaArtifactsValidatorValidator();
+ result = testSubject.NodeToscaArtifactsValidatorValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testServiceToscaArtifactsValidator() throws Exception {
+ public void testServiceToscaArtifactsValidator() {
ValidationToolConfiguration testSubject;
ServiceToscaArtifactsValidatorExecutor result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.ServiceToscaArtifactsValidator();
+ result = testSubject.ServiceToscaArtifactsValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testVFToscaArtifactValidator() throws Exception {
+ public void testVFToscaArtifactValidator() {
ValidationToolConfiguration testSubject;
VFToscaArtifactValidatorExecutor result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.VFToscaArtifactValidator();
+ result = testSubject.VFToscaArtifactValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testArtifactToolBL() throws Exception {
+ public void testArtifactToolBL() {
ValidationToolConfiguration testSubject;
ArtifactToolBL result;
// default test
testSubject = createTestSubject();
- result = testSubject.artifactToolBL();
+ result = testSubject.artifactToolBL(new ArrayList<>());
}
}
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/ArtifactValidatorExecuterTest.java
index e39f28ccaa..a54463bc52 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/ArtifactValidatorExecuterTest.java
@@ -20,7 +20,10 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.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;
import org.openecomp.sdc.be.model.Component;
@@ -30,11 +33,16 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.testng.Assert;
public class ArtifactValidatorExecuterTest {
private ArtifactValidatorExecuter createTestSubject() {
- return new ArtifactValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new ArtifactValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
}
@Test
@@ -68,8 +76,8 @@ public class ArtifactValidatorExecuterTest {
testSubject.setName(name);
}
- @Test(expected=NullPointerException.class)
- public void testValidate() throws Exception {
+ @Test
+ public void testValidate() {
ArtifactValidatorExecuter testSubject;
Map<String, List<Component>> vertices = new HashMap<>();
LinkedList<Component> linkedList = new LinkedList<Component>();
@@ -80,5 +88,6 @@ public class ArtifactValidatorExecuterTest {
// default test
testSubject = createTestSubject();
result = testSubject.validate(vertices);
+ Assert.assertFalse(result);
}
}
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
index 254cb407a9..a5f816c25c 100644
--- 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
@@ -20,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class NodeToscaArtifactsValidatorExecuterTest {
private NodeToscaArtifactsValidatorExecuter createTestSubject() {
- return new NodeToscaArtifactsValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected=NullPointerException.class)
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 3884c38d2a..9c0571cbb8 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,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ServiceToscaArtifactsValidatorExecutorTest {
private ServiceToscaArtifactsValidatorExecutor createTestSubject() {
- return new ServiceToscaArtifactsValidatorExecutor();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new ServiceToscaArtifactsValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected = NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
index 19f512ff1d..6b243b359e 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
@@ -20,12 +20,16 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
public class ServiceValidatorExecuterTest {
private ServiceValidatorExecuter createTestSubject() {
- return new ServiceValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ return new ServiceValidatorExecuter(janusGraphDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
index 89568ce8fc..41c04c37ec 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
@@ -20,13 +20,17 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
public class TopologyTemplateValidatorExecuterTest {
private TopologyTemplateValidatorExecuter createTestSubject() {
- return new TopologyTemplateValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ return new TopologyTemplateValidatorExecuter(janusGraphDaoMock);
}
@Test
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 f44f659ee3..1dfd353087 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,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class VFToscaArtifactValidatorExecutorTest {
private VFToscaArtifactValidatorExecutor createTestSubject() {
- return new VFToscaArtifactValidatorExecutor();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new VFToscaArtifactValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected=NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
index e833f5c2d0..688f4ca108 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
@@ -20,12 +20,21 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
import org.junit.Test;
+import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
public class VfValidatorExecuterTest {
private VfValidatorExecuter createTestSubject() {
- return new VfValidatorExecuter();
+ List<VfValidationTask> validationTasks = new ArrayList<>();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+
+ return new VfValidatorExecuter(validationTasks, janusGraphDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
index 326782548d..5053f4b9e3 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
@@ -20,17 +20,23 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
public class ArtifactValidationUtilsTest {
private ArtifactValidationUtils createTestSubject() {
- return new ArtifactValidationUtils();
+ ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+ TopologyTemplateOperation topologyTemplateOperation = mock(TopologyTemplateOperation.class);
+ return new ArtifactValidationUtils(artifactCassandraDao, topologyTemplateOperation);
}
@Test(expected=NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
index 3e1e7cf32e..d55f42131a 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
@@ -20,16 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.testng.Assert;
public class ServiceArtifactValidationTaskTest {
private ServiceArtifactValidationTask createTestSubject() {
- return new ServiceArtifactValidationTask();
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
+ return new ServiceArtifactValidationTask(artifactValidationUtilsMock);
}
- @Test(expected=NullPointerException.class)
+ @Test
public void testValidate() throws Exception {
ServiceArtifactValidationTask testSubject;
GraphVertex vertex = null;
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
index 0913be2595..a02f80a785 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
@@ -27,10 +29,11 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
public class VfArtifactValidationTaskTest {
private VfArtifactValidationTask createTestSubject() {
- return new VfArtifactValidationTask();
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
+ return new VfArtifactValidationTask(artifactValidationUtilsMock);
}
- @Test(expected=NullPointerException.class)
+ @Test
public void testValidate() throws Exception {
VfArtifactValidationTask testSubject;
GraphVertex vertex = null;