aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/test/java/org')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java3
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java52
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java33
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java157
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java4
10 files changed, 45 insertions, 214 deletions
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
index f7e678731e..27b6c0ab53 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
@@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
index 6d1bfcdb8f..2827f8721e 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
@@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
index ce8b664bda..16bd97b409 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
@@ -52,7 +52,8 @@ public class ASDCConfigurationTest extends BaseTest {
assertTrue(config.getPollingInterval() == 30);
assertTrue(config.getPollingTimeout() == 30);
assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size());
- assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.isUseHttpsWithDmaap() == true);
}
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
index 97fa773fd5..ba95a6ea24 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
@@ -20,7 +20,7 @@
package org.onap.so.asdc.client;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index e61957d8c2..546c4e2458 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -27,73 +27,40 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.transaction.Transactional;
import javax.ws.rs.core.Response;
-import org.junit.Ignore;
+import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResource;
-import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResource;
-import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceInstanceGroupCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
-import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ASDCRestInterfaceTest extends BaseTest {
- //ASDC Controller writes to this path
- static {
- System.setProperty("mso.config.path", "src/test/resources/");
- }
-
@Autowired
private AllottedResourceRepository allottedRepo;
@@ -116,6 +83,16 @@ public class ASDCRestInterfaceTest extends BaseTest {
@LocalServerPort
private int port;
+
+ @Rule
+ public TemporaryFolder folder= new TemporaryFolder();
+
+
+ @Before
+ public void setUp() {
+ //ASDC Controller writes to this path
+ System.setProperty("mso.config.path", folder.getRoot().toString());
+ }
@Test
@Transactional
@@ -148,7 +125,6 @@ public class ASDCRestInterfaceTest extends BaseTest {
AllottedResourceCustomization arCustomization = new AllottedResourceCustomization();
arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba");
arCustomization.setModelInstanceName("rege1802pnf 0");
- arCustomization.setResourceInput("{}");
arCustomizationSet.add(arCustomization);
arCustomization.setAllottedResource(expectedService);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
index f5f7445771..cd2c3ee7e6 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.asdc.Application;
import org.onap.so.asdc.BaseTest;
-import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
index 6f07f44e2b..db797cff29 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
@@ -55,7 +55,7 @@ public class ASDCConfigurationTest extends BaseTest {
@Test
public void isUseHttpsWithDmaapTest() {
- assertFalse(config.isUseHttpsWithDmaap());
+ assertTrue(config.isUseHttpsWithDmaap());
}
@Test
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
index 535434db32..c572097103 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
@@ -21,13 +21,16 @@
package org.onap.so.asdc.installer.bpmn;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import javax.transaction.Transactional;
@@ -40,39 +43,45 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.asdc.BaseTest;
-import org.onap.so.asdc.installer.bpmn.BpmnInstaller;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.junit.rules.TemporaryFolder;
@Transactional
-public class BpmnInstallerTest extends BaseTest {
+public class BpmnInstallerTest {
- @Autowired
- private BpmnInstaller bpmnInstaller;
+ private BpmnInstaller bpmnInstaller = new BpmnInstaller();
+ @Rule
+ public TemporaryFolder folder= new TemporaryFolder();
+
@Before
public void init() throws Exception {
- System.setProperty("mso.config.path", "src/test/resources");
+ System.setProperty("mso.config.path", folder.getRoot().toString());
}
@Test
public void buildMimeMultiPart_Test() throws Exception {
-
+ Path tempDirectoryPath = Paths.get(folder.getRoot().toString(), "ASDC");
+ Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn");
+ Files.createDirectories(tempDirectoryPath);
+ Files.createFile(tempFilePath);
HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn");
- String mimeMultipartBodyFilePath = System.getProperty("mso.config.path") + "/mime-multipart-body.txt";
+ String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt";
File mimeMultipartBody = new File(mimeMultipartBodyFilePath);
InputStream expectedContent = new FileInputStream(mimeMultipartBody);
- assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+ assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+
+ IOUtils.closeQuietly(expectedContent);
}
@Test
public void installBpmn_Test() throws Exception {
HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, ""));
HttpClient httpClient = mock(HttpClient.class);
- String csarPath = System.getProperty("mso.config.path") + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar";
+ String csarPath = "src/test/resources" + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar";
doReturn(response).when(httpClient).execute(any(HttpPost.class));
bpmnInstaller.installBpmn(csarPath);
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 89bfe07374..9ab4c5ecb2 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -25,7 +25,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -221,161 +221,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@Test
- @Ignore
- @Transactional
- public void installTheResourceTest() throws Exception {
- notificationData.setDistributionID("testStatusSuccessTosca");
- notificationData.setServiceVersion("123456");
- notificationData.setServiceUUID("5df8b6de-2083-11e7-93ae-92361f002671");
- notificationData.setWorkloadContext("workloadContext");
-
- HashMap<String, VfModuleArtifact> vfModuleArtifacts = mock(HashMap.class);
- CapabilityAssignments capabilityAssignments = mock(CapabilityAssignments.class);
- CapabilityAssignment capabilityAssignment = mock(CapabilityAssignment.class);
-
- vfResourceStructure = spy(new VfResourceStructure(notificationData, resourceInstance));
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelName("modelName");
- vnfResource.setModelVersion("1.1");
- vnfResource.setModelUUID("modelUUID");
- vnfResource.setOrchestrationMode("orchestrationMode");
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setVnfResources(vnfResource);
- vnfResourceCustomization.setModelCustomizationUUID("vnfResCustModelCustomizationUUID");
- vnfResourceCustomization.setModelInstanceName("modelInstanceName");
-
- AllottedResource allottedResource = new AllottedResource();
- allottedResource.setModelUUID("serviceMetadataValue");
- allottedResource.setModelInvariantUUID("modelInvariantUUID");
- allottedResource.setModelName("modelName");
- allottedResource.setModelVersion("1.1");
-
- AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
- allottedResourceCustomization.setAllottedResource(allottedResource);
- allottedResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- allottedResourceCustomization.setModelInstanceName("modelInstanceName");
-
- Service catalogService = new Service();
- catalogService.setServiceType("serviceType");
- catalogService.setModelUUID("5df8b6de-2083-11e7-93ae-92361f002672");
- catalogService.setModelInvariantUUID("modelInvariantUUID");
- catalogService.setModelName("modelName");
- catalogService.setModelVersion("modelVersion");
- catalogService.getVnfCustomizations().add(vnfResourceCustomization);
-
- Iterator artifactIterator = mock(Iterator.class);
- Iterator nodeTemplateIterator = mock(Iterator.class);
- IDistributionClientDownloadResult clientResult = mock(IDistributionClientDownloadResult.class);
- doReturn(IOUtils.toByteArray(
- new FileInputStream(
- new File(
- getClass().getClassLoader().getResource("resource-examples/simpleTest.yaml").getFile())
- ))).when(clientResult).getArtifactPayload();
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult);
- Collection<VfModuleArtifact> vfModuleArtifactsValues = mock(Collection.class);
-
- NodeTemplate nodeTemplate = mock(NodeTemplate.class);
- List<NodeTemplate> nodeTemplateList = new ArrayList<>();
- nodeTemplateList.add(nodeTemplate);
-
- HeatTemplate heatTemplate = new HeatTemplate();
- heatTemplate.setArtifactUuid("ff874603-4222-11e7-9252-005056850d2e");
- heatTemplate.setArtifactChecksum("MANUAL RECORD");
- heatTemplate.setTemplateBody("templateBody");
- heatTemplate.setTemplateName("module_mns_zrdm3frwl01exn_01_rgvm_1.yml");
- heatTemplate.setVersion("1");
-
- NetworkResource networkResource = new NetworkResource();
- networkResource.setAicVersionMin("aicVersionMin");
- networkResource.setModelUUID("modelUUID");
- networkResource.setOrchestrationMode("orchestrationMode");
- networkResource.setModelVersion("modelVersion");
- networkResource.setNeutronNetworkType("neutronNetworkType");
- networkResource.setAicVersionMax("aicVersionMax");
- networkResource.setModelName("CONTRAIL30_GNDIRECT");
- networkResource.setModelInvariantUUID("modelInvariantUUID");
- networkResource.setHeatTemplate(heatTemplate);
-
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
- networkResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- networkResourceCustomization.setModelInstanceName("modelInstanceName");
- networkResourceCustomization.setNetworkResource(networkResource);
-
- WatchdogServiceModVerIdLookup expectedModVerIdLookup = new WatchdogServiceModVerIdLookup(notificationData.getDistributionID(), notificationData.getServiceUUID());
- WatchdogDistributionStatus expectedDistributionStatus = new WatchdogDistributionStatus(notificationData.getDistributionID());
- WatchdogComponentDistributionStatus expectedComponentDistributionStatus = new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO);
- expectedComponentDistributionStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
-
- doReturn(sdcCsarHelper).when(toscaResourceStruct).getSdcCsarHelper();
- doReturn("metadataPropertyValue").when(sdcCsarHelper).getMetadataPropertyValue(any(Metadata.class), any(String.class));
- doReturn("ntPropertyLeafValue").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(any(NodeTemplate.class), any(String.class));
- doReturn("true").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
- doReturn("1").when(sdcCsarHelper).getCapabilityPropertyLeafValue(any(CapabilityAssignment.class), any(String.class));
- doReturn(vfGroups).when(sdcCsarHelper).getVfModulesByVf(any(String.class));
- doReturn(capabilityAssignments).when(sdcCsarHelper).getCapabilitiesOf(any(NodeTemplate.class));
- doReturn(capabilityAssignment).when(capabilityAssignments).getCapabilityByName(any(String.class));
-
- doReturn(catalogService).when(toscaResourceStruct).getCatalogService();
-
- doReturn(artifactInfo).when(toscaResourceStruct).getToscaArtifact();
- doReturn("artifactChecksum").when(artifactInfo).getArtifactChecksum();
- doReturn("artifactUUID").when(artifactInfo).getArtifactUUID();
- doReturn("artifactName").when(artifactInfo).getArtifactName();
- doReturn("1.0").when(artifactInfo).getArtifactVersion();
- doReturn("artifactDescription").when(artifactInfo).getArtifactDescription();
- doReturn("artifactURL").when(artifactInfo).getArtifactURL();
-
- doReturn(metadata).when(toscaResourceStruct).getServiceMetadata();
- doReturn("serviceMetadataValue").when(metadata).getValue(any(String.class));
- doReturn("CONTRAIL30_GNDIRECT").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
-
- doReturn("serviceVersion").when(toscaResourceStruct).getServiceVersion();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVfList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVlList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources();
- doReturn(metadata).when(nodeTemplate).getMetaData();
- doReturn("model_instance_name").when(nodeTemplate).getName();
- doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization();
- doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource();
- doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization();
-
- doReturn(vfModuleArtifacts).when(vfResourceStructure).getArtifactsMapByUUID();
- when(vfModuleArtifacts.values()).thenReturn(vfModuleArtifactsValues);
- when(vfModuleArtifactsValues.iterator()).thenReturn(artifactIterator);
- when(artifactIterator.hasNext()).thenReturn(true, false);
- when(artifactIterator.next()).thenReturn(vfModuleArtifact);
- when(artifactInfo.getArtifactType()).thenReturn(ASDCConfiguration.OTHER);
- when(nodeTemplateIterator.hasNext()).thenReturn(true, false);
-
- doReturn(networkResource).when(toscaResourceStruct).getCatalogNetworkResource();
- doReturn(networkResourceCustomization).when(toscaResourceStruct).getCatalogNetworkResourceCustomization();
-
- doNothing().when(toscaResourceStruct).setSuccessfulDeployment();
-
- toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure);
-
- AllottedResource actualAllottedResource = allottedRepo.findResourceByModelUUID(allottedResource.getModelUUID());
- AllottedResourceCustomization actualAllottedResourceCustomization = allottedCustomizationRepo.findOne(allottedResourceCustomization.getModelCustomizationUUID());
- Service actualService = serviceRepo.findByServiceType(catalogService.getServiceType());
- WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO);
-
- verify(toscaResourceStruct, times(1)).setSuccessfulDeployment();
- assertThat(actualAllottedResource,
- sameBeanAs(allottedResource));
- assertThat(actualAllottedResourceCustomization, sameBeanAs(allottedResourceCustomization)
- .ignoring("created"));
- assertThat(actualService, sameBeanAs(catalogService)
- .ignoring("created")
- .ignoring("networkCustomizations.0x1.created")
- .ignoring("networkCustomizations.0x1.networkResource.created"));
- assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedComponentDistributionStatus)
- .ignoring("createTime")
- .ignoring("modifyTime"));
- }
-
- @Test
public void installTheResourceExceptionTest() throws Exception {
expectedException.expect(ArtifactInstallerException.class);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
index b72e079e9e..cfce0f6a17 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
@@ -21,8 +21,8 @@
package org.onap.so.asdc.tenantIsolation;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;