diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-09-08 17:48:10 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-09-08 17:48:10 +0200 |
commit | 02847bc3889fe3c3a419612ea7a94eca8794bdc6 (patch) | |
tree | 20ac643bcffdb9f5cdecaf2cf242e3b7d710dde7 /src/test/java | |
parent | 15383eb639c7b78f21c0a969099642f3518bbf80 (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')
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 20b85d6f6..a283f43d4 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 19fad4805..69df97212 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 5d08e5ec0..a12d6b7d5 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 c6b19d0f9..03d7d65da 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";
|