aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-08 12:23:49 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-08 12:32:43 +0200
commit7104181e0ebd97bbd034b5c221561d42e4241fe5 (patch)
tree77e84b01460079c757b0acb15b06d7921882e0a5 /src/test/java/org
parent25f65d0f6bd061facf88dab5859ddef1926dfecc (diff)
Sonar improvements and class renaming
Some sonar improvements and class renaming in different files Change-Id: I8d8eff1e3fedee1d1c31e62edb80e1bb9ce75362 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/it/DcaeIT.java7
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java25
-rw-r--r--src/test/java/org/onap/clamp/clds/it/SdcIT.java15
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java6
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java11
5 files changed, 30 insertions, 34 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
index 6cdcf98d6..fc13270c3 100644
--- a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
@@ -30,8 +30,7 @@ import org.onap.clamp.clds.AbstractIT;
import org.onap.clamp.clds.client.req.DcaeReq;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.prop.ModelProperties;
-import org.onap.clamp.clds.transform.TransformUtil;
-
+import org.onap.clamp.clds.util.ResourceFileUtil;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
@@ -45,8 +44,8 @@ public class DcaeIT extends AbstractIT {
@Test
public void testDcaeReq() throws Exception {
- String modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json");
String modelName = "example-model";
String controlName = "ClosedLoop-FRWL-SIG-1582f840-2881-11e6-b4ec-005056a9d756";
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 c0487e915..19fad4805 100644
--- a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
@@ -43,7 +43,7 @@ import org.onap.clamp.clds.model.prop.Policy;
import org.onap.clamp.clds.model.prop.PolicyChain;
import org.onap.clamp.clds.model.prop.StringMatch;
import org.onap.clamp.clds.model.prop.Tca;
-import org.onap.clamp.clds.transform.TransformUtil;
+import org.onap.clamp.clds.util.ResourceFileUtil;
import org.onap.policy.api.AttributeType;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.boot.test.context.SpringBootTest;
@@ -62,14 +62,13 @@ public class PolicyClientIT extends AbstractIT {
String modelName;
String controlName;
-
/**
- * Initialize Test.
- */
+ * Initialize Test.
+ */
@Before
public void setUp() throws IOException {
- modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
- modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
+ modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json");
+ modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json");
modelName = "example-model06";
controlName = "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf";
}
@@ -81,11 +80,11 @@ public class PolicyClientIT extends AbstractIT {
String stringMatchPolicyRequestUuid = UUID.randomUUID().toString();
String policyJson = StringMatchPolicyReq.format(refProp, prop);
- String correctValue = TransformUtil.getResourceAsString("expected/stringmatch.json");
+ String correctValue = ResourceFileUtil.getResourceAsString("expected/stringmatch.json");
JSONAssert.assertEquals(policyJson, correctValue, true);
String responseMessage = "";
try {
- responseMessage = policyClient.sendMicroService(policyJson, prop, stringMatchPolicyRequestUuid);
+ responseMessage = policyClient.sendMicroServiceInJson(policyJson, prop, stringMatchPolicyRequestUuid);
} catch (Exception e) {
assertTrue(e.getMessage().contains("Policy send failed: PE500 "));
}
@@ -102,7 +101,7 @@ public class PolicyClientIT extends AbstractIT {
Map<AttributeType, Map<String, String>> attributes = OperationalPolicyReq.formatAttributes(refProp,
prop, policy.getId(), policyChain);
- String responseMessage = policyClient.sendBrms(attributes, prop, operationalPolicyRequestUuid);
+ String responseMessage = policyClient.sendBrmsPolicy(attributes, prop, operationalPolicyRequestUuid);
System.out.println(responseMessage);
}
}
@@ -110,15 +109,15 @@ public class PolicyClientIT extends AbstractIT {
private void createUpdateTcaPolicy(String actionCd) throws Exception {
ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp);
- Tca tca = prop.getTca();
+ Tca tca = prop.getType(Tca.class);
if (tca.isFound()) {
String tcaPolicyRequestUuid = UUID.randomUUID().toString();
String policyJson = TcaMPolicyReq.formatTca(refProp, prop);
- String correctValue = TransformUtil.getResourceAsString("expected/tca.json");
+ String correctValue = ResourceFileUtil.getResourceAsString("expected/tca.json");
JSONAssert.assertEquals(policyJson, correctValue, true);
String responseMessage = "";
try {
- responseMessage = policyClient.sendMicroService(policyJson, prop, tcaPolicyRequestUuid);
+ responseMessage = policyClient.sendMicroServiceInJson(policyJson, prop, tcaPolicyRequestUuid);
} catch (Exception e) {
assertTrue(e.getMessage().contains("Policy send failed: PE500 "));
}
@@ -159,7 +158,7 @@ public class PolicyClientIT extends AbstractIT {
private void deleteTcaPolicy(String actionCd) throws Exception {
ModelProperties prop = new ModelProperties(modelName, controlName, actionCd, false, modelBpmnProp, modelProp);
- Tca tca = prop.getTca();
+ Tca tca = prop.getType(Tca.class);
if (tca.isFound()) {
prop.setCurrentModelElementId(tca.getId());
String responseMessage = "";
diff --git a/src/test/java/org/onap/clamp/clds/it/SdcIT.java b/src/test/java/org/onap/clamp/clds/it/SdcIT.java
index 62932f82a..da9e5af76 100644
--- a/src/test/java/org/onap/clamp/clds/it/SdcIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/SdcIT.java
@@ -33,8 +33,7 @@ import org.onap.clamp.clds.client.req.SdcReq;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.prop.ModelProperties;
import org.onap.clamp.clds.model.refprop.RefProp;
-import org.onap.clamp.clds.transform.TransformUtil;
-
+import org.onap.clamp.clds.util.ResourceFileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -58,11 +57,11 @@ public class SdcIT extends AbstractIT {
@Test
public void testBlueprint() throws Exception {
- String modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json");
String modelName = "example-model06";
String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756";
- String docText = TransformUtil.getResourceAsString("example/templateProp.json");
+ String docText = ResourceFileUtil.getResourceAsString("example/templateProp.json");
ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT,
true, modelBpmnProp, modelProp);
String blueprint = SdcReq.formatBlueprint(refProp, prop, docText);
@@ -73,11 +72,11 @@ public class SdcIT extends AbstractIT {
@Test
public void testTcaBlueprint() throws Exception {
- String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelPropForPolicy.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
String modelName = "example-model06";
String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756";
- String docText = TransformUtil.getResourceAsString("example/templatePropForTca.json");
+ String docText = ResourceFileUtil.getResourceAsString("example/templatePropForTca.json");
ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT,
true, modelBpmnProp, modelProp);
String blueprint = SdcReq.formatBlueprint(refProp, prop, docText);
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java
index 9c9cb4a73..89eaf51cd 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
-import org.onap.clamp.clds.transform.TransformUtil;
+import org.onap.clamp.clds.util.ResourceFileUtil;
public class CustomModelElementTest {
@@ -38,8 +38,8 @@ public class CustomModelElementTest {
public void testNewElement() {
try {
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
- String modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json");
String modName = "example-model-name";
String controlName = "example-control-name";
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
index c1c4a8c39..22b3ba0cb 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
@@ -29,8 +29,7 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
-
-import org.onap.clamp.clds.transform.TransformUtil;
+import org.onap.clamp.clds.util.ResourceFileUtil;
/**
@@ -40,8 +39,8 @@ public class ModelPropertiesTest {
@Test
public void testJsonParse() throws IOException {
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnProp.json");
- String modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json");
String modName = "example-model-name";
String controlName = "example-control-name";
@@ -68,10 +67,10 @@ public class ModelPropertiesTest {
@Test
public void testPolicy() throws IOException {
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
+ String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
System.out.println(modelBpmnProp);
- String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
+ String modelProp = ResourceFileUtil.getResourceAsString("example/modelPropForPolicy.json");
System.out.println(modelProp);
ModelProperties prop = new ModelProperties("example-model-name", "example-control-name",
null, true, modelBpmnProp, modelProp);