aboutsummaryrefslogtreecommitdiffstats
path: root/models-pap/src/test/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-03-22 14:12:03 -0400
committerJim Hahn <jrh3@att.com>2019-03-25 10:33:34 -0400
commita8cd3141696d2a2258d90fc234eb6a2618b8731b (patch)
treebe1fa429f936d68b3db9e8b69bed05fd072d52fb /models-pap/src/test/java/org/onap
parent2a245ef80e39a101015efb164de53f1753fa5d47 (diff)
Add PolicyIdentOptVersion
Added additional PolicyIdentXxx classes. Added PdpDeployPolicies, which makes use of it, thus eliminating the need for PdpPolicies, which will be deleted once the PAP has been modified to use the new code. Added Validated class to facilitate field validation. Added utility methods to Validated class. Use new validator methods in PolicyIdentXxx classes. Use addError() method in validator class. Use parameter types instead of "?". Use static Validator instead of local. Get "result" from each call to a validateXxx() method. Derived PolicyIdentOptVersion from PfConceptKey. Moved PolicyIdent classes to models-pdp. Added PolicyIdent classes to models-pap. Also removed copy constructors from classes in models-pap, as those are plain POJOs that will not be copied. Copy constructors will be added to new classes that will be added to models-pdp in a separate review. Forgot to include the new Ident classes in models-pap. Change-Id: I923132c464c7802ee3e9225685cde44f36c64620 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-pap/src/test/java/org/onap')
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java66
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java51
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java75
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java49
4 files changed, 0 insertions, 241 deletions
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java
deleted file mode 100644
index ee52d82fb..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpGroup.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.TreeMap;
-import org.junit.Test;
-import org.onap.policy.models.pdp.enums.PdpState;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPdpGroup {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpGroup(null)).isInstanceOf(NullPointerException.class);
-
- PdpGroup orig = new PdpGroup();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpGroup(orig).toString());
-
- // verify with all values
- orig.setDescription("my-descript");
- orig.setName("my-name");
- orig.setPdpGroupState(PdpState.SAFE);
-
- PdpSubGroup sub1 = new PdpSubGroup();
- sub1.setCurrentInstanceCount(10);
- PdpSubGroup sub2 = new PdpSubGroup();
- sub2.setCurrentInstanceCount(11);
- orig.setPdpSubgroups(Arrays.asList(sub1, sub2));
-
- Map<String, String> props = new TreeMap<>();
- props.put("key-A", "value-A");
- props.put("key-B", "value-B");
- orig.setProperties(props);
-
- System.out.println("orig=" + orig);
-
- assertEquals(orig.toString(), new PdpGroup(orig).toString());
- }
-}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java
deleted file mode 100644
index 65fbef612..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpInstanceDetails.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.models.pdp.enums.PdpHealthStatus;
-import org.onap.policy.models.pdp.enums.PdpState;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPdpInstanceDetails {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpInstanceDetails(null)).isInstanceOf(NullPointerException.class);
-
- PdpInstanceDetails orig = new PdpInstanceDetails();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString());
-
- // verify with all values
- orig.setHealthy(PdpHealthStatus.TEST_IN_PROGRESS);
- orig.setInstanceId("my-id");
- orig.setMessage("my-message");
- orig.setPdpState(PdpState.SAFE);
- assertEquals(orig.toString(), new PdpInstanceDetails(orig).toString());
- }
-}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java
deleted file mode 100644
index 9af2f4e9d..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPdpSubGroup.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.TreeMap;
-import org.junit.Test;
-import org.onap.policy.models.base.keys.PolicyTypeIdent;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPdpSubGroup {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new PdpSubGroup(null)).isInstanceOf(NullPointerException.class);
-
- PdpSubGroup orig = new PdpSubGroup();
-
- // verify with null values
- assertEquals(orig.toString(), new PdpSubGroup(orig).toString());
-
- // verify with all values
- orig.setCurrentInstanceCount(10);
- orig.setDesiredInstanceCount(11);
-
- PdpInstanceDetails inst1 = new PdpInstanceDetails();
- inst1.setInstanceId("my-id-A");
- PdpInstanceDetails inst2 = new PdpInstanceDetails();
- inst2.setInstanceId("my-id-B");
- orig.setPdpInstances(Arrays.asList(inst1, inst2));
-
- orig.setPdpType("my-type");
-
- Policy pol1 = new Policy();
- pol1.setName("policy-A");
- Policy pol2 = new Policy();
- pol2.setName("policy-B");
- orig.setPolicies(Arrays.asList(pol1, pol2));
-
- Map<String, String> props = new TreeMap<>();
- props.put("key-A", "value-A");
- props.put("key-B", "value-B");
- orig.setProperties(props);
-
- PolicyTypeIdent supp1 = new PolicyTypeIdent("supp-A", "1.2");
- PolicyTypeIdent supp2 = new PolicyTypeIdent("supp-B", "3.4");
- orig.setSupportedPolicyTypes(Arrays.asList(supp1, supp2));
-
- assertEquals(orig.toString(), new PdpSubGroup(orig).toString());
- }
-}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java
deleted file mode 100644
index 6a042d3be..000000000
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestPolicy.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 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.
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.pap.concepts;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Test the copy constructor, as {@link TestModels} tests the other methods.
- */
-public class TestPolicy {
-
- @Test
- public void testCopyConstructor() {
- assertThatThrownBy(() -> new Policy(null)).isInstanceOf(NullPointerException.class);
-
- Policy orig = new Policy();
-
- // verify with null values
- assertEquals(orig.toString(), new Policy(orig).toString());
-
- // verify with all values
- orig.setName("my-name");
- orig.setPolicyType("my-type");
- orig.setPolicyTypeImpl("my-impl");
- orig.setPolicyTypeVersion("my-type-vers");
- assertEquals(orig.toString(), new Policy(orig).toString());
- }
-}