summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-16 19:29:00 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-16 19:29:00 +0000
commitf116f388adff2971f802035ca96415032b5fc5fd (patch)
tree10f3e063d43d79d49924fd5dd140c1b388ad36f8
parent06afc161b8d6cd7fba59d49f73a31565809f5859 (diff)
parent96e93d0c2642717ed5b37dcc2721ee2755141e76 (diff)
Merge "Consistent returns on Service Template gets"
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java72
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java37
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java22
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java63
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java15
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java69
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java18
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java8
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java33
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java10
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java31
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java67
-rw-r--r--models-provider/src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml421
13 files changed, 700 insertions, 166 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
index 949cb96dc..1c1e4613e 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java
@@ -30,6 +30,7 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
+import java.util.function.Function;
import javax.persistence.CascadeType;
import javax.persistence.EmbeddedId;
@@ -45,6 +46,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
+import org.apache.commons.lang3.StringUtils;
import org.onap.policy.models.base.PfValidationResult.ValidationResult;
// @formatter:off
@@ -67,7 +69,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@EqualsAndHashCode(callSuper = false)
public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> extends PfConcept
- implements PfConceptGetter<C>, PfAuthorative<List<Map<String, A>>> {
+ implements PfConceptGetter<C>, PfAuthorative<List<Map<String, A>>> {
private static final long serialVersionUID = -324211738823208318L;
@EmbeddedId
@@ -178,31 +180,32 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
for (Map<String, A> incomingConceptMap : authorativeList) {
// Add the map entries one by one
for (Entry<String, A> incomingConceptEntry : incomingConceptMap.entrySet()) {
- C jpaConcept = getConceptNewInstance();
+ PfConceptKey conceptKey = new PfConceptKey();
+ if (incomingConceptEntry.getKey().matches(PfKey.KEY_ID_REGEXP)) {
+ conceptKey = new PfConceptKey(incomingConceptEntry.getKey());
+ } else {
+ conceptKey.setName(incomingConceptEntry.getKey());
+ if (incomingConceptEntry.getValue().getVersion() != null) {
+ conceptKey.setVersion(incomingConceptEntry.getValue().getVersion());
+ } else {
+ conceptKey.setVersion(PfKey.NULL_KEY_VERSION);
+ }
+ }
+
+ incomingConceptEntry.getValue().setName(findConceptField(conceptKey, conceptKey.getName(),
+ incomingConceptEntry.getValue(), PfNameVersion::getName));
+ incomingConceptEntry.getValue().setVersion(findConceptField(conceptKey, conceptKey.getVersion(),
+ incomingConceptEntry.getValue(), PfNameVersion::getVersion));
+
+ C jpaConcept = getConceptNewInstance();
// This cast allows us to call the fromAuthorative method
@SuppressWarnings("unchecked")
PfAuthorative<A> authoritiveImpl = (PfAuthorative<A>) jpaConcept;
- if (incomingConceptEntry.getValue().getName() == null) {
- incomingConceptEntry.getValue().setName(incomingConceptEntry.getKey());
- }
-
// Set the key name and the rest of the values on the concept
authoritiveImpl.fromAuthorative(incomingConceptEntry.getValue());
- // This cast gets the key of the concept
- PfConceptKey conceptKey = (PfConceptKey) jpaConcept.getKey();
-
- // Set the concept key of the concept
- conceptKey.setName(incomingConceptEntry.getValue().getName());
-
- if (incomingConceptEntry.getValue().getVersion() != null) {
- conceptKey.setVersion(incomingConceptEntry.getValue().getVersion());
- } else {
- conceptKey.setVersion(PfKey.NULL_KEY_VERSION);
- }
-
// After all that, save the map entry
conceptMap.put(conceptKey, jpaConcept);
}
@@ -210,7 +213,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
if (conceptMap.isEmpty()) {
throw new PfModelRuntimeException(Response.Status.BAD_REQUEST,
- "An incoming list of concepts must have at least one entry");
+ "An incoming list of concepts must have at least one entry");
}
}
@@ -229,7 +232,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
if (key.equals(PfConceptKey.getNullKey())) {
result.addValidationMessage(
- new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
}
result = key.validate(result);
@@ -253,14 +256,14 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
for (final Entry<PfConceptKey, C> conceptEntry : conceptMap.entrySet()) {
if (conceptEntry.getKey().equals(PfConceptKey.getNullKey())) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on concept entry " + conceptEntry.getKey() + " may not be the null key"));
+ "key on concept entry " + conceptEntry.getKey() + " may not be the null key"));
} else if (conceptEntry.getValue() == null) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on concept entry " + conceptEntry.getKey() + " may not be null"));
+ "value on concept entry " + conceptEntry.getKey() + " may not be null"));
} else if (!conceptEntry.getKey().equals(conceptEntry.getValue().getKey())) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on concept entry key " + conceptEntry.getKey() + " does not equal concept value key "
- + conceptEntry.getValue().getKey()));
+ "key on concept entry key " + conceptEntry.getKey() + " does not equal concept value key "
+ + conceptEntry.getValue().getKey()));
result = conceptEntry.getValue().validate(result);
} else {
result = conceptEntry.getValue().validate(result);
@@ -308,7 +311,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
@Override
public C get(final String conceptKeyName, final String conceptKeyVersion) {
return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).get(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
@Override
@@ -319,7 +322,7 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
@Override
public Set<C> getAll(final String conceptKeyName, final String conceptKeyVersion) {
return new PfConceptGetterImpl<>((NavigableMap<PfConceptKey, C>) conceptMap).getAll(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
/**
@@ -331,11 +334,24 @@ public class PfConceptContainer<C extends PfConcept, A extends PfNameVersion> ex
private C getConceptNewInstance() {
try {
String conceptClassName =
- ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0].getTypeName();
+ ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0].getTypeName();
return (C) Class.forName(conceptClassName).getDeclaredConstructor().newInstance();
} catch (Exception ex) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
- "failed to instantiate instance of container concept class", ex);
+ "failed to instantiate instance of container concept class", ex);
+ }
+ }
+
+ private String findConceptField(final PfConceptKey conceptKey, final String keyFieldValue,
+ final PfNameVersion concept, final Function<PfNameVersion, String> fieldGetterFunction) {
+
+ String conceptField = fieldGetterFunction.apply(concept);
+
+ if (StringUtils.isBlank(conceptField) || keyFieldValue.equals(conceptField)) {
+ return keyFieldValue;
+ } else {
+ throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Key " + conceptKey.getId() + " field "
+ + keyFieldValue + " does not match the value " + conceptField + " in the concept field");
}
}
}
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
index 461fd2495..61028f927 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyImpl.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,9 +23,11 @@ package org.onap.policy.models.base;
import java.util.ArrayList;
import java.util.List;
+
import lombok.Getter;
import lombok.NonNull;
import lombok.ToString;
+
import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@@ -116,6 +118,15 @@ public abstract class PfKeyImpl extends PfKey {
}
/**
+ * Determines if the name is "null".
+ *
+ * @return {@code true} if the name is null, {@code false} otherwise
+ */
+ public boolean isNullName() {
+ return PfKey.NULL_KEY_NAME.equals(getName());
+ }
+
+ /**
* Determines if the version is "null".
*
* @return {@code true} if the version is null, {@code false} otherwise
@@ -147,7 +158,7 @@ public abstract class PfKeyImpl extends PfKey {
}
if (thisVersionArray.length >= 2 && otherVersionArray.length >= 2
- && !thisVersionArray[1].equals(otherVersionArray[1])) {
+ && !thisVersionArray[1].equals(otherVersionArray[1])) {
return Compatibility.MINOR;
}
@@ -189,12 +200,12 @@ public abstract class PfKeyImpl extends PfKey {
}
if (thisVersionArray.length >= 2 && otherVersionArray.length >= 2
- && !thisVersionArray[1].equals(otherVersionArray[1])) {
+ && !thisVersionArray[1].equals(otherVersionArray[1])) {
return Integer.valueOf(thisVersionArray[1]) > Integer.valueOf(otherVersionArray[1]);
}
if (thisVersionArray.length >= 3 && otherVersionArray.length >= 3
- && !thisVersionArray[2].equals(otherVersionArray[2])) {
+ && !thisVersionArray[2].equals(otherVersionArray[2])) {
return Integer.valueOf(thisVersionArray[2]) > Integer.valueOf(otherVersionArray[2]);
}
@@ -215,8 +226,7 @@ public abstract class PfKeyImpl extends PfKey {
if (versionArray.length >= 2) {
return Integer.parseInt(versionArray[1]);
- }
- else {
+ } else {
return 0;
}
}
@@ -227,26 +237,25 @@ public abstract class PfKeyImpl extends PfKey {
if (versionArray.length >= 3) {
return Integer.parseInt(versionArray[2]);
- }
- else {
+ } else {
return 0;
}
}
@Override
public PfValidationResult validate(final PfValidationResult result) {
- final String nameValidationErrorMessage = Assertions.getStringParameterValidationMessage(NAME_TOKEN, getName(),
- getNameRegEx());
+ final String nameValidationErrorMessage =
+ Assertions.getStringParameterValidationMessage(NAME_TOKEN, getName(), getNameRegEx());
if (nameValidationErrorMessage != null) {
result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
- "name invalid-" + nameValidationErrorMessage));
+ "name invalid-" + nameValidationErrorMessage));
}
- final String versionValidationErrorMessage = Assertions.getStringParameterValidationMessage(VERSION_TOKEN,
- getVersion(), getVersionRegEx());
+ final String versionValidationErrorMessage =
+ Assertions.getStringParameterValidationMessage(VERSION_TOKEN, getVersion(), getVersionRegEx());
if (versionValidationErrorMessage != null) {
result.addValidationMessage(new PfValidationMessage(this, this.getClass(), ValidationResult.INVALID,
- "version invalid-" + versionValidationErrorMessage));
+ "version invalid-" + versionValidationErrorMessage));
}
return result;
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
index 1b7a996ed..60ae85dd8 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ModelServiceTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,7 +31,7 @@ import org.onap.policy.models.base.testconcepts.DummyPfModel;
public class ModelServiceTest {
- private static final String MODEL_KEY_IS_NULL = "modelKey is marked @NonNull but is null";
+ private static final String MODEL_KEY_IS_NULL = "modelKey is marked .*on.*ull but is null$";
private static final String MODEL_NAME = "ModelName";
@Test
@@ -40,7 +40,7 @@ public class ModelServiceTest {
assertFalse(PfModelService.existsModel("NonExistantName"));
assertThatThrownBy(() -> PfModelService.getModel("NonExistantName"))
- .hasMessage("Model for name NonExistantName not found in model service");
+ .hasMessage("Model for name NonExistantName not found in model service");
PfModelService.registerModel(MODEL_NAME, new DummyPfModel());
assertTrue(PfModelService.existsModel(MODEL_NAME));
@@ -50,7 +50,7 @@ public class ModelServiceTest {
assertFalse(PfModelService.existsModel(MODEL_NAME));
assertThatThrownBy(() -> PfModelService.getModel(MODEL_NAME))
- .hasMessage("Model for name ModelName not found in model service");
+ .hasMessage("Model for name ModelName not found in model service");
PfModelService.registerModel(MODEL_NAME, new DummyPfModel());
assertTrue(PfModelService.existsModel(MODEL_NAME));
@@ -59,20 +59,18 @@ public class ModelServiceTest {
PfModelService.clear();
assertFalse(PfModelService.existsModel(MODEL_NAME));
assertThatThrownBy(() -> PfModelService.getModel(MODEL_NAME))
- .hasMessage("Model for name ModelName not found in model service");
+ .hasMessage("Model for name ModelName not found in model service");
- assertThatThrownBy(() -> PfModelService.registerModel(null, null))
- .hasMessage(MODEL_KEY_IS_NULL);
+ assertThatThrownBy(() -> PfModelService.registerModel(null, null)).hasMessageMatching(MODEL_KEY_IS_NULL);
assertThatThrownBy(() -> PfModelService.registerModel("nullModelName", null))
- .hasMessage("model is marked @NonNull but is null");
+ .hasMessageMatching("^model is marked .*on.*ull but is null$");
assertThatThrownBy(() -> PfModelService.registerModel(null, new DummyPfModel()))
- .hasMessage(MODEL_KEY_IS_NULL);
+ .hasMessageMatching(MODEL_KEY_IS_NULL);
- assertThatThrownBy(() -> PfModelService.deregisterModel(null))
- .hasMessage(MODEL_KEY_IS_NULL);
+ assertThatThrownBy(() -> PfModelService.deregisterModel(null)).hasMessageMatching(MODEL_KEY_IS_NULL);
- assertThatThrownBy(() -> PfModelService.getModel(null)).hasMessage(MODEL_KEY_IS_NULL);
+ assertThatThrownBy(() -> PfModelService.getModel(null)).hasMessageMatching(MODEL_KEY_IS_NULL);
}
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
index b760e17c0..8234741f6 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java
@@ -48,12 +48,14 @@ import org.onap.policy.models.base.testconcepts.DummyPfConceptSub;
*/
public class PfConceptContainerTest {
- private static final String NAME2 = "name2";
- private static final String NAME1 = "name1";
private static final String NAME0 = "name0";
- private static final String KEY_IS_NULL = "key is marked @NonNull but is null";
+ private static final String NAME1 = "name1";
+ private static final String NAME2 = "name2";
+ private static final String NAME3 = "name3";
+ private static final String ID3 = "name3:0.0.1";
+ private static final String VERSION0_0_1 = "0.0.1";
+ private static final String KEY_IS_NULL = "^key is marked .*on.*ull but is null$";
private static final String DUMMY_VALUE = "Dummy";
- private static final String VERSION0 = "0.0.1";
@SuppressWarnings({"unchecked", "rawtypes"})
@Test
@@ -70,15 +72,16 @@ public class PfConceptContainerTest {
container = new DummyPfConceptContainer(new PfConceptKey(), new TreeMap<PfConceptKey, DummyPfConcept>());
assertNotNull(container);
- assertThatThrownBy(() -> new PfConceptContainer((PfConceptKey) null, null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new PfConceptContainer((PfConceptKey) null, null)).hasMessageMatching(KEY_IS_NULL);
- assertThatThrownBy(() -> new DummyPfConceptContainer((PfConceptKey) null, null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new DummyPfConceptContainer((PfConceptKey) null, null))
+ .hasMessageMatching(KEY_IS_NULL);
assertThatThrownBy(() -> new DummyPfConceptContainer(new PfConceptKey(), null))
- .hasMessage("conceptMap is marked @NonNull but is null");
+ .hasMessageMatching("^conceptMap is marked .*on.*ull but is null$");
assertThatThrownBy(() -> new DummyPfConceptContainer(null, new TreeMap<PfConceptKey, DummyPfConcept>()))
- .hasMessage(KEY_IS_NULL);
+ .hasMessageMatching(KEY_IS_NULL);
container.getKey().setName(DUMMY_VALUE);
DummyPfConceptContainer clonedContainer = new DummyPfConceptContainer(container);
@@ -86,12 +89,12 @@ public class PfConceptContainerTest {
assertEquals(DUMMY_VALUE, clonedContainer.getKey().getName());
assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("^copyConcept is marked .*on.*ull but is null$");
List<PfKey> keyList = container.getKeys();
assertEquals(1, keyList.size());
- PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0);
+ PfConceptKey conceptKey = new PfConceptKey("Key", VERSION0_0_1);
Map<PfConceptKey, DummyPfConcept> conceptMap = new TreeMap<>();
conceptMap.put(conceptKey, new DummyPfConcept(conceptKey));
@@ -115,7 +118,7 @@ public class PfConceptContainerTest {
assertEquals(0, container.compareTo(clonedContainer));
assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null))
- .isInstanceOf(NullPointerException.class);
+ .isInstanceOf(NullPointerException.class);
assertFalse(container.compareTo(null) == 0);
assertEquals(0, container.compareTo(container));
@@ -127,16 +130,17 @@ public class PfConceptContainerTest {
testContainer.getKey().setVersion(container.getKey().getVersion());
assertEquals(0, container.compareTo(testContainer));
- PfConceptKey testConceptKey = new PfConceptKey("TestKey", VERSION0);
+ PfConceptKey testConceptKey = new PfConceptKey("TestKey", VERSION0_0_1);
testContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
assertFalse(container.compareTo(testContainer) == 0);
final DummyPfConceptContainer container3 = container;
- assertThatThrownBy(() -> container3.validate(null)).hasMessage("resultIn is marked @NonNull but is null");
+ assertThatThrownBy(() -> container3.validate(null))
+ .hasMessageMatching("^resultIn is marked .*on.*ull but is null$");
DummyPfConceptContainer validateContainer = new DummyPfConceptContainer();
assertFalse(validateContainer.validate(new PfValidationResult()).isOk());
- validateContainer.setKey(new PfConceptKey("VCKey", VERSION0));
+ validateContainer.setKey(new PfConceptKey("VCKey", VERSION0_0_1));
assertTrue(validateContainer.validate(new PfValidationResult()).isOk());
validateContainer.getConceptMap().put(testConceptKey, new DummyPfConcept(testConceptKey));
@@ -174,32 +178,51 @@ public class PfConceptContainerTest {
public void testAuthorative() {
Map<String, DummyAuthorativeConcept> dacMap = new LinkedHashMap<>();
dacMap.put(NAME0, new DummyAuthorativeConcept(NAME0, "1.2.3", "Hello"));
- dacMap.put(NAME1, new DummyAuthorativeConcept(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "Hi"));
+ dacMap.put(NAME1, new DummyAuthorativeConcept("IncorrectName", PfKey.NULL_KEY_VERSION, "Hi"));
dacMap.put(NAME2, new DummyAuthorativeConcept(NAME2, "1.2.3", "Howdy"));
+ dacMap.put(ID3, new DummyAuthorativeConcept(NAME3, "9.9.9", "Ciao"));
+ dacMap.put("name4:1.2.3", new DummyAuthorativeConcept(null, null, "Slan"));
+ dacMap.put("name5", new DummyAuthorativeConcept(null, null, "Bye"));
List<Map<String, DummyAuthorativeConcept>> authorativeList = new ArrayList<>();
authorativeList.add(dacMap);
DummyPfConceptContainer container = new DummyPfConceptContainer();
+
+ assertThatThrownBy(() -> container.fromAuthorative(authorativeList))
+ .hasMessage("Key name1:0.0.0 field name1 does not match the value IncorrectName in the concept field");
+
+ dacMap.put(NAME1, new DummyAuthorativeConcept(NAME1, PfKey.NULL_KEY_VERSION, "Hi"));
+
+ assertThatThrownBy(() -> container.fromAuthorative(authorativeList))
+ .hasMessage("Key name3:0.0.1 field 0.0.1 does not match the value 9.9.9 in the concept field");
+
+ dacMap.put(ID3, new DummyAuthorativeConcept(NAME3, "0.0.1", "Ciao"));
+
container.fromAuthorative(authorativeList);
assertEquals("Hello", container.getConceptMap().get(new PfConceptKey("name0:1.2.3")).getDescription());
- assertEquals("Hi", container.getConceptMap().get(new PfConceptKey("NULL:0.0.0")).getDescription());
+ assertEquals("Hi", container.getConceptMap().get(new PfConceptKey("name1:0.0.0")).getDescription());
assertEquals("Howdy", container.getConceptMap().get(new PfConceptKey("name2:1.2.3")).getDescription());
+ assertEquals("Ciao", container.getConceptMap().get(new PfConceptKey("name3:0.0.1")).getDescription());
+ assertEquals("name4", container.getConceptMap().get(new PfConceptKey("name4:1.2.3")).getName());
+ assertEquals("1.2.3", container.getConceptMap().get(new PfConceptKey("name4:1.2.3")).getVersion());
+ assertEquals("0.0.0", container.getConceptMap().get(new PfConceptKey("name5:0.0.0")).getVersion());
List<Map<String, DummyAuthorativeConcept>> outMapList = container.toAuthorative();
- assertEquals(dacMap.get(NAME1), outMapList.get(0).get("NULL"));
- assertEquals(dacMap.get(NAME0).getDescription(), outMapList.get(1).get(NAME0).getDescription());
+ assertEquals(dacMap.get(NAME0), outMapList.get(0).get(NAME0));
+ assertEquals(dacMap.get(NAME1).getDescription(), outMapList.get(1).get(NAME1).getDescription());
assertEquals(dacMap.get(NAME2), outMapList.get(2).get(NAME2));
+ assertEquals(dacMap.get(NAME3), outMapList.get(2).get(NAME3));
DummyBadPfConceptContainer badContainer = new DummyBadPfConceptContainer();
assertThatThrownBy(() -> badContainer.fromAuthorative(authorativeList))
- .hasMessage("failed to instantiate instance of container concept class");
+ .hasMessage("failed to instantiate instance of container concept class");
authorativeList.clear();
assertThatThrownBy(() -> container.fromAuthorative(authorativeList))
- .hasMessage("An incoming list of concepts must have at least one entry");
+ .hasMessage("An incoming list of concepts must have at least one entry");
}
@Test(expected = NullPointerException.class)
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java
index a29858393..62d8d2bb3 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptKeyTest.java
@@ -1,5 +1,6 @@
/*-
* ============LICENSE_START=======================================================
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,7 +33,7 @@ import org.onap.policy.models.base.testconcepts.DummyPfConcept;
public class PfConceptKeyTest {
private static final String VERSION001 = "0.0.1";
- private static final String ID_IS_NULL = "id is marked @NonNull but is null";
+ private static final String ID_IS_NULL = "id is marked .*on.*ull but is null$";
@Test
public void testConceptKey() {
@@ -47,6 +48,7 @@ public class PfConceptKeyTest {
assertEquals(someKey1, someKey2);
assertEquals(someKey1, someKey3);
assertFalse(someKey1.isNullVersion());
+ assertFalse(someKey1.isNullName());
assertEquals("PfConceptKey(name=my-name, version=0.0.1)", someKey1.toString());
assertEquals("my-name", someKey1.getName());
@@ -55,7 +57,6 @@ public class PfConceptKeyTest {
assertEquals(someKey2, someKey1.getKey());
assertEquals(1, someKey1.getKeys().size());
-
PfConcept pfc = new DummyPfConcept();
assertEquals(PfConceptKey.getNullKey().getId(), pfc.getId());
@@ -63,16 +64,16 @@ public class PfConceptKeyTest {
assertTrue(PfConceptKey.getNullKey().isNullKey());
- assertThatThrownBy(() -> PfConceptKey.getNullKey().matchesId(null)).hasMessage(ID_IS_NULL);
+ assertThatThrownBy(() -> PfConceptKey.getNullKey().matchesId(null)).hasMessageMatching(ID_IS_NULL);
assertThatThrownBy(() -> someKey0.setName(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("name is marked @NonNull but is null");
+ .hasMessageMatching("^name is marked .*on.*ull but is null$");
assertThatThrownBy(() -> someKey0.setVersion(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("version is marked @NonNull but is null");
+ .hasMessageMatching("^version is marked .*on.*ull but is null$");
assertThatIllegalArgumentException().isThrownBy(() -> new PfConceptKey("my-name.*", VERSION001)).withMessage(
- "parameter 'name': value 'my-name.*', does not match regular expression '^[A-Za-z0-9\\-_\\.]+$'"
- .replace('\'', '"'));
+ "parameter 'name': value 'my-name.*', does not match regular expression '^[A-Za-z0-9\\-_\\.]+$'"
+ .replace('\'', '"'));
}
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
index f467ec35a..4210bc607 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,18 +29,20 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
+
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+
import org.junit.Test;
import org.onap.policy.models.base.PfKey.Compatibility;
import org.onap.policy.models.base.testconcepts.DummyPfKey;
public class PfKeyImplTest {
- private static final String OTHER_IS_NULL = "otherKey is marked @NonNull but is null";
- private static final String ID_IS_NULL = "id is marked @NonNull but is null";
+ private static final String OTHER_IS_NULL = "^otherKey is marked .*on.*ull but is null$";
+ private static final String ID_IS_NULL = "^id is marked .*on.*ull but is null$";
private static final String VERSION123 = "1.2.3";
private static final String VERSION100 = "1.0.0";
private static final String VERSION001 = "0.0.1";
@@ -48,11 +50,11 @@ public class PfKeyImplTest {
@Test
public void testConceptKey() {
assertThatIllegalArgumentException().isThrownBy(() -> new MyKey("some bad key id"))
- .withMessage("parameter \"id\": value \"some bad key id\", "
- + "does not match regular expression \"" + PfKey.KEY_ID_REGEXP + "\"");
+ .withMessage("parameter \"id\": value \"some bad key id\", " + "does not match regular expression \""
+ + PfKey.KEY_ID_REGEXP + "\"");
assertThatThrownBy(() -> new MyKey((MyKey) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("^copyConcept is marked .*on.*ull but is null$");
MyKey someKey0 = new MyKey();
assertTrue(someKey0.isNullKey());
@@ -89,7 +91,7 @@ public class PfKeyImplTest {
assertEquals("name:0.1.2", someKey4.getId());
assertThatThrownBy(() -> someKey0.getCompatibility(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("otherKey is marked @NonNull but is null");
+ .hasMessageMatching("^otherKey is marked .*on.*ull but is null$");
assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(new DummyPfKey()));
assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(someKey1));
@@ -109,19 +111,19 @@ public class PfKeyImplTest {
assertFalse(someKey1.isCompatible(new DummyPfKey()));
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey0.validate(new PfValidationResult()).getValidationResult());
+ someKey0.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey1.validate(new PfValidationResult()).getValidationResult());
+ someKey1.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey2.validate(new PfValidationResult()).getValidationResult());
+ someKey2.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey3.validate(new PfValidationResult()).getValidationResult());
+ someKey3.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey4.validate(new PfValidationResult()).getValidationResult());
+ someKey4.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey5.validate(new PfValidationResult()).getValidationResult());
+ someKey5.validate(new PfValidationResult()).getValidationResult());
assertEquals(PfValidationResult.ValidationResult.VALID,
- someKey6.validate(new PfValidationResult()).getValidationResult());
+ someKey6.validate(new PfValidationResult()).getValidationResult());
someKey0.clean();
assertNotNull(someKey0.toString());
@@ -132,7 +134,7 @@ public class PfKeyImplTest {
assertEquals(-12, someKey7.compareTo(someKey0));
assertThatThrownBy(() -> someKey0.compareTo(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("otherObj is marked @NonNull but is null");
+ .hasMessageMatching("^otherObj is marked .*on.*ull but is null$");
assertEquals(0, someKey0.compareTo(someKey0));
assertEquals(-36, someKey0.compareTo(new DummyPfKey()));
@@ -148,18 +150,20 @@ public class PfKeyImplTest {
@Test
public void testNullArguments() {
- assertThatThrownBy(() -> new MyKey((String) null)).hasMessage(ID_IS_NULL);
+ assertThatThrownBy(() -> new MyKey((String) null)).hasMessageMatching(ID_IS_NULL);
assertThatThrownBy(() -> new MyKey((MyKey) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("^copyConcept is marked .*on.*ull but is null$");
- assertThatThrownBy(() -> new MyKey(null, null)).hasMessage("name is marked @NonNull but is null");
+ assertThatThrownBy(() -> new MyKey(null, null)).hasMessageMatching("name is marked .*on.*ull but is null$");
- assertThatThrownBy(() -> new MyKey("name", null)).hasMessage("version is marked @NonNull but is null");
+ assertThatThrownBy(() -> new MyKey("name", null))
+ .hasMessageMatching("^version is marked .*on.*ull but is null$");
- assertThatThrownBy(() -> new MyKey(null, VERSION001)).hasMessage("name is marked @NonNull but is null");
+ assertThatThrownBy(() -> new MyKey(null, VERSION001))
+ .hasMessageMatching("^name is marked .*on.*ull but is null$");
- assertThatThrownBy(() -> new MyKey("AKey", VERSION001).isCompatible(null)).hasMessage(OTHER_IS_NULL);
+ assertThatThrownBy(() -> new MyKey("AKey", VERSION001).isCompatible(null)).hasMessageMatching(OTHER_IS_NULL);
}
@Test
@@ -174,10 +178,8 @@ public class PfKeyImplTest {
testKey.validate(validationResult);
nameField.set(testKey, "TheKey");
nameField.setAccessible(false);
- assertEquals(
- "name invalid-parameter name with value Key Name "
- + "does not match regular expression " + PfKey.NAME_REGEXP,
- validationResult.getMessageList().get(0).getMessage());
+ assertEquals("name invalid-parameter name with value Key Name " + "does not match regular expression "
+ + PfKey.NAME_REGEXP, validationResult.getMessageList().get(0).getMessage());
Field versionField = testKey.getClass().getDeclaredField("version");
versionField.setAccessible(true);
@@ -186,21 +188,18 @@ public class PfKeyImplTest {
testKey.validate(validationResult2);
versionField.set(testKey, VERSION001);
versionField.setAccessible(false);
- assertEquals(
- "version invalid-parameter version with value Key Version "
- + "does not match regular expression " + PfKey.VERSION_REGEXP,
- validationResult2.getMessageList().get(0).getMessage());
+ assertEquals("version invalid-parameter version with value Key Version " + "does not match regular expression "
+ + PfKey.VERSION_REGEXP, validationResult2.getMessageList().get(0).getMessage());
}
@Test
public void testkeynewerThan() {
MyKey key1 = new MyKey("Key1", VERSION123);
- assertThatThrownBy(() -> key1.isNewerThan(null)).hasMessage(OTHER_IS_NULL);
+ assertThatThrownBy(() -> key1.isNewerThan(null)).hasMessageMatching(OTHER_IS_NULL);
- assertThatThrownBy(() -> key1.isNewerThan(new PfReferenceKey()))
- .hasMessage("org.onap.policy.models.base.PfReferenceKey is not "
- + "an instance of " + PfKeyImpl.class.getName());
+ assertThatThrownBy(() -> key1.isNewerThan(new PfReferenceKey())).hasMessage(
+ "org.onap.policy.models.base.PfReferenceKey is not " + "an instance of " + PfKeyImpl.class.getName());
assertFalse(key1.isNewerThan(key1));
@@ -241,10 +240,10 @@ public class PfKeyImplTest {
PfReferenceKey refKey = new PfReferenceKey();
- assertThatThrownBy(() -> refKey.isNewerThan(null)).hasMessage(OTHER_IS_NULL);
+ assertThatThrownBy(() -> refKey.isNewerThan(null)).hasMessageMatching(OTHER_IS_NULL);
assertThatThrownBy(() -> refKey.isNewerThan(new MyKey()))
- .hasMessage(MyKey.class.getName() + " is not an instance of " + PfReferenceKey.class.getName());
+ .hasMessage(MyKey.class.getName() + " is not an instance of " + PfReferenceKey.class.getName());
assertFalse(refKey.isNewerThan(refKey));
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
index 3e5d738bd..46a00664f 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,7 +34,7 @@ import org.onap.policy.models.base.testconcepts.DummyPfConceptKeySub;
public class PfKeyUseTest {
- private static final String OTHER_KEY_IS_NULL = "otherKey is marked @NonNull but is null";
+ private static final String OTHER_KEY_IS_NULL = "^otherKey is marked .*on.*ull but is null$";
@Test
public void testKeyUse() {
@@ -43,7 +43,7 @@ public class PfKeyUseTest {
assertNotNull(new PfKeyUse(new PfReferenceKey()));
assertThatThrownBy(() -> new PfKeyUse((PfKeyUse) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("^copyConcept is marked .*on.*ull but is null$");
PfConceptKey key = new PfConceptKey("Key", "0.0.1");
PfKeyUse keyUse = new PfKeyUse();
@@ -55,7 +55,7 @@ public class PfKeyUseTest {
assertEquals(Compatibility.IDENTICAL, keyUse.getCompatibility(key));
- assertThatThrownBy(() -> key.getCompatibility(null)).hasMessage(OTHER_KEY_IS_NULL);
+ assertThatThrownBy(() -> key.getCompatibility(null)).hasMessageMatching(OTHER_KEY_IS_NULL);
assertTrue(keyUse.isCompatible(key));
@@ -87,20 +87,20 @@ public class PfKeyUseTest {
PfValidationResult resultNull = new PfValidationResult();
assertEquals(false, keyUseNull.validate(resultNull).isValid());
- assertThatThrownBy(() -> keyUse.setKey(null)).hasMessage("key is marked @NonNull but is null");
+ assertThatThrownBy(() -> keyUse.setKey(null)).hasMessageMatching("^key is marked .*on.*ull but is null$");
- assertThatThrownBy(() -> keyUse.getCompatibility(null)).hasMessage(OTHER_KEY_IS_NULL);
+ assertThatThrownBy(() -> keyUse.getCompatibility(null)).hasMessageMatching(OTHER_KEY_IS_NULL);
- assertThatThrownBy(() -> keyUse.isCompatible(null)).hasMessage(OTHER_KEY_IS_NULL);
+ assertThatThrownBy(() -> keyUse.isCompatible(null)).hasMessageMatching(OTHER_KEY_IS_NULL);
- assertThatThrownBy(() -> keyUse.validate(null)).hasMessage("result is marked @NonNull but is null");
+ assertThatThrownBy(() -> keyUse.validate(null)).hasMessageMatching("^result is marked .*on.*ull but is null$");
PfKeyUse testKeyUse = new PfKeyUse(new DummyPfConceptKeySub(new PfConceptKey()));
assertEquals(testKeyUse, new PfKeyUse(testKeyUse));
assertThatThrownBy(() -> new PfKeyUse((PfKeyUse) null)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> keyUse.isNewerThan(null)).hasMessage(OTHER_KEY_IS_NULL);
+ assertThatThrownBy(() -> keyUse.isNewerThan(null)).hasMessageMatching(OTHER_KEY_IS_NULL);
assertEquals(false, testKeyUse.isNewerThan(keyUse));
assertEquals(false, testKeyUse.isNewerThan(testKeyUse));
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
index 9b1a778ac..c124393fe 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,10 +46,10 @@ public class PfModelTest {
assertNotNull(new DummyPfModel(new DummyPfModel()));
assertThatThrownBy(() -> new DummyPfModel((PfConceptKey) null))
- .hasMessage("key is marked @NonNull but is null");
+ .hasMessageMatching("^key is marked .*on.*ull but is null$");
assertThatThrownBy(() -> new DummyPfModel((DummyPfModel) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("^copyConcept is marked .*on.*ull but is null$");
DummyPfModel dpm = new DummyPfModel(new PfConceptKey("modelKey", VERSION001));
DummyPfModel dpmClone = new DummyPfModel(dpm);
@@ -74,7 +74,7 @@ public class PfModelTest {
DummyPfModel dpm = new DummyPfModel(dpmKey);
assertTrue(dpm.validate(new PfValidationResult()).isValid());
- assertThatThrownBy(() -> dpm.validate(null)).hasMessage("resultIn is marked @NonNull but is null");
+ assertThatThrownBy(() -> dpm.validate(null)).hasMessageMatching("^resultIn is marked .*on.*ull but is null$");
dpm.setKey(PfConceptKey.getNullKey());
assertFalse(dpm.validate(new PfValidationResult()).isValid());
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
index b12ce4de0..ba36b9e8f 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
+
import org.junit.Test;
public class PfReferenceKeyTest {
@@ -54,7 +55,7 @@ public class PfReferenceKeyTest {
assertEquals("NULL:0.0.0:NULL:NULL", PfReferenceKey.getNullKey().getId());
assertThatThrownBy(() -> new PfReferenceKey(new PfConceptKey(), null))
- .hasMessage("parameter \"localName\" is null");
+ .hasMessage("parameter \"localName\" is null");
PfReferenceKey testReferenceKey = new PfReferenceKey();
testReferenceKey.setParentConceptKey(new PfConceptKey("PN", VERSION001));
@@ -83,7 +84,7 @@ public class PfReferenceKeyTest {
assertEquals("NLN", testReferenceKey.getLocalName());
assertThatThrownBy(() -> testReferenceKey.isCompatible(null))
- .hasMessage("otherKey is marked @NonNull but is null");
+ .hasMessageMatching("^otherKey is marked .*on.*ull but is null$");
assertFalse(testReferenceKey.isCompatible(PfConceptKey.getNullKey()));
assertFalse(testReferenceKey.isCompatible(PfReferenceKey.getNullKey()));
@@ -101,7 +102,7 @@ public class PfReferenceKeyTest {
PfReferenceKey clonedReferenceKey = new PfReferenceKey(testReferenceKey);
assertEquals("PfReferenceKey(parentKeyName=NPKN, parentKeyVersion=0.0.1, parentLocalName=NPKLN, localName=NLN)",
- clonedReferenceKey.toString());
+ clonedReferenceKey.toString());
assertFalse(testReferenceKey.hashCode() == 0);
@@ -144,9 +145,9 @@ public class PfReferenceKeyTest {
parentNameField.set(testReferenceKey, "ParentName");
parentNameField.setAccessible(false);
assertEquals(
- "parentKeyName invalid-parameter parentKeyName with value Parent Name "
- + "does not match regular expression " + PfKey.NAME_REGEXP,
- validationResult.getMessageList().get(0).getMessage());
+ "parentKeyName invalid-parameter parentKeyName with value Parent Name "
+ + "does not match regular expression " + PfKey.NAME_REGEXP,
+ validationResult.getMessageList().get(0).getMessage());
Field parentVersionField = testReferenceKey.getClass().getDeclaredField("parentKeyVersion");
parentVersionField.setAccessible(true);
@@ -156,9 +157,9 @@ public class PfReferenceKeyTest {
parentVersionField.set(testReferenceKey, VERSION001);
parentVersionField.setAccessible(false);
assertEquals(
- "parentKeyVersion invalid-parameter parentKeyVersion with value Parent Version "
- + "does not match regular expression " + PfKey.VERSION_REGEXP,
- validationResult2.getMessageList().get(0).getMessage());
+ "parentKeyVersion invalid-parameter parentKeyVersion with value Parent Version "
+ + "does not match regular expression " + PfKey.VERSION_REGEXP,
+ validationResult2.getMessageList().get(0).getMessage());
Field parentLocalNameField = testReferenceKey.getClass().getDeclaredField("parentLocalName");
parentLocalNameField.setAccessible(true);
@@ -168,9 +169,9 @@ public class PfReferenceKeyTest {
parentLocalNameField.set(testReferenceKey, PARENT_LOCAL_NAME);
parentLocalNameField.setAccessible(false);
assertEquals(
- "parentLocalName invalid-parameter parentLocalName with value "
- + "Parent Local Name does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
- validationResult3.getMessageList().get(0).getMessage());
+ "parentLocalName invalid-parameter parentLocalName with value "
+ + "Parent Local Name does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
+ validationResult3.getMessageList().get(0).getMessage());
Field localNameField = testReferenceKey.getClass().getDeclaredField("localName");
localNameField.setAccessible(true);
@@ -180,8 +181,8 @@ public class PfReferenceKeyTest {
localNameField.set(testReferenceKey, LOCAL_NAME);
localNameField.setAccessible(false);
assertEquals(
- "localName invalid-parameter localName with value Local Name "
- + "does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
- validationResult4.getMessageList().get(0).getMessage());
+ "localName invalid-parameter localName with value Local Name "
+ + "does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
+ validationResult4.getMessageList().get(0).getMessage());
}
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java
index 942f47c1d..e3a0e3338 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfSearchableKeyTest.java
@@ -1,5 +1,6 @@
/*-
* ============LICENSE_START=======================================================
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,7 +32,7 @@ import org.onap.policy.models.base.testconcepts.DummyPfConcept;
public class PfSearchableKeyTest {
private static final String VERSION001 = "0.0.1";
- private static final String ID_IS_NULL = "id is marked @NonNull but is null";
+ private static final String ID_IS_NULL = "^id is marked .*on.*ull but is null$";
@Test
public void testSearchableKey() {
@@ -54,7 +55,6 @@ public class PfSearchableKeyTest {
assertEquals(someKey2, someKey1.getKey());
assertEquals(1, someKey1.getKeys().size());
-
PfConcept pfc = new DummyPfConcept();
assertEquals(PfSearchableKey.getNullKey().getId(), pfc.getId());
@@ -62,13 +62,13 @@ public class PfSearchableKeyTest {
assertTrue(PfSearchableKey.getNullKey().isNullKey());
- assertThatThrownBy(() -> PfSearchableKey.getNullKey().matchesId(null)).hasMessage(ID_IS_NULL);
+ assertThatThrownBy(() -> PfSearchableKey.getNullKey().matchesId(null)).hasMessageMatching(ID_IS_NULL);
assertThatThrownBy(() -> someKey0.setName(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("name is marked @NonNull but is null");
+ .hasMessageMatching("^name is marked .*on.*ull but is null$");
assertThatThrownBy(() -> someKey0.setVersion(null)).isInstanceOf(NullPointerException.class)
- .hasMessage("version is marked @NonNull but is null");
+ .hasMessageMatching("^version is marked .*on.*ull but is null$");
PfSearchableKey someKey4 = new PfSearchableKey("my-name.*", VERSION001);
assertEquals("my-name.*", someKey4.getName());
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
index 28b9fd922..1495fca7d 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfTimestampKeyTest.java
@@ -1,8 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP Policy Model
- * ================================================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,14 +26,15 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Date;
+
import org.junit.Test;
public class PfTimestampKeyTest {
private static final String VERSION001 = "0.0.1";
- private static final String CONCEPT_IS_NULL = "copyConcept is marked @NonNull but is null";
- private static final String NAME_IS_NULL = "name is marked @NonNull but is null";
- private static final String VERSION_IS_NULL = "version is marked @NonNull but is null";
- private static final String TIMESTAMP_IS_NULL = "timeStamp is marked @NonNull but is null";
+ private static final String CONCEPT_IS_NULL = "^copyConcept is marked .*on.*ull but is null$";
+ private static final String NAME_IS_NULL = "^name is marked .*on.*ull but is null$";
+ private static final String VERSION_IS_NULL = "^version is marked .*on.*ull but is null$";
+ private static final String TIMESTAMP_IS_NULL = "^timeStamp is marked .*on.*ull but is null$";
private static final long timeStamp = 1574832537641L;
@Test
@@ -60,24 +59,24 @@ public class PfTimestampKeyTest {
assertEquals(1, someKey1.getKeys().size());
assertThatThrownBy(() -> new PfTimestampKey((PfTimestampKey) null)).isInstanceOf(NullPointerException.class)
- .hasMessage(CONCEPT_IS_NULL);
+ .hasMessageMatching(CONCEPT_IS_NULL);
assertThatThrownBy(() -> new PfTimestampKey(null, null, null)).isInstanceOf(NullPointerException.class)
- .hasMessage(NAME_IS_NULL);
+ .hasMessageMatching(NAME_IS_NULL);
assertThatThrownBy(() -> new PfTimestampKey("my-name", null, null)).isInstanceOf(NullPointerException.class)
- .hasMessage(VERSION_IS_NULL);
+ .hasMessageMatching(VERSION_IS_NULL);
assertThatThrownBy(() -> new PfTimestampKey("my-name", VERSION001, null))
- .isInstanceOf(NullPointerException.class).hasMessage(TIMESTAMP_IS_NULL);
+ .isInstanceOf(NullPointerException.class).hasMessageMatching(TIMESTAMP_IS_NULL);
assertThatThrownBy(() -> someKey0.setName(null)).isInstanceOf(NullPointerException.class)
- .hasMessage(NAME_IS_NULL);
+ .hasMessageMatching(NAME_IS_NULL);
assertThatThrownBy(() -> someKey0.setVersion(null)).isInstanceOf(NullPointerException.class)
- .hasMessage(VERSION_IS_NULL);
+ .hasMessageMatching(VERSION_IS_NULL);
assertThatThrownBy(() -> someKey0.setTimeStamp(null)).isInstanceOf(NullPointerException.class)
- .hasMessage(TIMESTAMP_IS_NULL);
+ .hasMessageMatching(TIMESTAMP_IS_NULL);
assertFalse(someKey1.isNewerThan(someKey2));
assertThatThrownBy(() -> someKey1.isNewerThan((PfKey) null)).isInstanceOf(NullPointerException.class)
- .hasMessage("otherKey is marked @NonNull but is null");
+ .hasMessageMatching("^otherKey is marked .*on.*ull but is null$");
someKey2.setTimeStamp(new Date(timeStamp + 1));
assertTrue(someKey2.isNewerThan(someKey1));
someKey3.setName("my-name3");
@@ -86,7 +85,7 @@ public class PfTimestampKeyTest {
assertEquals(-1, someKey1.compareTo(someKey2));
assertEquals(-1, someKey1.compareTo(someKey3));
assertThatThrownBy(() -> someKey1.compareTo((PfConcept) null)).isInstanceOf(NullPointerException.class)
- .hasMessage("otherObj is marked @NonNull but is null");
+ .hasMessageMatching("^otherObj is marked .*on.*ull but is null$");
PfTimestampKey someKey4 = new PfTimestampKey("NULL", "0.0.0", new Date(timeStamp));
assertFalse(someKey4.isNullKey());
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java
new file mode 100644
index 000000000..35ec95b45
--- /dev/null
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/revisionhierarchy/HierarchyFetchTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.provider.revisionhierarchy;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.Base64;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.provider.PolicyModelsProvider;
+import org.onap.policy.models.provider.PolicyModelsProviderFactory;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+public class HierarchyFetchTest {
+
+ private static PolicyModelsProviderParameters parameters;
+
+ @BeforeClass
+ public static void beforeSetupParameters() {
+ parameters = new PolicyModelsProviderParameters();
+ parameters.setDatabaseDriver("org.h2.Driver");
+ parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
+ parameters.setDatabaseUser("policy");
+ parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
+ parameters.setPersistenceUnit("ToscaConceptTest");
+ }
+
+ @Test
+ public void testInitAndClose() throws Exception {
+ PolicyModelsProvider databaseProvider =
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+
+ ToscaServiceTemplate serviceTemplate = new YamlJsonTranslator().fromYaml(
+ TextFileUtils
+ .getTextFileAsString("src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml"),
+ ToscaServiceTemplate.class);
+
+ assertThatThrownBy(() -> {
+ databaseProvider.createPolicies(serviceTemplate);
+ }).isInstanceOf(PfModelRuntimeException.class);
+
+ databaseProvider.close();
+ }
+}
diff --git a/models-provider/src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml b/models-provider/src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml
new file mode 100644
index 000000000..5f250e022
--- /dev/null
+++ b/models-provider/src/test/resources/servicetemplates/MultipleRevisionServiceTemplate.yaml
@@ -0,0 +1,421 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+policy_types:
+ onap.policies.PolicyTypeLevel0:1.0.0:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: Level 0 policy type
+ properties:
+ policyLevel0Property0:
+ type: policy.data.DataType0
+ policyLevel0Property1:
+ type: list
+ entry_schema:
+ type: policy.data.DataType1
+ onap.policies.PolicyTypeLevel0:2.0.0:
+ derived_from: tosca.policies.Root
+ version: 2.0.0
+ description: Level 0 policy type
+ properties:
+ policyLevel0Property0:
+ type: policy.data.DataType0
+ policyLevel0Property1:
+ type: list
+ entry_schema:
+ type: policy.data.DataType1
+ policyLevel0V2Property2:
+ type: policy.data.DataType5
+ onap.policies.PolicyTypeLevel0:
+ derived_from: tosca.policies.Root
+ version: 3.0.0
+ description: Level 0 policy type
+ properties:
+ policyLevel0Property0:
+ type: policy.data.DataType0
+ policyLevel0Property1:
+ type: list
+ entry_schema:
+ type: policy.data.DataType1
+ policyLevel0V2Property2:
+ type: policy.data.DataType5
+ policyLevel0V3Property3:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1:1.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0
+ version: 1.0.0
+ description: Level 0.1 policy type
+ properties:
+ policyLevel0.1Property0:
+ type: policy.data.DataType5
+ policyLevel0.1Property1:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1:2.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0
+ version: 2.0.0
+ description: Level 0.1 policy type
+ properties:
+ policyLevel0.1Property0:
+ type: policy.data.DataType5
+ policyLevel0.1Property1:
+ type: policy.data.DataType6
+ policyLevel0.1V2Property2:
+ type: policy.data.DataType5
+ onap.policies.PolicyTypeLevel0.1:
+ derived_from: onap.policies.PolicyTypeLevel0
+ version: 3.0.0
+ description: Level 0.1 policy type
+ properties:
+ policyLevel0.1Property0:
+ type: policy.data.DataType5
+ policyLevel0.1Property1:
+ type: policy.data.DataType6
+ policyLevel0.1V2Property2:
+ type: policy.data.DataType5
+ policyLevel0.1V3Property3:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1.2:1.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0.1
+ version: 1.0.0
+ description: Level 0.1.2 policy type
+ properties:
+ policyLevel0.1.2Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2Property1:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1.2:2.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0.1
+ version: 2.0.0
+ description: Level 0.1.2 policy type
+ properties:
+ policyLevel0.1.2Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2Property1:
+ type: policy.data.DataType6
+ policyLevel0.1.2V2Property2:
+ type: policy.data.DataType5
+ onap.policies.PolicyTypeLevel0.1.2:
+ derived_from: onap.policies.PolicyTypeLevel0.1
+ version: 3.0.0
+ description: Level 0.1.2 policy type
+ properties:
+ policyLevel0.1.2Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2Property1:
+ type: policy.data.DataType6
+ policyLevel0.1.2V2Property2:
+ type: policy.data.DataType5
+ policyLevel0.1.2V3Property3:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1.2.3:1.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0.1.2
+ version: 1.0.0
+ description: Level 0.1.2.3 policy type
+ properties:
+ policyLevel0.1.2.3Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2.3Property1:
+ type: policy.data.DataType6
+ onap.policies.PolicyTypeLevel0.1.2.3:2.0.0:
+ derived_from: onap.policies.PolicyTypeLevel0.1.2
+ version: 2.0.0
+ description: Level 0.1.2.3 policy type
+ properties:
+ policyLevel0.1.2.3Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2.3Property1:
+ type: policy.data.DataType6
+ policyLevel0.1.2.3V2Property2:
+ type: policy.data.DataType5
+ onap.policies.PolicyTypeLevel0.1.2.3:
+ derived_from: onap.policies.PolicyTypeLevel0.1.2
+ version: 3.0.0
+ description: Level 0.1.2.3 policy type
+ properties:
+ policyLevel0.1.2.3Property0:
+ type: policy.data.DataType5
+ policyLevel0.1.2.3Property1:
+ type: policy.data.DataType6
+ policyLevel0.1.2.3V2Property2:
+ type: policy.data.DataType5
+ policyLevel0.1.2.3V3Property3:
+ type: policy.data.DataType6
+data_types:
+ policy.data.DataType0:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType0Property0:
+ type: policy.data.DataType2
+ required: false
+ dataType0Property1:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.DataType3
+ policy.data.DataType1:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType1Property0:
+ type: policy.data.DataType4
+ required: false
+ dataType1Property1:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.DataType5
+ policy.data.DataType2:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType2Property0:
+ type: string
+ required: false
+ dataType2Property1:
+ type: list
+ required: true
+ entry_schema:
+ type: integer
+ policy.data.DataType3:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType3Property0:
+ type: string
+ required: false
+ policy.data.DataType4:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType4Property0:
+ type: string
+ required: false
+ dataType4Property1:
+ type: list
+ required: true
+ entry_schema:
+ type: integer
+ policy.data.DataType5:1.0.0:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType5Property0:
+ type: string
+ required: false
+ policy.data.DataType5:2.0.0:
+ derived_from: tosca.datatypes.Root
+ version: 2.0.0
+ properties:
+ dataType5Property0:
+ type: string
+ required: false
+ dataType5V2Property1:
+ type: string
+ required: false
+ policy.data.DataType5:
+ derived_from: tosca.datatypes.Root
+ version: 3.0.0
+ properties:
+ dataType5Property0:
+ type: string
+ required: false
+ dataType5V2Property1:
+ type: string
+ required: false
+ dataType5V2Property2:
+ type: integer
+ required: false
+ policy.data.DataType6:1.0.0:
+ derived_from: tosca.datatypes.Root
+ version: 1.0.0
+ properties:
+ dataType6Property0:
+ type: integer
+ required: false
+ policy.data.DataType6:
+ derived_from: tosca.datatypes.Root
+ version: 2.0.0
+ properties:
+ dataType6Property0:
+ type: integer
+ required: false
+ dataType6V2Property1:
+ type: integer
+ required: false
+topology_template:
+ policies:
+ - onap.policies.PolicyLevel0:
+ type: onap.policies.PolicyTypeLevel0
+ version: 1.0.0
+ type_version: 1.0.0
+ description: Level 0 policy
+ properties:
+ policyLevel0Property0:
+ dataType0Property0:
+ dataType2Property0: dataType2Property0 value
+ dataType2Property1:
+ - 123
+ - 456
+ - 789
+ dataType0Property1:
+ - dataType3Property0: dataType3Property0 value 0
+ - dataType3Property0: dataType3Property0 value 1
+ - dataType3Property0: dataType3Property0 value 2
+ - dataType3Property0: dataType3Property0 value 3
+ policyLevel0Property1:
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ - onap.policies.PolicyLevel0.1:
+ type: onap.policies.PolicyTypeLevel0
+ version: 1.0.0
+ type_version: 1.0.0
+ description: Level 0 policy
+ properties:
+ policyLevel0Property0:
+ dataType0Property0:
+ dataType2Property0: dataType2Property0 value
+ dataType2Property1:
+ - 123
+ - 456
+ - 789
+ dataType0Property1:
+ - dataType3Property0: dataType3Property0 value 0
+ - dataType3Property0: dataType3Property0 value 1
+ - dataType3Property0: dataType3Property0 value 2
+ - dataType3Property0: dataType3Property0 value 3
+ policyLevel0Property1:
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ policyLevel0.1Property0: policyLevel0.1Property0 value
+ policyLevel0.1Property1: 123
+ - onap.policies.PolicyLevel0.1.2:
+ type: onap.policies.PolicyTypeLevel0
+ version: 1.0.0
+ type_version: 1.0.0
+ description: Level 0 policy
+ properties:
+ policyLevel0Property0:
+ dataType0Property0:
+ dataType2Property0: dataType2Property0 value
+ dataType2Property1:
+ - 123
+ - 456
+ - 789
+ dataType0Property1:
+ - dataType3Property0: dataType3Property0 value 0
+ - dataType3Property0: dataType3Property0 value 1
+ - dataType3Property0: dataType3Property0 value 2
+ - dataType3Property0: dataType3Property0 value 3
+ policyLevel0Property1:
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ policyLevel0.1Property0: policyLevel0.1Property0 value
+ policyLevel0.1Property1: 123
+ policyLevel0.1.2Property0: policyLevel0.1.2Property0 value
+ policyLevel0.1.2Property1: 456
+ - onap.policies.PolicyLevel0.1.2.3:
+ type: onap.policies.PolicyTypeLevel0
+ version: 1.0.0
+ type_version: 1.0.0
+ description: Level 0 policy
+ properties:
+ policyLevel0Property0:
+ dataType0Property0:
+ dataType2Property0: dataType2Property0 value
+ dataType2Property1:
+ - 123
+ - 456
+ - 789
+ dataType0Property1:
+ - dataType3Property0: dataType3Property0 value 0
+ - dataType3Property0: dataType3Property0 value 1
+ - dataType3Property0: dataType3Property0 value 2
+ - dataType3Property0: dataType3Property0 value 3
+ policyLevel0Property1:
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ - dataType1Property0:
+ dataType4Property0: dataType4Property0 value
+ dataType4Property1:
+ - 123
+ - 456
+ - 789
+ dataType1Property1:
+ - dataType5Property0: dataType5Property0 value 0
+ - dataType5Property0: dataType5Property0 value 1
+ - dataType5Property0: dataType5Property0 value 2
+ - dataType5Property0: dataType5Property0 value 3
+ policyLevel0.1Property0: policyLevel0.1Property0 value
+ policyLevel0.1Property1: 123
+ policyLevel0.1.2Property0: policyLevel0.1.2Property0 value
+ policyLevel0.1.2Property1: 456
+ policyLevel0.1.2.3Property0: policyLevel0.1.2.3Property0 value
+ policyLevel0.1.2.3Property1: 456