aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-09-15 11:53:27 +0200
committersebdet <sebastien.determe@intl.att.com>2020-09-15 16:19:11 +0200
commit536db7b811eba341aef48a745b495da068d170eb (patch)
tree72cdba6e61989c7a00ef19545969ac0e49e30075 /src/test/java/org
parent2d9f989e0d37002c758bdf66a3f25fcfdac35b62 (diff)
Fix the ssl config
Fix SSL config so that clamp can access external files from the application.properties spring definition Issue-ID: CLAMP-884 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ic4483d56c86f52249b09b386cdbe505f2f2f2a66 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java10
-rw-r--r--src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java16
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java6
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java18
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java8
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java8
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java56
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java22
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java14
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java8
-rw-r--r--src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java20
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java6
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyComponentTest.java4
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java8
-rw-r--r--src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java14
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java8
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java15
-rw-r--r--src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java10
21 files changed, 131 insertions, 130 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
index 9fdc727bc..3d189cf71 100644
--- a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
@@ -26,29 +26,29 @@ import com.google.gson.JsonObject;
import java.io.IOException;
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.skyscreamer.jsonassert.JSONAssert;
public class CdsServicesTest {
@Test
public void testParseCdsListTypeProperties() throws IOException {
- String cdsResponse = ResourceFileUtil
+ String cdsResponse = ResourceFileUtils
.getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json");
CdsServices services = new CdsServices();
JsonObject output = services.parseCdsResponse(cdsResponse);
- JSONAssert.assertEquals(ResourceFileUtil
+ JSONAssert.assertEquals(ResourceFileUtils
.getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
JsonUtils.GSON.toJson(output), true);
}
@Test
public void testParseCdsResponse() throws IOException {
- String cdsResponse = ResourceFileUtil
+ String cdsResponse = ResourceFileUtils
.getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json");
CdsServices services = new CdsServices();
JsonObject output = services.parseCdsResponse(cdsResponse);
- JSONAssert.assertEquals(ResourceFileUtil
+ JSONAssert.assertEquals(ResourceFileUtils
.getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
JsonUtils.GSON.toJson(output), true);
}
diff --git a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
index d27690bfa..06df124ce 100644
--- a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
+++ b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
@@ -36,7 +36,7 @@ import java.nio.charset.StandardCharsets;
import org.junit.Test;
import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
/**
* This class tests the SDC Controller config.
@@ -51,7 +51,7 @@ public class SdcSingleControllerConfigurationTest {
public static SdcSingleControllerConfiguration loadControllerConfiguration(String fileName,
String sdcControllerName) {
- InputStreamReader streamReader = new InputStreamReader(ResourceFileUtil.getResourceAsStream(fileName),
+ InputStreamReader streamReader = new InputStreamReader(ResourceFileUtils.getResourceAsStream(fileName),
StandardCharsets.UTF_8);
JsonObject jsonNode = JsonUtils.GSON.fromJson(streamReader, JsonObject.class);
diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
index d985a5d72..c4c0c345a 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
@@ -29,7 +29,7 @@ import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.config.ClampProperties;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -59,7 +59,7 @@ public class CldsReferencePropertiesItCase {
*/
@Test
public void testGetFileContent() throws IOException {
- String users = ResourceFileUtil.getResourceAsString("clds/clds-users.json");
+ String users = ResourceFileUtils.getResourceAsString("clds/clds-users.json");
assertEquals(users, refProp.getFileContent("files.cldsUsers"));
// Test composite key
assertEquals(users, refProp.getFileContent("files", "cldsUsers"));
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
index cd7337a4d..a768526a0 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
@@ -43,7 +43,7 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.yaml.snakeyaml.Yaml;
public class BlueprintParserTest {
@@ -70,25 +70,25 @@ public class BlueprintParserTest {
*/
@BeforeClass
public static void loadBlueprints() throws IOException {
- microServiceTheWholeBlueprintValid = ResourceFileUtil
+ microServiceTheWholeBlueprintValid = ResourceFileUtils
.getResourceAsString("clds/blueprint-with-microservice-chain.yaml");
- newMicroServiceBlueprint = ResourceFileUtil.getResourceAsString("clds/new-microservice.yaml");
+ newMicroServiceBlueprint = ResourceFileUtils.getResourceAsString("clds/new-microservice.yaml");
- String microServiceBlueprintInvalid = ResourceFileUtil
+ String microServiceBlueprintInvalid = ResourceFileUtils
.getResourceAsString("clds/single-microservice-fragment-invalid.yaml");
jsonObjectBlueprintInvalid = yamlToJson(microServiceBlueprintInvalid);
- String microServiceBlueprintWithoutName = ResourceFileUtil
+ String microServiceBlueprintWithoutName = ResourceFileUtils
.getResourceAsString("clds/single-microservice-fragment-without-name.yaml");
jsonObjectBlueprintWithoutName = yamlToJson(microServiceBlueprintWithoutName);
- String microServiceBlueprintWithoutProperties = ResourceFileUtil
+ String microServiceBlueprintWithoutProperties = ResourceFileUtils
.getResourceAsString("clds/single-microservice-fragment-without-properties.yaml");
jsonObjectBlueprintWithoutProperties = yamlToJson(microServiceBlueprintWithoutProperties);
- String microServiceBlueprintValidWithVersion = ResourceFileUtil
+ String microServiceBlueprintValidWithVersion = ResourceFileUtils
.getResourceAsString("clds/single-microservice-fragment-valid-with-version.yaml");
jsonObjectBlueprintValidWithVersion = yamlToJson(microServiceBlueprintValidWithVersion);
- String microServiceBlueprintWithoutRelationships = ResourceFileUtil
+ String microServiceBlueprintWithoutRelationships = ResourceFileUtils
.getResourceAsString("clds/single-microservice-fragment-without-relationships.yaml");
jsonObjectBlueprintWithoutRelationships = yamlToJson(microServiceBlueprintWithoutRelationships);
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
index e00887478..f04e3fa3c 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
@@ -42,7 +42,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
@@ -112,14 +112,14 @@ public class CsarHandlerTest {
private IDistributionClientDownloadResult buildFakeSdcResut() throws IOException {
IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
- IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
+ IOUtils.toByteArray(ResourceFileUtils.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
return resultArtifact;
}
private IDistributionClientDownloadResult buildFakeSdcResultWithoutPolicyModel() throws IOException {
IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
- IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-without-policy.csar")));
+ IOUtils.toByteArray(ResourceFileUtils.getResourceAsStream("example/sdc/service-without-policy.csar")));
return resultArtifact;
}
diff --git a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java
index b26f3ede8..e73547652 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java
@@ -33,7 +33,7 @@ import javax.transaction.Transactional;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.tosca.Dictionary;
import org.onap.clamp.tosca.DictionaryElement;
import org.onap.clamp.tosca.DictionaryService;
@@ -61,14 +61,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
*/
@Test
public final void testParseToscaYaml() throws IOException {
- String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml");
+ String toscaModelYaml = ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml");
ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
String parsedJsonSchema =
convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app");
assertNotNull(parsedJsonSchema);
JSONAssert.assertEquals(
- ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"),
+ ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json.json"),
parsedJsonSchema, true);
}
@@ -82,14 +82,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
@Test
public final void testParseToscaYamlWithConstraints() throws IOException {
String toscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca-with-constraints.yaml");
ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
String parsedJsonSchema =
convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
assertNotNull(parsedJsonSchema);
JSONAssert.assertEquals(
- ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
+ ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
parsedJsonSchema, true);
}
@@ -103,14 +103,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
@Test
public final void testParseToscaYamlWithTypes() throws IOException {
String toscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca-with-datatypes.yaml");
ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
String parsedJsonSchema =
convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
assertNotNull(parsedJsonSchema);
JSONAssert.assertEquals(
- ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
+ ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
parsedJsonSchema, true);
}
@@ -126,7 +126,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
public final void testMetadataClampPossibleValues() throws IOException {
setupDictionary();
String toscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml);
assertNotNull(jsonObject);
@@ -141,7 +141,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType);
assertEquals("tca", acronym);
JSONAssert.assertEquals(
- ResourceFileUtil
+ ResourceFileUtils
.getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"),
parsedJsonSchema, true);
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
index 421bd6ab2..8a81445b2 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
@@ -31,7 +31,7 @@ import org.onap.clamp.clds.tosca.update.elements.ArrayField;
import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
public class ArrayFieldTest extends TestCase {
@@ -41,10 +41,10 @@ public class ArrayFieldTest extends TestCase {
* @throws IOException in case of failure
*/
public void testDeploy() throws IOException {
- JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(ResourceFileUtil.getResourceAsString(
- "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString(
+ JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(ResourceFileUtils.getResourceAsString(
+ "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), ResourceFileUtils.getResourceAsString(
"clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor");
ArrayField arrayParser = new ArrayField((ArrayList<Object>) toscaElementProperty.getItems().get("default"));
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
index 5215cbd4d..f147f404d 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
@@ -31,14 +31,14 @@ import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
public class ConstraintTest extends TestCase {
JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/constraints.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Operation");
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
index 0a0710c65..b9fcf51aa 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
@@ -31,7 +31,7 @@ import junit.framework.TestCase;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
public class JsonTemplateManagerTest extends TestCase {
@@ -44,11 +44,11 @@ public class JsonTemplateManagerTest extends TestCase {
public void testLaunchTranslationTca() throws IOException, UnknownComponentException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;"
- + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+ + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
"clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app";
jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -62,11 +62,11 @@ public class JsonTemplateManagerTest extends TestCase {
public void testLaunchTranslationFrequencyLimiter() throws IOException, UnknownComponentException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0&#63;"
- + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+ + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
"clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter";
jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -80,11 +80,11 @@ public class JsonTemplateManagerTest extends TestCase {
public void testLaunchTranslationApex() throws IOException, UnknownComponentException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ".policies.controlloop.operational.common.Apex/versions/1.0.0&#63;"
- + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+ + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
"clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Apex";
jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -98,11 +98,11 @@ public class JsonTemplateManagerTest extends TestCase {
public void testLaunchTranslationDrools() throws IOException, UnknownComponentException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ".policies.controlloop.operational.common.Drools/versions/1.0.0&#63;"
- + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+ + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
"clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Drools";
jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -117,9 +117,9 @@ public class JsonTemplateManagerTest extends TestCase {
public void testLaunchTranslation() throws IOException, UnknownComponentException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Drools";
jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -132,9 +132,9 @@ public class JsonTemplateManagerTest extends TestCase {
public void testAddTemplate() throws IOException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
int count = jsonTemplateManager.getJsonSchemaTemplates().size();
List<JsonTemplateField>
jsonTemplateFields =
@@ -154,9 +154,9 @@ public class JsonTemplateManagerTest extends TestCase {
public void testRemoveTemplate() throws IOException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
int count = jsonTemplateManager.getJsonSchemaTemplates().size();
jsonTemplateManager.removeTemplate("string");
assertNotSame(count, jsonTemplateManager.getJsonSchemaTemplates().size());
@@ -170,9 +170,9 @@ public class JsonTemplateManagerTest extends TestCase {
public void testUpdateTemplate() throws IOException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
int count = jsonTemplateManager.getJsonSchemaTemplates().get("integer").getJsonTemplateFields().size();
jsonTemplateManager.updateTemplate("integer", new JsonTemplateField("type"), false);
assertNotSame(count,
@@ -187,9 +187,9 @@ public class JsonTemplateManagerTest extends TestCase {
public void testHasTemplate() throws IOException {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
boolean has = true;
List<JsonTemplateField> jsonTemplateFieldsString =
new ArrayList<>(Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"),
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
index f7774214c..b5b0247c8 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
@@ -33,7 +33,7 @@ import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataExecutor;
import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.service.Service;
import org.onap.clamp.tosca.Dictionary;
import org.onap.clamp.tosca.DictionaryElement;
@@ -110,16 +110,16 @@ public class ToscaConverterWithDictionarySupportItCase {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil
+ ResourceFileUtils
.getResourceAsString("tosca/new-converter/tosca_metadata_clamp_possible_values.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
"onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport, null);
JSONAssert.assertEquals(
- ResourceFileUtil
+ ResourceFileUtils
.getResourceAsString("tosca/new-converter/tca-with-metadata.json"),
JsonUtils.GSON.toJson(jsonSchema), true);
}
@@ -127,21 +127,21 @@ public class ToscaConverterWithDictionarySupportItCase {
@Test
@Transactional
public final void testMetadataClampPossibleValueWithExecutor() throws IOException, UnknownComponentException {
- Service service = new Service(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
- ResourceFileUtil.getResourceAsString("tosca/resource-details-cds.json"));
+ Service service = new Service(ResourceFileUtils.getResourceAsString("tosca/service-details.json"),
+ ResourceFileUtils.getResourceAsString("tosca/resource-details-cds.json"));
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ ".policies.controlloop.operational.common.Apex/versions/1.0"
+ ".0&#63;connectionTimeToLive=5000/.file"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
"onap.policies.controlloop.operational.common.Apex", toscaMetadataParserWithDictionarySupport, service);
JSONAssert.assertEquals(
- ResourceFileUtil
+ ResourceFileUtils
.getResourceAsString("tosca/new-converter/tosca_apex_with_metadata.json"),
JsonUtils.GSON.toJson(jsonSchema), true);
}
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java
index 967f330dc..52f8444ff 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java
@@ -32,7 +32,7 @@ import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
public class ToscaElementPropertyTest extends TestCase {
public ToscaElementPropertyTest() throws IOException {
@@ -45,9 +45,9 @@ public class ToscaElementPropertyTest extends TestCase {
*/
public void testParseArray() throws IOException {
JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor");
JsonArray toTest =
@@ -62,9 +62,9 @@ public class ToscaElementPropertyTest extends TestCase {
*/
public void testAddConstraintsAsJson() throws IOException {
JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
ToscaElement toscaElement =
jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.operation.Failure");
ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("category");
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java
index 5f7de28ae..ba8454bb2 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java
@@ -29,7 +29,7 @@ import java.util.Arrays;
import junit.framework.TestCase;
import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
public class ToscaElementTest extends TestCase {
@@ -42,9 +42,9 @@ public class ToscaElementTest extends TestCase {
ArrayList<String> reference = new ArrayList<>(Arrays.asList("actor", "operation", "target", "payload"));
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+ ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
assertEquals(reference, toscaElement.propertiesNames());
}
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 926ed66b6..bc2ec2122 100644
--- a/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
@@ -72,6 +72,6 @@ public class JsonUtilsTest {
@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionFileNotExists() throws IOException {
- ResourceFileUtil.getResourceAsString("example/notExist.json");
+ ResourceFileUtils.getResourceAsString("example/notExist.json");
}
}
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index 1c33d5e05..86bc8c07e 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -35,6 +35,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.transaction.Transactional;
+
import org.apache.commons.lang3.RandomStringUtils;
import org.json.JSONException;
import org.junit.Assert;
@@ -49,7 +50,7 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerExceptio
import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.cds.CdsDataInstaller;
import org.onap.clamp.loop.service.ServicesRepository;
import org.onap.clamp.loop.template.LoopTemplate;
@@ -74,7 +75,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-@ActiveProfiles({"clamp-default","clamp-default-user","clamp-sdc-controller","legacy-operational-policy"})
+@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller", "legacy-operational-policy"})
public class CsarInstallerItCase {
private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
@@ -106,7 +107,7 @@ public class CsarInstallerItCase {
Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid);
BlueprintArtifact blueprintArtifact = Mockito.mock(BlueprintArtifact.class);
Mockito.when(blueprintArtifact.getDcaeBlueprint())
- .thenReturn(ResourceFileUtil.getResourceAsString(blueprintFilePath));
+ .thenReturn(ResourceFileUtils.getResourceAsString(blueprintFilePath));
Mockito.when(blueprintArtifact.getBlueprintArtifactName()).thenReturn(artifactName);
Mockito.when(blueprintArtifact.getBlueprintInvariantServiceUuid()).thenReturn(invariantServiceUuid);
Mockito.when(blueprintArtifact.getResourceAttached()).thenReturn(resource);
@@ -159,7 +160,7 @@ public class CsarInstallerItCase {
// Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper);
Mockito.when(csarHandler.getPolicyModelYaml())
- .thenReturn(Optional.ofNullable(ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml")));
+ .thenReturn(Optional.ofNullable(ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml")));
return csarHandler;
}
@@ -182,9 +183,10 @@ public class CsarInstallerItCase {
CsarHandler csarHandler = new CsarHandler(notificationData, "", "");
csarHandler
- .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).getFile());
+ .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).
+ getFile());
Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional
- .ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
+ .ofNullable(ResourceFileUtils.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
}
@Test
@@ -235,11 +237,11 @@ public class CsarInstallerItCase {
"1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml")).get();
assertThat(loopTemplate.getLoopElementModelsUsed()).hasSize(1);
assertThat(loopTemplate.getModelService().getServiceUuid()).isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0");
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"),
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"),
JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService()), true);
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/service-details.json"),
JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getServiceDetails()), true);
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/resource-details.json"),
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/resource-details.json"),
JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getResourceDetails()), true);
assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
.getLoopElementModel().getName()).isNotEmpty();
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 6827bf5f4..1d6940f83 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -35,7 +35,7 @@ import java.io.IOException;
import java.util.Random;
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.log.LogType;
import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.loop.service.Service;
@@ -111,7 +111,7 @@ public class LoopToJsonTest {
Loop loopTest = getLoop("ControlLoopTest", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
OperationalPolicy opPolicy = this.getOperationalPolicy(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
+ ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
loopTest.addOperationalPolicy(opPolicy);
MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
"{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
@@ -156,7 +156,7 @@ public class LoopToJsonTest {
"123456789", "https://dcaetest.org", "UUID-blueprint");
JsonObject jsonModel = new GsonBuilder().create()
- .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
+ .fromJson(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
jsonModel.get("resourceDetails").getAsJsonObject(), "1.0");
loopTest2.setModelService(service);
diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
index 02135933e..6a646e3e1 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
@@ -32,7 +32,7 @@ import org.apache.camel.Message;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.clamp.clds.config.LegacyOperationalPolicyController;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.components.external.ExternalComponentState;
import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.template.LoopTemplate;
@@ -290,7 +290,7 @@ public class PolicyComponentTest {
loopTest.setLoopTemplate(loopTemplate);
String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest, "POST");
- String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json");
+ String expectedRes = ResourceFileUtils.getResourceAsString("tosca/pdp-group-policy-payload.json");
assertThat(payload).isEqualTo(expectedRes);
}
diff --git a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
index b16aa558d..6f6cad815 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
@@ -37,7 +37,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.loop.template.PolicyModelId;
import org.onap.clamp.loop.template.PolicyModelsRepository;
@@ -125,7 +125,7 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldCreatePolicyModelFromTosca() throws IOException {
String toscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca_with_metadata.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel);
@@ -143,10 +143,10 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldUpdatePolicyModel() throws IOException {
String toscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca_with_metadata.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
String newToscaModelYaml =
- ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
PolicyModel updatedPolicyModel = policyModelsService.updatePolicyModelTosca(
policyModel.getPolicyModelType(), policyModel.getVersion(), newToscaModelYaml);
diff --git a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java b/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
index 2b3b48255..8a5b5876f 100644
--- a/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
+++ b/src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
@@ -33,7 +33,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.Loop;
import org.onap.clamp.loop.template.LoopElementModel;
import org.onap.clamp.loop.template.LoopTemplate;
@@ -56,7 +56,7 @@ public class BlueprintInputParametersTest {
Mockito.when(umService1.getName()).thenReturn("testName1");
LoopElementModel loopElement = Mockito.mock(LoopElementModel.class);
- String blueprint1 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
+ String blueprint1 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
Mockito.when(loopElement.getBlueprint()).thenReturn(blueprint1);
Mockito.when(umService1.getLoopElementModel()).thenReturn(loopElement);
@@ -64,7 +64,7 @@ public class BlueprintInputParametersTest {
Mockito.when(umService2.getName()).thenReturn("testName2");
LoopElementModel loopElement2 = Mockito.mock(LoopElementModel.class);
- String blueprint2 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca_2.yaml");
+ String blueprint2 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca_2.yaml");
Mockito.when(loopElement2.getBlueprint()).thenReturn(blueprint2);
Mockito.when(umService2.getLoopElementModel()).thenReturn(loopElement2);
@@ -72,7 +72,7 @@ public class BlueprintInputParametersTest {
Mockito.when(umService3.getName()).thenReturn("testName3");
LoopElementModel loopElement3 = Mockito.mock(LoopElementModel.class);
- String blueprint3 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca_3.yaml");
+ String blueprint3 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca_3.yaml");
Mockito.when(loopElement3.getBlueprint()).thenReturn(blueprint3);
Mockito.when(umService3.getLoopElementModel()).thenReturn(loopElement3);
@@ -90,7 +90,7 @@ public class BlueprintInputParametersTest {
JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
- ResourceFileUtil.getResourceAsString(
+ ResourceFileUtils.getResourceAsString(
"example/sdc/expected-result/deployment-parameters-multi-blueprints.json"));
}
@@ -112,14 +112,14 @@ public class BlueprintInputParametersTest {
LoopTemplate template = Mockito.mock(LoopTemplate.class);
Mockito.when(template.getUniqueBlueprint()).thenReturn(true);
- String blueprint = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
+ String blueprint = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
Mockito.when(template.getBlueprint()).thenReturn(blueprint);
Mockito.when(loop.getLoopTemplate()).thenReturn(template);
JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
- ResourceFileUtil.getResourceAsString(
+ ResourceFileUtils.getResourceAsString(
"example/sdc/expected-result/deployment-parameters-single-blueprint.json"));
}
}
diff --git a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
index 01e2184a7..0bfb6ece0 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
@@ -27,7 +27,7 @@ import com.google.gson.JsonObject;
import java.io.IOException;
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.template.PolicyModel;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -37,10 +37,10 @@ public class MicroServicePayloadTest {
public void testPayloadConstruction() throws IOException {
MicroServicePolicy policy = new MicroServicePolicy("testPolicy", new PolicyModel(
"onap.policies.monitoring.cdap.tca.hi.lo.app",
- ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null);
+ ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null);
policy.setConfigurationsJson(JsonUtils.GSON.fromJson(
- ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class));
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-payload.json"),
+ ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class));
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-payload.json"),
policy.createPolicyPayload(), false);
}
}
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index cef82e501..36f000720 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -28,35 +28,34 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import java.io.IOException;
-import java.util.Map;
+
import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
-import org.skyscreamer.jsonassert.JSONAssert;
public class OperationalPolicyPayloadTest {
@Test
public void testOperationalPolicyLegacyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+ ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", jsonConfig, null,
new PolicyModel("onap.policies.controlloop.Operational.legacy", "", "1.0.0", "test"), null, null, null);
assertThat(policy.createPolicyPayloadYaml())
- .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
+ .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.yaml"));
assertThat(policy.createPolicyPayload())
- .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.json"));
+ .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.json"));
}
@Test
public void testLegacyOperationalPolicyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+ ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
assertThat(LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(jsonConfig.get("operational_policy")))
- .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
+ .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
}
}
diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
index 4f728b44a..322548bb4 100644
--- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
+++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
@@ -29,7 +29,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import java.io.IOException;
import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.service.Service;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -37,7 +37,7 @@ public class OperationalPolicyRepresentationBuilderTest {
@Test
public void testOperationalPolicyPayloadConstruction() throws IOException {
- JsonObject jsonModel = new GsonBuilder().create().fromJson(ResourceFileUtil
+ JsonObject jsonModel = new GsonBuilder().create().fromJson(ResourceFileUtils
.getResourceAsString("tosca/model-properties-operational-policy.json"), JsonObject.class);
Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
jsonModel.get("resourceDetails").getAsJsonObject(), "1.0");
@@ -46,14 +46,14 @@ public class OperationalPolicyRepresentationBuilderTest {
assertThat(jsonSchema).isNotNull();
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-json-schema.json"),
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/operational-policy-json-schema.json"),
new GsonBuilder().create().toJson(jsonSchema), false);
}
@Test
public void testOperationalPolicyPayloadConstructionForCds() throws IOException {
JsonObject jsonModel = new GsonBuilder().create()
- .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
+ .fromJson(ResourceFileUtils.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
jsonModel.get("resourceDetails").getAsJsonObject(),
"1.0");
@@ -61,7 +61,7 @@ public class OperationalPolicyRepresentationBuilderTest {
JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service);
assertThat(jsonSchema).isNotNull();
JSONAssert.assertEquals(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
+ ResourceFileUtils.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
new GsonBuilder().create().toJson(jsonSchema), false);
}
}