aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-08 17:48:10 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-08 17:48:10 +0200
commit02847bc3889fe3c3a419612ea7a94eca8794bdc6 (patch)
tree20ac643bcffdb9f5cdecaf2cf242e3b7d710dde7 /src/test/java/org
parent15383eb639c7b78f21c0a969099642f3518bbf80 (diff)
Rework some sonar critical and major bugs
Class renamed to AbstractModelELement, exceptions reworked and IT tests as well Change-Id: Ief2b09b0e36776519338834e2af61aa6e638ee91 Issue-Id: CLAMP-43 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java14
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java2
4 files changed, 13 insertions, 9 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java b/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
index 20b85d6f..a283f43d 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
@@ -40,11 +40,11 @@ import org.onap.clamp.clds.model.prop.ModelProperties;
public class SdcReqTest {
- String baseUrl = "AYBABTU";
+ String baseUrl = "AYBABTU";
String serviceInvariantUUID = "serviceInvariantUUID";
@Test
- public void getSdcReqUrlsListNoGlobalPropTest() throws Exception {
+ public void getSdcReqUrlsListNoGlobalPropTest() {
ModelProperties prop = mock(ModelProperties.class);
SdcCatalogServices sdcCatalogServices = mock(SdcCatalogServices.class);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
index 19fad480..69df9721 100644
--- a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
@@ -119,7 +119,7 @@ public class PolicyClientIT extends AbstractIT {
try {
responseMessage = policyClient.sendMicroServiceInJson(policyJson, prop, tcaPolicyRequestUuid);
} catch (Exception e) {
- assertTrue(e.getMessage().contains("Policy send failed: PE500 "));
+ assertTrue(e.getMessage().contains("Exception while communicating with Policy"));
}
System.out.println(responseMessage);
}
diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
index 5d08e5ec..a12d6b7d 100644
--- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
@@ -202,9 +202,10 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void getServiceUuidFromServiceInvariantIdTest() throws Exception {
SdcCatalogServices spy = Mockito.spy(sdcCatalogWired);
- Mockito.when(spy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
- SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"));
+ Mockito.doReturn(IOUtils.toString(
+ SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"))
+ .when(spy).getSdcServicesInformation(null);
// Try the vcts4 version 1.0, this one should be replaced by 1.1 so it
// should not exist, returning empty string
String resUuidVcts4Null = spy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9b");
@@ -228,8 +229,10 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void getCldsServiceDataWithAlarmConditionsTest() throws Exception {
SdcCatalogServices spy = Mockito.spy(sdcCatalogWired);
- Mockito.when(spy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
- SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"));
+
+ Mockito.doReturn(IOUtils.toString(
+ SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"))
+ .when(spy).getSdcServicesInformation(null);
// This invariant uuid is the one from vcts4 v1.1
String serviceResourceDetailUrl = refProp.getStringValue("sdc.serviceUrl")
@@ -286,7 +289,8 @@ public class SdcCatalogServicesIT extends AbstractIT {
assertTrue("29018914-966c-442d-9d08-251b9dc45b8f".equals(cldsServiceData.getServiceUUID()));
assertTrue(cldsServiceData.getCldsVfs().size() == 1);
- List<CldsAlarmCondition> alarmsList = spy.getAllAlarmConditionsFromCldsServiceData(cldsServiceData, "alarmCondition");
+ List<CldsAlarmCondition> alarmsList = spy.getAllAlarmConditionsFromCldsServiceData(cldsServiceData,
+ "alarmCondition");
assertTrue(alarmsList.size() == 6);
}
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
index c6b19d0f..03d7d65d 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
@@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.JsonNode;
/**
* A CustomModelElement to test the capability to add new elements on the fly.
*/
-public class CustomModelElement extends ModelElement {
+public class CustomModelElement extends AbstractModelElement {
private static final String CUSTOM_TYPE = "customType";