aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/test
diff options
context:
space:
mode:
authoruj426b <uj426b@att.com>2020-07-31 12:06:01 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-08-20 12:23:26 +0000
commitdbb37442ecf243d3bcaf50f908691ad6f810ccfc (patch)
tree98663790800976a1785b1d127a9fb677712c0759 /models-tosca/src/test
parente88e4b3281fa4881093ccd1dfae8f826a5e9ff5a (diff)
Sonar Fixes policy/models, removing model-yaml
Change-Id: Icd82ea1aef90e4d638b13958519aac5ed5a53f73 Issue-ID: POLICY-2714 Signed-off-by: uj426b <uj426b@att.com>
Diffstat (limited to 'models-tosca/src/test')
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaIdentifierTestBase.java4
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java26
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java4
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java9
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java9
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java13
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java9
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java13
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java21
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java30
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java15
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java11
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java11
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java27
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java32
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java48
16 files changed, 149 insertions, 133 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaIdentifierTestBase.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaIdentifierTestBase.java
index d7bca2808..5419b217b 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaIdentifierTestBase.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaIdentifierTestBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,7 +67,7 @@ public class ToscaIdentifierTestBase<T extends Comparable<T>> {
assertTrue(ident.compareTo(null) > 0);
- assertTrue(ident.compareTo(makeIdent(NAME, VERSION)) == 0);
+ assertEquals(0, ident.compareTo(makeIdent(NAME, VERSION)));
assertTrue(ident.compareTo(makeIdent(NAME, null)) > 0);
assertTrue(ident.compareTo(makeIdent(null, VERSION)) > 0);
assertTrue(ident.compareTo(makeIdent(NAME, VERSION + "a")) < 0);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java
index 969e24003..7d900ab3a 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,7 +129,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
ToscaServiceTemplate gotServiceTemplate =
new AuthorativeToscaProvider().getPolicies(pfDao, policyKey.getName(), policyKey.getVersion());
@@ -137,7 +137,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy gotPolicy =
gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
- assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
+ assertEquals(beforePolicy.getType(), gotPolicy.getType());
List<ToscaPolicy> gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, POLICY1, VERSION_100);
assertEquals(1, gotPolicyList.size());
@@ -200,7 +200,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
ToscaServiceTemplate gotServiceTemplate =
new AuthorativeToscaProvider().getFilteredPolicies(pfDao, ToscaPolicyFilter.builder().build());
@@ -208,21 +208,21 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy gotPolicy =
gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
- assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
+ assertEquals(beforePolicy.getType(), gotPolicy.getType());
gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicies(pfDao,
ToscaPolicyFilter.builder().name(policyKey.getName()).build());
gotPolicy = gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
- assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
+ assertEquals(beforePolicy.getType(), gotPolicy.getType());
gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicies(pfDao,
ToscaPolicyFilter.builder().name(policyKey.getName()).version(VERSION_100).build());
gotPolicy = gotServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, gotPolicy));
- assertTrue(beforePolicy.getType().equals(gotPolicy.getType()));
+ assertEquals(beforePolicy.getType(), gotPolicy.getType());
List<ToscaPolicy> gotPolicyList = new AuthorativeToscaProvider().getPolicyList(pfDao, POLICY1, VERSION_100);
assertEquals(1, gotPolicyList.size());
@@ -274,7 +274,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
}
@Test
@@ -311,7 +311,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
ToscaServiceTemplate updatedServiceTemplate =
new AuthorativeToscaProvider().updatePolicies(pfDao, toscaServiceTemplate);
@@ -319,7 +319,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy updatedPolicy =
updatedServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, updatedPolicy));
- assertTrue(beforePolicy.getType().equals(updatedPolicy.getType()));
+ assertEquals(beforePolicy.getType(), updatedPolicy.getType());
}
@Test
@@ -368,7 +368,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
ToscaServiceTemplate deletedServiceTemplate =
new AuthorativeToscaProvider().deletePolicy(pfDao, policyKey.getName(), policyKey.getVersion());
@@ -376,7 +376,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy deletedPolicy =
deletedServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(deletedPolicy.getType()));
+ assertEquals(beforePolicy.getType(), deletedPolicy.getType());
// @formatter:off
assertThatThrownBy(
@@ -438,7 +438,7 @@ public class AuthorativeToscaProviderPolicyTest {
ToscaPolicy createdPolicy =
createdServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyKey.getName());
assertEquals(0, beforePolicy.compareNameVersion(beforePolicy, createdPolicy));
- assertTrue(beforePolicy.getType().equals(createdPolicy.getType()));
+ assertEquals(beforePolicy.getType(), createdPolicy.getType());
assertEquals(1, toscaServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
assertEquals(1, createdServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
index cd35f710a..5258053e9 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -97,6 +97,6 @@ public class ToscaServiceTemplateMappingTest {
JpaToscaServiceTemplate internalPolicyTypes2 = new JpaToscaServiceTemplate();
internalPolicyTypes2.fromAuthorative(plainPolicyTypes2);
assertTrue(internalPolicyTypes2.validate(new PfValidationResult()).isValid());
- assertTrue(internalPolicyTypes.compareTo(internalPolicyTypes2) == 0);
+ assertEquals(0, internalPolicyTypes.compareTo(internalPolicyTypes2));
}
}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
index c2f372f80..e00e48f21 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -88,16 +89,16 @@ public class JpaToscaDataTypeTest {
assertEquals(-1, tdt.compareTo(null));
assertEquals(0, tdt.compareTo(tdt));
- assertFalse(tdt.compareTo(tdt.getKey()) == 0);
+ assertNotEquals(0, tdt.compareTo(tdt.getKey()));
PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001);
JpaToscaDataType otherDt = new JpaToscaDataType(otherDtKey);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setKey(dtKey);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setConstraints(constraints);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setProperties(properties);
assertEquals(0, tdt.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java
index d897344e5..83d6aad97 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -78,11 +79,11 @@ public class JpaToscaEntrySchemaTest {
JpaToscaEntrySchema otherEs = new JpaToscaEntrySchema(typeKey);
- assertFalse(tes.compareTo(otherEs) == 0);
+ assertNotEquals(0, tes.compareTo(otherEs));
otherEs.setType(typeKey);
- assertFalse(tes.compareTo(otherEs) == 0);
+ assertNotEquals(0, tes.compareTo(otherEs));
otherEs.setDescription(A_DESCRIPTION);
- assertFalse(tes.compareTo(otherEs) == 0);
+ assertNotEquals(0, tes.compareTo(otherEs));
otherEs.setConstraints(constraints);
assertEquals(0, tes.compareTo(otherEs));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
index 498a768ff..f07a18223 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -84,18 +85,18 @@ public class JpaToscaEventFilterTest {
assertEquals(-1, tef.compareTo(null));
assertEquals(0, tef.compareTo(tef));
- assertFalse(tef.compareTo(tef.getKey()) == 0);
+ assertNotEquals(0, tef.compareTo(tef.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", VERSION_001, "OtherEventFilter");
JpaToscaEventFilter otherDt = new JpaToscaEventFilter(otherDtKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setKey(efKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setNode(nodeKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setRequirement(A_REQUREMENT);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setCapability(A_CAPABILITY);
assertEquals(0, tef.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
index 51a5d3c7a..61118c4b6 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -80,14 +81,14 @@ public class JpaToscaModelTest {
assertEquals(-1, tm.compareTo(null));
assertEquals(0, tm.compareTo(tm));
- assertFalse(tm.compareTo(tm.getKey()) == 0);
+ assertNotEquals(0, tm.compareTo(tm.getKey()));
PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001);
JpaToscaModel otherDt = new JpaToscaModel(otherDtKey);
- assertFalse(tm.compareTo(otherDt) == 0);
+ assertNotEquals(0, tm.compareTo(otherDt));
otherDt.setKey(tmKey);
- assertFalse(tm.compareTo(otherDt) == 0);
+ assertNotEquals(0, tm.compareTo(otherDt));
otherDt.setServiceTemplates(tsts);
assertEquals(0, tm.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
index c4cb61cc8..14a0b6a96 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -105,18 +106,18 @@ public class JpaToscaPolicyTest {
assertEquals(-1, tp.compareTo(null));
assertEquals(0, tp.compareTo(tp));
- assertFalse(tp.compareTo(tp.getKey()) == 0);
+ assertNotEquals(0, tp.compareTo(tp.getKey()));
PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001);
JpaToscaPolicy otherDt = new JpaToscaPolicy(otherDtKey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setKey(tpKey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setType(ptKey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setProperties(propertyMap);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setTargets(targets);
assertEquals(0, tp.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
index 34cc504b8..5a18902d0 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -103,24 +104,24 @@ public class JpaToscaPolicyTypeTest {
assertEquals(-1, tpt.compareTo(null));
assertEquals(0, tpt.compareTo(tpt));
- assertFalse(tpt.compareTo(tpt.getKey()) == 0);
+ assertNotEquals(0, tpt.compareTo(tpt.getKey()));
PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001);
JpaToscaPolicyType otherDt = new JpaToscaPolicyType(otherDtKey);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setKey(ptKey);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setDerivedFrom(derivedFromKey);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setMetadata(metadata);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setDescription(A_DESCRIPTION);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setProperties(properties);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setTargets(targets);
- assertFalse(tpt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tpt.compareTo(otherDt));
otherDt.setTriggers(triggers);
assertEquals(0, tpt.compareTo(otherDt));
@@ -181,7 +182,7 @@ public class JpaToscaPolicyTypeTest {
JpaToscaEntityType<ToscaPolicy> tet = new JpaToscaEntityType<>(tpt.getKey());
assertEquals(-1, tet.compareTo(null));
assertEquals(0, tet.compareTo(tet));
- assertFalse(tet.compareTo(tet.getKey()) == 0);
+ assertNotEquals(0, tet.compareTo(tet.getKey()));
assertNotNull(new JpaToscaPolicyType(new ToscaPolicyType()));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
index f06d4ffcb..ac2f6030f 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,9 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -102,7 +104,7 @@ public class JpaToscaPropertyTest {
assertEquals(tp, tdtClone0);
assertEquals(0, tp.compareTo(tdtClone0));
- assertTrue(tdtClone0.getMetadata() != tp.getMetadata());
+ assertNotSame(tdtClone0.getMetadata(), tp.getMetadata());
JpaToscaProperty tdtClone1 = new JpaToscaProperty(tp);
assertEquals(tp, tdtClone1);
@@ -110,37 +112,37 @@ public class JpaToscaPropertyTest {
assertEquals(-1, tp.compareTo(null));
assertEquals(0, tp.compareTo(tp));
- assertFalse(tp.compareTo(tp.getKey()) == 0);
+ assertNotEquals(0, tp.compareTo(tp.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", VERSION_001, "OtherProperty");
JpaToscaProperty otherDt = new JpaToscaProperty(otherDtKey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setKey(pkey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setType(ptypeKey);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setDescription(A_DESCRIPTION);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setRequired(false);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setDefaultValue(DEFAULT_KEY);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setStatus(ToscaProperty.Status.SUPPORTED);
- assertFalse(tp.compareTo(otherDt) == 0);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setConstraints(constraints);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setEntrySchema(tes);
assertEquals(0, tp.compareTo(otherDt));
otherDt.setRequired(true);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setRequired(false);
assertEquals(0, tp.compareTo(otherDt));
otherDt.setStatus(ToscaProperty.Status.UNSUPPORTED);
- assertFalse(tp.compareTo(otherDt) == 0);
+ assertNotEquals(0, tp.compareTo(otherDt));
otherDt.setStatus(ToscaProperty.Status.SUPPORTED);
assertEquals(0, tp.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
index c7a87e5fd..65d832b98 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -100,20 +101,20 @@ public class JpaToscaServiceTemplateTest {
assertEquals(-1, tst.compareTo(null));
assertEquals(0, tst.compareTo(tst));
- assertFalse(tst.compareTo(tst.getKey()) == 0);
+ assertNotEquals(0, tst.compareTo(tst.getKey()));
PfConceptKey otherDtKey = new PfConceptKey("otherDt", VERSION_001);
JpaToscaServiceTemplate otherDt = new JpaToscaServiceTemplate(otherDtKey);
- assertFalse(tst.compareTo(otherDt) == 0);
+ assertNotEquals(0, tst.compareTo(otherDt));
otherDt.setKey(tstKey);
- assertFalse(tst.compareTo(otherDt) == 0);
+ assertNotEquals(0, tst.compareTo(otherDt));
otherDt.setToscaDefinitionsVersion("Tosca Version");
- assertFalse(tst.compareTo(otherDt) == 0);
+ assertNotEquals(0, tst.compareTo(otherDt));
otherDt.setDataTypes(dataTypes);
- assertFalse(tst.compareTo(otherDt) == 0);
+ assertNotEquals(0, tst.compareTo(otherDt));
otherDt.setPolicyTypes(policyTypes);
- assertFalse(tst.compareTo(otherDt) == 0);
+ assertNotEquals(0, tst.compareTo(otherDt));
otherDt.setTopologyTemplate(ttt);
assertEquals(0, tst.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
index 10e9388cb..ef9039af9 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -88,16 +89,16 @@ public class JpaToscaTimeIntervalTest {
assertEquals(-1, tti.compareTo(null));
assertEquals(0, tti.compareTo(tti));
- assertFalse(tti.compareTo(tti.getKey()) == 0);
+ assertNotEquals(0, tti.compareTo(tti.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherTimeInterval");
JpaToscaTimeInterval otherDt = new JpaToscaTimeInterval(otherDtKey);
- assertFalse(tti.compareTo(otherDt) == 0);
+ assertNotEquals(0, tti.compareTo(otherDt));
otherDt.setKey(ttiKey);
- assertFalse(tti.compareTo(otherDt) == 0);
+ assertNotEquals(0, tti.compareTo(otherDt));
otherDt.setStartTime(startTime);
- assertFalse(tti.compareTo(otherDt) == 0);
+ assertNotEquals(0, tti.compareTo(otherDt));
otherDt.setEndTime(endTime);
assertEquals(0, tti.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
index b9d4ad487..d42dfb09d 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -84,16 +85,16 @@ public class JpaToscaTopologyTemplateTest {
assertEquals(-1, ttt.compareTo(null));
assertEquals(0, ttt.compareTo(ttt));
- assertFalse(ttt.compareTo(ttt.getKey()) == 0);
+ assertNotEquals(0, ttt.compareTo(ttt.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherSt", VERSION_001, "otherDt");
JpaToscaTopologyTemplate otherDt = new JpaToscaTopologyTemplate(otherDtKey);
- assertFalse(ttt.compareTo(otherDt) == 0);
+ assertNotEquals(0, ttt.compareTo(otherDt));
otherDt.setKey(tttKey);
- assertFalse(ttt.compareTo(otherDt) == 0);
+ assertNotEquals(0, ttt.compareTo(otherDt));
otherDt.setDescription(A_DESCRIPTION);
- assertFalse(ttt.compareTo(otherDt) == 0);
+ assertNotEquals(0, ttt.compareTo(otherDt));
otherDt.setPolicies(policies);
assertEquals(0, ttt.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
index 62f96940b..3b196c478 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ package org.onap.policy.models.tosca.simple.concepts;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -113,35 +114,35 @@ public class JpaToscaTriggerTest {
assertEquals(-1, tdt.compareTo(null));
assertEquals(0, tdt.compareTo(tdt));
- assertFalse(tdt.compareTo(tdt.getKey()) == 0);
+ assertNotEquals(0, tdt.compareTo(tdt.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", VERSION_001, "OtherTrigger");
JpaToscaTrigger otherDt = new JpaToscaTrigger(otherDtKey);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setKey(tkey);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setDescription(A_DESCRIPTION);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setEventType(EVENT_TYPE);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setSchedule(schedule);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setTargetFilter(targetFilter);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setCondition(lsc);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setConstraint(lsc);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setPeriod(Duration.ZERO);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setMethod(A_METHOD);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setAction(ACTION);
assertEquals(0, tdt.compareTo(otherDt));
otherDt.setEvaluations(100);
- assertFalse(tdt.compareTo(otherDt) == 0);
+ assertNotEquals(0, tdt.compareTo(otherDt));
otherDt.setEvaluations(0);
assertEquals(0, tdt.compareTo(otherDt));
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
index a4b3de36c..87a52242f 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ public class MonitoringPolicySerializationTest {
ToscaServiceTemplateUtils.addFragment(policyTypeServiceTemplate, serviceTemplateFromJson);
verifyVcpeMonitoringInputDeserialization(mergedServiceTemplate);
JpaToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(VCPE_MON_INPUT_YAML);
- assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0);
+ assertEquals(0, serviceTemplateFromJson.compareTo(serviceTemplateFromYaml));
// vDNS
serviceTemplateFromJson = deserializeMonitoringInputJson(VDNS_MON_INPUT_JSON);
@@ -117,7 +117,7 @@ public class MonitoringPolicySerializationTest {
ToscaServiceTemplateUtils.addFragment(policyTypeServiceTemplate, serviceTemplateFromJson);
verifyVdnsMonitoringInputDeserialization(mergedServiceTemplate);
serviceTemplateFromYaml = deserializeMonitoringInputYaml(VDNS_MON_INPUT_YAML);
- assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0);
+ assertEquals(0, serviceTemplateFromJson.compareTo(serviceTemplateFromYaml));
// vFirewall
serviceTemplateFromJson = deserializeMonitoringInputJson(VFW_MON_INPUT_JSON);
@@ -125,7 +125,7 @@ public class MonitoringPolicySerializationTest {
ToscaServiceTemplateUtils.addFragment(policyTypeServiceTemplate, serviceTemplateFromJson);
verifyVfwMonitoringInputDeserialization(mergedServiceTemplate);
serviceTemplateFromYaml = deserializeMonitoringInputYaml(VFW_MON_INPUT_YAML);
- assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0);
+ assertEquals(0, serviceTemplateFromJson.compareTo(serviceTemplateFromYaml));
}
@Test
@@ -189,7 +189,7 @@ public class MonitoringPolicySerializationTest {
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap();
// Check policies
- assertTrue(policiesConceptMap.size() == 1);
+ assertEquals(1, policiesConceptMap.size());
assertEquals(POLICY1, policiesConceptMap.keySet().iterator().next().getName());
assertEquals("onap.restart.tca:1.0.0",
serviceTemplate.getTopologyTemplate().getPolicies().get(POLICY1).getId());
@@ -197,12 +197,12 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 2);
+ assertEquals(2, policyVal.getMetadata().size());
assertEquals(POLICY_ID, policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals(POLICY1, policyVal.getMetadata().entrySet().iterator().next().getValue());
// Check properties
- assertTrue(policiesConceptMap.values().iterator().next().getProperties().size() == 1);
+ assertEquals(1, policiesConceptMap.values().iterator().next().getProperties().size());
assertEquals(TCA_POLICY, policyVal.getProperties().keySet().iterator().next());
assertNotNull(policyVal.getProperties().values().iterator().next());
}
@@ -221,7 +221,7 @@ public class MonitoringPolicySerializationTest {
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap();
// Check policies
- assertTrue(policiesConceptMap.size() == 1);
+ assertEquals(1, policiesConceptMap.size());
assertEquals(POLICY2, policiesConceptMap.keySet().iterator().next().getName());
assertEquals("onap.scaleout.tca:1.0.0",
serviceTemplate.getTopologyTemplate().getPolicies().get(POLICY2).getId());
@@ -229,12 +229,12 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 2);
+ assertEquals(2, policyVal.getMetadata().size());
assertEquals(POLICY_ID, policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals(POLICY2, policyVal.getMetadata().entrySet().iterator().next().getValue());
// Check properties
- assertTrue(policiesConceptMap.values().iterator().next().getProperties().size() == 1);
+ assertEquals(1, policiesConceptMap.values().iterator().next().getProperties().size());
assertEquals(TCA_POLICY, policyVal.getProperties().keySet().iterator().next());
assertNotNull(policyVal.getProperties().values().iterator().next());
}
@@ -253,7 +253,7 @@ public class MonitoringPolicySerializationTest {
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap();
// Check policies
- assertTrue(policiesConceptMap.size() == 1);
+ assertEquals(1, policiesConceptMap.size());
assertEquals(POLICY3, policiesConceptMap.keySet().iterator().next().getName());
assertEquals("onap.vfirewall.tca:1.0.0",
serviceTemplate.getTopologyTemplate().getPolicies().get(POLICY3).getId());
@@ -261,12 +261,12 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 2);
+ assertEquals(2, policyVal.getMetadata().size());
assertEquals(POLICY_ID, policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals(POLICY3, policyVal.getMetadata().entrySet().iterator().next().getValue());
// Check properties
- assertTrue(policiesConceptMap.values().iterator().next().getProperties().size() == 1);
+ assertEquals(1, policiesConceptMap.values().iterator().next().getProperties().size());
assertEquals(TCA_POLICY, policyVal.getProperties().keySet().iterator().next());
assertNotNull(policyVal.getProperties().values().iterator().next());
}
@@ -277,7 +277,7 @@ public class MonitoringPolicySerializationTest {
assertEquals(YAML_VERSION, serviceTemplateJsonObject.get(DEFINITION_VERSION).getAsString());
JsonObject topologyTemplateJsonObject = serviceTemplateJsonObject.get(TOPOLOGY_TEMPLATE).getAsJsonObject();
JsonArray policiesJsonArray = topologyTemplateJsonObject.get(POLICIES).getAsJsonArray();
- assertTrue(policiesJsonArray.size() == 1);
+ assertEquals(1, policiesJsonArray.size());
JsonObject policy = policiesJsonArray.iterator().next().getAsJsonObject();
assertNotNull(policy.get(POLICY1));
JsonObject policyVal = policy.get(POLICY1).getAsJsonObject();
@@ -294,7 +294,7 @@ public class MonitoringPolicySerializationTest {
assertEquals(YAML_VERSION, serviceTemplateJsonObject.get(DEFINITION_VERSION).getAsString());
JsonObject topologyTemplateJsonObject = serviceTemplateJsonObject.get(TOPOLOGY_TEMPLATE).getAsJsonObject();
JsonArray policiesJsonArray = topologyTemplateJsonObject.get(POLICIES).getAsJsonArray();
- assertTrue(policiesJsonArray.size() == 1);
+ assertEquals(1, policiesJsonArray.size());
JsonObject policy = policiesJsonArray.iterator().next().getAsJsonObject();
assertNotNull(policy.get(POLICY2));
JsonObject policyVal = policy.get(POLICY2).getAsJsonObject();
@@ -311,7 +311,7 @@ public class MonitoringPolicySerializationTest {
assertEquals(YAML_VERSION, serviceTemplateJsonObject.get(DEFINITION_VERSION).getAsString());
JsonObject topologyTemplateJsonObject = serviceTemplateJsonObject.get(TOPOLOGY_TEMPLATE).getAsJsonObject();
JsonArray policiesJsonArray = topologyTemplateJsonObject.get(POLICIES).getAsJsonArray();
- assertTrue(policiesJsonArray.size() == 1);
+ assertEquals(1, policiesJsonArray.size());
JsonObject policy = policiesJsonArray.iterator().next().getAsJsonObject();
assertNotNull(policy.get(POLICY3));
JsonObject policyVal = policy.get(POLICY3).getAsJsonObject();
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
index 14d3a1980..4a8378f21 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java
@@ -148,7 +148,7 @@ public class MonitoringPolicyTypeSerializationTest {
// Check policy_types
Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap();
- assertTrue(policyTypesConceptMap.size() == 2);
+ assertEquals(2, policyTypesConceptMap.size());
Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator();
Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next();
@@ -162,7 +162,7 @@ public class MonitoringPolicyTypeSerializationTest {
assertEquals("onap.policies.monitoring.tcagen2", secondPolicyType.getKey().getName());
assertEquals(VERSION_100, secondPolicyType.getKey().getVersion());
assertEquals(MONITORING, secondPolicyType.getValue().getDerivedFrom().getName());
- assertTrue(secondPolicyType.getValue().getProperties().size() == 1);
+ assertEquals(1, secondPolicyType.getValue().getProperties().size());
JpaToscaProperty property = secondPolicyType.getValue().getProperties().values().iterator().next();
assertEquals("onap.policies.monitoring.tcagen2", property.getKey().getParentKeyName());
@@ -173,7 +173,7 @@ public class MonitoringPolicyTypeSerializationTest {
// Check data_types
Map<PfConceptKey, JpaToscaDataType> dataTypesConceptMap = serviceTemplate.getDataTypes().getConceptMap();
- assertTrue(dataTypesConceptMap.size() == 3);
+ assertEquals(3, dataTypesConceptMap.size());
Iterator<Entry<PfConceptKey, JpaToscaDataType>> dataTypesIter = dataTypesConceptMap.entrySet().iterator();
Entry<PfConceptKey, JpaToscaDataType> firstDataType = dataTypesIter.next();
@@ -181,7 +181,7 @@ public class MonitoringPolicyTypeSerializationTest {
JpaToscaDataType firstDataTypeVal = firstDataType.getValue();
assertEquals(DATATYPE_ROOT, firstDataTypeVal.getDerivedFrom().getName());
assertEquals(VERSION_000, firstDataTypeVal.getDerivedFrom().getVersion());
- assertTrue(firstDataTypeVal.getProperties().size() == 6);
+ assertEquals(6, firstDataTypeVal.getProperties().size());
Iterator<JpaToscaProperty> firstDataTypePropertiesIter = firstDataTypeVal.getProperties().values().iterator();
JpaToscaProperty firstDataTypeFirstProperty = firstDataTypePropertiesIter.next();
@@ -191,7 +191,7 @@ public class MonitoringPolicyTypeSerializationTest {
assertTrue(firstDataTypeFirstProperty.isRequired());
assertEquals("Specifies Control Loop Schema Type for the event Name e.g. VNF, VM",
firstDataTypeFirstProperty.getDescription());
- assertTrue(firstDataTypeFirstProperty.getConstraints().size() == 1);
+ assertEquals(1, firstDataTypeFirstProperty.getConstraints().size());
assertEquals("org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues",
firstDataTypeFirstProperty.getConstraints().iterator().next().getClass().getName());
assertEquals(2,
@@ -240,7 +240,7 @@ public class MonitoringPolicyTypeSerializationTest {
JpaToscaDataType secondDataTypeVal = secondDataType.getValue();
assertEquals(DATATYPE_ROOT, secondDataTypeVal.getDerivedFrom().getName());
assertEquals(VERSION_000, secondDataTypeVal.getDerivedFrom().getVersion());
- assertTrue(secondDataTypeVal.getProperties().size() == 2);
+ assertEquals(2, secondDataTypeVal.getProperties().size());
Iterator<JpaToscaProperty> secondDataTypePropertiesIter = secondDataTypeVal.getProperties().values().iterator();
JpaToscaProperty secondDataTypeFirstProperty = secondDataTypePropertiesIter.next();
@@ -250,7 +250,7 @@ public class MonitoringPolicyTypeSerializationTest {
assertTrue(secondDataTypeFirstProperty.isRequired());
assertEquals("Domain name to which TCA needs to be applied", secondDataTypeFirstProperty.getDescription());
assertEquals("measurementsForVfScaling", secondDataTypeFirstProperty.getDefaultValue());
- assertTrue(secondDataTypeFirstProperty.getConstraints().size() == 1);
+ assertEquals(1, secondDataTypeFirstProperty.getConstraints().size());
assertTrue(secondDataTypeFirstProperty.getConstraints().iterator().next() instanceof JpaToscaConstraintLogical);
assertEquals("measurementsForVfScaling",
((JpaToscaConstraintLogical) (secondDataTypeFirstProperty.getConstraints().iterator().next()))
@@ -271,7 +271,7 @@ public class MonitoringPolicyTypeSerializationTest {
JpaToscaDataType thirdDataTypeVal = thirdDataType.getValue();
assertEquals(DATATYPE_ROOT, thirdDataTypeVal.getDerivedFrom().getName());
assertEquals(VERSION_000, thirdDataTypeVal.getDerivedFrom().getVersion());
- assertTrue(thirdDataTypeVal.getProperties().size() == 7);
+ assertEquals(7, thirdDataTypeVal.getProperties().size());
Iterator<JpaToscaProperty> thirdDataTypePropertiesIter = thirdDataTypeVal.getProperties().values().iterator();
JpaToscaProperty thirdDataTypeFirstProperty = thirdDataTypePropertiesIter.next();
@@ -289,13 +289,14 @@ public class MonitoringPolicyTypeSerializationTest {
assertTrue(thirdDataTypeSecondProperty.isRequired());
assertEquals("Closed Loop Event Status of the threshold", thirdDataTypeSecondProperty.getDescription());
assertNotNull(thirdDataTypeSecondProperty.getConstraints());
- assertTrue(thirdDataTypeSecondProperty.getConstraints().size() == 1);
+ assertEquals(1, thirdDataTypeSecondProperty.getConstraints().size());
assertEquals("JpaToscaConstraintValidValues(validValues=[ONSET, ABATED])",
thirdDataTypeSecondProperty.getConstraints().iterator().next().toString());
assertTrue(thirdDataTypeSecondProperty.getConstraints().iterator()
.next() instanceof JpaToscaConstraintValidValues);
- assertTrue(((JpaToscaConstraintValidValues) (thirdDataTypeSecondProperty.getConstraints().iterator().next()))
- .getValidValues().size() == 2);
+ assertEquals(2,
+ ((JpaToscaConstraintValidValues) (thirdDataTypeSecondProperty.getConstraints().iterator().next()))
+ .getValidValues().size());
JpaToscaProperty thirdDataTypeThirdProperty = thirdDataTypePropertiesIter.next();
assertEquals(THRESHOLDS, thirdDataTypeThirdProperty.getKey().getParentKeyName());
@@ -304,12 +305,13 @@ public class MonitoringPolicyTypeSerializationTest {
assertTrue(thirdDataTypeThirdProperty.isRequired());
assertEquals("Direction of the threshold", thirdDataTypeThirdProperty.getDescription());
assertNotNull(thirdDataTypeThirdProperty.getConstraints());
- assertTrue(thirdDataTypeThirdProperty.getConstraints().size() == 1);
+ assertEquals(1, thirdDataTypeThirdProperty.getConstraints().size());
assertEquals(
"JpaToscaConstraintValidValues(validValues=[LESS, LESS_OR_EQUAL, GREATER, GREATER_OR_EQUAL, EQUAL])",
thirdDataTypeThirdProperty.getConstraints().iterator().next().toString());
- assertTrue(((JpaToscaConstraintValidValues) (thirdDataTypeThirdProperty.getConstraints().iterator().next()))
- .getValidValues().size() == 5);
+ assertEquals(5,
+ ((JpaToscaConstraintValidValues) (thirdDataTypeThirdProperty.getConstraints().iterator().next()))
+ .getValidValues().size());
JpaToscaProperty thirdDataTypeFourthProperty = thirdDataTypePropertiesIter.next();
assertEquals(THRESHOLDS, thirdDataTypeFourthProperty.getKey().getParentKeyName());
@@ -319,9 +321,10 @@ public class MonitoringPolicyTypeSerializationTest {
assertEquals("Json field Path as per CEF message which needs to be analyzed for TCA",
thirdDataTypeFourthProperty.getDescription());
assertNotNull(thirdDataTypeFourthProperty.getConstraints());
- assertTrue(thirdDataTypeFourthProperty.getConstraints().size() == 1);
- assertTrue(((JpaToscaConstraintValidValues) (thirdDataTypeFourthProperty.getConstraints().iterator().next()))
- .getValidValues().size() == 43);
+ assertEquals(1, thirdDataTypeFourthProperty.getConstraints().size());
+ assertEquals(43,
+ ((JpaToscaConstraintValidValues) (thirdDataTypeFourthProperty.getConstraints().iterator().next()))
+ .getValidValues().size());
JpaToscaProperty thirdDataTypeFifthProperty = thirdDataTypePropertiesIter.next();
assertEquals(THRESHOLDS, thirdDataTypeFifthProperty.getKey().getParentKeyName());
@@ -330,11 +333,12 @@ public class MonitoringPolicyTypeSerializationTest {
assertTrue(thirdDataTypeFifthProperty.isRequired());
assertEquals("Threshold Event Severity", thirdDataTypeFifthProperty.getDescription());
assertNotNull(thirdDataTypeFifthProperty.getConstraints());
- assertTrue(thirdDataTypeFifthProperty.getConstraints().size() == 1);
+ assertEquals(1, thirdDataTypeFifthProperty.getConstraints().size());
assertEquals("JpaToscaConstraintValidValues(validValues=[CRITICAL, MAJOR, MINOR, WARNING, NORMAL])",
thirdDataTypeFifthProperty.getConstraints().iterator().next().toString());
- assertTrue(((JpaToscaConstraintValidValues) (thirdDataTypeFifthProperty.getConstraints().iterator().next()))
- .getValidValues().size() == 5);
+ assertEquals(5,
+ ((JpaToscaConstraintValidValues) (thirdDataTypeFifthProperty.getConstraints().iterator().next()))
+ .getValidValues().size());
;
JpaToscaProperty thirdDataTypeSixthProperty = thirdDataTypePropertiesIter.next();
@@ -365,7 +369,7 @@ public class MonitoringPolicyTypeSerializationTest {
// Check policy_types
Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap();
- assertTrue(policyTypesConceptMap.size() == 2);
+ assertEquals(2, policyTypesConceptMap.size());
Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator();
Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next();
@@ -379,7 +383,7 @@ public class MonitoringPolicyTypeSerializationTest {
assertEquals(DCAE, secondPolicyType.getKey().getName());
assertEquals(VERSION_100, secondPolicyType.getKey().getVersion());
assertEquals("onap.policies.Monitoring", secondPolicyType.getValue().getDerivedFrom().getName());
- assertTrue(secondPolicyType.getValue().getProperties().size() == 2);
+ assertEquals(2, secondPolicyType.getValue().getProperties().size());
Iterator<JpaToscaProperty> propertiesIter = secondPolicyType.getValue().getProperties().values().iterator();