summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2024-07-17 09:12:52 +0100
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>2024-09-18 09:27:05 +0100
commit683a4a788de041d390d57c5a8f71c4d83fff8820 (patch)
tree4ee82966876ac62e37cf5f83e8475370733a7060 /model
parent827a10e2abc1a0967cd215988de63c94a83d6e64 (diff)
Apex pdp code improvements
Fix compilation issues in windows Replace Acm policy with kafka coverage improvements Issue-ID: POLICY-5059 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: Idfac722cce2d1a2fa471e8c77286006bd883e9a7
Diffstat (limited to 'model')
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java12
-rw-r--r--model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java16
4 files changed, 36 insertions, 16 deletions
diff --git a/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
index 8c1f756c1..b5028273c 100644
--- a/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java
@@ -54,7 +54,7 @@ class SupportApexBasicModelTest {
@Test
void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
- var expectedResult = ResourceUtils.getResourceAsString(VALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(VALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -67,21 +67,21 @@ class SupportApexBasicModelTest {
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- var expectedResult = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -89,4 +89,8 @@ class SupportApexBasicModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java b/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
index a9cb16914..31083d4c4 100644
--- a/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
@@ -68,28 +68,28 @@ class ApexContextModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- var expectedResult = ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- var expectedResult = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expectedResult, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- var expectedResult = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expectedResult = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expectedResult, result.toString());
}
@@ -97,4 +97,8 @@ class ApexContextModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
index df1857c82..bb50fb35e 100644
--- a/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
@@ -64,28 +64,28 @@ class ApexEventModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- String expected = ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- String expected = ResourceUtils.getResourceAsString(WARNING_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- String expected = ResourceUtils.getResourceAsString(INVALID_MODEL_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
assertEquals(expected, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- String expected = ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING);
+ var expected = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
assertEquals(expected, result.toString());
}
@@ -93,4 +93,8 @@ class ApexEventModelTest {
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}
diff --git a/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
index 01f7062e1..c943befd5 100644
--- a/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
+++ b/model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
@@ -61,29 +61,37 @@ class ApexPolicyModelTest {
@Test
void testApexModelValidateObservation() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateObservation();
- assertEquals(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(OBSERVATION_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testApexModelValidateWarning() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateWarning();
- assertEquals(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(WARNING_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelValidateInvalidModel() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateInvalidModel();
- assertEquals(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelValidateMalstructured() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValidateMalstructured();
- assertEquals(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING), result.toString());
+ var expectedOutput = normalizeNewlines(ResourceUtils.getResourceAsString(INVALID_MODEL_MALSTRUCTURED_STRING));
+ assertEquals(expectedOutput, result.toString());
}
@Test
void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+
+ private String normalizeNewlines(String input) {
+ return input.replace("\r\n", "\n");
+ }
}