Add extra authorative TOSCA concepts 66/115166/3
authorliamfallon <liam.fallon@est.tech>
Fri, 20 Nov 2020 10:24:44 +0000 (10:24 +0000)
committerliamfallon <liam.fallon@est.tech>
Tue, 1 Dec 2020 12:27:54 +0000 (12:27 +0000)
This review brings in extra TOSCA concepts for Node types, nodes, and
capabilities.

The TOSCA handling is also amended to make the handling of equality
consistent. Now, if filtering or ordering is required using an order
rather than natural ordering, a comparator must be supplied by the user.

Issue-ID: POLICY-2900
Change-Id: Ie40e86870b97eb993b1338bdc0666ac116f72f67
Signed-off-by: liamfallon <liam.fallon@est.tech>
37 files changed:
models-base/src/main/java/org/onap/policy/models/base/PfConceptComparator.java [new file with mode: 0644]
models-base/src/main/java/org/onap/policy/models/base/PfConceptFilter.java
models-base/src/main/java/org/onap/policy/models/base/PfNameVersion.java
models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java [new file with mode: 0644]
models-base/src/test/java/org/onap/policy/models/base/PfConceptFilterTest.java
models-base/src/test/java/org/onap/policy/models/base/PfKeyImplTest.java
models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java
models-base/src/test/java/org/onap/policy/models/base/PfNameVersionTest.java
models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java
models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObject.java
models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectComparator.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityAssignment.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityType.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConstraint.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaDataType.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeTemplate.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeType.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaParameter.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyComparator.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilter.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersion.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeComparator.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilter.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaProperty.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRelationshipType.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRequirement.java [new file with mode: 0644]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaSchemaDefinition.java [moved from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntrySchema.java with 83% similarity]
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTopologyTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/package-info.java
models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchema.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeTest.java

diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptComparator.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptComparator.java
new file mode 100644 (file)
index 0000000..36bff5f
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.base;
+
+import java.util.Comparator;
+
+/**
+ * Compare two PfNameVersion objects.
+ */
+public class PfConceptComparator implements Comparator<PfConcept> {
+
+    @Override
+    public int compare(PfConcept left, PfConcept right) {
+        return left.getKey().compareTo(right.getKey());
+    }
+}
index 8cebcdb..df6141b 100644 (file)
@@ -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");
@@ -58,7 +58,7 @@ public class PfConceptFilter implements PfObjectFilter<PfConcept> {
         // @formatter:off
 
         if (LATEST_VERSION.equals(version)) {
-            return this.latestVersionFilter(returnList);
+            return this.latestVersionFilter(returnList, new PfConceptComparator());
         } else  {
             return returnList;
         }
index 7bdced7..f9fde53 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  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.
@@ -38,7 +38,7 @@ public interface PfNameVersion {
     public void setVersion(final String version);
 
     /**
-     * COmpare two name version implementation objects.
+     * Compare two name version implementation objects.
      *
      * @param left the left name/version implementation
      * @param right the right name/version implementation
index f4e4571..f7e29f1 100644 (file)
@@ -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,6 +23,7 @@ package org.onap.policy.models.base;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.function.Function;
 import java.util.function.Predicate;
@@ -34,7 +35,7 @@ import java.util.regex.Pattern;
  * @author Liam Fallon (liam.fallon@est.tech)
  */
 @FunctionalInterface
-public interface PfObjectFilter<T extends Comparable<T>> {
+public interface PfObjectFilter<T> {
     /**
      * Filter an incoming list, removing items that do not match the filter.
      *
@@ -118,15 +119,16 @@ public interface PfObjectFilter<T extends Comparable<T>> {
      * Sort an incoming list and remove all but the latest version of each concept.
      *
      * @param originalList the incoming list
+     * @param versionComparator the comparator to use to order versions of the incoming object
      * @return the filtered list
      */
-    public default List<T> latestVersionFilter(final List<T> originalList) {
+    public default List<T> latestVersionFilter(final List<T> originalList, final Comparator<T> versionComparator) {
         if (originalList.size() <= 1) {
             return originalList;
         }
 
         List<T> filteredList = new ArrayList<>(originalList);
-        Collections.sort(filteredList);
+        Collections.sort(filteredList, versionComparator);
 
         int icur = 0;
         for (int j = 1; j < filteredList.size(); j++) {
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptComparatorTest.java
new file mode 100644 (file)
index 0000000..ea07627
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============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.base;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.policy.models.base.testconcepts.DummyBadPfConcept;
+import org.onap.policy.models.base.testconcepts.DummyPfConcept;
+
+public class PfConceptComparatorTest {
+
+    @Test
+    public void testPfConceptComparator() {
+        assertEquals(0, new PfConceptComparator().compare(new DummyPfConcept(), new DummyPfConcept()));
+    }
+}
index 424293f..6d02b2f 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.policy.models.base;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
@@ -50,5 +51,14 @@ public class PfConceptFilterTest {
             final PfConceptFilter conceptFilterNull = new PfConceptFilter(null, null, null);
             conceptFilterNull.filter(null);
         }).hasMessageMatching("^originalList is marked .*on.*ull but is null$");
+
+        conceptFilter.setName("hello");
+        assertEquals("hello", conceptFilter.getName());
+
+        conceptFilter.setVersion("1.2.3");
+        assertEquals("1.2.3", conceptFilter.getVersion());
+
+        conceptFilter.setVersionPrefix("AAA");
+        assertEquals("AAA", conceptFilter.getVersionPrefix());
     }
 }
index 7bf270b..8b94a48 100644 (file)
@@ -145,6 +145,12 @@ public class PfKeyImplTest {
         MyKey someKey8 = new MyKey();
         someKey8.setVersion(VERSION001);
         assertFalse(someKey8.isNullKey());
+
+        someKey8.setVersion("10");
+        assertEquals(0, someKey8.getMinorVersion());
+
+        someKey8.setVersion("10.11");
+        assertEquals(0, someKey8.getPatchVersion());
     }
 
     @Test
index 2e742c3..5cebf1e 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.policy.models.base;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import javax.ws.rs.core.Response;
 import org.junit.Test;
@@ -39,10 +40,12 @@ public class PfModelExceptionInfoTest {
         final PfModelException pfme = new PfModelException(Response.Status.ACCEPTED, "HELLO");
         assertThat(pfme).hasMessage("HELLO");
         assertEquals("Server returned: Accepted", getErrorMessage(pfme).substring(0, 25));
+        assertNotNull(pfme.toString());
 
         final PfModelRuntimeException pfmr = new PfModelRuntimeException(Response.Status.ACCEPTED, "HELLO");
         assertThat(pfmr).hasMessage("HELLO");
         assertEquals("Server returned: Accepted", getErrorMessage(pfmr).substring(0, 25));
+        assertNotNull(pfmr.toString());
     }
 
     private String getErrorMessage(final ErrorResponseInfo eri) {
index 7152b12..2937b60 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  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.
@@ -57,6 +57,9 @@ public class PfNameVersionTest {
         dnv0.setVersion("1.2.3");
         assertEquals(-1, dnv0.compareNameVersion(dnv0, dnv1));
 
+        dnv1.setVersion(null);
+        assertEquals(-1, dnv0.compareNameVersion(dnv0, dnv1));
+
         dnv1.setVersion("1.2.3");
         assertEquals(0, dnv0.compareNameVersion(dnv0, dnv1));
     }
index d6985e9..59d7ad7 100644 (file)
@@ -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");
@@ -26,12 +26,14 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import org.junit.Test;
 import org.onap.policy.models.base.testconcepts.DummyPfObject;
+import org.onap.policy.models.base.testconcepts.DummyPfObjectComparator;
 import org.onap.policy.models.base.testconcepts.DummyPfObjectFilter;
 
 /**
@@ -96,7 +98,7 @@ public class PfObjectFilterTest {
         assertEquals(true, dof.filterString(HELLO, HELLO));
         assertEquals(true, dof.filterString(HELLO, null));
 
-        List<DummyPfObject> latestVersionList = dof.latestVersionFilter(doList);
+        List<DummyPfObject> latestVersionList = dof.latestVersionFilter(doList, new DummyPfObjectComparator());
         assertEquals(3, latestVersionList.size());
         assertEquals("aaaaa", latestVersionList.get(0).getName());
         assertEquals(VERSION002, latestVersionList.get(0).getVersion());
@@ -107,7 +109,8 @@ public class PfObjectFilterTest {
 
         latestVersionList.remove(2);
         latestVersionList.remove(1);
-        List<DummyPfObject> newestVersionList = dof.latestVersionFilter(latestVersionList);
+        List<DummyPfObject> newestVersionList = dof.latestVersionFilter(latestVersionList,
+            new DummyPfObjectComparator());
         assertEquals(latestVersionList, newestVersionList);
 
         MyFilter filter = new MyFilter();
index 53009dd..9759f4a 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  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.
@@ -33,21 +33,8 @@ import org.onap.policy.models.base.PfNameVersion;
  */
 @Data
 @RequiredArgsConstructor
-public class DummyPfObject implements PfNameVersion, Comparable<DummyPfObject> {
+public class DummyPfObject implements PfNameVersion {
     private String name;
     private String version;
     private String description;
-
-    @Override
-    public int compareTo(@NonNull final DummyPfObject otherObject) {
-        int result = ObjectUtils.compare(this.name, otherObject.name);
-        if (result != 0) {
-            return result;
-        }
-        result = ObjectUtils.compare(this.version, otherObject.version);
-        if (result != 0) {
-            return result;
-        }
-        return ObjectUtils.compare(this.description, otherObject.description);
-    }
 }
diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectComparator.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectComparator.java
new file mode 100644 (file)
index 0000000..f83bce6
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============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.base.testconcepts;
+
+import java.util.Comparator;
+import org.onap.policy.models.base.PfNameVersion;
+
+/**
+ * Compare two PfNameVersion objects.
+ */
+public class DummyPfObjectComparator implements Comparator<DummyPfObject> {
+
+    @Override
+    public int compare(final DummyPfObject left, final DummyPfObject right) {
+        return left.compareNameVersion(left, right);
+    }
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityAssignment.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityAssignment.java
new file mode 100644 (file)
index 0000000..207f07a
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.tosca.authorative.concepts;
+
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ToscaCapabilityAssignment extends ToscaEntity {
+    private Map<String, Object> properties;
+    private Map<String, Object> attributes;
+    private List<Object> occurrences;
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaCapabilityType.java
new file mode 100644 (file)
index 0000000..dd8fb05
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * 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.tosca.authorative.concepts;
+
+import java.util.Map;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class ToscaCapabilityType extends ToscaEntity {
+    private Map<String, ToscaProperty> properties;
+}
index 582b73c..33235a4 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications 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.
@@ -35,7 +35,6 @@ import lombok.Data;
  */
 @Data
 public class ToscaConstraint {
-
     @ApiModelProperty(name = "valid_values")
     @SerializedName("valid_values")
     private List<String> validValues;
@@ -57,5 +56,4 @@ public class ToscaConstraint {
     @ApiModelProperty(name = "less_or_equal")
     @SerializedName("less_or_equal")
     private String lessOrEqual;
-
 }
index b07163b..6ea8804 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications 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.
index b242bff..10d3b7a 100644 (file)
@@ -44,7 +44,6 @@ import org.onap.policy.models.base.PfNameVersion;
 @NoArgsConstructor
 public class ToscaEntity implements PfNameVersion {
     private String name;
-
     private String version;
 
     @ApiModelProperty(name = "derived_from")
@@ -52,7 +51,6 @@ public class ToscaEntity implements PfNameVersion {
     private String derivedFrom;
 
     private Map<String, String> metadata;
-
     private String description;
 
     /**
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeTemplate.java
new file mode 100644 (file)
index 0000000..343eb8e
--- /dev/null
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * 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.tosca.authorative.concepts;
+
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class ToscaNodeTemplate extends ToscaEntity {
+    private String type;
+    private Map<String, Object> properties;
+    private List<Map<String, ToscaRequirement>> requirements;
+    private Map<String, ToscaCapabilityAssignment> capabilities;
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaNodeType.java
new file mode 100644 (file)
index 0000000..5a4c941
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * 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.tosca.authorative.concepts;
+
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class ToscaNodeType extends ToscaEntity {
+    private Map<String, ToscaProperty> properties;
+    private List<Map<String, ToscaRequirement>> requirements;
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaParameter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaParameter.java
new file mode 100644 (file)
index 0000000..290bdac
--- /dev/null
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * 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.tosca.authorative.concepts;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+public class ToscaParameter {
+    private String name;
+    private String type;
+
+    @ApiModelProperty(name = "type_version")
+    @SerializedName("type_version")
+
+    private String typeVersion;
+    private Object value;
+}
index 27d4eb2..c98a844 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications 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.
@@ -43,7 +43,7 @@ import lombok.ToString;
 @EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
 @ToString(callSuper = true)
-public class ToscaPolicy extends ToscaEntity implements Comparable<ToscaPolicy> {
+public class ToscaPolicy extends ToscaEntity {
     private String type;
 
     @ApiModelProperty(name = "type_version")
@@ -88,9 +88,4 @@ public class ToscaPolicy extends ToscaEntity implements Comparable<ToscaPolicy>
     public ToscaPolicyTypeIdentifier getTypeIdentifier() {
         return new ToscaPolicyTypeIdentifier(getType(), getTypeVersion());
     }
-
-    @Override
-    public int compareTo(final ToscaPolicy other) {
-        return compareNameVersion(this, other);
-    }
 }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyComparator.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyComparator.java
new file mode 100644 (file)
index 0000000..8bbe70d
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.tosca.authorative.concepts;
+
+import java.util.Comparator;
+
+/**
+ * Compare two ToscaPolicy objects.
+ */
+public class ToscaPolicyComparator implements Comparator<ToscaPolicy> {
+
+    @Override
+    public int compare(final ToscaPolicy left, final ToscaPolicy right) {
+        return left.compareNameVersion(left, right);
+    }
+}
index 33170db..86c2e6f 100644 (file)
@@ -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");
@@ -67,7 +67,7 @@ public class ToscaPolicyFilter implements PfObjectFilter<ToscaPolicy> {
         // @formatter:off
 
         if (LATEST_VERSION.equals(version)) {
-            return this.latestVersionFilter(returnList);
+            return this.latestVersionFilter(returnList, new ToscaPolicyComparator());
         } else  {
             return returnList;
         }
index 43e7114..29bff91 100644 (file)
@@ -22,6 +22,7 @@
 package org.onap.policy.models.tosca.authorative.concepts;
 
 import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
@@ -35,9 +36,11 @@ import org.apache.commons.lang3.ObjectUtils;
 public class ToscaPolicyIdentifierOptVersion implements Comparable<ToscaPolicyIdentifierOptVersion> {
 
     @NonNull
+    @ApiModelProperty(name = "policy-id")
     @SerializedName("policy-id")
     private String name;
 
+    @ApiModelProperty(name = "policy-version")
     @SerializedName("policy-version")
     private String version;
 
index f948eda..af8f5fa 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications 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.
@@ -39,7 +39,7 @@ import lombok.NonNull;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
-public class ToscaPolicyType extends ToscaEntity implements Comparable<ToscaPolicyType> {
+public class ToscaPolicyType extends ToscaEntity {
     private Map<String, ToscaProperty> properties;
 
     /**
@@ -57,9 +57,4 @@ public class ToscaPolicyType extends ToscaEntity implements Comparable<ToscaPoli
             }
         }
     }
-
-    @Override
-    public int compareTo(final ToscaPolicyType other) {
-        return compareNameVersion(this, other);
-    }
 }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeComparator.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeComparator.java
new file mode 100644 (file)
index 0000000..9f45a78
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============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.tosca.authorative.concepts;
+
+import java.util.Comparator;
+
+/**
+ * Compare two ToscaPolicyType objects.
+ */
+public class ToscaPolicyTypeComparator implements Comparator<ToscaPolicyType> {
+
+    @Override
+    public int compare(final ToscaPolicyType left, final ToscaPolicyType right) {
+        return left.compareNameVersion(left, right);
+    }
+}
index da6c561..4e9810b 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  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.
@@ -55,7 +55,7 @@ public class ToscaPolicyTypeFilter implements PfObjectFilter<ToscaPolicyType> {
         // @formatter:off
 
         if (LATEST_VERSION.equals(version)) {
-            return this.latestVersionFilter(returnList);
+            return this.latestVersionFilter(returnList, new ToscaPolicyTypeComparator());
         } else  {
             return returnList;
         }
index 59fbc8b..0bd0d44 100644 (file)
@@ -41,9 +41,10 @@ public class ToscaProperty {
     }
 
     private String name;
-
     private String type;
 
+    @ApiModelProperty(name = "type_version")
+    @SerializedName("type_version")
     private String typeVersion;
 
     private String description;
@@ -53,14 +54,16 @@ public class ToscaProperty {
     private Object defaultValue;
 
     private boolean required = false;
-
     private Status status;
-
     private List<ToscaConstraint> constraints;
 
+    @ApiModelProperty(name = "key_schema")
+    @SerializedName("key_schema")
+    private ToscaSchemaDefinition keySchema;
+
     @ApiModelProperty(name = "entry_schema")
     @SerializedName("entry_schema")
-    private ToscaEntrySchema entrySchema;
+    private ToscaSchemaDefinition entrySchema;
 
     private Map<String, String> metadata;
 }
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRelationshipType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRelationshipType.java
new file mode 100644 (file)
index 0000000..9e43d89
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Model
+ * ================================================================================
+ * 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.tosca.authorative.concepts;
+
+import java.util.Map;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+public class ToscaRelationshipType extends ToscaEntity {
+    private Map<String, ToscaProperty> properties;
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRequirement.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaRequirement.java
new file mode 100644 (file)
index 0000000..34dbb4f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * ============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.tosca.authorative.concepts;
+
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+
+@Data
+public class ToscaRequirement extends ToscaEntity {
+    private String capability;
+    private String node;
+    private String relationship;
+    private List<Object> occurrences;
+    private Map<String, Object> properties;
+}
 
 package org.onap.policy.models.tosca.authorative.concepts;
 
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import java.util.List;
 import lombok.Data;
 
 /**
- * Class to represent TOSCA entry schema matching input/output from/to client.
+ * Class to represent TOSCA schema matching input/output from/to client.
  *
  * @author Chenfei Gao (cgao@research.att.com)
  */
 @Data
-public class ToscaEntrySchema {
+public class ToscaSchemaDefinition {
     private String name;
-
     private String type;
 
+    @ApiModelProperty(name = "type_version")
+    @SerializedName("type_version")
     private String typeVersion;
 
     private String description;
-
     private List<ToscaConstraint> constraints;
 }
index 1739196..e83d173 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications 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.
@@ -37,28 +37,39 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = true)
 public class ToscaServiceTemplate extends ToscaEntity {
-
     @ApiModelProperty(name = "tosca_definitions_version")
     @SerializedName("tosca_definitions_version")
     private String toscaDefinitionsVersion;
 
-    @ApiModelProperty(name = "topology_template")
-    @SerializedName("topology_template")
-    private ToscaTopologyTemplate toscaTopologyTemplate;
+    @ApiModelProperty(name = "data_types")
+    @SerializedName("data_types")
+    private Map<String, ToscaDataType> dataTypes;
+
+    @ApiModelProperty(name = "capability_types")
+    @SerializedName("capability_types")
+    private Map<String, ToscaCapabilityType> capabilityTypes;
+
+    @ApiModelProperty(name = "node_types")
+    @SerializedName("node_types")
+    private Map<String, ToscaNodeType> nodeTypes;
+
+    @ApiModelProperty(name = "relationship_types")
+    @SerializedName("relationship_types")
+    private Map<String, ToscaRelationshipType> relationshipTypes;
 
     @ApiModelProperty(name = "policy_types")
     @SerializedName("policy_types")
     private Map<String, ToscaPolicyType> policyTypes;
 
-    @ApiModelProperty(name = "data_types")
-    @SerializedName("data_types")
-    private Map<String, ToscaDataType> dataTypes;
-
-    public Map<ToscaEntityKey, ToscaPolicyType> getPolicyTypesAsMap() {
-        return ToscaEntity.getEntityMapAsMap(policyTypes);
-    }
+    @ApiModelProperty(name = "topology_template")
+    @SerializedName("topology_template")
+    private ToscaTopologyTemplate toscaTopologyTemplate;
 
     public Map<ToscaEntityKey, ToscaDataType> getDataTypesAsMap() {
         return ToscaEntity.getEntityMapAsMap(dataTypes);
     }
-}
\ No newline at end of file
+
+    public Map<ToscaEntityKey, ToscaPolicyType> getPolicyTypesAsMap() {
+        return ToscaEntity.getEntityMapAsMap(policyTypes);
+    }
+}
index 74ebf07..a243b16 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP Policy Model
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.
@@ -22,6 +23,8 @@
 
 package org.onap.policy.models.tosca.authorative.concepts;
 
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import java.util.List;
 import java.util.Map;
 import lombok.Data;
@@ -33,9 +36,14 @@ import lombok.Data;
  */
 @Data
 public class ToscaTopologyTemplate {
-
     private String description;
 
+    private Map<String, ToscaParameter> inputs;
+
+    @ApiModelProperty(name = "node_templates")
+    @SerializedName("node_templates")
+    private Map<String, ToscaNodeTemplate> nodeTemplates;
+
     private List<Map<String, ToscaPolicy>> policies;
 
     public Map<ToscaEntityKey, ToscaPolicy> getPoliciesAsMap() {
index 1db09b8..f100c89 100644 (file)
@@ -27,4 +27,4 @@
  * @author Chenfei Gao (cgao@research.att.com)
  *
  */
-package org.onap.policy.models.tosca.authorative.concepts;
\ No newline at end of file
+package org.onap.policy.models.tosca.authorative.concepts;
index b697d51..ef6aa7e 100644 (file)
@@ -42,7 +42,7 @@ import org.onap.policy.models.base.PfValidationMessage;
 import org.onap.policy.models.base.PfValidationResult;
 import org.onap.policy.models.base.PfValidationResult.ValidationResult;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaConstraint;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaEntrySchema;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaSchemaDefinition;
 
 /**
  * Class to represent the EntrySchema of list/map property in TOSCA definition.
@@ -54,7 +54,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntrySchema;
 @EqualsAndHashCode(callSuper = false)
 @NoArgsConstructor
 public class JpaToscaEntrySchema
-        implements PfAuthorative<ToscaEntrySchema>, Serializable, Comparable<JpaToscaEntrySchema> {
+        implements PfAuthorative<ToscaSchemaDefinition>, Serializable, Comparable<JpaToscaEntrySchema> {
 
     private static final long serialVersionUID = 3645882081163287058L;
 
@@ -93,13 +93,13 @@ public class JpaToscaEntrySchema
      *
      * @param authorativeConcept the authorative concept to copy from
      */
-    public JpaToscaEntrySchema(final ToscaEntrySchema authorativeConcept) {
+    public JpaToscaEntrySchema(final ToscaSchemaDefinition authorativeConcept) {
         this.fromAuthorative(authorativeConcept);
     }
 
     @Override
-    public ToscaEntrySchema toAuthorative() {
-        ToscaEntrySchema toscaEntrySchema = new ToscaEntrySchema();
+    public ToscaSchemaDefinition toAuthorative() {
+        ToscaSchemaDefinition toscaEntrySchema = new ToscaSchemaDefinition();
 
         toscaEntrySchema.setType(type.getName());
         toscaEntrySchema.setTypeVersion(type.getVersion());
@@ -120,7 +120,7 @@ public class JpaToscaEntrySchema
     }
 
     @Override
-    public void fromAuthorative(final ToscaEntrySchema toscaEntrySchema) {
+    public void fromAuthorative(final ToscaSchemaDefinition toscaEntrySchema) {
         if (toscaEntrySchema.getTypeVersion() != null) {
             type = new PfConceptKey(toscaEntrySchema.getType(), toscaEntrySchema.getTypeVersion());
         } else {
index faafa8c..9fd5593 100644 (file)
@@ -56,11 +56,11 @@ public class ToscaPolicyTest {
         assertEquals("3.2.1", type.getVersion());
 
         ToscaPolicy clonedPolicy0 = new ToscaPolicy(policy);
-        assertEquals(0, policy.compareTo(clonedPolicy0));
+        assertEquals(0, new ToscaPolicyComparator().compare(policy, clonedPolicy0));
 
         policy.setProperties(new LinkedHashMap<String, Object>());
         policy.getProperties().put("PropertyKey", "PropertyValue");
         ToscaPolicy clonedPolicy1 = new ToscaPolicy(policy);
-        assertEquals(0, policy.compareTo(clonedPolicy1));
+        assertEquals(0, new ToscaPolicyComparator().compare(policy, clonedPolicy1));
     }
 }
index fc9c693..75c6b51 100644 (file)
@@ -46,7 +46,7 @@ public class ToscaPolicyTypeTest {
         tpt.setDescription("Desc");
 
         ToscaPolicyType clonedTpt0 = new ToscaPolicyType(tpt);
-        assertEquals(0, tpt.compareTo(clonedTpt0));
+        assertEquals(0, new ToscaPolicyTypeComparator().compare(tpt, clonedTpt0));
 
         tpt.setMetadata(new LinkedHashMap<>());
         tpt.setProperties(new LinkedHashMap<>());
@@ -57,6 +57,6 @@ public class ToscaPolicyTypeTest {
         tpt.getProperties().put("Property0", tp);
 
         ToscaPolicyType clonedTpt1 = new ToscaPolicyType(tpt);
-        assertEquals(0, tpt.compareTo(clonedTpt1));
+        assertEquals(0, new ToscaPolicyTypeComparator().compare(tpt, clonedTpt1));
     }
 }