summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSébastien Determe <sd378r@intl.att.com>2017-09-08 10:43:39 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-08 10:43:39 +0000
commit72e904aa818b14e0f3d869c94cac3cb90930749e (patch)
treefa2b42b694884ba81d1865497050d9bd7d49703c /src/test
parent45b70326931145251f6c5afafac23915db2c57fe (diff)
parent7104181e0ebd97bbd034b5c221561d42e4241fe5 (diff)
Merge "Sonar improvements and class renaming"
Diffstat (limited to 'src/test')
-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);