aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-07-19 12:04:46 +0100
committeradheli.tavares <adheli.tavares@est.tech>2024-07-19 12:05:20 +0100
commit9133dabc8566458899d39a7223fcc9c43788febd (patch)
tree509cc81d37da3e31bb606383f4b21d68747899c6
parentc295ebcf3e6c15510e9c0d9a1ae1dd206b403d73 (diff)
Uplift json schema validator library
Issue-ID: POLICY-5084 Change-Id: I426cd992895d4ce4b840ac1ab479152f954cceaf Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java14
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java32
-rw-r--r--policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java44
-rw-r--r--policy-utils/pom.xml6
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java28
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java39
-rw-r--r--pom.xml3
7 files changed, 66 insertions, 100 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
index 6740700a..a4abdf37 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021,2023 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 2023-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
package org.onap.policy.drools.server.restful;
-import com.worldturner.medeia.api.ValidationFailedException;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
@@ -365,14 +364,13 @@ public class RestLifecycleManager implements LifecycleApi {
return Response.status(Response.Status.NOT_ACCEPTABLE).build();
}
- try {
- LifecycleFeature.getFsm().getDomainMaker().conformance(toscaPolicy);
- } catch (ValidationFailedException v) {
- logger.trace("policy {} validation errors: {}", toscaPolicy, v.getMessage(), v);
- return Response.status(Response.Status.NOT_ACCEPTABLE).entity(v.getFailures()).build();
+ var isOk = LifecycleFeature.getFsm().getDomainMaker().conformance(toscaPolicy);
+ if (isOk) {
+ return Response.status(Response.Status.OK).entity(Collections.emptyList()).build();
+ } else {
+ return Response.status(Response.Status.NOT_ACCEPTABLE).entity(Collections.emptyList()).build();
}
- return Response.status(Response.Status.OK).entity(Collections.emptyList()).build();
}
private Response deployUndeployOperation(String policy, boolean deploy) {
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
index 23d3e24a..fcf946e4 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
@@ -75,10 +75,6 @@ public class RestLifecycleManagerTest {
private static final String EXAMPLE_NATIVE_ARTIFACT_POLICY_JSON =
"src/test/resources/tosca-policy-native-artifact-example.json";
- private static final String EXAMPLE_OTHER_UNVAL_POLICY_NAME = "other-unvalidated";
- private static final String EXAMPLE_OTHER_UNVAL_POLICY_JSON =
- "src/test/resources/tosca-policy-other-unvalidated.json";
-
private static final String EXAMPLE_OTHER_VAL_POLICY_NAME = "other-validated";
private static final String EXAMPLE_OTHER_VAL_POLICY_JSON =
"src/test/resources/tosca-policy-other-validated.json";
@@ -257,10 +253,6 @@ public class RestLifecycleManagerTest {
}
testNotNativePolicy(opPolicy);
- /* add tosca policy "other-unvalidated" of policy type "type1.type2" with no attached type schema */
-
- testNotNativePolicy(getPolicyFromFile(EXAMPLE_OTHER_UNVAL_POLICY_JSON, EXAMPLE_OTHER_UNVAL_POLICY_NAME));
-
/* add tosca policy "other-validated" of policy type "typeA" with an attached type schema */
testNotNativePolicy(getPolicyFromFile(EXAMPLE_OTHER_VAL_POLICY_JSON, EXAMPLE_OTHER_VAL_POLICY_NAME));
@@ -269,9 +261,7 @@ public class RestLifecycleManagerTest {
ToscaPolicy toscaPolicyValError =
getPolicyFromFile(EXAMPLE_OTHER_VAL_ERROR_POLICY_JSON, EXAMPLE_OTHER_VAL_ERROR_POLICY_NAME);
- assertThat(
- listPost(toString(toscaPolicyValError),
- Status.NOT_ACCEPTABLE.getStatusCode())).isNotEmpty();
+ assertThat(listPost(toString(toscaPolicyValError), Status.NOT_ACCEPTABLE.getStatusCode())).isEmpty();
booleanPost("policies", toString(toscaPolicyValError),
Status.NOT_ACCEPTABLE.getStatusCode(), Boolean.FALSE);
@@ -303,7 +293,7 @@ public class RestLifecycleManagerTest {
/* delete native artifact policy */
- booleanDelete("policies/example.artifact/1.0.0", Status.OK.getStatusCode(), Boolean.TRUE);
+ booleanDelete("policies/example.artifact/1.0.0", Status.OK.getStatusCode());
assertTrue(PolicyControllerConstants.getFactory().get("lifecycle").isAlive());
assertFalse(PolicyControllerConstants.getFactory().get("lifecycle").getDrools().isBrained());
@@ -321,7 +311,7 @@ public class RestLifecycleManagerTest {
/* delete native controller policy */
- booleanDelete("policies/example.controller/1.0.0", Status.OK.getStatusCode(), Boolean.TRUE);
+ booleanDelete("policies/example.controller/1.0.0", Status.OK.getStatusCode());
resourceLists("policyTypes", 2);
get("policyTypes/onap.policies.native.drools.Artifact/1.0.0", Status.OK.getStatusCode());
@@ -337,9 +327,7 @@ public class RestLifecycleManagerTest {
assertThatIllegalArgumentException().isThrownBy(() -> PolicyControllerConstants.getFactory().get("lifecycle"));
opPolicy.getMetadata().remove("policy-id");
- assertThat(
- listPost(toString(opPolicy),
- Status.NOT_ACCEPTABLE.getStatusCode())).isNotEmpty();
+ assertThat(listPost(toString(opPolicy), Status.NOT_ACCEPTABLE.getStatusCode())).isEmpty();
metrics();
}
@@ -362,7 +350,7 @@ public class RestLifecycleManagerTest {
get("policies/example.artifact/1.0.0", Status.OK.getStatusCode());
booleanDelete("policies/" + toscaPolicy.getName() + "/" + toscaPolicy.getVersion(),
- Status.OK.getStatusCode(), Boolean.TRUE);
+ Status.OK.getStatusCode());
assertEquals(0,
PolicyControllerConstants
.getFactory().get("lifecycle").getDrools().facts("junits", ToscaPolicy.class).size());
@@ -400,9 +388,9 @@ public class RestLifecycleManagerTest {
booleanResponse(response, statusCode, bool);
}
- private void booleanDelete(String contextPath, int statusCode, Boolean bool) {
+ private void booleanDelete(String contextPath, int statusCode) {
Response response = client.delete(contextPath, Collections.emptyMap());
- booleanResponse(response, statusCode, bool);
+ booleanResponse(response, statusCode, Boolean.TRUE);
}
private void resourceLists(String resource, int size) {
@@ -462,9 +450,9 @@ public class RestLifecycleManagerTest {
}
private LifecycleFsm newFsmInstance() throws NoSuchFieldException, IllegalAccessException {
- LifecycleFsm fsm = new LifecycleFsm();
- ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", fsm);
- return fsm;
+ LifecycleFsm lifecycleFsm = new LifecycleFsm();
+ ControllerSupport.setStaticField(LifecycleFeature.class, "fsm", lifecycleFsm);
+ return lifecycleFsm;
}
protected ToscaPolicy getPolicyFromFile(String filePath, String policyName) throws CoderException, IOException {
diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java
index 3d1e8490..dc6212b3 100644
--- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java
+++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java
@@ -26,7 +26,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import com.worldturner.medeia.api.ValidationFailedException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -53,12 +52,12 @@ class DomainPolicyTypesTest {
// Native Drools Policy
private static final String EXAMPLE_NATIVE_DROOLS_POLICY_NAME = "example";
private static final String EXAMPLE_NATIVE_DROOLS_POLICY_JSON =
- "src/test/resources/tosca-policy-native-artifact-example.json";
+ "src/test/resources/tosca-policy-native-artifact-example.json";
// Controller Drools Policy
private static final String EXAMPLE_CONTROLLER_DROOLS_POLICY_NAME = "example";
private static final String EXAMPLE_CONTROLLER_DROOLS_POLICY_JSON =
- "src/test/resources/tosca-policy-native-controller-example.json";
+ "src/test/resources/tosca-policy-native-controller-example.json";
private DomainMaker domainMaker;
private StandardCoder nonValCoder;
@@ -71,8 +70,7 @@ class DomainPolicyTypesTest {
@Test
void testToscaNativeDroolsPolicy() throws CoderException, IOException {
- String rawNativeDroolsPolicy =
- getPolicyFromFileString();
+ String rawNativeDroolsPolicy = getPolicyFromFileString();
ToscaPolicy toscaPolicy =
getExamplesPolicy(EXAMPLE_NATIVE_DROOLS_POLICY_JSON, EXAMPLE_NATIVE_DROOLS_POLICY_NAME);
@@ -88,7 +86,7 @@ class DomainPolicyTypesTest {
String policyId = "" + toscaPolicy.getMetadata().remove("policy-id");
assertThatThrownBy(() -> domainMaker.convertTo(toscaPolicy, NativeArtifactPolicy.class))
- .isInstanceOf(CoderException.class).hasCauseInstanceOf(ValidationFailedException.class);
+ .isInstanceOf(CoderException.class);
toscaPolicy.getMetadata().put("policy-id", policyId);
@@ -97,9 +95,7 @@ class DomainPolicyTypesTest {
domainDroolsPolicy.setName("");
assertFalse(domainMaker.isDomainConformant(policyTypeId, domainDroolsPolicy));
- assertThatThrownBy(() -> domainMaker.conformance(policyTypeId, domainDroolsPolicy))
- .isInstanceOf(ValidationFailedException.class)
- .hasMessageContaining("Pattern ^(.+)$ is not contained in text");
+ assertFalse(domainMaker.conformance(policyTypeId, domainDroolsPolicy));
// @formatter:off
NativeArtifactPolicy domainDroolsPolicy2 =
@@ -115,16 +111,14 @@ class DomainPolicyTypesTest {
.typeVersion("1.0.0").build();
// @formatter:on
- assertTrue(domainMaker
- .isDomainConformant(
- new ToscaConceptIdentifier(domainDroolsPolicy2.getType(), domainDroolsPolicy2.getTypeVersion()),
- domainDroolsPolicy2));
+ var toscaId = new ToscaConceptIdentifier(domainDroolsPolicy2.getType(), domainDroolsPolicy2.getTypeVersion());
+ assertTrue(domainMaker.isDomainConformant(toscaId, domainDroolsPolicy2));
}
@Test
void testToscaControllerPolicy() throws CoderException {
ToscaPolicy toscaPolicy =
- getExamplesPolicy(EXAMPLE_CONTROLLER_DROOLS_POLICY_JSON, EXAMPLE_CONTROLLER_DROOLS_POLICY_NAME);
+ getExamplesPolicy(EXAMPLE_CONTROLLER_DROOLS_POLICY_JSON, EXAMPLE_CONTROLLER_DROOLS_POLICY_NAME);
assertTrue(domainMaker.isConformant(toscaPolicy));
ControllerPolicy controllerPolicy = domainMaker.convertTo(toscaPolicy, ControllerPolicy.class);
@@ -139,24 +133,24 @@ class DomainPolicyTypesTest {
assertEquals("org.onap.policy.controlloop.CanonicalOnset",
controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0).getEventClass());
assertEquals("[?($.closedLoopEventStatus == 'ONSET')]",
- controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0).getEventFilter());
+ controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0).getEventFilter());
assertEquals("org.onap.policy.controlloop.util.Serialization",
- controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0)
- .getCustomSerialization().getCustomSerializerClass());
+ controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0)
+ .getCustomSerialization().getCustomSerializerClass());
assertEquals("gson",
- controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0)
- .getCustomSerialization().getJsonParser());
+ controllerPolicy.getProperties().getSourceTopics().get(0).getEvents().get(0)
+ .getCustomSerialization().getJsonParser());
assertEquals("appc-cl", controllerPolicy.getProperties().getSinkTopics().get(0).getTopicName());
assertEquals("org.onap.policy.appc.Response",
- controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0).getEventClass());
+ controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0).getEventClass());
assertEquals("[?($.CommonHeader && $.Status)]",
- controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0).getEventFilter());
+ controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0).getEventFilter());
assertEquals("org.onap.policy.appc.util.Serialization",
- controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0)
- .getCustomSerialization().getCustomSerializerClass());
+ controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0)
+ .getCustomSerialization().getCustomSerializerClass());
assertEquals("gsonPretty",
- controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0)
- .getCustomSerialization().getJsonParser());
+ controllerPolicy.getProperties().getSinkTopics().get(0).getEvents().get(0)
+ .getCustomSerialization().getJsonParser());
assertEquals("value1", controllerPolicy.getProperties().getCustomConfig().get("field1"));
}
diff --git a/policy-utils/pom.xml b/policy-utils/pom.xml
index eb821b84..048c8c26 100644
--- a/policy-utils/pom.xml
+++ b/policy-utils/pom.xml
@@ -4,7 +4,7 @@
ONAP Policy Engine - Drools PDP
================================================================================
Copyright (C) 2017, 2019-2021 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2023 Nordix Foundation.
+ Modifications Copyright (C) 2023-2024 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -67,8 +67,8 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
- <groupId>com.worldturner.medeia</groupId>
- <artifactId>medeia-validator-core</artifactId>
+ <groupId>com.networknt</groupId>
+ <artifactId>json-schema-validator</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java b/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
index 6266f171..506b0977 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/policies/DomainMaker.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
package org.onap.policy.drools.policies;
-import com.worldturner.medeia.api.ValidationFailedException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import lombok.NoArgsConstructor;
@@ -120,11 +119,8 @@ public class DomainMaker {
try {
validators.get(policy.getTypeIdentifier()).conformance(rawPolicy);
} catch (CoderException e) {
- logger.info("policy {}:{}:{} is not conformant",
- policy.getTypeIdentifier(), policy.getName(), policy.getVersion(), e);
- if (e.getCause() instanceof ValidationFailedException) {
- throw (ValidationFailedException) e.getCause();
- }
+ logger.error("policy {}:{}:{} is not conformant",
+ policy.getTypeIdentifier(), policy.getName(), policy.getVersion(), e);
return false;
}
@@ -144,10 +140,7 @@ public class DomainMaker {
try {
validators.get(policyType).encode(domainPolicy);
} catch (CoderException e) {
- logger.info("policy {}:{} is not conformant", policyType, domainPolicy.getClass().getName(), e);
- if (e.getCause() instanceof ValidationFailedException) {
- throw (ValidationFailedException) e.getCause();
- }
+ logger.error("policy {}:{} is not conformant", policyType, domainPolicy.getClass().getName(), e);
return false;
}
@@ -162,11 +155,10 @@ public class DomainMaker {
// A known schema is one that embedded in a .jar in the classpath as a resource
// matching the following syntax: <policy-type-name>-<policy-type-version>.schema.json.
//
- var schema =
- ResourceUtils
- .getResourceAsString("schemas/"
- + policyType.getName() + "-" + policyType.getVersion() + ".schema.json");
+ var schemaPath = "schemas/" + policyType.getName() + "-" + policyType.getVersion() + ".schema.json";
+ var schema = ResourceUtils.getResourceAsString(schemaPath);
if (schema == null) {
+ logger.error("Couldn't find a matching schema for type {}", policyType);
return false;
}
@@ -178,9 +170,9 @@ public class DomainMaker {
*/
public boolean registerValidator(@NonNull ToscaConceptIdentifier policyType, @NonNull String schema) {
try {
- validators.put(policyType, new StandardValCoder(schema, policyType.toString()));
+ validators.put(policyType, new StandardValCoder(schema));
} catch (RuntimeException r) {
- logger.info("schema for {} is not valid", policyType, r);
+ logger.error("schema for {} is not valid", policyType, r);
return false;
}
return true;
@@ -197,7 +189,7 @@ public class DomainMaker {
* Converts a JSON policy into a Domain Policy.
*/
public <T> T convertTo(@NonNull ToscaConceptIdentifier policyType, @NonNull String json, @NonNull Class<T> clazz)
- throws CoderException {
+ throws CoderException {
if (isRegistered(policyType)) {
return validators.get(policyType).decode(json, clazz);
} else {
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
index 5563d5ea..ee32cb2b 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java
@@ -27,7 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import com.worldturner.medeia.api.ValidationFailedException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -48,7 +47,7 @@ class DomainMakerTest {
private DomainMaker domainMaker;
@BeforeEach
- public void setUp() throws Exception {
+ public void setUp() {
domainMaker = new DomainMaker();
}
@@ -77,7 +76,7 @@ class DomainMakerTest {
@Test
void testIsDomainConformant() {
ToscaConceptIdentifier policyTypeId =
- new ToscaConceptIdentifier("policy.type.A", "1.0.0");
+ new ToscaConceptIdentifier("policy.type.A", "1.0.0");
DomainAPolicy domainAPolicy = createDomainPolicy();
@@ -86,7 +85,7 @@ class DomainMakerTest {
// integer exceeding max. value
domainAPolicy.getProperties().getNested().setNested3(999);
assertFalse(domainMaker.isDomainConformant(policyTypeId, domainAPolicy));
- domainAPolicy.getProperties().getNested().setNested3(33); // restore good valude
+ domainAPolicy.getProperties().getNested().setNested3(33); // restore good value
// not registered schema for policy type
policyTypeId.setVersion("2.0.0");
@@ -100,9 +99,7 @@ class DomainMakerTest {
assertTrue(domainMaker.conformance(policy1));
policy1.getProperties().remove("nested");
- assertThatThrownBy(() -> domainMaker.conformance(policy1))
- .isInstanceOf(ValidationFailedException.class)
- .hasMessageContaining("Required property nested is missing from object");
+ assertFalse(domainMaker.conformance(policy1));
DomainAPolicy domainAPolicy = createDomainPolicy();
assertTrue(domainMaker.conformance(policy1.getTypeIdentifier(), domainAPolicy));
@@ -110,15 +107,13 @@ class DomainMakerTest {
domainAPolicy.getProperties().getNested().setNested1("");
ToscaConceptIdentifier ident1 = policy1.getTypeIdentifier();
- assertThatThrownBy(() -> domainMaker.conformance(ident1, domainAPolicy))
- .isInstanceOf(ValidationFailedException.class)
- .hasMessageContaining("Pattern ^(.+)$ is not contained in text");
+ assertFalse(domainMaker.conformance(ident1, domainAPolicy));
}
@Test
void testRegisterValidator() throws IOException, CoderException {
ToscaConceptIdentifier policyTypeId =
- new ToscaConceptIdentifier("policy.type.external", "9.9.9");
+ new ToscaConceptIdentifier("policy.type.external", "9.9.9");
assertTrue(domainMaker.registerValidator(policyTypeId,
getJsonFromFile("src/test/resources/policy.type.external-9.9.9.schema.json")));
@@ -135,11 +130,11 @@ class DomainMakerTest {
@Test
void testConvertToDomainPolicy() throws IOException, CoderException {
DomainAPolicy domainAPolicy =
- domainMaker.convertTo(getToscaPolicy("src/test/resources/policyA.json"), DomainAPolicy.class);
+ domainMaker.convertTo(getToscaPolicy("src/test/resources/policyA.json"), DomainAPolicy.class);
assertDomainPolicy(domainAPolicy);
assertNotNull(domainMaker.convertTo(getToscaPolicy("src/test/resources/policyA-no-policy-type.json"),
- DomainAPolicy.class));
+ DomainAPolicy.class));
}
@Test
@@ -153,11 +148,11 @@ class DomainMakerTest {
@Test
void testIsRegistered() {
ToscaConceptIdentifier policyTypeId1 =
- new ToscaConceptIdentifier("policy.type.A", "1.0.0");
+ new ToscaConceptIdentifier("policy.type.A", "1.0.0");
assertTrue(domainMaker.isRegistered(policyTypeId1));
ToscaConceptIdentifier policyTypeId2 =
- new ToscaConceptIdentifier("policy.type.external", "7.7.9");
+ new ToscaConceptIdentifier("policy.type.external", "7.7.9");
assertFalse(domainMaker.isRegistered(policyTypeId2));
}
@@ -173,13 +168,13 @@ class DomainMakerTest {
private DomainAPolicy createDomainPolicy() {
return DomainAPolicy.builder().metadata(Metadata.builder().policyId("A").build())
- .name("A")
- .version("1.0.0")
- .type("policy.type.A")
- .typeVersion("1.0.0")
- .properties(Properties.builder()
- .nested(Nested.builder().nested1("nested1").nested2(true).nested3(50).build())
- .build()).build();
+ .name("A")
+ .version("1.0.0")
+ .type("policy.type.A")
+ .typeVersion("1.0.0")
+ .properties(Properties.builder()
+ .nested(Nested.builder().nested1("nested1").nested2(true).nested3(50).build())
+ .build()).build();
}
private void assertDomainPolicy(DomainAPolicy domainAPolicy) {
diff --git a/pom.xml b/pom.xml
index 8828a2d1..e80ff124 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,6 @@
<staging.path>content/repositories/staging/</staging.path>
<!-- Project common dependency versions -->
- <json.path.version>2.9.0</json.path.version>
<hibernate.commons.annotations.version>6.0.6.Final</hibernate.commons.annotations.version>
<xml.apis.version>1.4.01</xml.apis.version>
<policy.common.version>3.0.1-SNAPSHOT</policy.common.version>
@@ -133,7 +132,7 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
- <version>${json.path.version}</version>
+ <version>${version.json-path}</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>