summaryrefslogtreecommitdiffstats
path: root/applications
diff options
context:
space:
mode:
Diffstat (limited to 'applications')
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java14
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java4
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java6
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslatorTest.java2
-rw-r--r--applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java11
-rw-r--r--applications/naming/src/test/java/org/onap/policy/xacml/pdp/application/naming/NamingPdpApplicationTest.java8
-rw-r--r--applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java2
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java27
8 files changed, 36 insertions, 38 deletions
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
index fbfde1a4..d3aba91f 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtilsTest.java
@@ -207,12 +207,12 @@ public class XacmlPolicyUtilsTest {
@Test
public void testUncommonConditions() throws IOException {
- File fileTemp = policyFolder.newFile();
+ Path fileTemp = policyFolder.newFile().toPath();
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() ->
- XacmlPolicyUtils.writePolicyFile(fileTemp.toPath(), new String("not a policy"))
+ XacmlPolicyUtils.writePolicyFile(fileTemp, "not a policy")
);
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() ->
- XacmlPolicyUtils.constructUniquePolicyFilename(new String("not a policy"),
+ XacmlPolicyUtils.constructUniquePolicyFilename("not a policy",
policyFolder.getRoot().toPath())
);
}
@@ -313,7 +313,7 @@ public class XacmlPolicyUtilsTest {
// Copy to this folder
//
File copyFolder = policyFolder.newFolder("copy");
- assertThat(copyFolder.exists()).isTrue();
+ assertThat(copyFolder).exists();
//
// Mock up a properties object
//
@@ -332,10 +332,10 @@ public class XacmlPolicyUtilsTest {
File propertiesFile = XacmlPolicyUtils.copyXacmlPropertiesContents(
fileProperties.toAbsolutePath().toString(), mockProperties, myCreator);
- assertThat(propertiesFile.canRead()).isTrue();
+ assertThat(propertiesFile).canRead();
assertThat(Path.of(copyFolder.getAbsolutePath(),
- rootPath.getFileName().toString()).toFile().canRead()).isTrue();
+ rootPath.getFileName().toString()).toFile()).canRead();
assertThat(Path.of(copyFolder.getAbsolutePath(),
- path1.getFileName().toString()).toFile().canRead()).isTrue();
+ path1.getFileName().toString()).toFile()).canRead();
}
}
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java
index cd28bddc..9b489a67 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/matchable/MatchablePolicyTypeTest.java
@@ -187,10 +187,10 @@ public class MatchablePolicyTypeTest implements MatchableCallback {
schema.setType("string");
property.setEntrySchema(schema);
MatchablePropertyTypeMap mapValue = new MatchablePropertyTypeMap(property);
- assertThat(mapValue.validate(new String("foo"))).hasSize(0);
+ assertThat(mapValue.validate("foo")).isEmpty();
MatchablePropertyTypeList listValue = new MatchablePropertyTypeList(property);
- assertThat(listValue.validate(new String("foo"))).hasSize(0);
+ assertThat(listValue.validate("foo")).isEmpty();
}
@Test
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
index 8e692583..b8a1d18a 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
@@ -162,7 +162,7 @@ public class StdBaseTranslatorTest {
assertThat(rule.getObligationExpressions().getObligationExpression().size()).isEqualTo(1);
assertThat(rule.getObligationExpressions().getObligationExpression().get(0)
- .getAttributeAssignmentExpression().size()).isEqualTo(0);
+ .getAttributeAssignmentExpression()).isEmpty();
//
// Should not throw an exception
@@ -184,7 +184,7 @@ public class StdBaseTranslatorTest {
assertNotNull(decision);
assertThat(decision.getPolicies()).isNotNull();
- assertThat(decision.getPolicies().size()).isEqualTo(0);
+ assertThat(decision.getPolicies()).isEmpty();
}
@Test
@@ -218,7 +218,7 @@ public class StdBaseTranslatorTest {
assertNotNull(decision);
assertThat(decision.getPolicies()).isNotNull();
- assertThat(decision.getPolicies().size()).isEqualTo(0);
+ assertThat(decision.getPolicies()).isEmpty();
Obligation badObligation = TestUtilsCommon.createXacmlObligation(
ToscaDictionary.ID_OBLIGATION_REST_BODY.stringValue(),
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslatorTest.java
index 42c13d9e..9f0e0ac9 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslatorTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslatorTest.java
@@ -116,7 +116,7 @@ public class StdCombinedPolicyResultsTranslatorTest {
assertNotNull(decision);
assertThat(decision.getPolicies()).isNotNull();
- assertThat(decision.getPolicies().size()).isEqualTo(1);
+ assertThat(decision.getPolicies()).hasSize(1);
}
@Test
diff --git a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java
index bdb8a343..fd6711d4 100644
--- a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java
+++ b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java
@@ -172,7 +172,7 @@ public class MonitoringPdpApplicationTest {
LOGGER.info("Decision {}", decision);
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies()).hasSize(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
//
// Test the branch for query params, and we have no policy anyway
//
@@ -181,7 +181,7 @@ public class MonitoringPdpApplicationTest {
LOGGER.info("Decision {}", decision);
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies()).hasSize(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
//
// Test the branch for query params, and we have no policy anyway
//
@@ -190,7 +190,7 @@ public class MonitoringPdpApplicationTest {
LOGGER.info("Decision {}", decision);
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies()).hasSize(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
}
@SuppressWarnings("unchecked")
@@ -244,8 +244,7 @@ public class MonitoringPdpApplicationTest {
assertThat(decision.getKey()).isNotNull();
assertThat(decision.getKey().getPolicies()).hasSize(1);
jsonPolicy = (Map<String, Object>) decision.getKey().getPolicies().get("onap.scaleout.tca");
- assertThat(jsonPolicy).isNotNull();
- assertThat(jsonPolicy).doesNotContainKey("properties");
+ assertThat(jsonPolicy).isNotNull().doesNotContainKey("properties");
//
// Don't Ask for abbreviated results
//
@@ -290,7 +289,7 @@ public class MonitoringPdpApplicationTest {
LOGGER.info("Decision {}", decision.getKey());
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies()).hasSize(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
}
}
diff --git a/applications/naming/src/test/java/org/onap/policy/xacml/pdp/application/naming/NamingPdpApplicationTest.java b/applications/naming/src/test/java/org/onap/policy/xacml/pdp/application/naming/NamingPdpApplicationTest.java
index 0077d0b9..85b182cd 100644
--- a/applications/naming/src/test/java/org/onap/policy/xacml/pdp/application/naming/NamingPdpApplicationTest.java
+++ b/applications/naming/src/test/java/org/onap/policy/xacml/pdp/application/naming/NamingPdpApplicationTest.java
@@ -176,7 +176,7 @@ public class NamingPdpApplicationTest {
LOGGER.info("Decision {}", decision.getKey());
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies().size()).isEqualTo(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
}
@Test
@@ -194,7 +194,7 @@ public class NamingPdpApplicationTest {
// There is no default policy
//
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(0);
+ assertThat(response.getPolicies()).isEmpty();
//
// Ask for VNF
//
@@ -204,7 +204,7 @@ public class NamingPdpApplicationTest {
//
response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(1);
+ assertThat(response.getPolicies()).hasSize(1);
//
// Validate it
//
@@ -227,7 +227,7 @@ public class NamingPdpApplicationTest {
LOGGER.info("Decision Returned Policy {}", entrySet.getKey());
assertThat(entrySet.getValue()).isInstanceOf(Map.class);
Map<String, Object> policyContents = (Map<String, Object>) entrySet.getValue();
- assertThat(policyContents.containsKey("properties")).isTrue();
+ assertThat(policyContents).containsKey("properties");
assertThat(policyContents.get("properties")).isInstanceOf(Map.class);
Map<String, Object> policyProperties = (Map<String, Object>) policyContents.get("properties");
diff --git a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
index a11c1b14..f434e80f 100644
--- a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
+++ b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
@@ -220,7 +220,7 @@ public class NativePdpApplicationTest {
assertThat(response).isNotNull();
Decision decision = response.getResults().iterator().next().getDecision();
assertThat(decision).isNotNull();
- assertThat(decision.toString()).isEqualTo(expected);
+ assertThat(decision).hasToString(expected);
LOGGER.info("Xacml response we received {}", DOMResponse.toString(response));
}
} \ No newline at end of file
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
index 8886af21..631a359c 100644
--- a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
@@ -208,7 +208,7 @@ public class OptimizationPdpApplicationTest {
LOGGER.info("Decision {}", decision.getKey());
assertThat(decision.getKey()).isNotNull();
- assertThat(decision.getKey().getPolicies().size()).isEqualTo(0);
+ assertThat(decision.getKey().getPolicies()).isEmpty();
}
/**
@@ -223,15 +223,14 @@ public class OptimizationPdpApplicationTest {
//
List<ToscaPolicy> loadedPolicies = TestUtils.loadPolicies("src/test/resources/test-optimization-policies.yaml",
service);
- assertThat(loadedPolicies).isNotNull();
- assertThat(loadedPolicies).hasSize(14);
+ assertThat(loadedPolicies).isNotNull().hasSize(14);
//
// Ask for a decision for available default policies
//
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(2);
+ assertThat(response.getPolicies()).hasSize(2);
//
// Validate it
//
@@ -255,10 +254,10 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(1);
+ assertThat(response.getPolicies()).hasSize(1);
response.getPolicies().forEach((key, value) -> {
- assertThat(((Map<String, Object>) value).get("type"))
- .isEqualTo(("onap.policies.optimization.resource.HpaPolicy"));
+ assertThat(((Map<String, Object>) value)).containsEntry("type",
+ "onap.policies.optimization.resource.HpaPolicy");
});
//
// Validate it
@@ -285,7 +284,7 @@ public class OptimizationPdpApplicationTest {
//
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(2);
+ assertThat(response.getPolicies()).hasSize(2);
//
// Validate it
//
@@ -308,7 +307,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(3);
+ assertThat(response.getPolicies()).hasSize(3);
//
// Validate it
//
@@ -331,7 +330,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(6);
+ assertThat(response.getPolicies()).hasSize(6);
//
// Validate it
//
@@ -405,7 +404,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(7);
+ assertThat(response.getPolicies()).hasSize(7);
//
// Validate it
//
@@ -428,7 +427,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(1);
+ assertThat(response.getPolicies()).hasSize(1);
//
// Validate it
//
@@ -452,7 +451,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(2);
+ assertThat(response.getPolicies()).hasSize(2);
//
// Validate it
//
@@ -516,7 +515,7 @@ public class OptimizationPdpApplicationTest {
LOGGER.info("Decision Returned Policy {}", entrySet.getKey());
assertThat(entrySet.getValue()).isInstanceOf(Map.class);
Map<String, Object> policyContents = (Map<String, Object>) entrySet.getValue();
- assertThat(policyContents.containsKey("properties")).isTrue();
+ assertThat(policyContents).containsKey("properties");
assertThat(policyContents.get("properties")).isInstanceOf(Map.class);
Map<String, Object> policyProperties = (Map<String, Object>) policyContents.get("properties");