aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2019-03-05 14:25:59 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-05 14:25:59 +0000
commite577b6a44e1dda60fb68543bcdfc627f111b4a97 (patch)
tree4d1056c9924cb22dcf02b02e353cec7f529e3841 /src/test/java/org
parent179bae8d30eed732b671f1956ffab90de0700ac2 (diff)
parent86cf9ece99fdc169427426010d07d59b3d0d1d91 (diff)
Merge "Rework the hibernate adapter"
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/dao/model/LoopToJsonTest.java15
-rw-r--r--src/test/java/org/onap/clamp/it/dao/model/LoopRepositoriesItCase.java15
2 files changed, 16 insertions, 14 deletions
diff --git a/src/test/java/org/onap/clamp/dao/model/LoopToJsonTest.java b/src/test/java/org/onap/clamp/dao/model/LoopToJsonTest.java
index 496d8c0e..2d9bfd2d 100644
--- a/src/test/java/org/onap/clamp/dao/model/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/dao/model/LoopToJsonTest.java
@@ -27,8 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
import com.google.gson.Gson;
+import com.google.gson.JsonObject;
-import java.util.Map;
import java.util.Random;
import org.junit.Test;
@@ -39,29 +39,30 @@ public class LoopToJsonTest {
private OperationalPolicy getOperationalPolicy(String configJson, String name) {
OperationalPolicy opPolicy = new OperationalPolicy();
opPolicy.setName(name);
- opPolicy.setConfigurationsJson(new Gson().fromJson(configJson, Map.class));
+ opPolicy.setConfigurationsJson(new Gson().fromJson(configJson, JsonObject.class));
return opPolicy;
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl) {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
Loop loop = new Loop();
loop.setName(name);
loop.setSvgRepresentation(svgRepresentation);
loop.setBlueprint(blueprint);
- loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, Map.class));
+ loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class));
loop.setLastComputedState(LoopState.DESIGN);
loop.setDcaeDeploymentId(dcaeId);
loop.setDcaeDeploymentStatusUrl(dcaeUrl);
+ loop.setDcaeBlueprintId(dcaeBlueprintId);
return loop;
}
private MicroServicePolicy getMicroServicePolicy(String name, String jsonRepresentation, String policyTosca,
String jsonProperties, boolean shared) {
MicroServicePolicy µService = new MicroServicePolicy();
- µService.setJsonRepresentation(new Gson().fromJson(jsonRepresentation, Map.class));
+ µService.setJsonRepresentation(new Gson().fromJson(jsonRepresentation, JsonObject.class));
µService.setPolicyTosca(policyTosca);
- µService.setProperties(new Gson().fromJson(jsonProperties, Map.class));
+ µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
µService.setShared(shared);
µService.setName(name);
@@ -79,7 +80,7 @@ public class LoopToJsonTest {
@Test
public void LoopGsonTest() {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
- "123456789", "https://dcaetest.org");
+ "123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",
diff --git a/src/test/java/org/onap/clamp/it/dao/model/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/it/dao/model/LoopRepositoriesItCase.java
index 67ab247f..8a523fc0 100644
--- a/src/test/java/org/onap/clamp/it/dao/model/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/it/dao/model/LoopRepositoriesItCase.java
@@ -27,9 +27,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
import java.time.Instant;
-import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,29 +70,30 @@ public class LoopRepositoriesItCase {
private OperationalPolicy getOperationalPolicy(String configJson, String name) {
OperationalPolicy opPolicy = new OperationalPolicy();
opPolicy.setName(name);
- opPolicy.setConfigurationsJson(new Gson().fromJson(configJson, Map.class));
+ opPolicy.setConfigurationsJson(new Gson().fromJson(configJson, JsonObject.class));
return opPolicy;
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl) {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
Loop loop = new Loop();
loop.setName(name);
loop.setSvgRepresentation(svgRepresentation);
loop.setBlueprint(blueprint);
- loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, Map.class));
+ loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class));
loop.setLastComputedState(LoopState.DESIGN);
loop.setDcaeDeploymentId(dcaeId);
loop.setDcaeDeploymentStatusUrl(dcaeUrl);
+ loop.setDcaeBlueprintId(dcaeBlueprintId);
return loop;
}
private MicroServicePolicy getMicroServicePolicy(String name, String jsonRepresentation, String policyTosca,
String jsonProperties, boolean shared) {
MicroServicePolicy µService = new MicroServicePolicy();
- µService.setJsonRepresentation(new Gson().fromJson(jsonRepresentation, Map.class));
+ µService.setJsonRepresentation(new Gson().fromJson(jsonRepresentation, JsonObject.class));
µService.setPolicyTosca(policyTosca);
- µService.setProperties(new Gson().fromJson(jsonProperties, Map.class));
+ µService.setProperties(new Gson().fromJson(jsonProperties, JsonObject.class));
µService.setShared(shared);
µService.setName(name);
@@ -110,7 +111,7 @@ public class LoopRepositoriesItCase {
@Transactional
public void CrudTest() {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
- "123456789", "https://dcaetest.org");
+ "123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy("{\"type\":\"GUARD\"}", "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "{\"configtype\":\"json\"}",