summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml16
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java11
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java23
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
6 files changed, 34 insertions, 22 deletions
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 0201dd6776..bfb600f3ba 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -73,14 +73,14 @@
</plugin>
</plugins>
<pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 9cee2882be..893f50c458 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -263,7 +263,7 @@
<artifactId>openstack4j-jersey2</artifactId>
<version>3.2.0</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 4e8443bf45..200f6375ea 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -17,6 +17,8 @@ import com.fasterxml.jackson.databind.JsonMappingException;
@Component
public class AuditDataService {
+ private static final String AUDIT_STACK_DATA = "AuditStackData";
+
@Autowired
private RequestsDbClient requestsDbClient;
@@ -30,7 +32,7 @@ public class AuditDataService {
throws JsonProcessingException {
List<RequestProcessingData> requestProcessingDataList =
requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), "AuditStackData");
+ auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
if (requestProcessingDataList.isEmpty()) {
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
@@ -39,7 +41,7 @@ public class AuditDataService {
requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
requestProcessingData.setName(auditInventory.getHeatStackName());
- requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setTag(AUDIT_STACK_DATA);
requestProcessingData.setValue(auditListString);
requestsDbClient.saveRequestProcessingData(requestProcessingData);
@@ -53,12 +55,11 @@ public class AuditDataService {
* @throws JsonMappingException
* @throws JsonParseException
*/
- public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory)
- throws JsonParseException, JsonMappingException, IOException {
+ public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) throws IOException {
List<RequestProcessingData> requestProcessingDataList =
requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), "AuditStackData");
+ auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
if (!requestProcessingDataList.isEmpty()) {
RequestProcessingData requestProcessingData = requestProcessingDataList.get(0);
String auditListString = requestProcessingData.getValue();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index fd36995f3d..76e5bbc47f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -1,10 +1,9 @@
package org.onap.so.adapters.tasks.audit;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
+import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -13,7 +12,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
@@ -22,6 +20,7 @@ import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
+
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditDataServiceTest {
@@ -56,9 +55,8 @@ public class AuditDataServiceTest {
vserver.setVserverId("testVserverId");
audit.setAaiObject(vserver);
auditList.getAuditList().add(audit);
-
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);
RequestProcessingData requestProcessingData = new RequestProcessingData();
requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
@@ -99,4 +97,17 @@ public class AuditDataServiceTest {
"testVnfModuleId", "testVfModuleName1", "AuditStackData");
}
+ @Test
+ public void testGetStackDataToRequestDbWhenRequestProcessingDataListIsEmpty() throws Exception {
+
+ Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
+ .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
+ Optional<AAIObjectAuditList> result = auditDataService.getStackDataFromRequestDb(auditInventory);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
+ "testVnfModuleId", "testVfModuleName1", "AuditStackData");
+ assertThat(result).isEmpty();
+
+ }
+
+
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index ba179b6717..55e59d134e 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -280,7 +280,7 @@
</ignore>
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 0c320faf8a..8bc9501fbd 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -16,7 +16,7 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
- <pluginManagement>
+ <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>