summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java6
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java15
-rw-r--r--src/main/java/org/onap/clamp/clds/util/JsonUtils.java120
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopService.java7
-rw-r--r--src/main/java/org/onap/clamp/loop/common/AuditEntity.java42
-rw-r--r--src/main/java/org/onap/clamp/loop/service/Service.java3
-rw-r--r--src/main/java/org/onap/clamp/util/PassDecoder.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java28
-rw-r--r--src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java92
-rw-r--r--src/test/resources/example/model-properties/custom/modelBpmnPropertiesMultiVF.json273
-rw-r--r--src/test/resources/tosca/loop.json130
12 files changed, 74 insertions, 648 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
index fdac85232..b2478462f 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
@@ -58,7 +58,7 @@ public class CldsConfiguration {
/**
* This loads the file system.properties.
*
- * @return
+ * @return The PropertiesFactoryBean
*/
@Bean(name = "mapper")
public PropertiesFactoryBean mapper() {
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
index 261288503..5a3e22a35 100644
--- a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
@@ -69,9 +69,9 @@ public class SdcControllerConfiguration {
@PostConstruct
public void loadSdcControllers() {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
- sdcControllersConfig.getAllDefinedControllers().forEach((k, v) -> {
- logger.info("Creating controller instance:" + k);
- SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, null);
+ sdcControllersConfig.getAllDefinedControllers().forEach((key, value) -> {
+ logger.info("Creating controller instance:" + key);
+ SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, value, null);
sdcControllersList.add(sdcController);
});
}
diff --git a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
index 2e025ba7d..232db48c4 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertor.java
@@ -360,21 +360,6 @@ public class ToscaYamlToJsonConvertor {
JSONArray jsonArray = new JSONArray();
((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> {
if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
-
- ((LinkedHashMap<String, Object>) pmap.getValue()).entrySet().stream().forEach(p -> {
- if (p.getValue() instanceof Map) {
- LinkedHashMap<String, Object> childNodeMap2 = (LinkedHashMap<String, Object>) p
- .getValue();
- if (childNodeMap2.containsKey(ToscaSchemaConstants.TYPE)
- && (((String) childNodeMap2.get(ToscaSchemaConstants.TYPE))
- .contains(ToscaSchemaConstants.POLICY_DATA))) {
- }
- }
- });
- }
- });
- ((LinkedHashMap<String, Object>) dataNodes.get(typeValue)).entrySet().stream().forEach(pmap -> {
- if (pmap.getKey().equalsIgnoreCase(ToscaSchemaConstants.PROPERTIES)) {
parseToscaPropertiesForType(childObjectKey,
(LinkedHashMap<String, Object>) pmap.getValue(), entrySchemaObject, childArray,
jsonEntrySchema, dataNodes, true, incrementComplexSimpleTypeOrder());
diff --git a/src/main/java/org/onap/clamp/clds/util/JsonUtils.java b/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
index cc875d6d9..704d3ac37 100644
--- a/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/JsonUtils.java
@@ -25,21 +25,10 @@ package org.onap.clamp.clds.util;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.Spliterator;
-import java.util.Spliterators;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
import org.onap.clamp.clds.service.SecureServicePermission;
import org.onap.clamp.clds.service.SecureServicePermissionDeserializer;
@@ -52,8 +41,6 @@ import org.onap.clamp.dao.model.gson.converter.InstantSerializer;
public class JsonUtils {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(JsonUtils.class);
- private static final String LOG_ELEMENT_NOT_FOUND = "Value '{}' for key 'name' not found in JSON";
- private static final String LOG_ELEMENT_NOT_FOUND_IN_JSON = "Value '{}' for key 'name' not found in JSON {}";
public static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer()).create();
@@ -65,111 +52,4 @@ public class JsonUtils {
private JsonUtils() {
}
-
- /**
- * typeAdapter Return the value field of the json node element that has a name
- * field equals to the given name.
- */
- public static String getStringValueByName(JsonElement jsonElement, String name) {
- String value = extractJsonValueFromElement(jsonElement, name).map(JsonUtils::extractStringValueFromElement)
- .orElse(null);
- if (value == null) {
- if (logger.isDebugEnabled()) {
- logger.debug(LOG_ELEMENT_NOT_FOUND_IN_JSON, name, jsonElement.toString());
- } else {
- logger.warn(LOG_ELEMENT_NOT_FOUND, name);
- }
- }
- return value;
- }
-
- /**
- * Return an array of values for the field of the json node element that has a
- * name field equals to the given name.
- */
- public static List<String> getStringValuesByName(JsonElement jsonElement, String name) {
- List<String> values = extractJsonValueFromElement(jsonElement, name)
- .map(JsonUtils::extractStringValuesFromElement).orElse(new ArrayList<>());
- if (values.isEmpty()) {
- if (logger.isDebugEnabled()) {
- logger.debug(LOG_ELEMENT_NOT_FOUND_IN_JSON, name, jsonElement.toString());
- } else {
- logger.warn(LOG_ELEMENT_NOT_FOUND, name);
- }
- }
- return values;
- }
-
- /**
- * Return the int value field of the json node element that has a name field
- * equals to the given name.
- */
- public static Integer getIntValueByName(JsonElement element, String name) {
- String value = getStringValueByName(element, name);
- return Integer.valueOf(value);
- }
-
- /**
- * Return the Json value field of the json node element that has a name field
- * equals to the given name.
- */
- public static JsonObject getJsonObjectByName(JsonElement jsonElement, String name) {
- JsonObject jsonObject = extractJsonValueFromElement(jsonElement, name).map(JsonElement::getAsJsonObject)
- .orElse(null);
- if (jsonObject == null) {
- logger.warn(LOG_ELEMENT_NOT_FOUND, name);
- } else {
- logger.debug(LOG_ELEMENT_NOT_FOUND_IN_JSON, name, jsonElement.toString());
- }
- return jsonObject;
- }
-
- private static Optional<JsonElement> extractJsonValueFromElement(JsonElement jsonElement, String name) {
- if (jsonElement != null) {
- if (jsonElement.isJsonArray()) {
- return extractValueJsonFromArray(jsonElement, name);
- } else if (hasMatchingParameterName(name, jsonElement)) {
- return Optional.of(jsonElement);
- }
- }
- return Optional.empty();
- }
-
- private static Optional<JsonElement> extractValueJsonFromArray(JsonElement jsonElement, String name) {
- for (JsonElement element : jsonElement.getAsJsonArray()) {
- if (hasMatchingParameterName(name, element)) {
- return Optional.of(element.getAsJsonObject().get("value"));
- }
- }
- return Optional.empty();
- }
-
- private static boolean hasMatchingParameterName(String name, JsonElement element) {
- return element.isJsonObject() && element.getAsJsonObject().has("name")
- && name.equals(element.getAsJsonObject().get("name").getAsString());
- }
-
- private static String extractStringValueFromElement(JsonElement element) {
- if (element.isJsonArray()) {
- return element.getAsJsonArray().get(0).getAsString();
- } else if (element.isJsonPrimitive()) {
- return element.getAsJsonPrimitive().getAsString();
- } else {
- return GSON.toJson(element);
- }
- }
-
- private static List<String> extractStringValuesFromElement(JsonElement element) {
- if (element.isJsonArray()) {
- return StreamSupport
- .stream(Spliterators.spliteratorUnknownSize(element.getAsJsonArray().iterator(),
- Spliterator.ORDERED), false)
- .filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsJsonPrimitive)
- .filter(JsonPrimitive::isString).map(JsonPrimitive::getAsString).collect(Collectors.toList());
- } else {
- String value = extractStringValueFromElement(element);
- return Lists.newArrayList(value);
- }
-
- }
}
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java
index e52029662..fb857fbf4 100644
--- a/src/main/java/org/onap/clamp/loop/LoopService.java
+++ b/src/main/java/org/onap/clamp/loop/LoopService.java
@@ -65,6 +65,13 @@ public class LoopService {
loopsRepository.deleteById(loopName);
}
+ /**
+ * This method is used to refresh the DCAE deployment status fields.
+ *
+ * @param loop The loop instance to be modified
+ * @param deploymentId The deployment ID as returned by DCAE
+ * @param deploymentUrl The Deployment URL as returned by DCAE
+ */
public void updateDcaeDeploymentFields(Loop loop, String deploymentId, String deploymentUrl) {
loop.setDcaeDeploymentId(deploymentId);
loop.setDcaeDeploymentStatusUrl(deploymentUrl);
diff --git a/src/main/java/org/onap/clamp/loop/common/AuditEntity.java b/src/main/java/org/onap/clamp/loop/common/AuditEntity.java
index 445f5b9e8..bf9d10d74 100644
--- a/src/main/java/org/onap/clamp/loop/common/AuditEntity.java
+++ b/src/main/java/org/onap/clamp/loop/common/AuditEntity.java
@@ -38,6 +38,10 @@ import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
+/**
+ * This class is the parent of the hibernate entities requiring to be audited.
+ *
+ */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class AuditEntity {
@@ -66,6 +70,11 @@ public class AuditEntity {
return createdDate;
}
+ /**
+ * createdDate setter.
+ *
+ * @param createdDate The created Date object
+ */
public void setCreatedDate(Instant createdDate) {
if (createdDate != null) {
this.createdDate = createdDate.truncatedTo(ChronoUnit.SECONDS);
@@ -74,10 +83,20 @@ public class AuditEntity {
}
}
+ /**
+ * updatedDate getter.
+ *
+ * @return the updatedDate
+ */
public Instant getUpdatedDate() {
return updatedDate;
}
+ /**
+ * updatedDate setter.
+ *
+ * @param updatedDate updatedDate to set
+ */
public void setUpdatedDate(Instant updatedDate) {
if (updatedDate != null) {
this.updatedDate = updatedDate.truncatedTo(ChronoUnit.SECONDS);
@@ -86,22 +105,45 @@ public class AuditEntity {
}
}
+ /**
+ * updatedBy getter.
+ *
+ * @return the updatedBy
+ */
public String getUpdatedBy() {
return updatedBy;
}
+ /**
+ * updatedBy setter.
+ *
+ * @param updatedBy the updatedBy
+ */
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
+ /**
+ * createdBy getter.
+ *
+ * @return the createdBy
+ */
public String getCreatedBy() {
return createdBy;
}
+ /**
+ * createdBy setter.
+ *
+ * @param createdBy the createdBy to set
+ */
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
+ /**
+ * Empty constructor.
+ */
public AuditEntity() {
}
diff --git a/src/main/java/org/onap/clamp/loop/service/Service.java b/src/main/java/org/onap/clamp/loop/service/Service.java
index b74ee0b0d..33b8e02da 100644
--- a/src/main/java/org/onap/clamp/loop/service/Service.java
+++ b/src/main/java/org/onap/clamp/loop/service/Service.java
@@ -86,11 +86,10 @@ public class Service implements Serializable {
*/
public Service(String serviceDetails, String resourceDetails) {
JsonObject serviceDetailsJson = JsonUtils.GSON.fromJson(serviceDetails, JsonObject.class);
- JsonObject resourceDetailsJson = JsonUtils.GSON.fromJson(resourceDetails, JsonObject.class);
this.name = serviceDetailsJson.get("name").getAsString();
this.serviceUuid = serviceDetailsJson.get("UUID").getAsString();
this.serviceDetails = serviceDetailsJson;
- this.resourceDetails = resourceDetailsJson;
+ this.resourceDetails = JsonUtils.GSON.fromJson(resourceDetails, JsonObject.class);
}
/**
diff --git a/src/main/java/org/onap/clamp/util/PassDecoder.java b/src/main/java/org/onap/clamp/util/PassDecoder.java
index 70a47477e..029f55d69 100644
--- a/src/main/java/org/onap/clamp/util/PassDecoder.java
+++ b/src/main/java/org/onap/clamp/util/PassDecoder.java
@@ -29,6 +29,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+
import org.onap.aaf.cadi.Symm;
import org.onap.clamp.clds.util.ResourceFileUtil;
@@ -43,8 +44,9 @@ public class PassDecoder {
/**
* Decode the password.
+ *
* @param encryptedPass The encrypted password
- * @param keyFileIs The key file in InputStream format
+ * @param keyFile The key file name in String
*/
public static String decode(String encryptedPass, String keyFile) {
if (null == keyFile) {
diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java
index 18f77cba0..a9e279de4 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTest.java
@@ -38,7 +38,8 @@ public class ToscaYamlToJsonConvertorTest {
* This Test validates TOSCA yaml to JSON Schema conversion based on JSON Editor
* Schema.
*
- * @throws IOException In case of issue when opening the tosca yaml file and converted json file
+ * @throws IOException In case of issue when opening the tosca yaml file and
+ * converted json file
*/
@Test
public final void testParseToscaYaml() throws IOException {
@@ -53,37 +54,38 @@ public class ToscaYamlToJsonConvertorTest {
}
/**
- * This Test validates TOSCA yaml with constraints to JSON Schema conversion based on JSON Editor
- * Schema.
+ * This Test validates TOSCA yaml with constraints to JSON Schema conversion
+ * based on JSON Editor Schema.
*
- * @throws IOException In case of issue when opening the tosca yaml file and converted json file
+ * @throws IOException In case of issue when opening the tosca yaml file and
+ * converted json file
*/
@Test
public final void testParseToscaYamlWithConstraints() throws IOException {
String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml");
ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
- String parsedJsonSchema = convertor.parseToscaYaml(toscaModelYaml,"onap.policies.monitoring.example.app");
+ String parsedJsonSchema = convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
assertNotNull(parsedJsonSchema);
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints" +
- ".json"),
- parsedJsonSchema, true);
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
+ parsedJsonSchema, true);
}
/**
- * This Test validates TOSCA yaml with different datatypes to JSON Schema conversion based on JSON Editor
- * Schema.
+ * This Test validates TOSCA yaml with different datatypes to JSON Schema
+ * conversion based on JSON Editor Schema.
*
- * @throws IOException In case of issue when opening the tosca yaml file and converted json file
+ * @throws IOException In case of issue when opening the tosca yaml file and
+ * converted json file
*/
@Test
public final void testParseToscaYamlWithTypes() throws IOException {
String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml");
ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
- String parsedJsonSchema = convertor.parseToscaYaml(toscaModelYaml,"onap.policies.monitoring.example.app");
+ String parsedJsonSchema = convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
assertNotNull(parsedJsonSchema);
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
- parsedJsonSchema, true);
+ parsedJsonSchema, true);
}
}
diff --git a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
index d1adc166f..926ed66b6 100644
--- a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
@@ -26,16 +26,10 @@
package org.onap.clamp.clds.util;
-import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
-import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
import java.io.IOException;
-import java.util.List;
import org.junit.Test;
@@ -56,26 +50,6 @@ public class JsonUtilsTest {
}
}
- private static final JsonObject DEPLOY_PARAMETERS = JsonUtils.GSON.fromJson(
- "{\n"
- + " \"aaiEnrichmentHost\": \"aai.onap.svc.cluster.local\",\n"
- + " \"aaiEnrichmentPort\": \"8443\",\n"
- + " \"enableAAIEnrichment\": true,\n"
- + " \"dmaap_host\": \"message-router\",\n"
- + " \"dmaap_port\": \"3904\",\n"
- + " \"enableRedisCaching\": false,\n"
- + " \"redisHosts\": \"dcae-redis:6379\",\n"
- + " \"tag_version\": \"nexus3.onap.org:10001/onap/org.onap.dcaegen2."
- + "deployments.tca-cdap-container:1.1.0\",\n"
- + " \"consul_host\": \"consul-server\",\n"
- + " \"consul_port\": \"8500\",\n"
- + " \"cbs_host\": \"config-binding-service\",\n"
- + " \"cbs_port\": \"10000\",\n"
- + " \"external_port\": \"32010\",\n"
- + " \"policy_id\": \"AUTO_GENERATED_POLICY_ID_AT_SUBMIT\"\n"
- + " }", JsonObject.class);
-
-
@Test
public void testGetObjectMapperInstance() {
assertNotNull(JsonUtils.GSON);
@@ -90,74 +64,12 @@ public class JsonUtilsTest {
TestClass test = new TestClass("value1", "value2");
test.setObject2(new TestObject2("test3"));
Object testObject = JsonUtils.GSON.fromJson("[\"org.onap.clamp.clds.util.JsonUtilsTest$TestClass\""
- + ",{\"test\":\"value1\",\"test2\":\"value2\",\"object2\":[\"org.onap.clamp.clds.util.TestObject2\","
- + "{\"test3\":\"test3\"}]}]", Object.class);
+ + ",{\"test\":\"value1\",\"test2\":\"value2\",\"object2\":[\"org.onap.clamp.clds.util.TestObject2\","
+ + "{\"test3\":\"test3\"}]}]", Object.class);
assertNotNull(testObject);
assertFalse(testObject instanceof TestObject);
}
- @Test
- public void shouldReturnJsonValueByName() throws IOException {
- // given
- String modelProperties = ResourceFileUtil
- .getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
- JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
-
- // when
- String locationName = JsonUtils.getStringValueByName(globalElement, "location");
- String timeoutValue = JsonUtils.getStringValueByName(globalElement, "timeout");
-
- // then
- assertThat(locationName).isEqualTo("SNDGCA64");
- assertThat(timeoutValue).isEqualTo("500");
- }
-
- @Test
- public void shouldReturnJsonObjectByPropertyName() throws IOException {
- // given
- String modelProperties = ResourceFileUtil
- .getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
- JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
-
- // when
- JsonObject deployParameters = JsonUtils.getJsonObjectByName(globalElement, "deployParameters");
-
- // then
- assertThat(deployParameters).isEqualToComparingFieldByField(DEPLOY_PARAMETERS);
- }
-
- @Test
- public void shouldReturnJsonValuesByPropertyName() throws IOException {
- // given
- String modelProperties = ResourceFileUtil
- .getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
- JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
-
- // when
- List<String> vfs = JsonUtils.getStringValuesByName(globalElement, "vf");
-
- // then
- assertThat(vfs).containsExactly(
- "6c7aaec2-59eb-41d9-8681-b7f976ab668d",
- "8sadsad0-a98s-6a7s-fd12-sadji9sa8d12",
- "8sfd71ad-a90d-asd9-as87-8a7sd81adsaa"
- );
- }
-
- @Test
- public void shouldReturnJsonValueAsInteger() throws IOException {
- // given
- String modelProperties = ResourceFileUtil
- .getResourceAsString("example/model-properties/custom/modelBpmnPropertiesMultiVF.json");
- JsonElement globalElement = JsonUtils.GSON.fromJson(modelProperties, JsonObject.class).get("global");
-
- // when
- Integer timeoutValue = JsonUtils.getIntValueByName(globalElement, "timeout");
-
- // then
- assertThat(timeoutValue).isEqualTo(500);
- }
-
@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionFileNotExists() throws IOException {
ResourceFileUtil.getResourceAsString("example/notExist.json");
diff --git a/src/test/resources/example/model-properties/custom/modelBpmnPropertiesMultiVF.json b/src/test/resources/example/model-properties/custom/modelBpmnPropertiesMultiVF.json
deleted file mode 100644
index 211aaecf7..000000000
--- a/src/test/resources/example/model-properties/custom/modelBpmnPropertiesMultiVF.json
+++ /dev/null
@@ -1,273 +0,0 @@
-{
- "global":
- [
- {
- "name": "service",
- "value":
- [
- "0f983e18-4603-4bb4-a98c-e29691fb16a1"
- ]
- },
-
- {
- "name": "vf",
- "value":
- [
- "6c7aaec2-59eb-41d9-8681-b7f976ab668d",
- "8sadsad0-a98s-6a7s-fd12-sadji9sa8d12",
- "8sfd71ad-a90d-asd9-as87-8a7sd81adsaa"
- ]
- },
-
- {
- "name": "actionSet",
- "value":
- [
- "vnfRecipe"
- ]
- },
-
- {
- "name": "location",
- "value":
- [
- "SNDGCA64"
- ]
- },
- {
- "name": "timeout",
- "value": "500"
- },
- {
- "name": "deployParameters",
- "value": {
- "aaiEnrichmentHost": "aai.onap.svc.cluster.local",
- "aaiEnrichmentPort": "8443",
- "enableAAIEnrichment": true,
- "dmaap_host": "message-router",
- "dmaap_port": "3904",
- "enableRedisCaching": false,
- "redisHosts": "dcae-redis:6379",
- "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0",
- "consul_host": "consul-server",
- "consul_port": "8500",
- "cbs_host": "config-binding-service",
- "cbs_port": "10000",
- "external_port": "32010",
- "policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT"
- }
- }
- ],
-
- "Policy_":
- {
- "Policy1":
- [
- {
- "name": "pname",
- "value": "Policy1"
- },
-
- {
- "name": "pid",
- "value": "1"
- },
-
- {
- "name": "timeout",
- "value": "500"
- },
-
- {
- "policyConfigurations":
- [
- [
- {
- "name": "recipe",
- "value":
- [
- "restart"
- ]
- },
-
- {
- "name": "maxRetries",
- "value":
- [
- "3"
- ]
- },
-
- {
- "name": "retryTimeLimit",
- "value":
- [
- "180"
- ]
- },
-
- {
- "name": "_id",
- "value":
- [
- "n9bQ4t6"
- ]
- },
-
- {
- "name": "parentPolicy",
- "value":
- [
- ""
- ]
- },
- {
- "name": "targetResourceId",
- "value":
- [
- "resource-id"
- ]
- }
- ],
-
- [
- {
- "name": "recipe",
- "value":
- [
- "rebuild"
- ]
- },
-
- {
- "name": "maxRetries",
- "value":
- [
- "3"
- ]
- },
-
- {
- "name": "retryTimeLimit",
- "value":
- [
- "180"
- ]
- },
-
- {
- "name": "_id",
- "value":
- [
- "ItE5xKT"
- ]
- },
-
- {
- "name": "parentPolicy",
- "value":
- [
- "n9bQ4t6"
- ]
- },
-
- {
- "name": "parentPolicyConditions",
- "value":
- [
- "Failure_Retries",
- "Failure_Timeout",
- "Failure_Exception",
- "Failure"
- ]
- },
- {
- "name": "targetResourceId",
- "value":
- [
- "resource-id"
- ]
- }
- ]
- ]
- }
- ]
- },
-
- "TCA_":
- {
- "Narra":
- [
- {
- "name": "tname",
- "value": "Narra"
- },
-
- {
- "name": "tuuid",
- "value": "886be8da-14fe-tca1-d04b-d13b55d58df9"
- },
-
- {
- "name": "tnfc",
- "value": "ENBE"
- },
-
- {
- "name": "tcaEnab",
- "value": "on"
- },
-
- {
- "name": "tcaPol",
- "value": "Policy1"
- },
-
- {
- "name": "tcaPolId",
- "value": "1"
- },
-
- {
- "name": "tcaInt",
- "value": "2"
- },
-
- {
- "name": "tcaSev",
- "value": "Warning"
- },
-
- {
- "name": "tcaVio",
- "value": "3"
- },
-
- {
- "serviceConfigurations":
- [
- [
- "PMRRCCONNESTABFAILCELLLATENCY",
- "LESS",
- "4",
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[?(@.Name == 'PMRRCCONNESTABFAILCELLLATENCY')].Value"
- ],
-
- [
- "PMRAATTCBRA",
- "GREATER",
- "30",
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[?(@.Name == 'PMRAATTCBRA')].Value"
- ]
- ]
- }
- ]
- },
-
- "CustomType_": [
- {
- "name": "test",
- "value": "This is a test"
- }
- ]
-} \ No newline at end of file
diff --git a/src/test/resources/tosca/loop.json b/src/test/resources/tosca/loop.json
deleted file mode 100644
index cb1697b80..000000000
--- a/src/test/resources/tosca/loop.json
+++ /dev/null
@@ -1,130 +0,0 @@
-{
- "name": "ControlLoopTest",
- "dcaeDeploymentId": "123456789",
- "dcaeDeploymentStatusUrl": "https://dcaetest.org",
- "dcaeBlueprintId": "UUID-blueprint",
- "globalPropertiesJson": {
- "testname": "testvalue"
- },
- "modelService": {
- "serviceDetails": {
- "serviceType": "",
- "namingPolicy": "",
- "environmentContext": "General_Revenue-Bearing",
- "serviceEcompNaming": "true",
- "serviceRole": "",
- "name": "vLoadBalancerMS",
- "description": "vLBMS",
- "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
- "ecompGeneratedNaming": "true",
- "category": "Network L4+",
- "type": "Service",
- "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
- "instantiationType": "A-la-carte"
- },
- "resourceDetails": {
- "CP": {},
- "VL": {},
- "VF": {
- "vLoadBalancerMS 0": {
- "resourceVendor": "Test",
- "resourceVendorModelNumber": "",
- "name": "vLoadBalancerMS",
- "description": "vLBMS",
- "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
- "subcategory": "Load Balancer",
- "category": "Application L4+",
- "type": "VF",
- "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
- "version": "1.0",
- "resourceVendorRelease": "1.0",
- "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
- }
- },
- "CR": {},
- "VFC": {},
- "PNF": {},
- "Service": {},
- "CVFC": {},
- "Service Proxy": {},
- "Configuration": {},
- "AllottedResource": {},
- "VFModule": {
- "Vloadbalancerms..vpkg..module-1": {
- "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
- "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
- "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
- "min_vf_module_instances": 0,
- "vf_module_label": "vpkg",
- "max_vf_module_instances": 1,
- "vf_module_type": "Expansion",
- "isBase": false,
- "initial_count": 0,
- "volume_group": false
- },
- "Vloadbalancerms..vdns..module-3": {
- "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
- "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
- "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
- "min_vf_module_instances": 0,
- "vf_module_label": "vdns",
- "max_vf_module_instances": 50,
- "vf_module_type": "Expansion",
- "isBase": false,
- "initial_count": 0,
- "volume_group": false
- },
- "Vloadbalancerms..base_template..module-0": {
- "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
- "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
- "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
- "min_vf_module_instances": 1,
- "vf_module_label": "base_template",
- "max_vf_module_instances": 1,
- "vf_module_type": "Base",
- "isBase": true,
- "initial_count": 1,
- "volume_group": false
- },
- "Vloadbalancerms..vlb..module-2": {
- "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
- "vfModuleModelVersion": "1",
- "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
- "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
- "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
- "min_vf_module_instances": 0,
- "vf_module_label": "vlb",
- "max_vf_module_instances": 1,
- "vf_module_type": "Expansion",
- "isBase": false,
- "initial_count": 0,
- "volume_group": false
- }
- }
- }
- },
- "lastComputedState": "DESIGN",
- "components": {
- "POLICY": {
- "componentState": {
- "stateName": "UNKNOWN",
- "description": "The current status is not clear. Need to regresh the status to get the current status."
- }
- },
- "DCAE": {
- "componentState": {
- "stateName": "BLUEPRINT_DEPLOYED",
- "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
- }
- }
- },
- "operationalPolicies": [],
- "microServicePolicies": [],
- "loopLogs": []
-}