summaryrefslogtreecommitdiffstats
path: root/common-parameters/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'common-parameters/src/test/java')
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidation.java48
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java32
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java32
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java32
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java30
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java33
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java33
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java33
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java31
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java31
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java29
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java32
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java36
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java32
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java18
15 files changed, 132 insertions, 350 deletions
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidation.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidation.java
index 57d69f8d..8adf1165 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidation.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidation.java
@@ -293,6 +293,12 @@ public class TestValidation {
// non-null should be OK
result = new ParameterValidationResult(NotNullSub.class.getDeclaredField(NOT_NULL_STRING_NAME), "");
assertEquals(ValidationStatus.CLEAN, result.getStatus());
+
+ /*
+ * Super class annotation - null should be OK
+ */
+ result = new ParameterValidationResult(NotNullSub2.class.getDeclaredField("anotherString"), null);
+ assertEquals(ValidationStatus.CLEAN, result.getStatus());
}
@Test
@@ -358,47 +364,34 @@ public class TestValidation {
// these classes are used to test class-level annotations
- @NotNull
- private static class NotNullBase {
+
+ private static class EmptyBase {
}
- private static class NotNullSub extends NotNullBase {
+ @NotNull
+ private static class NotNullSub extends EmptyBase {
@SuppressWarnings("unused")
private String notNullString;
}
- private static class NotBlankBase {
-
+ private static class NotNullSub2 extends NotNullSub {
+ @SuppressWarnings("unused")
+ private String anotherString;
}
@NotBlank
- private static class NotBlankSub extends NotBlankBase {
+ private static class NotBlankSub extends EmptyBase {
@SuppressWarnings("unused")
private String notBlankString;
}
- private abstract static class SimpleGroup implements ParameterGroup {
- private String name;
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(String name) {
- this.name = name;
- }
- }
-
- private static class Contained extends SimpleGroup {
+ private static class Contained extends ParameterGroupImpl {
@Min(value = 1)
private int minInt;
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
+ public Contained() {
+ super("Contained");
}
@SuppressWarnings("unused")
@@ -407,13 +400,12 @@ public class TestValidation {
}
}
- private static class Container extends SimpleGroup {
+ private static class Container extends ParameterGroupImpl {
@NotNull
private Contained item;
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
+ public Container() {
+ super("Container");
}
@SuppressWarnings("unused")
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
index 505b2ce4..d1787482 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java
@@ -1,47 +1,31 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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.common.parameters.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class EmptyParameterGroup implements ParameterGroup {
- private String name;
+public class EmptyParameterGroup extends ParameterGroupImpl {
- public EmptyParameterGroup(final String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
+ public EmptyParameterGroup(String name) {
+ super(name);
}
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java
index e05eea3f..e6c85923 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java
@@ -1,36 +1,35 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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.common.parameters.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupMissingGetter implements ParameterGroup {
- private String name;
+public class ParameterGroupMissingGetter extends ParameterGroupImpl {
private String value;
public ParameterGroupMissingGetter(final String name) {
- this.name = name;
+ super(name);
}
-
+
public String getTheValue() {
return value;
}
@@ -38,19 +37,4 @@ public class ParameterGroupMissingGetter implements ParameterGroup {
public void setValue(String value) {
this.value = value;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java
index 78a7c157..1d90ca1f 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java
@@ -1,36 +1,35 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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.common.parameters.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupPrivateGetter implements ParameterGroup {
- private String name;
+public class ParameterGroupPrivateGetter extends ParameterGroupImpl {
private String value;
public ParameterGroupPrivateGetter(final String name) {
- this.name = name;
+ super(name);
}
-
+
public String getTheValue() {
return getValue();
}
@@ -42,19 +41,4 @@ public class ParameterGroupPrivateGetter implements ParameterGroup {
public void setValue(String value) {
this.value = value;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
index c448cea1..e37b47ae 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java
@@ -1,52 +1,36 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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.common.parameters.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupWithArray implements ParameterGroup {
- private String name;
+public class ParameterGroupWithArray extends ParameterGroupImpl {
private int[] intArray = {1, 2, 3};
public ParameterGroupWithArray(final String name) {
- this.name = name;
+ super(name);
}
public int[] getIntArray() {
return intArray;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
index 7f2c0ab5..ee7c1715 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -22,21 +23,18 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.ArrayList;
import java.util.List;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
-
-public class ParameterGroupWithCollection implements ParameterGroup {
- private String name;
+public class ParameterGroupWithCollection extends ParameterGroupImpl {
private List<Integer> intArrayList = new ArrayList<>();
/**
* Create a test parameter group.
- *
+ *
* @param name the parameter group name
*/
public ParameterGroupWithCollection(final String name) {
- this.name = name;
+ super(name);
intArrayList.add(1);
intArrayList.add(2);
@@ -46,19 +44,4 @@ public class ParameterGroupWithCollection implements ParameterGroup {
public List<Integer> getIntArrayList() {
return intArrayList;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
index 57a5a110..b3c7d1b7 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -22,12 +23,10 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
-
-import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupWithIllegalMapKey implements ParameterGroup {
- private String name;
+public class ParameterGroupWithIllegalMapKey extends ParameterGroupImpl {
private Map<Integer, ParameterGroup> badMap = new LinkedHashMap<>();
/**
@@ -35,8 +34,8 @@ public class ParameterGroupWithIllegalMapKey implements ParameterGroup {
* @param name the parameter group name
*/
public ParameterGroupWithIllegalMapKey(final String name) {
- this.name = name;
-
+ super(name);
+
badMap.put(1, new TestParametersLGeneric("One"));
badMap.put(2, new TestParametersLGeneric("Two"));
badMap.put(3, new TestParametersLGeneric("Three"));
@@ -45,20 +44,4 @@ public class ParameterGroupWithIllegalMapKey implements ParameterGroup {
public Map<Integer, ParameterGroup> getBadMap() {
return badMap;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
-
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
index 39e35d9c..4df708a4 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -22,12 +23,9 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
-
-public class ParameterGroupWithIllegalMapValue implements ParameterGroup {
- private String name;
+public class ParameterGroupWithIllegalMapValue extends ParameterGroupImpl {
private Map<String, Integer> intMap = new LinkedHashMap<>();
/**
@@ -35,8 +33,8 @@ public class ParameterGroupWithIllegalMapValue implements ParameterGroup {
* @param name the parameter group name
*/
public ParameterGroupWithIllegalMapValue(final String name) {
- this.name = name;
-
+ super(name);
+
intMap.put("One", 1);
intMap.put("Two", 2);
intMap.put("Three", 3);
@@ -45,19 +43,4 @@ public class ParameterGroupWithIllegalMapValue implements ParameterGroup {
public Map<String, Integer> getIntMap() {
return intMap;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
index 9b661bd5..35752c75 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -21,12 +22,9 @@
package org.onap.policy.common.parameters.testclasses;
import java.util.List;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
-
-public class ParameterGroupWithNullCollection implements ParameterGroup {
- private String name;
+public class ParameterGroupWithNullCollection extends ParameterGroupImpl {
private List<Integer> nullList = null;
/**
@@ -34,25 +32,10 @@ public class ParameterGroupWithNullCollection implements ParameterGroup {
* @param name the parameter group name
*/
public ParameterGroupWithNullCollection(final String name) {
- this.name = name;
+ super(name);
}
public List<Integer> getNullList() {
return nullList;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
index ac863a42..1a640023 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -21,12 +22,9 @@
package org.onap.policy.common.parameters.testclasses;
import java.util.Map;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
-
-public class ParameterGroupWithNullMapValue implements ParameterGroup {
- private String name;
+public class ParameterGroupWithNullMapValue extends ParameterGroupImpl {
private Map<String, Integer> nullMap = null;
/**
@@ -34,25 +32,10 @@ public class ParameterGroupWithNullMapValue implements ParameterGroup {
* @param name the parameter group name
*/
public ParameterGroupWithNullMapValue(final String name) {
- this.name = name;
+ super(name);
}
public Map<String, Integer> getNullMap() {
return nullMap;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java
index 830c8117..7fe1402f 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java
@@ -1,30 +1,30 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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.common.parameters.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupWithNullSubGroup implements ParameterGroup {
- private String name;
+public class ParameterGroupWithNullSubGroup extends ParameterGroupImpl {
private ParameterGroup subGroup = null;
/**
@@ -32,25 +32,10 @@ public class ParameterGroupWithNullSubGroup implements ParameterGroup {
* @param name the parameter group name
*/
public ParameterGroupWithNullSubGroup(final String name) {
- this.name = name;
+ super(name);
}
public ParameterGroup getSubGroup() {
return subGroup;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
index 3966e49c..08c799f5 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -22,12 +23,10 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.ArrayList;
import java.util.List;
-
-import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
-public class ParameterGroupWithParameterGroupCollection implements ParameterGroup {
- private String name;
+public class ParameterGroupWithParameterGroupCollection extends ParameterGroupImpl {
private List<ParameterGroup> parameterGroupArrayList = new ArrayList<>();
/**
@@ -35,8 +34,8 @@ public class ParameterGroupWithParameterGroupCollection implements ParameterGrou
* @param name the parameter group name
*/
public ParameterGroupWithParameterGroupCollection(final String name) {
- this.name = name;
-
+ super(name);
+
parameterGroupArrayList.add(new TestParametersLGeneric("Generic0"));
parameterGroupArrayList.add(new TestParametersLGeneric("Generic1"));
parameterGroupArrayList.add(new TestParametersLGeneric("Generic2"));
@@ -45,19 +44,4 @@ public class ParameterGroupWithParameterGroupCollection implements ParameterGrou
public List<ParameterGroup> getParameterGroupArrayList() {
return parameterGroupArrayList;
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
index b4a7e9c8..748eb902 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -23,16 +24,14 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterConstants;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ValidationStatus;
-public class TestParametersL00 implements ParameterGroup {
+public class TestParametersL00 extends ParameterGroupImpl {
private static final String A_CONSTANT = "A Constant";
-
- private String name = A_CONSTANT;
+
private int l00IntField = 0;
private String l00StringField = "Legal " + this.getClass().getCanonicalName();
private TestParametersL10 l00L10Nested = new TestParametersL10("l00L10Nested");
@@ -45,16 +44,16 @@ public class TestParametersL00 implements ParameterGroup {
* Default constructor.
*/
public TestParametersL00() {
- // Default Cnstructor
+ super(A_CONSTANT);
}
/**
* Create a test parameter group.
- *
+ *
* @param name the parameter group name
*/
public TestParametersL00(final String name) {
- this.name = name;
+ super(name);
TestParametersLGeneric l00LGenericNestedMapVal0 = new TestParametersLGeneric("l00LGenericNestedMapVal0");
l00LGenericNestedMap.put(l00LGenericNestedMapVal0.getName(), l00LGenericNestedMapVal0);
@@ -94,10 +93,6 @@ public class TestParametersL00 implements ParameterGroup {
this.isSomeFlag = isSomeFlag;
}
- public void setName(String name) {
- this.name = name;
- }
-
public void setL00IntField(int l00IntField) {
this.l00IntField = l00IntField;
}
@@ -120,7 +115,7 @@ public class TestParametersL00 implements ParameterGroup {
/**
* Trigger a validation message.
- *
+ *
* @param triggerStatus Validation status to trigger
* @param level Number of levels to recurse before stopping
*/
@@ -162,15 +157,10 @@ public class TestParametersL00 implements ParameterGroup {
}
@Override
- public String getName() {
- return name;
- }
-
- @Override
public GroupValidationResult validate() {
- GroupValidationResult validationResult = new GroupValidationResult(this);
+ GroupValidationResult validationResult = super.validate();
- if (name == null || name.trim().length() == 0) {
+ if (getName() == null || getName().trim().length() == 0) {
validationResult.setResult("name", ValidationStatus.INVALID, "name must be a non-blank string");
}
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
index f63ec3f9..8ad682ff 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* 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=========================================================
*/
@@ -23,14 +24,12 @@ package org.onap.policy.common.parameters.testclasses;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ParameterConstants;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ValidationStatus;
-public class TestParametersL10 implements ParameterGroup {
- private String name;
+public class TestParametersL10 extends ParameterGroupImpl {
private int l10IntField = 0;
private String l10StringField = "Legal " + this.getClass().getCanonicalName();
private TestParametersLGeneric l10LGenericNested0 = new TestParametersLGeneric("l10LGenericNested0");
@@ -43,14 +42,14 @@ public class TestParametersL10 implements ParameterGroup {
public TestParametersL10() {
// Default Constructor
}
-
+
/**
* Create a test parameter group.
- *
+ *
* @param name the parameter group name
*/
public TestParametersL10(final String name) {
- this.name = name;
+ super(name);
TestParametersLGeneric l10LGenericNestedMapVal0 = new TestParametersLGeneric("l10LGenericNestedMapVal0");
l10LGenericNestedMap.put(l10LGenericNestedMapVal0.getName(), l10LGenericNestedMapVal0);
@@ -78,10 +77,6 @@ public class TestParametersL10 implements ParameterGroup {
return l10LGenericNestedMap;
}
- public void setName(String name) {
- this.name = name;
- }
-
public void setL10IntField(int l10IntField) {
this.l10IntField = l10IntField;
}
@@ -104,7 +99,7 @@ public class TestParametersL10 implements ParameterGroup {
/**
* Trigger a validation message.
- *
+ *
* @param level Number of levels to recurse before stopping
*/
public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) {
@@ -145,13 +140,8 @@ public class TestParametersL10 implements ParameterGroup {
}
@Override
- public String getName() {
- return this.name;
- }
-
- @Override
public GroupValidationResult validate() {
- GroupValidationResult validationResult = new GroupValidationResult(this);
+ GroupValidationResult validationResult = super.validate();
if (l10StringField == null || l10StringField.trim().length() == 0) {
validationResult.setResult("l10StringField", ValidationStatus.INVALID,
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
index 1e5764c6..2fc04180 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java
@@ -22,13 +22,12 @@
package org.onap.policy.common.parameters.testclasses;
import org.onap.policy.common.parameters.GroupValidationResult;
-import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
-public class TestParametersLGeneric implements ParameterGroup {
- private String name;
+public class TestParametersLGeneric extends ParameterGroupImpl {
private int lgenericIntField = 0;
@NotNull @NotBlank
@@ -47,7 +46,7 @@ public class TestParametersLGeneric implements ParameterGroup {
* @param name the parameter group name
*/
public TestParametersLGeneric(final String name) {
- this.name = name;
+ super(name);
}
public int getLgenericIntField() {
@@ -58,10 +57,6 @@ public class TestParametersLGeneric implements ParameterGroup {
return lgenericStringField;
}
- public void setName(String name) {
- this.name = name;
- }
-
public void setLgenericIntField(int lgenericIntField) {
this.lgenericIntField = lgenericIntField;
}
@@ -107,13 +102,8 @@ public class TestParametersLGeneric implements ParameterGroup {
}
@Override
- public String getName() {
- return this.name;
- }
-
- @Override
public GroupValidationResult validate() {
- GroupValidationResult validationResult = new GroupValidationResult(this);
+ GroupValidationResult validationResult = super.validate();
if ("lgenericStringField".equals(lgenericStringField)) {
validationResult.setResult("lgenericStringField", ValidationStatus.WARNING,