summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-05-14 20:41:10 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-05-14 20:41:10 +0300
commitbbf42bf31ff4b82eee7e4ac4087f2c8d738e9283 (patch)
tree0ab440945e79150f3842480baf76b3317ad74a64 /catalog-be/src/test/java/org
parent8e9598ce20ead12a911becf762963a17afdfcc5e (diff)
Raise JUnit coverage catalog-be
Change-Id: I8248dae43365495a0eb7410e658b34decea77440 Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java18
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java520
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactoryTest.java62
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstanceTest.java233
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationDataImplTest.java202
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorServiceTest.java147
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ResourceArtifactInfoImplTest.java80
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceArtifactInfoImplTest.java20
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java323
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCallTest.java51
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java21
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/DistributionStatusRequestTest.java30
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java217
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java47
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java22
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java82
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java30
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java37
18 files changed, 1913 insertions, 229 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java
index c1a13f2066..566a8983b9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java
@@ -112,24 +112,6 @@ public class DistributionEngineTest{
return new DistributionEngine();
}
- /*@Test(expected=ExceptionInInitializerError.class)
- public void testMain() throws Exception {
- String[] args = new String[] { "" };
-
- // default test
- DistributionEngine.main(args);
- }*/
-
- @Test
- public void testIsActive() throws Exception {
- DistributionEngine testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isActive();
- }
-
@Test(expected=NullPointerException.class)
public void testInit() throws Exception {
DistributionEngine testSubject;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
index 514618c89a..d1cc869835 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineTest.java
@@ -1,190 +1,348 @@
package org.openecomp.sdc.be.components.distribution.engine;
-import fj.data.Either;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.auditing.impl.AuditingManager;
+import org.openecomp.sdc.be.components.BeConfDependentTest;
+import org.openecomp.sdc.be.components.distribution.engine.IDmaapNotificationData.DmaapActionEnum;
+import org.openecomp.sdc.be.components.distribution.engine.IDmaapNotificationData.OperationaEnvironmentTypeEnum;
+import org.openecomp.sdc.be.components.distribution.engine.report.DistributionCompleteReporter;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
-import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
+import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao;
-import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
+import org.openecomp.sdc.be.dao.impl.AuditingDao;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.info.OperationalEnvInfo;
import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
-import org.openecomp.sdc.common.http.client.api.HttpResponse;
+import org.openecomp.sdc.common.datastructure.Wrapper;
+import org.springframework.test.util.ReflectionTestUtils;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import fj.data.Either;
+import mockit.Deencapsulation;
+
+public class EnvironmentsEngineTest extends BeConfDependentTest {
+
+ private EnvironmentsEngine createTestSubject() {
+ return new EnvironmentsEngine(new DmaapConsumer(new ExecutorFactory(), new DmaapClientFactory()),
+ new OperationalEnvironmentDao(), new DME2EndpointIteratorCreator(), new AaiRequestHandler(),
+ new ComponentsUtils(new AuditingManager(new AuditingDao(), new AuditCassandraDao())),
+ new CambriaHandler(), new DistributionEngineClusterHealth(), new DistributionCompleteReporterMock());
+ }
+
+ @Test
+ public void testInit() throws Exception {
+ EnvironmentsEngine testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "init");
+ }
+
+ @Test
+ public void testConnectUebTopicTenantIsolation() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+ opEnvEntry.setEnvironmentId("mock");
+ AtomicBoolean status = null;
+ Map<String, DistributionEngineInitTask> envNamePerInitTask = new HashMap<>();
+ Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>();
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.connectUebTopicTenantIsolation(opEnvEntry, status, envNamePerInitTask, envNamePerPollingTask);
+ }
+
+ @Test
+ public void testConnectUebTopic() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+ AtomicBoolean status = new AtomicBoolean(true);
+ Map<String, DistributionEngineInitTask> envNamePerInitTask = new HashMap<>();
+ Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>();
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "connectUebTopic", opEnvEntry, status, envNamePerInitTask,
+ envNamePerPollingTask);
+ }
+
+ @Test
+ public void testHandleMessage() throws Exception {
+ EnvironmentsEngine testSubject;
+ String notification = "";
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.handleMessage(notification);
+ }
+
+ @Test
+ public void testHandleMessageLogic() throws Exception {
+ EnvironmentsEngine testSubject;
+ String notification = "";
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.handleMessageLogic(notification);
+ }
+
+ @Test
+ public void testValidateNotification() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ errorWrapper.setInnerElement(true);
+ IDmaapNotificationDataMock notificationData = new IDmaapNotificationDataMock();
+ IDmaapAuditNotificationDataMock auditNotificationData = new IDmaapAuditNotificationDataMock();
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "validateNotification",
+ errorWrapper, notificationData, auditNotificationData);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testSaveEntryWithFailedStatus() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "saveEntryWithFailedStatus", errorWrapper, opEnvEntry);
+ }
+
+ @Test
+ public void testRetrieveUebAddressesFromAftDme() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "retrieveUebAddressesFromAftDme", errorWrapper, opEnvEntry);
+ }
+
+ @Test
+ public void testCreateUebKeys() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ Set<String> dmaapUebAddress = new HashSet<>();
+ dmaapUebAddress.add("mock");
+ opEnvEntry.setDmaapUebAddress(dmaapUebAddress);
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "createUebKeys", errorWrapper, opEnvEntry);
+ }
+
+ /*@Test
+ public void testRetrieveOpEnvInfoFromAAI() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+ opEnvEntry.setEnvironmentId("mock");
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "retrieveOpEnvInfoFromAAI",
+ Wrapper.class, opEnvEntry);
+ }*/
+
+ /*
+ * @Test public void testSaveEntryWithInProgressStatus() throws Exception {
+ * EnvironmentsEngine testSubject; Wrapper<Boolean> errorWrapper = new
+ * Wrapper<>(); Wrapper<OperationalEnvironmentEntry> opEnvEntryWrapper = new
+ * Wrapper<>(); IDmaapNotificationData notificationData = new
+ * IDmaapNotificationDataMock();
+ *
+ * // default test testSubject = createTestSubject();
+ * Deencapsulation.invoke(testSubject, "saveEntryWithInProgressStatus",
+ * errorWrapper, opEnvEntryWrapper, notificationData); }
+ */
+
+ /*
+ * @Test public void testValidateState() throws Exception { EnvironmentsEngine
+ * testSubject; Wrapper<Boolean> errorWrapper = null; IDmaapNotificationDataMock
+ * notificationData = new IDmaapNotificationDataMock();
+ * notificationData.setOperationalEnvironmentId("mock");
+ *
+ * // default test testSubject = createTestSubject();
+ * Deencapsulation.invoke(testSubject, "validateState", Wrapper.class,
+ * notificationData); }
+ */
+
+ @Test
+ public void testValidateActionType() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ IDmaapNotificationDataMock notificationData = new IDmaapNotificationDataMock();
+ notificationData.setDmaapActionEnum(DmaapActionEnum.DELETE);
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "validateActionType", errorWrapper, notificationData);
+
+ notificationData.setDmaapActionEnum(DmaapActionEnum.CREATE);
+ Deencapsulation.invoke(testSubject, "validateActionType", errorWrapper, notificationData);
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testValidateEnvironmentType() throws Exception {
+ EnvironmentsEngine testSubject;
+ Wrapper<Boolean> errorWrapper = new Wrapper<>();
+ IDmaapNotificationDataMock notificationData = new IDmaapNotificationDataMock();
+ IDmaapAuditNotificationDataMock auditNotificationData = new IDmaapAuditNotificationDataMock();
+ auditNotificationData.operationalEnvironmentName = "mock";
+ notificationData.operationaEnvironmentTypeEnum = OperationaEnvironmentTypeEnum.ECOMP;
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "validateEnvironmentType", errorWrapper, notificationData,
+ auditNotificationData);
+
+ notificationData.operationaEnvironmentTypeEnum = OperationaEnvironmentTypeEnum.UNKONW;
+ notificationData.setDmaapActionEnum(DmaapActionEnum.CREATE);
+ Deencapsulation.invoke(testSubject, "validateEnvironmentType", errorWrapper, notificationData,
+ auditNotificationData);
+ }
+
+ @Test
+ public void testMap2OpEnvKey() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "map2OpEnvKey", entry);
+ }
+
+ @Test
+ public void testReadEnvFromConfig() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "readEnvFromConfig");
+ }
+
+ @Test
+ public void testCreateUebTopicsForEnvironment() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry opEnvEntry = new OperationalEnvironmentEntry();
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.createUebTopicsForEnvironment(opEnvEntry);
+ }
+
+ @Test
+ public void testSetConfigurationManager() throws Exception {
+ EnvironmentsEngine testSubject;
+ ConfigurationManager configurationManager = null;
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "setConfigurationManager", new Object[] { ConfigurationManager.class });
+ }
+
+ @Test
+ public void testGetEnvironments() throws Exception {
+ EnvironmentsEngine testSubject;
+ Map<String, OperationalEnvironmentEntry> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getEnvironments();
+ }
+
+ @Test
+ public void testIsInMap() throws Exception {
+ EnvironmentsEngine testSubject;
+ OperationalEnvironmentEntry env = new OperationalEnvironmentEntry();
+ env.setEnvironmentId("mock");
+ Map<String, OperationalEnvironmentEntry> mockEnvironments = new HashMap<>();
+ mockEnvironments.put("mock", new OperationalEnvironmentEntry());
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ ReflectionTestUtils.setField(testSubject, "environments", mockEnvironments);
+ result = testSubject.isInMap(env);
+ }
+
+ private class DistributionCompleteReporterMock implements DistributionCompleteReporter {
+ @Override
+ public void reportDistributionComplete(DistributionStatusNotification distributionStatusNotification) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ private class IDmaapNotificationDataMock implements IDmaapNotificationData {
+
+ private String operationalEnvironmentId;
+ private OperationaEnvironmentTypeEnum operationaEnvironmentTypeEnum;
+ private DmaapActionEnum dmaapActionEnum;
+
+ public OperationaEnvironmentTypeEnum getOperationaEnvironmentTypeEnum() {
+ return operationaEnvironmentTypeEnum;
+ }
+
+ public void setOperationaEnvironmentTypeEnum(OperationaEnvironmentTypeEnum operationaEnvironmentTypeEnum) {
+ this.operationaEnvironmentTypeEnum = operationaEnvironmentTypeEnum;
+ }
+
+ public DmaapActionEnum getDmaapActionEnum() {
+ return dmaapActionEnum;
+ }
+
+ public void setDmaapActionEnum(DmaapActionEnum dmaapActionEnum) {
+ this.dmaapActionEnum = dmaapActionEnum;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+ @Override
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ @Override
+ public OperationaEnvironmentTypeEnum getOperationalEnvironmentType() {
+ return operationaEnvironmentTypeEnum;
+ }
+
+ @Override
+ public DmaapActionEnum getAction() {
+ return dmaapActionEnum;
+ }
+ }
+
+ private class IDmaapAuditNotificationDataMock implements IDmaapAuditNotificationData {
+ private String operationalEnvironmentName;
+ private String tenantContext;
+
+ @Override
+ public String getOperationalEnvironmentName() {
+ return null;
+ }
+
+ @Override
+ public String getTenantContext() {
+ return null;
+ }
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-@RunWith(value = MockitoJUnitRunner.class)
-public class EnvironmentsEngineTest {
-
- @InjectMocks
- private EnvironmentsEngine envEngine;
- @Mock
- private DmaapConsumer dmaapConsumer;
- @Mock
- private OperationalEnvironmentDao operationalEnvironmentDao;
- @Mock
- private DME2EndpointIteratorCreator epIterCreator;
- @Mock
- private ConfigurationManager configurationManager;
- @Mock
- private DistributionEngineConfiguration distributionEngineConfiguration;
- @Mock
- private AaiRequestHandler aaiRequestHandler;
-
- @Before
- public void preStart() {
- when(configurationManager.getDistributionEngineConfiguration()).thenReturn(distributionEngineConfiguration);
- envEngine.setConfigurationManager(configurationManager);
- }
-
- @Test
- public void testInit() {
- List<OperationalEnvironmentEntry> entryList = Arrays.asList(createOpEnvEntry("Env1"), createOpEnvEntry("Env2"));
- Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> successEither = Either.left(entryList);
- when(operationalEnvironmentDao.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED)).thenReturn(successEither);
-
- when(distributionEngineConfiguration.getEnvironments()).thenReturn(Arrays.asList("Env Loaded From Configuration"));
- when(distributionEngineConfiguration.getUebPublicKey()).thenReturn("Dummy Public Key");
- when(distributionEngineConfiguration.getUebSecretKey()).thenReturn("Dummy Private Key");
- when(distributionEngineConfiguration.getUebServers()).thenReturn(
- Arrays.asList("uebsb91kcdc.it.att.com:3904", "uebsb92kcdc.it.att.com:3904", "uebsb91kcdc.it.att.com:3904"));
-
- envEngine.init();
-
- Map<String, OperationalEnvironmentEntry> mapEnvs = envEngine.getEnvironments();
- assertEquals("unexpected size of map",3, mapEnvs.size());
- }
-
-
- @Test
- public void testGetFullOperationalEnvByIdSuccess() {
- String json = getFullOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isLeft());
-
- OperationalEnvInfo operationalEnvInfo = response.left().value();
-
- assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
- }
-
- @Test
- public void testGetPartialOperationalEnvByIdSuccess() {
- String json = getPartialOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isLeft());
-
- OperationalEnvInfo operationalEnvInfo = response.left().value();
-
- assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json);
- }
-
-
- @Test
- public void testGetOperationalEnvByIdFailedByJsonConvert() {
- String jsonCorrupted = getCorruptedOperationalEnvJson();
-
- HttpResponse<String> restResponse = new HttpResponse<String>(jsonCorrupted, HttpStatus.SC_OK, "Successfully Completed");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isRight());
- assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_INTERNAL_SERVER_ERROR, response.right().value());
- }
-
- @Test
- public void testGetOperationalEnvByIdFailed404() {
- String json = getFullOperationalEnvJson();
- HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_NOT_FOUND, "Not Found");
- when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse);
-
- Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId");
- assertTrue("The operational environment request ran as not expected", response.isRight());
- assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_NOT_FOUND, response.right().value());
- }
-
-
- @Test(expected = IOException.class)
- public void testCorruptedOperationalEnvJson() throws IOException {
- String jsonCorrupted = getCorruptedOperationalEnvJson();
- OperationalEnvInfo.createFromJson(jsonCorrupted);
- }
-
- private String getCorruptedOperationalEnvJson() {
- return "{\"OPERATIONAL-environment-name\":\"Op Env Name\","
- + "\"OPERATIONAL-environment-type\":\"VNF\","
- + "\"OPERATIONAL-environment-status\":\"Activate\","
- + "\"tenant-context\":\"Test\"}";
- }
-
- private String getPartialOperationalEnvJson() {
- return "{" +
- "\"operational-environment-id\":\"UUID of Operational Environment\"," +
- "\"operational-environment-name\":\"Op Env Name\"," +
- "\"operational-environment-type\":\"VNF\"," +
- "\"operational-environment-status\":\"Activate\"," +
- "\"tenant-context\":\"Test\"," +
- "\"workload-context\":\"VNF_Development\"," +
- "\"resource-version\":\"1505228226913\"," +
- "\"relationship-list\":{" +
- "\"relationship\":[]" +
- "}" +
- "}";
- }
-
- private String getFullOperationalEnvJson() {
- return "{" +
- "\"operational-environment-id\":\"OEid1\"," +
- "\"operational-environment-name\":\"OEname1\"," +
- "\"operational-environment-type\":\"OEtype1\"," +
- "\"operational-environment-status\":\"OEstatus1\"," +
- "\"tenant-context\":\"OEtenantcontext1\"," +
- "\"workload-context\":\"OEworkloadcontext1\"," +
- "\"resource-version\":\"1511363173278\"," +
- "\"relationship-list\":{" +
- "\"relationship\":[" +
- "{" +
- "\"related-to\":\"operational-environment\"," +
- "\"relationship-label\":\"managedBy\"," +
- "\"related-link\":\"/aai/v12/cloud-infrastructure/operational-environments/operational-environment/OEid3\"," +
- "\"relationship-data\":[" +
- "{" +
- "\"relationship-key\":\"operational-environment.operational-environment-id\"," +
- "\"relationship-value\":\"OEid3\"" +
- "}" +
- "]," +
- "\"related-to-property\":[" +
- "{" +
- "\"property-key\":\"operational-environment.operational-environment-name\"," +
- "\"property-value\":\"OEname3\"" +
- "}]}]}}";
- }
-
- private OperationalEnvironmentEntry createOpEnvEntry(String name) {
- OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry();
- entry.setEnvironmentId(name);
- return entry;
- }
-
-}
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactoryTest.java
new file mode 100644
index 0000000000..b5ddb58789
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactoryTest.java
@@ -0,0 +1,62 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+
+import org.junit.Test;
+
+import mockit.Deencapsulation;
+
+public class ExecutorFactoryTest {
+
+ private ExecutorFactory createTestSubject() {
+ return new ExecutorFactory();
+ }
+
+ @Test
+ public void testCreate() throws Exception {
+ ExecutorFactory testSubject;
+ String name = "mock";
+ UncaughtExceptionHandler exceptionHandler = new UncaughtExceptionHandlerMock();
+ ExecutorService result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.create(name, exceptionHandler);
+ }
+
+ @Test
+ public void testCreateScheduled() throws Exception {
+ ExecutorFactory testSubject;
+ String name = "";
+ ScheduledExecutorService result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.createScheduled(name);
+ }
+
+ @Test
+ public void testCreateThreadFactory() throws Exception {
+ ExecutorFactory testSubject;
+ String name = "mock";
+ ThreadFactory result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "createThreadFactory",
+ name, new UncaughtExceptionHandlerMock());
+ }
+
+ private class UncaughtExceptionHandlerMock implements UncaughtExceptionHandler {
+
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstanceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstanceTest.java
new file mode 100644
index 0000000000..b5beabda3d
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstanceTest.java
@@ -0,0 +1,233 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
+import org.openecomp.sdc.be.model.ComponentInstance;
+
+public class JsonContainerResourceInstanceTest {
+
+ private JsonContainerResourceInstance createTestSubject() {
+ return new JsonContainerResourceInstance(new ComponentInstance(), "", null);
+ }
+
+ @Test
+ public void testConstructor() throws Exception {
+ ComponentInstance componentInstance = new ComponentInstance();
+ new JsonContainerResourceInstance(componentInstance, new LinkedList<>());
+ componentInstance.setOriginType(OriginTypeEnum.Configuration);
+ new JsonContainerResourceInstance(componentInstance, new LinkedList<>());
+ }
+
+ @Test
+ public void testGetResourceInstanceName() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceInstanceName();
+ }
+
+ @Test
+ public void testSetResourceInstanceName() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resourceInstanceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceInstanceName(resourceInstanceName);
+ }
+
+ @Test
+ public void testGetResourceName() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceName();
+ }
+
+ @Test
+ public void testSetResourceName() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resourceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceName(resourceName);
+ }
+
+ @Test
+ public void testGetResourceVersion() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceVersion();
+ }
+
+ @Test
+ public void testSetResourceVersion() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resourceVersion = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceVersion(resourceVersion);
+ }
+
+ @Test
+ public void testGetResoucreType() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResoucreType();
+ }
+
+ @Test
+ public void testSetResoucreType() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resoucreType = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResoucreType(resoucreType);
+ }
+
+ @Test
+ public void testGetResourceUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceUUID();
+ }
+
+ @Test
+ public void testSetResourceUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resourceUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceUUID(resourceUUID);
+ }
+
+ @Test
+ public void testGetArtifacts() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ List<ArtifactInfoImpl> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getArtifacts();
+ }
+
+ @Test
+ public void testSetArtifacts() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ List<ArtifactInfoImpl> artifacts = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setArtifacts(artifacts);
+ }
+
+ @Test
+ public void testGetResourceInvariantUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceInvariantUUID();
+ }
+
+ @Test
+ public void testSetResourceInvariantUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String resourceInvariantUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceInvariantUUID(resourceInvariantUUID);
+ }
+
+ @Test
+ public void testGetResourceCustomizationUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceCustomizationUUID();
+ }
+
+ @Test
+ public void testSetResourceCustomizationUUID() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String customizationUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceCustomizationUUID(customizationUUID);
+ }
+
+ @Test
+ public void testGetCategory() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCategory();
+ }
+
+ @Test
+ public void testSetCategory() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String category = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCategory(category);
+ }
+
+ @Test
+ public void testGetSubcategory() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getSubcategory();
+ }
+
+ @Test
+ public void testSetSubcategory() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String subcategory = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setSubcategory(subcategory);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ JsonContainerResourceInstance testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationDataImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationDataImplTest.java
new file mode 100644
index 0000000000..de7e5a129c
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationDataImplTest.java
@@ -0,0 +1,202 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import java.util.List;
+
+import org.junit.Test;
+
+public class NotificationDataImplTest {
+
+ private NotificationDataImpl createTestSubject() {
+ return new NotificationDataImpl();
+ }
+
+ @Test
+ public void testGetDistributionID() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getDistributionID();
+ }
+
+ @Test
+ public void testGetServiceName() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceName();
+ }
+
+ @Test
+ public void testGetServiceVersion() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceVersion();
+ }
+
+ @Test
+ public void testGetServiceUUID() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceUUID();
+ }
+
+ @Test
+ public void testSetDistributionID() throws Exception {
+ NotificationDataImpl testSubject;
+ String distributionID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setDistributionID(distributionID);
+ }
+
+ @Test
+ public void testSetServiceName() throws Exception {
+ NotificationDataImpl testSubject;
+ String serviceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceName(serviceName);
+ }
+
+ @Test
+ public void testSetServiceVersion() throws Exception {
+ NotificationDataImpl testSubject;
+ String serviceVersion = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceVersion(serviceVersion);
+ }
+
+ @Test
+ public void testSetServiceUUID() throws Exception {
+ NotificationDataImpl testSubject;
+ String serviceUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceUUID(serviceUUID);
+ }
+
+ @Test
+ public void testGetServiceDescription() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceDescription();
+ }
+
+ @Test
+ public void testSetServiceDescription() throws Exception {
+ NotificationDataImpl testSubject;
+ String serviceDescription = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceDescription(serviceDescription);
+ }
+
+ @Test
+ public void testGetWorkloadContext() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getWorkloadContext();
+ }
+
+ @Test
+ public void testSetWorkloadContext() throws Exception {
+ NotificationDataImpl testSubject;
+ String workloadContext = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setWorkloadContext(workloadContext);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+
+ @Test
+ public void testGetResources() throws Exception {
+ NotificationDataImpl testSubject;
+ List<JsonContainerResourceInstance> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResources();
+ }
+
+ @Test
+ public void testSetResources() throws Exception {
+ NotificationDataImpl testSubject;
+ List<JsonContainerResourceInstance> resources = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResources(resources);
+ }
+
+ @Test
+ public void testGetServiceArtifacts() throws Exception {
+ NotificationDataImpl testSubject;
+ List<ArtifactInfoImpl> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceArtifacts();
+ }
+
+ @Test
+ public void testSetServiceArtifacts() throws Exception {
+ NotificationDataImpl testSubject;
+ List<ArtifactInfoImpl> serviceArtifacts = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceArtifacts(serviceArtifacts);
+ }
+
+ @Test
+ public void testGetServiceInvariantUUID() throws Exception {
+ NotificationDataImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServiceInvariantUUID();
+ }
+
+ @Test
+ public void testSetServiceInvariantUUID() throws Exception {
+ NotificationDataImpl testSubject;
+ String serviceInvariantUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceInvariantUUID(serviceInvariantUUID);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorServiceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorServiceTest.java
new file mode 100644
index 0000000000..bda1723fde
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorServiceTest.java
@@ -0,0 +1,147 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionNotificationTopicConfig;
+
+public class NotificationExecutorServiceTest {
+
+ private NotificationExecutorService createTestSubject() {
+ return new NotificationExecutorService();
+ }
+
+ @Test
+ public void testCreateExcecutorService() throws Exception {
+ NotificationExecutorService testSubject;
+ DistributionNotificationTopicConfig distributionNotificationTopic = new DistributionNotificationTopicConfig();
+ ExecutorService result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.createExcecutorService(distributionNotificationTopic);
+ distributionNotificationTopic.setMinThreadPoolSize(1);
+ result = testSubject.createExcecutorService(distributionNotificationTopic);
+ distributionNotificationTopic.setMaxThreadPoolSize(1);
+ result = testSubject.createExcecutorService(distributionNotificationTopic);
+ }
+
+ @Test
+ public void testShutdownAndAwaitTermination() throws Exception {
+ NotificationExecutorService testSubject;
+ NotificationExecutorServiceMock pool = new NotificationExecutorServiceMock();
+ long maxTimeToWait = 435435;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.shutdownAndAwaitTermination(pool, maxTimeToWait);
+ pool.awaitTermination = true;
+ testSubject.shutdownAndAwaitTermination(pool, maxTimeToWait);
+ pool.awaitTermination = true;
+ pool.isShutdownException = true;
+ testSubject.shutdownAndAwaitTermination(pool, maxTimeToWait);
+ }
+
+ private class NotificationExecutorServiceMock implements ExecutorService {
+
+ private boolean awaitTermination = false;
+ private boolean isShutdownException = false;
+
+ @Override
+ public void execute(Runnable command) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<Runnable> shutdownNow() {
+ // TODO Auto-generated method stub
+ if (isShutdownException) {
+ try {
+ throw new InterruptedException();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isShutdown() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isTerminated() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+ // TODO Auto-generated method stub
+ return awaitTermination;
+ }
+
+ @Override
+ public <T> Future<T> submit(Callable<T> task) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> Future<T> submit(Runnable task, T result) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Future<?> submit(Runnable task) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
+ throws InterruptedException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
+ throws InterruptedException, ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
+ throws InterruptedException, ExecutionException, TimeoutException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ResourceArtifactInfoImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ResourceArtifactInfoImplTest.java
new file mode 100644
index 0000000000..476e51252d
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ResourceArtifactInfoImplTest.java
@@ -0,0 +1,80 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import org.junit.Test;
+
+public class ResourceArtifactInfoImplTest {
+
+ private ResourceArtifactInfoImpl createTestSubject() {
+ return new ResourceArtifactInfoImpl();
+ }
+
+ @Test
+ public void testGetResourceName() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceName();
+ }
+
+ @Test
+ public void testSetResourceName() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String resourceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceName(resourceName);
+ }
+
+ @Test
+ public void testGetResourceVersion() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceVersion();
+ }
+
+ @Test
+ public void testSetResourceVersion() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String resourceVersion = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceVersion(resourceVersion);
+ }
+
+ @Test
+ public void testGetResourceUUID() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceUUID();
+ }
+
+ @Test
+ public void testSetResourceUUID() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String resourceUUID = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceUUID(resourceUUID);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ ResourceArtifactInfoImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceArtifactInfoImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceArtifactInfoImplTest.java
new file mode 100644
index 0000000000..b38e1f5fa9
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceArtifactInfoImplTest.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import org.junit.Test;
+
+public class ServiceArtifactInfoImplTest {
+
+ private ServiceArtifactInfoImpl createTestSubject() {
+ return new ServiceArtifactInfoImpl();
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ ServiceArtifactInfoImpl testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
index 0c1f3a7513..c50eb88f80 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
@@ -1,76 +1,347 @@
package org.openecomp.sdc.be.components.distribution.engine;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
import org.junit.Test;
+import org.openecomp.sdc.be.components.BeConfDependentTest;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+
+import mockit.Deencapsulation;
-public class ServiceDistributionArtifactsBuilderTest {
+public class ServiceDistributionArtifactsBuilderTest extends BeConfDependentTest {
private ServiceDistributionArtifactsBuilder createTestSubject() {
return new ServiceDistributionArtifactsBuilder();
}
-
@Test
- public void testBuildResourceInstanceArtifactUrl() throws Exception {
- Service service = new Service();
- ComponentInstance resourceInstance = new ComponentInstance();
- String artifactName = "";
- String result;
+ public void testGetInterfaceLifecycleOperation() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ InterfaceLifecycleOperation result;
// default test
- result = ServiceDistributionArtifactsBuilder.buildResourceInstanceArtifactUrl(service, resourceInstance,
- artifactName);
+ testSubject = createTestSubject();
+ result = testSubject.getInterfaceLifecycleOperation();
}
-
-
-
@Test
- public void testBuildServiceArtifactUrl() throws Exception {
- Service service = new Service();;
- String artifactName = "";
+ public void testSetInterfaceLifecycleOperation() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ InterfaceLifecycleOperation interfaceLifecycleOperation = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setInterfaceLifecycleOperation(interfaceLifecycleOperation);
+ }
+
+ @Test
+ public void testResolveWorkloadContext() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ String workloadContext = "";
String result;
// default test
- result = ServiceDistributionArtifactsBuilder.buildServiceArtifactUrl(service, artifactName);
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "resolveWorkloadContext", new Object[] { workloadContext });
}
-
+ @Test
+ public void testBuildResourceInstanceForDistribution() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Service service = new Service();
+ String distributionId = "";
+ String workloadContext = "";
+ INotificationData result;
+ // test 1
+ testSubject = createTestSubject();
+ workloadContext = "mock";
+ result = testSubject.buildResourceInstanceForDistribution(service, distributionId, workloadContext);
+
+ // test 2
+ testSubject = createTestSubject();
+ workloadContext = null;
+ result = testSubject.buildResourceInstanceForDistribution(service, distributionId, workloadContext);
+ }
-
@Test
- public void testGetInterfaceLifecycleOperation() throws Exception {
+ public void testBuildServiceForDistribution() throws Exception {
ServiceDistributionArtifactsBuilder testSubject;
- InterfaceLifecycleOperation result;
+ INotificationData notificationData = new INotificationDataMock();
+ Service service = new Service();
+ service.setDeploymentArtifacts(new HashMap<>());
+ service.setToscaArtifacts(new HashMap<>());
+ INotificationData result;
// default test
testSubject = createTestSubject();
- result = testSubject.getInterfaceLifecycleOperation();
+ result = testSubject.buildServiceForDistribution(notificationData, service);
}
+ @Test(expected = NullPointerException.class)
+ public void testConvertServiceArtifactsToArtifactInfo() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Service service = new Service();
+ service.setDeploymentArtifacts(new HashMap<>());
+ Map<String, ArtifactDefinition> toscaArtifacts = new HashMap<>();
+ ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+ ArtifactDefinition artifactDefinition2 = new ArtifactDefinition();
+ artifactDefinition.setArtifactType(ArtifactTypeEnum.TOSCA_TEMPLATE.getType());
+ artifactDefinition2.setArtifactType(ArtifactTypeEnum.TOSCA_CSAR.getType());
+ toscaArtifacts.put("mock", artifactDefinition);
+ toscaArtifacts.put("mock2", artifactDefinition2);
+ service.setToscaArtifacts(new HashMap<>());
+ List<ArtifactInfoImpl> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "convertServiceArtifactsToArtifactInfo", service);
+ service.setToscaArtifacts(toscaArtifacts);
+ result = Deencapsulation.invoke(testSubject, "convertServiceArtifactsToArtifactInfo", service);
+ }
+ @Test(expected=NullPointerException.class)
+ public void testConvertRIsToJsonContanier() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Service service = new Service();
+ List<ComponentInstance> resourceInstances = new LinkedList<>();
+ List<JsonContainerResourceInstance> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "convertRIsToJsonContanier", service);
+
+ resourceInstances.add(new ComponentInstance());
+ service.setComponentInstances(resourceInstances);
+ result = Deencapsulation.invoke(testSubject, "convertRIsToJsonContanier", service);
+ }
+
@Test
- public void testSetInterfaceLifecycleOperation() throws Exception {
+ public void testFillJsonContainer() throws Exception {
ServiceDistributionArtifactsBuilder testSubject;
- InterfaceLifecycleOperation interfaceLifecycleOperation = null;
+ JsonContainerResourceInstance jsonContainer = new JsonContainerResourceInstance(new ComponentInstance(),
+ new LinkedList<>());
+ Resource resource = new Resource();
// default test
testSubject = createTestSubject();
- testSubject.setInterfaceLifecycleOperation(interfaceLifecycleOperation);
+ Deencapsulation.invoke(testSubject, "fillJsonContainer", jsonContainer, resource);
+ }
+
+ @Test
+ public void testConvertToArtifactsInfoImpl() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Service service = new Service();
+ ComponentInstance resourceInstance = new ComponentInstance();
+ List<ArtifactInfoImpl> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "convertToArtifactsInfoImpl", service, resourceInstance);
+ }
+
+ @Test
+ public void testSetCategories() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ JsonContainerResourceInstance jsonContainer = null;
+ List<CategoryDefinition> categories = null;
+
+ // test 1
+ testSubject = createTestSubject();
+ categories = null;
+ Deencapsulation.invoke(testSubject, "setCategories",
+ new Object[] { JsonContainerResourceInstance.class, List.class });
+ }
+
+ @Test
+ public void testGetArtifactsWithPayload() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ ComponentInstance resourceInstance = new ComponentInstance();
+ Map<String, ArtifactDefinition> deploymentArtifacts = new HashMap<>();
+ resourceInstance.setDeploymentArtifacts(deploymentArtifacts);
+ List<ArtifactDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getArtifactsWithPayload", resourceInstance);
+ deploymentArtifacts.put("mock", new ArtifactDefinition());
+ result = Deencapsulation.invoke(testSubject, "getArtifactsWithPayload", resourceInstance);
+ }
+
+ @Test
+ public void testBuildResourceInstanceArtifactUrl() throws Exception {
+ Service service = new Service();
+ service.setSystemName("mock");
+ service.setVersion("mock");
+ ComponentInstance resourceInstance = new ComponentInstance();
+ resourceInstance.setNormalizedName("mock");
+ String artifactName = "mock";
+ String result;
+
+ // default test
+ result = ServiceDistributionArtifactsBuilder.buildResourceInstanceArtifactUrl(service, resourceInstance,
+ artifactName);
+ }
+
+ @Test
+ public void testBuildServiceArtifactUrl() throws Exception {
+ Service service = new Service();
+ String artifactName = "mock";
+ String result;
+
+ // default test
+ result = ServiceDistributionArtifactsBuilder.buildServiceArtifactUrl(service, artifactName);
}
-
@Test
public void testVerifyServiceContainsDeploymentArtifacts() throws Exception {
ServiceDistributionArtifactsBuilder testSubject;
- Service service = new Service();;
+ Service service = new Service();
boolean result;
// default test
testSubject = createTestSubject();
result = testSubject.verifyServiceContainsDeploymentArtifacts(service);
+ Map<String, ArtifactDefinition> deploymentArtifacts = new HashMap<>();
+ deploymentArtifacts.put("mock", new ArtifactDefinition());
+ service.setDeploymentArtifacts(deploymentArtifacts);
+ result = testSubject.verifyServiceContainsDeploymentArtifacts(service);
+ List<ComponentInstance> resourceInstances = new LinkedList<>();
+ resourceInstances.add(new ComponentInstance());
+ service.setComponentInstances(resourceInstances);
+ service.setDeploymentArtifacts(null);
+ result = testSubject.verifyServiceContainsDeploymentArtifacts(service);
+ }
+
+ @Test
+ public void testIsContainsPayload() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Map<String, ArtifactDefinition> deploymentArtifacts = null;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "isContainsPayload", new Object[] { Map.class });
+ }
+
+ private class INotificationDataMock implements INotificationData {
+
+ @Override
+ public String getDistributionID() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceUUID() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getServiceInvariantUUID() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<JsonContainerResourceInstance> getResources() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List<ArtifactInfoImpl> getServiceArtifacts() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getWorkloadContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setDistributionID(String distributionId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceName(String serviceName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceVersion(String serviceVersion) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceUUID(String serviceUUID) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceDescription(String serviceDescription) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceInvariantUUID(String serviceInvariantUuid) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setResources(List<JsonContainerResourceInstance> resource) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setServiceArtifacts(List<ArtifactInfoImpl> artifacts) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setWorkloadContext(String workloadContext) {
+ // TODO Auto-generated method stub
+
+ }
+
}
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCallTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCallTest.java
new file mode 100644
index 0000000000..36f5c03226
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCallTest.java
@@ -0,0 +1,51 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.components.BeConfDependentTest;
+
+public class UebHealthCheckCallTest extends BeConfDependentTest {
+
+ private UebHealthCheckCall createTestSubject() {
+ return new UebHealthCheckCall("mock", "mock");
+ }
+
+ @Test
+ public void testCall() throws Exception {
+ UebHealthCheckCall testSubject;
+ Boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.call();
+ }
+
+ @Test
+ public void testGetServer() throws Exception {
+ UebHealthCheckCall testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getServer();
+ }
+
+ @Test
+ public void testGetCambriaHandler() throws Exception {
+ UebHealthCheckCall testSubject;
+ CambriaHandler result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCambriaHandler();
+ }
+
+ @Test
+ public void testSetCambriaHandler() throws Exception {
+ UebHealthCheckCall testSubject;
+ CambriaHandler cambriaHandler = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCambriaHandler(cambriaHandler);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java
index 4144dcf620..c8e7447e5b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayloadTest.java
@@ -6,6 +6,7 @@ import java.util.Map;
import org.junit.Test;
import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
import org.openecomp.sdc.be.model.GroupInstanceProperty;
@@ -15,7 +16,10 @@ public class VfModuleArtifactPayloadTest {
return new VfModuleArtifactPayload(new GroupDefinition());
}
-
+ @Test
+ public void testConstructor() {
+ new VfModuleArtifactPayload(new GroupInstance());
+ }
@Test
@@ -60,4 +64,19 @@ public class VfModuleArtifactPayloadTest {
testSubject = createTestSubject();
testSubject.setProperties(properties);
}
+
+ @Test
+ public void testcompareByGroupName() throws Exception {
+ VfModuleArtifactPayload testSubject;
+ GroupDefinition groupDefinition = new GroupDefinition();
+ groupDefinition.setName("module-1234.545");
+ VfModuleArtifactPayload vfModuleArtifactPayload1 = new VfModuleArtifactPayload(groupDefinition);
+ GroupDefinition groupDefinition2 = new GroupDefinition();
+ groupDefinition.setName("module-3424.546");
+ VfModuleArtifactPayload vfModuleArtifactPayload2 = new VfModuleArtifactPayload(groupDefinition);
+ // default test
+ testSubject = createTestSubject();
+ testSubject.compareByGroupName(vfModuleArtifactPayload1, vfModuleArtifactPayload2);
+ testSubject.compareByGroupName(vfModuleArtifactPayload1, vfModuleArtifactPayload1);
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/DistributionStatusRequestTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/DistributionStatusRequestTest.java
new file mode 100644
index 0000000000..ea18dab68a
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/DistributionStatusRequestTest.java
@@ -0,0 +1,30 @@
+package org.openecomp.sdc.be.components.distribution.engine.rest;
+
+import org.junit.Test;
+
+public class DistributionStatusRequestTest {
+
+ private DistributionStatusRequest createTestSubject() {
+ return new DistributionStatusRequest("", "");
+ }
+
+ @Test
+ public void testGetStatus() throws Exception {
+ DistributionStatusRequest testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getStatus();
+ }
+
+ @Test
+ public void testGetErrorReason() throws Exception {
+ DistributionStatusRequest testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getErrorReason();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
index c7b55f2eef..4bbf7afdd0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java
@@ -1,15 +1,209 @@
package org.openecomp.sdc.be.components.health;
+import java.util.LinkedList;
import java.util.List;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.Assert;
import org.junit.Test;
+import org.openecomp.sdc.be.components.BeConfDependentTest;
+import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth;
+import org.openecomp.sdc.be.components.distribution.engine.DmaapHealth;
+import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector;
import org.openecomp.sdc.common.api.HealthCheckInfo;
+import org.springframework.test.util.ReflectionTestUtils;
-public class HealthCheckBusinessLogicTest {
+import mockit.Deencapsulation;
+
+public class HealthCheckBusinessLogicTest extends BeConfDependentTest{
private HealthCheckBusinessLogic createTestSubject() {
- return new HealthCheckBusinessLogic();
+ HealthCheckBusinessLogic healthCheckBusinessLogic = new HealthCheckBusinessLogic();
+ DmaapHealth dmaapHealth = new DmaapHealth();
+ ReflectionTestUtils.setField(healthCheckBusinessLogic, "dmaapHealth", dmaapHealth);
+ DistributionEngineClusterHealth distributionEngineClusterHealth = new DistributionEngineClusterHealth();
+ ReflectionTestUtils.setField(healthCheckBusinessLogic, "distributionEngineClusterHealth", distributionEngineClusterHealth);
+ SwitchoverDetector switchoverDetector = new SwitchoverDetector();
+ ReflectionTestUtils.setField(healthCheckBusinessLogic, "switchoverDetector", switchoverDetector);
+ List<HealthCheckInfo> prevBeHealthCheckInfos = new LinkedList<>();
+ ReflectionTestUtils.setField(healthCheckBusinessLogic, "prevBeHealthCheckInfos", prevBeHealthCheckInfos);
+ return healthCheckBusinessLogic;
+ }
+
+ @Test
+ public void testInit() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.init();
+ }
+
+ @Test
+ public void testIsDistributionEngineUp() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.isDistributionEngineUp();
+ }
+
+ @Test
+ public void testGetBeHealthCheckInfosStatus() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ Pair<Boolean, List<HealthCheckInfo>> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getBeHealthCheckInfosStatus();
+ }
+
+ @Test
+ public void testGetBeHealthCheckInfos() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> result;
+
+
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getBeHealthCheckInfos");
+ }
+
+ @Test
+ public void testGetEsHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getEsHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetBeHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getBeHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetDmaapHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getDmaapHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetTitanHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getTitanHealthCheck(healthCheckInfos);
+ }
+
+ @Test
+ public void testGetCassandraHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getCassandraHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetDistributionEngineCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "getDistributionEngineCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetAmdocsHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getAmdocsHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetDcaeHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ List<HealthCheckInfo> healthCheckInfos = new LinkedList<>();
+ List<HealthCheckInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getDcaeHealthCheck", healthCheckInfos);
+ }
+
+ @Test
+ public void testGetHostedComponentsBeHealthCheck() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ String componentName = "mock";
+ String healthCheckUrl = "mock";
+ HealthCheckInfo result;
+
+ // test 1
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getHostedComponentsBeHealthCheck",
+ componentName, healthCheckUrl);
+
+ // test 2
+ testSubject = createTestSubject();
+ healthCheckUrl = "";
+ result = Deencapsulation.invoke(testSubject, "getHostedComponentsBeHealthCheck",
+ componentName, healthCheckUrl);
+ }
+
+ @Test
+ public void testDestroy() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "destroy");
+ }
+
+ @Test
+ public void testLogAlarm() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ String componentChangedMsg = "mock";
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "logAlarm", componentChangedMsg);
+ }
+
+ @Test
+ public void testGetSiteMode() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getSiteMode();
}
@Test
@@ -48,4 +242,23 @@ public class HealthCheckBusinessLogicTest {
Assert.assertEquals(false, result);
}
+ @Test
+ public void testBuildOnBoardingHealthCheckUrl() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "buildOnBoardingHealthCheckUrl");
+ }
+
+ @Test
+ public void testBuildDcaeHealthCheckUrl() throws Exception {
+ HealthCheckBusinessLogic testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "buildDcaeHealthCheckUrl");
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java
new file mode 100644
index 0000000000..c2ad653353
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/exceptions/ComponentExceptionTest.java
@@ -0,0 +1,47 @@
+package org.openecomp.sdc.be.components.impl.exceptions;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.exception.ResponseFormat;
+
+public class ComponentExceptionTest {
+
+ private ComponentException createTestSubject() {
+ return new ComponentException(new ResponseFormat());
+ }
+
+ @Test
+ public void testConstructor() throws Exception {
+ new ComponentException(ActionStatus.AAI_ARTIFACT_GENERATION_FAILED, "mock", "moc");
+ }
+
+ @Test
+ public void testGetResponseFormat() throws Exception {
+ ComponentException testSubject;
+ ResponseFormat result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResponseFormat();
+ }
+
+ @Test
+ public void testGetActionStatus() throws Exception {
+ ComponentException testSubject;
+ ActionStatus result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getActionStatus();
+ }
+
+ @Test
+ public void testGetParams() throws Exception {
+ ComponentException testSubject;
+ String[] result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getParams();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
index 80f63e71e9..19c6db9239 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java
@@ -23,14 +23,22 @@ package org.openecomp.sdc.be.components.lifecycle;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.List;
+
import org.junit.Before;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -68,7 +76,19 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase {
resource = createResourceObject();
}
+
+ @Test
+ public void testConstructor(){
+ Resource resource = createResourceVFCMTObject();
+ User user = new User("cs0008", "Carlos", "Santana", "cs@sdc.com", "DESIGNER", null);
+
+ for (LifeCycleTransitionEnum value : LifeCycleTransitionEnum.values()) {
+ new CertificationChangeTransition(value, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao);
+ }
+
+ }
+
@Test
public void testVFCMTStateValidation(){
Resource resource = createResourceVFCMTObject();
@@ -86,7 +106,7 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase {
assertEquals(changeStateResult.isLeft(), true);
}
-
+
@Test
public void testStateValidationFail() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java
new file mode 100644
index 0000000000..7001d26245
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java
@@ -0,0 +1,82 @@
+package org.openecomp.sdc.be.components.lifecycle;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.auditing.impl.AuditingManager;
+import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
+import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
+import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
+import org.openecomp.sdc.be.dao.impl.AuditingDao;
+import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentMetadataDefinition;
+import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.operations.impl.CapabilityOperation;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
+import org.openecomp.sdc.exception.ResponseFormat;
+
+import fj.data.Either;
+import mockit.Deencapsulation;
+
+public class CertificationRequestTransitionTest extends LifecycleTestBase {
+
+ private CertificationRequestTransition createTestSubject() {
+ return new CertificationRequestTransition(
+ new ComponentsUtils(new AuditingManager(new AuditingDao(), new AuditCassandraDao())),
+ new ToscaElementLifecycleOperation(), new ServiceDistributionArtifactsBuilder(),
+ new ServiceBusinessLogic(), new CapabilityOperation(), new ToscaExportHandler(),
+ new ToscaOperationFacade(), new TitanDao(new TitanGraphClient()));
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ CertificationRequestTransition testSubject;
+ LifeCycleTransitionEnum result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getName();
+ }
+
+ @Test
+ public void testGetAuditingAction() throws Exception {
+ CertificationRequestTransition testSubject;
+ AuditingActionEnum result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAuditingAction();
+ }
+
+ @Test
+ public void testValidateAllResourceInstanceCertified() throws Exception {
+ CertificationRequestTransition testSubject;
+ Component component = new Resource();
+ Either<Boolean, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "validateAllResourceInstanceCertified", component);
+ }
+
+ @Test
+ public void testValidateConfiguredAtomicReqCapSatisfied() throws Exception {
+ CertificationRequestTransition testSubject;
+ Component component = new Resource();
+ Either<Boolean, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "validateConfiguredAtomicReqCapSatisfied", component);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java
new file mode 100644
index 0000000000..e7f8422b15
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoBaseTest.java
@@ -0,0 +1,30 @@
+package org.openecomp.sdc.be.components.lifecycle;
+
+import org.junit.Test;
+
+public class LifecycleChangeInfoBaseTest {
+
+ private LifecycleChangeInfoBase createTestSubject() {
+ return new LifecycleChangeInfoBase();
+ }
+
+ @Test
+ public void testGetUserRemarks() throws Exception {
+ LifecycleChangeInfoBase testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getUserRemarks();
+ }
+
+ @Test
+ public void testSetUserRemarks() throws Exception {
+ LifecycleChangeInfoBase testSubject;
+ String userRemarks = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setUserRemarks(userRemarks);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java
new file mode 100644
index 0000000000..584051a394
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleChangeInfoWithActionTest.java
@@ -0,0 +1,37 @@
+package org.openecomp.sdc.be.components.lifecycle;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum;
+
+public class LifecycleChangeInfoWithActionTest {
+
+ private LifecycleChangeInfoWithAction createTestSubject() {
+ return new LifecycleChangeInfoWithAction();
+ }
+
+ @Test
+ public void testConstructor() throws Exception {
+ new LifecycleChangeInfoWithAction("mock");
+ new LifecycleChangeInfoWithAction("mock", LifecycleChanceActionEnum.CREATE_FROM_CSAR);
+ }
+
+ @Test
+ public void testGetAction() throws Exception {
+ LifecycleChangeInfoWithAction testSubject;
+ LifecycleChanceActionEnum result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAction();
+ }
+
+ @Test
+ public void testSetAction() throws Exception {
+ LifecycleChangeInfoWithAction testSubject;
+ LifecycleChanceActionEnum action = LifecycleChanceActionEnum.CREATE_FROM_CSAR;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAction(action);
+ }
+} \ No newline at end of file