aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/pom.xml49
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java115
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiPDUSessionEstSRTest.java6
3 files changed, 83 insertions, 87 deletions
diff --git a/server/pom.xml b/server/pom.xml
index ef046131..65622ff9 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -28,6 +28,8 @@
<description>source code for usecase-ui server</description>
<properties>
+ <spring-boot.version>3.0.11</spring-boot.version>
+ <jackson.version>2.16.1</jackson.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
@@ -45,17 +47,10 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>6.1.3</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
- <version>3.0.11</version>
+ <version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -66,12 +61,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -90,7 +79,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-rest</artifactId>
+ <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@@ -137,25 +126,20 @@
</exclusions>
</dependency>
- <!-- jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>2.16.1</version>
+ <version>${jackson.version}</version>
</dependency>
-
- <!-- jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>2.16.1</version>
+ <version>${jackson.version}</version>
</dependency>
-
- <!-- jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.16.1</version>
+ <version>${jackson.version}</version>
</dependency>
<dependency>
@@ -193,19 +177,25 @@
</dependency>
<dependency>
- <groupId>org.onap.msb.java-sdk</groupId>
- <artifactId>msb-java-sdk</artifactId>
- <version>1.0.0</version>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
- <scope>compile</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
+ <scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
@@ -217,6 +207,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <scope>test</scope>
<version>4.13.2</version>
</dependency>
<dependency>
@@ -323,7 +314,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>3.0.11</version>
+ <version>${spring-boot.version}</version>
<configuration>
<executable>true</executable>
</configuration>
@@ -374,7 +365,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.5</version>
+ <version>0.8.9</version>
<executions>
<execution>
<id>prepare-agent</id>
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
index 1daa4430..68dd91c1 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionServiceTest.java
@@ -18,7 +18,6 @@ package org.onap.usecaseui.server.service.lcm.impl;
import okhttp3.MediaType;
import okio.Buffer;
import okio.BufferedSource;
-import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
@@ -57,6 +56,8 @@ import jakarta.servlet.ServletInputStream;
import jakarta.servlet.http.HttpServletRequest;
import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -68,8 +69,8 @@ import static org.onap.usecaseui.server.util.CallStub.successfulCall;
public class DefaultPackageDistributionServiceTest {
private ResponseBody result;
-
-
+
+
private HttpServletRequest mockRequest() throws IOException {
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getContentLength()).thenReturn(0);
@@ -321,7 +322,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getNsLcmJobStatus(serviceId,jobId, responseId,operationType);
}
-
+
@Test
public void itCanDeleteNsPackage() {
String csarId = "1";
@@ -350,7 +351,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.deleteNsPackage(csarId);
}
-
+
@Test
public void itCanGetVnfPackages(){
//ResponseBody result=null;
@@ -361,16 +362,16 @@ public class DefaultPackageDistributionServiceTest {
// Assert.assertSame(result, service.getVnfPackages());
Assert.assertNotNull(service.getVnfPackages());
}
-
+
@Test
public void getVnfPackagesThrowExceptionWhenVFCResponseError(){
-
+
VfcService vfcService = mock(VfcService.class);
when(vfcService.getVnfPackages ()).thenReturn(emptyBodyCall());
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getVnfPackages();
}
-
+
@Test
public void getVnfPackagesThrowException(){
VfcService vfcService = mock(VfcService.class);
@@ -378,7 +379,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getVnfPackages();
}
-
+
@Test
public void itCanDeleteVFPackage() {
String csarId = "1";
@@ -407,7 +408,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.deleteVnfPackage(csarId);
}
-
+
@Test
public void itCanGetNetworkServicePackages() {
VfcService vfcService = mock(VfcService.class);
@@ -431,7 +432,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getNetworkServicePackages();
}
-
+
@Test
public void itCanGetPnfPackages(){
VfcService vfcService = mock(VfcService.class);
@@ -440,16 +441,16 @@ public class DefaultPackageDistributionServiceTest {
Assert.assertNotNull(service.getPnfPackages());
}
-
+
@Test
public void getPnfPackagesThrowExceptionWhenVFCResponseError(){
-
+
VfcService vfcService = mock(VfcService.class);
when(vfcService.getPnfPackages ()).thenReturn(emptyBodyCall());
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getPnfPackages();
}
-
+
@Test
public void getPnfPackagesThrowException(){
VfcService vfcService = mock(VfcService.class);
@@ -457,18 +458,20 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getPnfPackages();
}
-
+
@Test
public void itDownLoadNsPackage(){
String nsdInfoId="1";
- ResponseBody result=null;
+ ResponseBody successResponse=null;
VfcService vfcService = mock(VfcService.class);
- when(vfcService.downLoadNsPackage(nsdInfoId)).thenReturn(successfulCall(result));
+ when(vfcService.downLoadNsPackage(nsdInfoId)).thenReturn(successfulCall(successResponse));
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- Assert.assertTrue(StringUtils.isNotEmpty(service.downLoadNsPackage(nsdInfoId)));
+ String result = service.downLoadNsPackage(nsdInfoId);
+ assertNotNull(result);
+ assertNotEquals("", result);
}
-
+
@Test
public void downLoadNsPackagehrowExceptionWhenVFCResponseError(){
String nsdInfoId="1";
@@ -477,7 +480,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadNsPackage(nsdInfoId);
}
-
+
@Test
public void downLoadNsPackageThrowException(){
String nsdInfoId="1";
@@ -486,7 +489,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadNsPackage(nsdInfoId);
}
-
+
@Test
public void itDownLoadPnfPackage(){
String pnfInfoId="1";
@@ -496,7 +499,7 @@ public class DefaultPackageDistributionServiceTest {
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.downLoadPnfPackage(pnfInfoId));
}
-
+
@Test
public void downLoadPnfPackagehrowExceptionWhenVFCResponseError(){
String pnfInfoId="1";
@@ -505,7 +508,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadPnfPackage(pnfInfoId);
}
-
+
@Test
public void downLoadPnfPackageThrowException(){
String pnfInfoId="1";
@@ -514,7 +517,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadPnfPackage(pnfInfoId);
}
-
+
@Test
public void itDownLoadVnfPackage(){
String vnfInfoId="1";
@@ -524,7 +527,7 @@ public class DefaultPackageDistributionServiceTest {
Assert.assertSame("{\"status\":\"SUCCESS\"}", service.downLoadVnfPackage(vnfInfoId));
}
-
+
@Test
public void downLoadVnfPackagehrowExceptionWhenVFCResponseError(){
String vnfInfoId="1";
@@ -533,7 +536,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadVnfPackage(vnfInfoId);
}
-
+
@Test
public void downLoadVnfPackageThrowException(){
String vnfInfoId="1";
@@ -542,7 +545,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.downLoadVnfPackage(vnfInfoId);
}
-
+
@Test
public void itCanDeleteNsdPackage() {
String csarId = "1";
@@ -571,7 +574,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.deleteNsdPackage(csarId);
}
-
+
@Test
public void itCanDeleteVnfPackage() {
String csarId = "1";
@@ -600,7 +603,7 @@ public class DefaultPackageDistributionServiceTest {
service.deleteVnfPackage(csarId);
Assert.assertSame("{\"status\":\"FAILED\"}", service.deleteVnfPackage(csarId));
}
-
+
@Test
public void itCanDeletePnfdPackage() {
String csarId = "1";
@@ -630,7 +633,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.deletePnfPackage(csarId);
}
-
+
@Test
public void itCanDeleteNetworkServiceInstance() {
String csarId = "1";
@@ -660,7 +663,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.deleteNetworkServiceInstance(csarId);
}
-
+
@Test
public void itCanCreateNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
@@ -689,7 +692,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.createNetworkServiceInstance(request);
}
-
+
@Test
public void itCanGetNetworkServiceInfo() throws IOException {
nsServiceRsp ns = new nsServiceRsp();
@@ -721,9 +724,9 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getNetworkServiceInfo();
}
-
-
+
+
@Test
public void itCanHealNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
@@ -756,17 +759,17 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.healNetworkServiceInstance(request,csarId);
}
-
+
@Test
public void itCanScaleNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
String csarId = "1";
- ResponseBody result=null;
VfcService vfcService = mock(VfcService.class);
- //when(vfcService.scaleNetworkServiceInstance(csarId,anyObject())).thenReturn(successfulCall(result));
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- Assert.assertTrue(StringUtils.isNotEmpty(service.scaleNetworkServiceInstance(request,csarId)));
+ String result = service.scaleNetworkServiceInstance(request,csarId);
+ assertNotNull(result);
+ assertNotEquals("", result);
}
@Test
@@ -788,8 +791,8 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.scaleNetworkServiceInstance(request,csarId);
}
-
-
+
+
@Test
public void itCaninstantiateNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
@@ -821,8 +824,8 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.instantiateNetworkServiceInstance(request,serviceInstanceId);
}
-
-
+
+
@Test
public void itCanTerminateNetworkServiceInstance() throws IOException {
HttpServletRequest request = mockRequest();
@@ -855,16 +858,18 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.terminateNetworkServiceInstance(request,csarId);
}
-
+
@Test
public void itCreateNetworkServiceData() throws IOException {
HttpServletRequest request = mockRequest();
- ResponseBody result=null;
+ ResponseBody responseBody = null;
VfcService vfcService = mock(VfcService.class);
- when(vfcService.createNetworkServiceData(Mockito.any())).thenReturn(successfulCall(result));
+ when(vfcService.createNetworkServiceData(Mockito.any())).thenReturn(successfulCall(responseBody));
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
- Assert.assertTrue(StringUtils.isNotEmpty(service.createNetworkServiceData(request)));
+ String result = service.createNetworkServiceData(request);
+ assertNotNull(result);
+ assertNotEquals("", result);
}
@Test
@@ -884,7 +889,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.createNetworkServiceData(request);
}
-
+
@Test
public void itCreateVnfData() throws IOException {
HttpServletRequest request = mockRequest();
@@ -913,7 +918,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.createVnfData(request);
}
-
+
@Test
public void itCreatePnfData() throws IOException {
HttpServletRequest request = mockRequest();
@@ -942,7 +947,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.createPnfData(request);
}
-
+
@Test
public void itGetNsdInfo() throws IOException {
String nsdId="1";
@@ -971,7 +976,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getNsdInfo(nsdId);
}
-
+
@Test
public void itGetVnfInfo() throws IOException {
String nsdId="1";
@@ -1000,7 +1005,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getVnfInfo(nsdId);
}
-
+
@Test
public void itGetPnfInfo() throws IOException {
String nsdId="1";
@@ -1029,7 +1034,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getPnfInfo(nsdId);
}
-
+
@Test
public void itCanListNsTemplates() throws IOException {
VfcService vfcService = mock(VfcService.class);
@@ -1054,7 +1059,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.listNsTemplates();
}
-
+
@Test
public void itCanGetVnfInfoById() throws IOException {
String nsdId="1";
@@ -1082,7 +1087,7 @@ public class DefaultPackageDistributionServiceTest {
PackageDistributionService service = new DefaultPackageDistributionService(null, vfcService);
service.getVnfInfoById(nsdId);
}
-
+
@Test
public void itCanFetchNsTemplateData() throws IOException {
HttpServletRequest request = mockRequest();
@@ -1112,4 +1117,4 @@ public class DefaultPackageDistributionServiceTest {
service.fetchNsTemplateData(request);
}
- } \ No newline at end of file
+ }
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiPDUSessionEstSRTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiPDUSessionEstSRTest.java
index 9195fa31..98ff23dd 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiPDUSessionEstSRTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiPDUSessionEstSRTest.java
@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.server.bean.nsmf.monitor.SlicingKpiReqInfo;
-class KpiPDUSessionEstSRTest {
+public class KpiPDUSessionEstSRTest {
@Before
public void before() throws Exception {
@@ -34,9 +34,9 @@ class KpiPDUSessionEstSRTest {
@Test
public void testSetAndGetKpiPDUSessionEstSR() throws Exception {
-
+
KpiPDUSessionEstSR kpiPDUSessionEstSR = new KpiPDUSessionEstSR();
-
+
List<PDUSessionEstSR> pDUSessionEstSRList = new ArrayList<>();
PDUSessionEstSR pDUSessionEstSR = new PDUSessionEstSR();
pDUSessionEstSR.setTimeStamp("12345634456");