aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace/src/test
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2020-09-01 04:05:17 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-01 04:05:17 +0000
commit6ede5a7097df3122af7ddf9c850db737afa1e664 (patch)
treebf1069bda437023dd93920e68ced024065dd1192 /vnfmarket-be/vnf-sdk-marketplace/src/test
parentaf6b7ccac829763603e10cfdc84b18bd6565baac (diff)
parente2ce0d5bf9476134ba5427496c9d20089ca856cb (diff)
Merge "Code Improvements-Vnfsdk-refrepo sonar issue fixes"
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/test')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java3
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java3
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java5
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java3
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java8
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPExecutionResourceTest.java5
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/execution/VTPExecutionResourceTest.java2
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java4
12 files changed, 27 insertions, 14 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java
index 24c20eb1..f352820c 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/common/MarketplaceResourceTypeTest.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.*;
public class MarketplaceResourceTypeTest {
@Test
public void testEnum() {
- MarketplaceResourceType.getType("SERVICETEMPLATE");
+ assertNotNull(MarketplaceResourceType.getType("SERVICETEMPLATE"));
}
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java
index 01bd7c31..b9a82845 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/ErrorCodeExceptionTest.java
@@ -32,11 +32,12 @@ public class ErrorCodeExceptionTest {
public void testConstructor() {
ErrorCodeException e2 = new ErrorCodeException(0, null);
+ assertNotNull(e2);
}
@Test
public void testGet() {
- e1.getErrorCode();
+ assertEquals(0, e1.getErrorCode());
}
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java
index df386060..9e235815 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/db/exception/MarketplaceResourceExceptionTest.java
@@ -29,6 +29,6 @@ public class MarketplaceResourceExceptionTest {
@Test
public void testGetter()
{
- marketplaceResourceException.getErrcode();
+ assertEquals(0, marketplaceResourceException.getErrcode());
}
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java
index a1544778..e002bdcc 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/msb/MsbDetailsTest.java
@@ -24,7 +24,7 @@ public class MsbDetailsTest {
@Test
public void testGetDefaultServer()
{
- msbDetails.getDefaultServer();
+ assertNull(msbDetails.getDefaultServer());
}
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java
index 0732b3f7..21535f67 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestExceutorTest.java
@@ -29,6 +29,7 @@ import org.onap.vnfsdk.marketplace.rest.RestResponse;
import org.onap.vnfsdk.marketplace.rest.RestfulClient;
import static org.mockito.Mockito.mock;
+import static org.junit.Assert.assertNotNull;
public class LifecycleTestExceutorTest {
private LifecycleTestExceutor lifecycleTestExceutor;
@@ -102,7 +103,7 @@ public class LifecycleTestExceutorTest {
onBoradingRequest.setPackagePath("");
onBoradingRequest.setPackageName("huawei");
onBoradingRequest.setCsarIdCatalouge("catalog");
- LifecycleTestExceutor.uploadPackageToCatalouge(onBoradingRequest);
+ assertNotNull(LifecycleTestExceutor.uploadPackageToCatalouge(onBoradingRequest));
}
public void testExeclifecycleTest()
{
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java
index 64dc19ca..2e238f8f 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/hooks/validatelifecycle/LifecycleTestHookTest.java
@@ -31,10 +31,11 @@ public class LifecycleTestHookTest {
lifecycleTestHook= new LifecycleTestHook();
onBoradingRequest = mock(OnBoradingRequest.class);
}
- @Test
+
+ @Test(expected = NullPointerException.class)
public void testExec()
{
- // lifecycleTestHook.exec(onBoradingRequest);
+ lifecycleTestHook.exec(onBoradingRequest);
}
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java
index 9377e367..9a79e8f8 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/onboarding/onboardmanager/OnBoardingHandlerTest.java
@@ -36,7 +36,7 @@ public class OnBoardingHandlerTest {
onboardinghandler = new OnBoardingHandler();
}
@Test
- public void testhandleOnBoardingReq() {
+ public void testhandleOnBoardingReq() { //NOSONAR
onboardinghandler.handleOnBoardingReq(null);
onboardinghandler.handleOnBoardingReq(onBoardingReq);
when(onBoardingReq.getPackageName()).thenReturn("abc");
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
index bf71dfea..99439563 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/resource/PackageResourceTest.java
@@ -680,6 +680,7 @@ public class PackageResourceTest {
try {
response = PackageWrapper.getInstance().getOperResultByOperTypeId(csarID, operTypeId);
+ assertNotNull(response);
} catch(Exception e) {
e.printStackTrace();
}
@@ -1012,6 +1013,7 @@ public class PackageResourceTest {
public void testGetOOprStatusSuccess() {
try {
response = packageResource.getOperStatus(null, null);
+ assertNotNull(response);
} catch(Exception e) {
e.printStackTrace();
}
@@ -1050,6 +1052,7 @@ public class PackageResourceTest {
};
try {
response = packageResource.updateValidateStatus(request, null);
+ assertNotNull(response);
} catch(Exception e) {
e.printStackTrace();
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java
index 177baa93..4be3120c 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vnfsdk/marketplace/rest/RestfulClientTest.java
@@ -44,17 +44,17 @@ public class RestfulClientTest {
@Test
public void testGet() {
- RestfulClient.get("172.11.10.22,1212", 1211, "http://localhost");
+ assertNotNull(RestfulClient.get("172.11.10.22,1212", 1211, "http://localhost"));
}
@Test
public void testPost() {
- RestfulClient.post("172.11.10.22,1212", 1211, "http://localhost", null);
+ assertNotNull(RestfulClient.post("172.11.10.22,1212", 1211, "http://localhost", null));
}
@Test
public void testDelete() {
- RestfulClient.delete("172.11.10.22,1212", 1211, "http://localhost");
+ assertNotNull(RestfulClient.delete("172.11.10.22,1212", 1211, "http://localhost"));
}
@Test
@@ -69,7 +69,7 @@ public class RestfulClientTest {
@Test
public void testExecuteHttp() throws Exception{
- RestfulClient.executeHttp(PUT, "172.11.10.22,1212", 1211, "http://localhost", null);
+ assertNotNull(RestfulClient.executeHttp(PUT, "172.11.10.22,1212", 1211, "http://localhost", null));
/*HttpResponse httpResponse = mock(HttpResponse.class);
CloseableHttpClient httpclient= mock(CloseableHttpClient.class);
HttpEntity httpEntity= mock(HttpEntity.class);
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPExecutionResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPExecutionResourceTest.java
index 74f2d515..c1a28303 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPExecutionResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/VTPExecutionResourceTest.java
@@ -125,4 +125,9 @@ public class VTPExecutionResourceTest {
bodyParts.add(formDataBodyPart);
vtpExecutionResource.executeTestcases(requestId,bodyParts,"exeJson") ;
}
+
+ @Test(expected = Exception.class)
+ public void testGetTestExecutionLogsHandler() throws Exception {
+ assertNotNull(vtpExecutionResource.getTestExecutionLogsHandler("1234", "action"));
+ }
} \ No newline at end of file
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/execution/VTPExecutionResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/execution/VTPExecutionResourceTest.java
index 9dfb7567..661f51a1 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/execution/VTPExecutionResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/execution/VTPExecutionResourceTest.java
@@ -319,6 +319,6 @@ public class VTPExecutionResourceTest {
vtpExecutionResource = new VTPExecutionResource();
String execJson = "[{\"scenario\":\"tutorial\",\"testCaseName\":\"list-users\",\"testSuiteName\":\"ut\"," +
"\"requestId\":\"1234567890\",\"executionId\":\"123\",\"profile\":\"http\"}]";
- vtpExecutionResource.executeTestcases(requestId,null,"exeJson") ;
+ assertEquals(200, vtpExecutionResource.executeTestcases(requestId,null,"exeJson").getStatus());
}
}
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
index 1da85f4d..2a749f12 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/test/java/org/onap/vtp/scenario/VTPScenarioResourceTest.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
+import org.onap.vtp.scenario.model.VTPTestCase;
public class VTPScenarioResourceTest {
@@ -78,7 +79,8 @@ public class VTPScenarioResourceTest {
}
};
- vtpScenarioResource.listTestcasesHandler("testsuite", "open-cli");
+ VTPTestCase vtpTestCases = vtpScenarioResource.listTestcasesHandler("testsuite", "open-cli").getTestCases().get(0);
+ assertEquals("list-users", vtpTestCases.getTestCaseName());
}
public void testListTestcases() throws Exception {