summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dcaedt_be/pom.xml19
-rw-r--r--dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/CompositionEngine.java2
-rw-r--r--dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/CompositionController.java4
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/BlueprintBusinessLogicTest.java9
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionBusinessLogicTest.java17
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionCatalogBusinessLogicTest.java7
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ReferenceBusinessLogicTest.java14
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ServiceBusinessLogicTest.java3
-rw-r--r--dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/VfcmtBusinessLogicTest.java4
-rw-r--r--dcaedt_catalog/api/pom.xml15
-rw-r--r--dcaedt_catalog/asdc/pom.xml29
-rw-r--r--dcaedt_catalog/asdc/src/test/java/org/onap/sdc/dcae/utils/SDCResponseErrorHandlerTest.java5
-rw-r--r--dcaedt_catalog/service/pom.xml8
-rw-r--r--dcaedt_tools/pom.xml6
-rw-r--r--dcaedt_tools/src/test/java/BaseTest.java29
-rw-r--r--dcaedt_tools/src/test/java/DeployTemplateTest.java5
-rw-r--r--dcaedt_tools/src/test/java/TemplateContainerTest.java2
-rw-r--r--pom.xml6
18 files changed, 106 insertions, 78 deletions
diff --git a/dcaedt_be/pom.xml b/dcaedt_be/pom.xml
index 15753cc..59abbd1 100644
--- a/dcaedt_be/pom.xml
+++ b/dcaedt_be/pom.xml
@@ -13,6 +13,7 @@
</parent>
<properties>
+ <!--suppress UnresolvedMavenProperty -->
<docker.staging.tag>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest</docker.staging.tag>
</properties>
@@ -85,13 +86,13 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>1.6.4</version>
+ <version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.6.4</version>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -134,7 +135,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
- <version>1.5.2.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.websocket</groupId>
@@ -292,6 +293,16 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ <configuration>
+ <classifier>exec</classifier>
+ </configuration>
+ </execution>
+ </executions>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
diff --git a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/CompositionEngine.java b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/CompositionEngine.java
index c633c59..f07358a 100644
--- a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/CompositionEngine.java
+++ b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/CompositionEngine.java
@@ -14,7 +14,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
diff --git a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/CompositionController.java b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/CompositionController.java
index aad0250..e13990d 100644
--- a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/CompositionController.java
+++ b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/CompositionController.java
@@ -1,9 +1,6 @@
package org.onap.sdc.dcae.composition.controller;
import org.onap.sdc.common.onaplog.Enums.LogLevel;
-import org.onap.sdc.dcae.catalog.engine.CatalogResponse;
-import org.onap.sdc.dcae.catalog.engine.ElementRequest;
-import org.onap.sdc.dcae.catalog.engine.ItemsRequest;
import org.onap.sdc.dcae.composition.impl.CompositionBusinessLogic;
import org.onap.sdc.dcae.composition.impl.CompositionCatalogBusinessLogic;
import org.onap.sdc.dcae.composition.restmodels.MessageResponse;
@@ -18,7 +15,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
-import org.springframework.web.context.request.async.DeferredResult;
@RestController
@EnableAutoConfiguration
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/BlueprintBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/BlueprintBusinessLogicTest.java
index a00130f..9150c59 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/BlueprintBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/BlueprintBusinessLogicTest.java
@@ -3,10 +3,9 @@ package org.onap.sdc.dcae.composition.impl;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.MockitoAnnotations;
import org.onap.sdc.dcae.client.ISdcClient;
import org.onap.sdc.dcae.composition.restmodels.sdc.Artifact;
import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed;
@@ -15,12 +14,10 @@ import org.springframework.http.ResponseEntity;
import java.util.ArrayList;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import static org.onap.sdc.dcae.composition.util.DcaeBeConstants.Composition.fileNames.COMPOSITION_YML;
-@RunWith(MockitoJUnitRunner.class)
public class BlueprintBusinessLogicTest {
private static final String USER_ID = "UserId";
@@ -39,13 +36,13 @@ public class BlueprintBusinessLogicTest {
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
new ErrorConfigurationLoader(System.getProperty("user.dir")+"/src/main/webapp/WEB-INF");
resourceDetailed = new ResourceDetailed();
resourceDetailed.setUuid(VFCMT_UUID);
classUnderTest.setSdcRestClient(sdcClientMock);
when(sdcClientMock.getResource(eq(VFCMT_UUID), eq(REQUEST_ID))).thenReturn(resourceDetailed);
- when(sdcClientMock.getResourceArtifact(eq(VFCMT_UUID), anyString(), anyString())).thenReturn("\"{\\\\\\\"version\\\\\\\":0,\\\\\\\"flowType\\\\\\\":\\\\\\\"templateInfoFlowType\\\\\\\",\\\\\\\"nodes\\\\\\\":[],\\\\\\\"inputs\\\\\\\":[],\\\\\\\"outputs\\\\\\\":[],\\\\\\\"relations\\\\\\\":[]}\\\"\"");
}
@Test
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionBusinessLogicTest.java
index d9b65b2..5e6d2a3 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionBusinessLogicTest.java
@@ -21,9 +21,12 @@ import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.*;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
public class CompositionBusinessLogicTest {
@@ -63,14 +66,14 @@ public class CompositionBusinessLogicTest {
emulateListOfArtifactsWithCompositionYml();
when(sdcClientMock.getResource(anyString(),anyString())).thenReturn(vfcmt);
when(vfcmt.getLifecycleState()).thenReturn("NOT_CERTIFIED_CHECKIN");
- when(sdcClientMock.changeResourceLifecycleState(anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(vfcmt);
+ when(sdcClientMock.changeResourceLifecycleState(anyString(), any(), anyString(), any(), anyString())).thenReturn(vfcmt);
compositionBusinessLogic.saveComposition(justAString, justAString, justAString, justAString, false);
verify(sdcClientMock).getResource(anyString(),anyString());
verify(sdcClientMock, times(0)).createResourceArtifact(anyString(),anyString(),any(),anyString());
verify(sdcClientMock).updateResourceArtifact(anyString(), anyString(), any(), anyString());
- verify(sdcClientMock, times(2)).changeResourceLifecycleState(anyString(),anyString(),anyString(),anyString(),anyString());
+ verify(sdcClientMock, times(2)).changeResourceLifecycleState(anyString(),any(),anyString(),any(),anyString());
}
@Test
@@ -81,14 +84,14 @@ public class CompositionBusinessLogicTest {
when(vfcmt.getLifecycleState()).thenReturn("NOT_CERTIFIED_CHECKIN");
RequestError requestError = new RequestError();
requestError.setServiceException(new ServiceException("SVC4086", "", null));
- when(sdcClientMock.changeResourceLifecycleState(anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(vfcmt).thenThrow(new ASDCException(HttpStatus.FORBIDDEN, requestError));
+ when(sdcClientMock.changeResourceLifecycleState(anyString(), any(), anyString(), any(), anyString())).thenReturn(vfcmt).thenThrow(new ASDCException(HttpStatus.FORBIDDEN, requestError));
ResponseEntity result = compositionBusinessLogic.saveComposition(justAString, justAString, justAString, justAString, false);
verify(sdcClientMock).getResource(anyString(),anyString());
verify(sdcClientMock, times(0)).createResourceArtifact(anyString(),anyString(),any(),anyString());
verify(sdcClientMock).updateResourceArtifact(anyString(), anyString(), any(), anyString());
- verify(sdcClientMock, times(3)).changeResourceLifecycleState(anyString(),anyString(),anyString(),anyString(),anyString());
+ verify(sdcClientMock, times(3)).changeResourceLifecycleState(anyString(),any(),anyString(),any(),anyString());
assertEquals(403, result.getStatusCodeValue());
}
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionCatalogBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionCatalogBusinessLogicTest.java
index 25bf1f1..7c773ee 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionCatalogBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/CompositionCatalogBusinessLogicTest.java
@@ -7,21 +7,14 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.dcae.catalog.asdc.ASDCCatalog;
-import org.onap.sdc.dcae.catalog.asdc.ASDCException;
import org.onap.sdc.dcae.catalog.engine.CatalogController;
-import org.onap.sdc.dcae.catalog.engine.CatalogError;
-import org.onap.sdc.dcae.catalog.engine.CatalogResponse;
import org.onap.sdc.dcae.client.ISdcClient;
import org.onap.sdc.dcae.composition.restmodels.canvas.DcaeComponentCatalog;
import org.onap.sdc.dcae.composition.restmodels.sdc.Resource;
import org.onap.sdc.dcae.composition.util.DcaeBeConstants;
import org.onap.sdc.dcae.errormng.ErrorConfigurationLoader;
-import org.onap.sdc.dcae.errormng.RequestError;
import org.onap.sdc.dcae.errormng.ResponseFormat;
-import org.onap.sdc.dcae.errormng.ServiceException;
-import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.context.request.async.DeferredResult;
import java.util.Arrays;
import java.util.List;
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ReferenceBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ReferenceBusinessLogicTest.java
index 70c0577..f69f660 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ReferenceBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ReferenceBusinessLogicTest.java
@@ -3,10 +3,9 @@ package org.onap.sdc.dcae.composition.impl;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.MockitoAnnotations;
import org.onap.sdc.dcae.client.ISdcClient;
import org.onap.sdc.dcae.composition.restmodels.MonitoringComponent;
import org.onap.sdc.dcae.composition.restmodels.sdc.*;
@@ -17,13 +16,15 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
-@RunWith(MockitoJUnitRunner.class)
public class ReferenceBusinessLogicTest {
private String userId = "me";
private String requestId = "1";
@@ -41,6 +42,7 @@ public class ReferenceBusinessLogicTest {
@Before
public void setup(){
+ MockitoAnnotations.initMocks(this);
classUnderTest.setSdcRestClient(sdcClientMock);
new ErrorConfigurationLoader(System.getProperty("user.dir")+"/src/main/webapp/WEB-INF");
}
@@ -99,7 +101,7 @@ public class ReferenceBusinessLogicTest {
mockGetService();
ResponseEntity responseEntity = classUnderTest.deleteVfcmtReferenceBlueprint(userId, "", monitoringComponentName, serviceUuid, vfiName, "", requestId);
verify(sdcClientMock).getService(serviceUuid, requestId);
- verify(sdcClientMock).deleteInstanceArtifact(anyString(), anyString(), anyString(), anyString(), anyString(), anyString());
+ verify(sdcClientMock).deleteInstanceArtifact(anyString(), anyString(), anyString(), anyString(), any(), anyString());
Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
}
@@ -115,7 +117,7 @@ public class ReferenceBusinessLogicTest {
@Test
public void deleteVfcmtReferenceBlueprint_exceptionSdcdeleteInstanceResourceArtifact() throws Exception {
mockGetService();
- doThrow(new RuntimeException("")).when(sdcClientMock).deleteInstanceArtifact(anyString(), anyString(), anyString(), anyString(), anyString(), anyString());
+ doThrow(new RuntimeException("")).when(sdcClientMock).deleteInstanceArtifact(anyString(), anyString(), anyString(), anyString(), any(), anyString());
ResponseEntity<ResponseFormat> responseEntity = classUnderTest.deleteVfcmtReferenceBlueprint(userId, "", monitoringComponentName, serviceUuid, vfiName, "", requestId);
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ServiceBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ServiceBusinessLogicTest.java
index a6f82f6..15c460a 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ServiceBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/ServiceBusinessLogicTest.java
@@ -28,6 +28,7 @@ import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertNotEquals;
@@ -154,7 +155,7 @@ public class ServiceBusinessLogicTest {
@Test
public void test_GetAttachedService() {
- when(serviceBusinessLogic.getSdcRestClient().getResourceArtifact(anyString(), anyString(), anyString())).thenReturn("artifact data");
+ when(serviceBusinessLogic.getSdcRestClient().getResourceArtifact(any(), any(), any())).thenReturn("artifact data");
ResponseEntity<MessageResponse> result = serviceBusinessLogic.getAttachedService(vfcmtUuid, requestId);
assertEquals(HttpStatus.OK, result.getStatusCode());
diff --git a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/VfcmtBusinessLogicTest.java b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/VfcmtBusinessLogicTest.java
index 5f1ba41..c347c34 100644
--- a/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/VfcmtBusinessLogicTest.java
+++ b/dcaedt_be/src/test/java/org/onap/sdc/dcae/composition/impl/VfcmtBusinessLogicTest.java
@@ -118,11 +118,11 @@ public class VfcmtBusinessLogicTest {
verify(sdcClientMock, times(0)).createResource(userId, request, requestId);
verify(sdcClientMock).getResource(anyString(),anyString());
- verify(sdcClientMock).getResourceArtifact(anyString(),anyString(),anyString());
+ verify(sdcClientMock).getResourceArtifact(any(),anyString(),anyString());
verify(sdcClientMock, times(0)).createResourceArtifact(anyString(),anyString(),any(),anyString());
verify(sdcClientMock, times(0)).updateResourceArtifact(anyString(), anyString(), any(), anyString());
verify(sdcClientMock).addExternalMonitoringReference(anyString(),any(),any(),anyString());
- verify(sdcClientMock).changeResourceLifecycleState(anyString(),anyString(),anyString(),anyString(),anyString());
+ verify(sdcClientMock).changeResourceLifecycleState(anyString(),any(),anyString(),anyString(),anyString());
}
diff --git a/dcaedt_catalog/api/pom.xml b/dcaedt_catalog/api/pom.xml
index f6925db..950ced8 100644
--- a/dcaedt_catalog/api/pom.xml
+++ b/dcaedt_catalog/api/pom.xml
@@ -177,8 +177,19 @@
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
+ <artifactId>mockito-all</artifactId>
+ <version>2.0.2-beta</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <version>1.8.16</version>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <version>1.8.16</version>
<scope>test</scope>
</dependency>
diff --git a/dcaedt_catalog/asdc/pom.xml b/dcaedt_catalog/asdc/pom.xml
index 1414a91..2ecf3ff 100644
--- a/dcaedt_catalog/asdc/pom.xml
+++ b/dcaedt_catalog/asdc/pom.xml
@@ -44,9 +44,10 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>1.3.3.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
<configuration>
<mainClass>org.onap.sdc.dcae.catalog.asdc.ASDCEngine</mainClass>
+ <classifier>exec</classifier>
</configuration>
<executions>
<execution>
@@ -78,7 +79,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
- <version>1.4.1.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -88,7 +89,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
- <version>1.4.1.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -125,10 +126,22 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>2.0.2-beta</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <version>1.8.16</version>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <version>1.8.16</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/dcaedt_catalog/asdc/src/test/java/org/onap/sdc/dcae/utils/SDCResponseErrorHandlerTest.java b/dcaedt_catalog/asdc/src/test/java/org/onap/sdc/dcae/utils/SDCResponseErrorHandlerTest.java
index 15c4a8a..82eec21 100644
--- a/dcaedt_catalog/asdc/src/test/java/org/onap/sdc/dcae/utils/SDCResponseErrorHandlerTest.java
+++ b/dcaedt_catalog/asdc/src/test/java/org/onap/sdc/dcae/utils/SDCResponseErrorHandlerTest.java
@@ -3,9 +3,8 @@ package org.onap.sdc.dcae.utils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.MockitoAnnotations;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
@@ -15,7 +14,6 @@ import org.springframework.web.client.HttpServerErrorException;
import java.io.IOException;
import java.io.InputStream;
-@RunWith(MockitoJUnitRunner.class)
public class SDCResponseErrorHandlerTest {
@InjectMocks
private SDCResponseErrorHandler classUnderTest;
@@ -24,6 +22,7 @@ public class SDCResponseErrorHandlerTest {
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
clientHttpResponse = new ClientHttpResponse() {
@Override
public HttpStatus getStatusCode() throws IOException {
diff --git a/dcaedt_catalog/service/pom.xml b/dcaedt_catalog/service/pom.xml
index b4f20d2..85a3019 100644
--- a/dcaedt_catalog/service/pom.xml
+++ b/dcaedt_catalog/service/pom.xml
@@ -26,9 +26,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>1.3.3.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
<configuration>
- <mainClass>org.onap.sdc.dcae.catalog.engine.CatalogEngine</mainClass>
+ <classifier>exec</classifier>
</configuration>
<executions>
<execution>
@@ -60,7 +60,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
- <version>1.4.1.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -70,7 +70,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
- <version>1.4.1.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.onap.sdc.dcae-d.dt-be-main</groupId>
diff --git a/dcaedt_tools/pom.xml b/dcaedt_tools/pom.xml
index 2109bc9..0d2c31f 100644
--- a/dcaedt_tools/pom.xml
+++ b/dcaedt_tools/pom.xml
@@ -217,13 +217,13 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>1.6.4</version>
+ <version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.6.4</version>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/dcaedt_tools/src/test/java/BaseTest.java b/dcaedt_tools/src/test/java/BaseTest.java
index d3a6ed5..16372e0 100644
--- a/dcaedt_tools/src/test/java/BaseTest.java
+++ b/dcaedt_tools/src/test/java/BaseTest.java
@@ -1,7 +1,6 @@
import org.junit.Before;
-import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.MockitoAnnotations;
import org.onap.sdc.dcae.composition.restmodels.sdc.Resource;
import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed;
import utilities.IDcaeRestClient;
@@ -12,11 +11,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
-@RunWith(MockitoJUnitRunner.class)
abstract class BaseTest {
static final String USER_ID = "userId";
static final String TEMPLATE_INFO_NAME = "templateInfoName";
@@ -44,31 +41,26 @@ abstract class BaseTest {
@Before
public void setup() {
- when(dcaeRestClient.getUserId()).thenReturn(USER_ID);
- mockGetAllVfcmt();
+ MockitoAnnotations.initMocks(this);
+
mockGetCatalog();
- mockGetItemModel();
- mockGetItemType();
- mockCheckoutVfcmtAndCreateResource();
- when(dcaeRestClient.saveComposition(anyString(), anyString())).thenReturn("Composition Created");
}
- private void mockCheckoutVfcmtAndCreateResource() {
+ void mockCheckoutVfcmtAndCreateResource() {
ResourceDetailed resourceDetailed = new ResourceDetailed();
resourceDetailed.setName(VFCMT_NAME1);
resourceDetailed.setUuid(UUID1);
resourceDetailed.setLifecycleState("NOT_CERTIFIED_CHECKOUT");
resourceDetailed.setLastUpdaterUserId(USER_ID);
- when(dcaeRestClient.checkoutVfcmt(anyString())).thenReturn(resourceDetailed);
when(dcaeRestClient.createResource(any())).thenReturn(resourceDetailed);
}
- private void mockGetItemType() {
- when(dcaeRestClient.getItemType(anyString(), anyString())).thenReturn("{\"data\":{\"type\":{\"itemId\":\"e45ec9d7-01df-4cb1-896f-aff2a6ca5a8b/tosca.dcae.nodes.cdapApp.Map\", \"typeinfo\":\"typeInfo\"}}}");
+ void mockGetItemType() {
+ when(dcaeRestClient.getItemType(any(), any())).thenReturn("{\"data\":{\"type\":{\"itemId\":\"e45ec9d7-01df-4cb1-896f-aff2a6ca5a8b/tosca.dcae.nodes.cdapApp.Map\", \"typeinfo\":\"typeInfo\"}}}");
}
- private void mockGetItemModel() {
- when(dcaeRestClient.getItemModel(anyString())).thenReturn("{\"data\":{\"model\":{\"itemId\":\"\",\"nodes\":[{\"capability\":{\"type\":\"someType\"}, \"type\":\"type\", \"name\":\"SomeNameFromRequirement\", \"requirements\":[{\"name\":\"SomeNameFromRequirement\"}], \"properties\":[{}], \"capabilities\":[{\"name\":\"SomeNameToCapability\"}],\"type\":\"type\"}]}}}",
+ void mockGetItemModel() {
+ when(dcaeRestClient.getItemModel(any())).thenReturn("{\"data\":{\"model\":{\"itemId\":\"\",\"nodes\":[{\"capability\":{\"type\":\"someType\"}, \"type\":\"type\", \"name\":\"SomeNameFromRequirement\", \"requirements\":[{\"name\":\"SomeNameFromRequirement\"}], \"properties\":[{}], \"capabilities\":[{\"name\":\"SomeNameToCapability\"}],\"type\":\"type\"}]}}}",
"{\"data\":{\"model\":{\"itemId\":\"\",\"nodes\":[{\"capability\":{\"type\":\"someType\"}, \"type\":\"type\", \"name\":\"SomeNameToCapability\", \"requirements\":[{\"name\":\"SomeNameFromRequirement\"}], \"properties\":[{}], \"capabilities\":[{\"name\":\"SomeNameToCapability\"}],\"type\":\"type\"}]}}}");
}
@@ -88,11 +80,10 @@ abstract class BaseTest {
item.setName(ITEM_NAME3);
items.add(item);
catalog.put(ELEMENT_NAME3, items);
- when(dcaeRestClient.getDcaeCatalog()).thenReturn(catalog);
}
- private void mockGetAllVfcmt() {
+ void mockGetAllVfcmt() {
List<ResourceDetailed> resourceDetaileds = new ArrayList<>();
ResourceDetailed resourceDetailed = new ResourceDetailed();
resourceDetailed.setName(VFCMT_NAME1);
diff --git a/dcaedt_tools/src/test/java/DeployTemplateTest.java b/dcaedt_tools/src/test/java/DeployTemplateTest.java
index 6a8a019..0dc35f9 100644
--- a/dcaedt_tools/src/test/java/DeployTemplateTest.java
+++ b/dcaedt_tools/src/test/java/DeployTemplateTest.java
@@ -7,6 +7,7 @@ import tools.DeployTemplate;
import java.util.*;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -23,6 +24,10 @@ public class DeployTemplateTest extends BaseTest {
@Override
public void setup() {
super.setup();
+ super.mockGetAllVfcmt();
+ super.mockCheckoutVfcmtAndCreateResource();
+ when(dcaeRestClient.getUserId()).thenReturn(USER_ID);
+ when(dcaeRestClient.saveComposition(any(), any())).thenReturn("Composition Created");
templateInfoToJsonObjectMap = new HashMap<>();
TemplateInfo templateInfo = new TemplateInfo();
templateInfo.setName(VFCMT_NAME1);
diff --git a/dcaedt_tools/src/test/java/TemplateContainerTest.java b/dcaedt_tools/src/test/java/TemplateContainerTest.java
index 6b09991..d4053a1 100644
--- a/dcaedt_tools/src/test/java/TemplateContainerTest.java
+++ b/dcaedt_tools/src/test/java/TemplateContainerTest.java
@@ -25,6 +25,8 @@ public class TemplateContainerTest extends BaseTest {
@Override
public void setup() {
super.setup();
+ super.mockGetItemModel();
+ super.mockGetItemType();
templateInfos = new ArrayList<>();
TemplateInfo templateInfo = new TemplateInfo();
templateInfo.setName(TEMPLATE_INFO_NAME);
diff --git a/pom.xml b/pom.xml
index 9a816f3..4598d24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.9.RELEASE</version>
+ <version>2.0.5.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
@@ -40,6 +40,10 @@
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ </exclusion>
+ <exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>