summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-03-05 05:17:11 +0100
committersebdet <sebastien.determe@intl.att.com>2019-03-05 10:32:27 +0100
commit86cf9ece99fdc169427426010d07d59b3d0d1d91 (patch)
treed7b3711e643b6590be305ab7eccf4dd8b9bbab0b /src/test/java
parent75c0f1dd0b0b9700a3f235611131fdc500e10eb0 (diff)
Rework the hibernate adapter
This was using the Jackson library so a new handmade hibernate adapter has been developed. Issue-ID: CLAMP-300 Change-Id: Ia1c1e8791370c139127e6fa4bd2b96c02f632fde Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test/java')
-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\"}",