diff options
Diffstat (limited to 'common-parameters/src/test')
34 files changed, 118 insertions, 1888 deletions
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestAbstractParameters.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestAbstractParameters.java deleted file mode 100644 index b568d7fb..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestAbstractParameters.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.EmptyParameterGroup; - -public class TestAbstractParameters { - - @Test - public void testAbstractParameters() { - final EmptyParameterGroup parameters = new EmptyParameterGroup("Empty Group"); - assertTrue(parameters.isValid()); - } -} diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java index 8795602a..b7bea204 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidationResult.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 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. @@ -20,6 +20,7 @@ package org.onap.policy.common.parameters; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -91,6 +92,10 @@ public class TestBeanValidationResult { assertEquals(INITIAL_INDENT + BEAN_INVALID_MSG + MID_INDENT + cleanMsg + MID_INDENT + invalidMsg, bean.getResult(INITIAL_INDENT, NEXT_INDENT, true)); + + bean = new BeanValidationResult(NAME, OBJECT); + assertFalse(bean.addResult(MY_LIST, "hello", ValidationStatus.INVALID, TEXT1)); + assertThat(bean.getResult()).contains("\"" + MY_LIST + "\" value \"hello\" INVALID, " + TEXT1); } @Test diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidator.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidator.java index 1095ff40..83d0a7f9 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidator.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestBeanValidator.java @@ -23,6 +23,7 @@ package org.onap.policy.common.parameters; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertTrue; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,11 +32,13 @@ import java.util.function.Consumer; import lombok.Getter; import org.junit.Before; import org.junit.Test; +import org.onap.policy.common.parameters.annotations.ClassName; import org.onap.policy.common.parameters.annotations.Max; import org.onap.policy.common.parameters.annotations.Min; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Pattern; +import org.onap.policy.common.parameters.annotations.Size; import org.onap.policy.common.parameters.annotations.Valid; public class TestBeanValidator { @@ -43,6 +46,7 @@ public class TestBeanValidator { private static final String STR_FIELD = "strValue"; private static final String INT_FIELD = "intValue"; private static final String NUM_FIELD = "numValue"; + private static final String ITEMS_FIELD = "items"; private static final String STRING_VALUE = "string value"; private static final int INT_VALUE = 20; @@ -170,6 +174,83 @@ public class TestBeanValidator { assertTrue(validator.validateTop(TOP, notBlankInt).isValid()); } + /** + * Tests verSize with a collection. + */ + @Test + public void testVerSizeCollection() { + class CollectionSizeCheck { + @Getter + @Size(min = 3) + Collection<Integer> items; + } + + CollectionSizeCheck collCheck = new CollectionSizeCheck(); + + // valid length - exact + collCheck.items = List.of(1, 2, 3); + assertThat(validator.validateTop(TOP, collCheck).isValid()).isTrue(); + + // valid length - extra + collCheck.items = List.of(1, 2, 3, 4); + assertThat(validator.validateTop(TOP, collCheck).isValid()).isTrue(); + + // too few + collCheck.items = List.of(1, 2); + assertInvalid("testVerSize", validator.validateTop(TOP, collCheck), ITEMS_FIELD, "minimum", "3"); + + // null + collCheck.items = null; + assertThat(validator.validateTop(TOP, collCheck).isValid()).isTrue(); + } + + /** + * Tests verSize with a map. + */ + @Test + public void testVerSizeMap() { + class MapSizeCheck { + @Getter + @Size(min = 3) + Map<Integer, Integer> items; + } + + MapSizeCheck mapCheck = new MapSizeCheck(); + + // valid length - exact + mapCheck.items = Map.of(1, 10, 2, 20, 3, 30); + assertThat(validator.validateTop(TOP, mapCheck).isValid()).isTrue(); + + // valid length - extra + mapCheck.items = Map.of(1, 10, 2, 20, 3, 30, 4, 40); + assertThat(validator.validateTop(TOP, mapCheck).isValid()).isTrue(); + + // too few + mapCheck.items = Map.of(1, 10, 2, 20); + assertInvalid("testVerSize", validator.validateTop(TOP, mapCheck), ITEMS_FIELD, "minimum", "3"); + + // null + mapCheck.items = null; + assertThat(validator.validateTop(TOP, mapCheck).isValid()).isTrue(); + } + + /** + * Tests verSize with an object for which it doesn't apply. + */ + @Test + public void testVerSizeOther() { + class OtherSizeCheck { + @Getter + @Size(min = 3) + Integer items; + } + + OtherSizeCheck otherCheck = new OtherSizeCheck(); + + otherCheck.items = 10; + assertThat(validator.validateTop(TOP, otherCheck).isValid()).isTrue(); + } + @Test public void testVerRegex() { class RegexCheck { @@ -411,6 +492,30 @@ public class TestBeanValidator { } @Test + public void testVerClassName() { + class ClassNameCheck { + @Getter + @ClassName + String strValue; + } + + ClassNameCheck classCheck = new ClassNameCheck(); + + // null should be OK + classCheck.strValue = null; + assertTrue(validator.validateTop(TOP, classCheck).isValid()); + + // valid class name + classCheck.strValue = getClass().getName(); + assertTrue(validator.validateTop(TOP, classCheck).isValid()); + + // invalid class name + classCheck.strValue = "<unknown class>"; + assertInvalid("testVerClassName", validator.validateTop(TOP, classCheck), + STR_FIELD, "class is not in the classpath"); + } + + @Test public void testVerCascade() { class Item { @Getter diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java deleted file mode 100644 index abef5528..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestJsonInput.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.TestParametersL00; - - -public class TestJsonInput { - - @Test - public void testJsonInput() throws IOException { - TestParametersL00 testParameterGroup = null; - - // Read the parameters from JSON using Gson - final Gson gson = new GsonBuilder().create(); - testParameterGroup = gson.fromJson(new FileReader("src/test/resources/parameters/TestParameters.json"), - TestParametersL00.class); - - GroupValidationResult validationResult = testParameterGroup.validate(); - assertTrue(validationResult.isValid()); - assertEquals("l00NameFromFile", testParameterGroup.getName()); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt"))) - .replaceAll("\\s+", ""); - assertEquals(expectedResult, validationResult.getResult("", " ", true).replaceAll("\\s+", "")); - } -} diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestParameterService.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestParameterService.java deleted file mode 100644 index fda37816..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestParameterService.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -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.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.EmptyParameterGroup; - -public class TestParameterService { - private static final String EMPTY_GROUP = "Empty Group"; - - @Test - public void testParameterService() { - ParameterService.clear(); - - assertFalse(ParameterService.contains("EmptyGroup")); - - assertThatThrownBy(() -> ParameterService.get("EmptyGroup")) - .hasMessage("\"EmptyGroup\" not found in parameter service"); - - ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP)); - assertTrue(ParameterService.contains(EMPTY_GROUP)); - assertNotNull(ParameterService.get(EMPTY_GROUP)); - - assertThatThrownBy(() -> ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP))) - .hasMessage("\"Empty Group\" already registered in parameter service"); - - assertThatThrownBy(() -> ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP), false)) - .hasMessage("\"Empty Group\" already registered in parameter service"); - - ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP), true); - assertTrue(ParameterService.contains(EMPTY_GROUP)); - - ParameterService.deregister(EMPTY_GROUP); - assertFalse(ParameterService.contains(EMPTY_GROUP)); - - ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP), true); - assertTrue(ParameterService.contains(EMPTY_GROUP)); - - ParameterService.deregister(EMPTY_GROUP); - assertFalse(ParameterService.contains(EMPTY_GROUP)); - - EmptyParameterGroup epg = new EmptyParameterGroup(EMPTY_GROUP); - ParameterService.register(epg); - assertTrue(ParameterService.contains(EMPTY_GROUP)); - assertNotNull(ParameterService.get(EMPTY_GROUP)); - - ParameterService.deregister(epg); - assertFalse(ParameterService.contains(EMPTY_GROUP)); - - assertThatThrownBy(() -> ParameterService.deregister(EMPTY_GROUP)) - .hasMessage("\"Empty Group\" not registered in parameter service"); - - assertThatThrownBy(() -> ParameterService.get(EMPTY_GROUP)) - .hasMessage("\"Empty Group\" not found in parameter service"); - - ParameterService.register(new EmptyParameterGroup(EMPTY_GROUP)); - assertTrue(ParameterService.contains(EMPTY_GROUP)); - assertNotNull(ParameterService.get(EMPTY_GROUP)); - - assertEquals(1, ParameterService.getAll().size()); - ParameterService.clear(); - assertEquals(0, ParameterService.getAll().size()); - assertFalse(ParameterService.contains(EMPTY_GROUP)); - - assertThatThrownBy(() -> ParameterService.get(EMPTY_GROUP)) - .hasMessage("\"Empty Group\" not found in parameter service"); - } -} 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 9e7121cd..b19b92da 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 @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 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. @@ -21,25 +21,17 @@ package org.onap.policy.common.parameters; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; import org.junit.Test; import org.onap.policy.common.parameters.annotations.Max; import org.onap.policy.common.parameters.annotations.Min; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; -import org.onap.policy.common.parameters.testclasses.TestParametersL00; -import org.onap.policy.common.parameters.testclasses.TestParametersL10; +import org.onap.policy.common.parameters.annotations.Valid; public class TestValidation { - private static final String L0_PARAMETERS = "l0Parameters"; - private static final String NOT_BLANK_STRING_MESSAGE = "field 'notBlankString' type 'java.lang.String' value '' INVALID, must be a non-blank string\n" .replace('\'', '"'); @@ -74,177 +66,15 @@ public class TestValidation { private long maxLong; @Test - public void testValidationOk() throws IOException { - TestParametersL00 l0Parameters = new TestParametersL00(L0_PARAMETERS); - - GroupValidationResult validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertTrue(validationResult.isClean()); - assertNull(validationResult.getResult()); - assertEquals(l0Parameters, validationResult.getParameterGroup()); - assertEquals(l0Parameters.getName(), validationResult.getName()); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt"))) - .replaceAll("\\s+", ""); - assertEquals(expectedResult, validationResult.getResult("", " ", true).replaceAll("\\s+", "")); - } - - @Test - public void testValidationObservation() throws IOException { - TestParametersL00 l0Parameters = new TestParametersL00(L0_PARAMETERS); - - l0Parameters.triggerValidationStatus(ValidationStatus.OBSERVATION, 3); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt"))) - .replaceAll("\\s+", ""); - - GroupValidationResult validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertFalse(validationResult.isClean()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.OBSERVATION, 2); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.OBSERVATION, 1); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.OBSERVATION, 0); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(null, validationResult.getResult()); - } - - @Test - public void testValidationWarning() throws IOException { - TestParametersL00 l0Parameters = new TestParametersL00(L0_PARAMETERS); - - l0Parameters.triggerValidationStatus(ValidationStatus.WARNING, 3); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt"))) - .replaceAll("\\s+", ""); - - GroupValidationResult validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.WARNING, 2); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.WARNING, 1); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.WARNING, 0); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(null, validationResult.getResult()); - } - - @Test - public void testValidationInvalid() throws IOException { - TestParametersL00 l0Parameters = new TestParametersL00(L0_PARAMETERS); - - l0Parameters.triggerValidationStatus(ValidationStatus.INVALID, 3); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt"))) - .replaceAll("\\s+", ""); - - GroupValidationResult validationResult = l0Parameters.validate(); - assertFalse(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.INVALID, 2); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertFalse(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.INVALID, 1); - - expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt"))) - .replaceAll("\\s+", ""); - - validationResult = l0Parameters.validate(); - assertFalse(validationResult.isValid()); - assertEquals(expectedResult, validationResult.getResult().replaceAll("\\s+", "")); - - l0Parameters.triggerValidationStatus(ValidationStatus.CLEAN, 3); - l0Parameters.triggerValidationStatus(ValidationStatus.INVALID, 0); - - validationResult = l0Parameters.validate(); - assertTrue(validationResult.isValid()); - assertEquals(null, validationResult.getResult()); - } - - @Test - public void testValidationEmptySubGroup() { - TestParametersL10 l10Parameters = new TestParametersL10("l10Parameters"); - - l10Parameters.setL10LGenericNested0(null); - - GroupValidationResult validationResult = l10Parameters.validate(); - assertTrue(validationResult.isValid()); - - assertTrue(validationResult.getResult("", "", true).contains("UNDEFINED")); - } - - @Test public void testGetValidationResult() { Contained item = new Contained(); item.setName("item"); Container cont = new Container(); cont.item = item; - GroupValidationResult result = cont.validate(); + BeanValidationResult result = cont.validate(); assertEquals(ValidationStatus.INVALID, result.getStatus()); - assertTrue(result.getResult().contains(">= 1")); + assertThat(result.getResult()).contains("minimum"); item.minInt = 1000; result = cont.validate(); @@ -253,7 +83,7 @@ public class TestValidation { cont.item = null; result = cont.validate(); assertEquals(ValidationStatus.INVALID, result.getStatus()); - assertTrue(result.getResult().contains("is null")); + assertThat(result.getResult()).contains("is null"); } @Test @@ -429,6 +259,7 @@ public class TestValidation { private static class Container extends ParameterGroupImpl { @NotNull + @Valid private Contained item; public Container() { diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java deleted file mode 100644 index b02022d7..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationErrors.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.ParameterGroupMissingGetter; -import org.onap.policy.common.parameters.testclasses.ParameterGroupPrivateGetter; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithArray; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithCollection; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithIllegalMapKey; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithIllegalMapValue; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithNullCollection; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithNullMapValue; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithNullSubGroup; -import org.onap.policy.common.parameters.testclasses.ParameterGroupWithParameterGroupCollection; - -public class TestValidationErrors { - @Test - public void testBadArrayValidation() { - ParameterGroupWithArray groupWithArray = new ParameterGroupWithArray("Illegal Array Group"); - assertTrue(groupWithArray.isValid()); - } - - @Test - public void testCollectionValidation() { - ParameterGroupWithCollection legalCollection = new ParameterGroupWithCollection("Legal Collection"); - assertTrue(legalCollection.isValid()); - - ParameterGroupWithParameterGroupCollection illegalCollection = new ParameterGroupWithParameterGroupCollection( - "Illegal Collection"); - - assertThatThrownBy(illegalCollection::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("collection parameter \"parameterGroupArrayList\" is illegal," - + " parameter groups are not allowed as collection members"); - } - - @Test - public void testNullCollection() { - ParameterGroupWithNullCollection nullCollection = new ParameterGroupWithNullCollection("Null Collection"); - - assertThatThrownBy(nullCollection::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("collection parameter \"nullList\" is null"); - } - - @Test - public void testMapNullSubGroupValidation() { - ParameterGroupWithNullSubGroup nullSub = new ParameterGroupWithNullSubGroup("Null sub group value"); - - nullSub.isValid(); - assertNull(nullSub.getSubGroup()); - } - - @Test - public void testMapNullValueValidation() { - ParameterGroupWithNullMapValue nullMap = new ParameterGroupWithNullMapValue("Null Map value"); - - assertThatThrownBy(nullMap::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("map parameter \"nullMap\" is null"); - } - - @Test - public void testBadMapKeyValidation() { - ParameterGroupWithIllegalMapKey illegalMap = new ParameterGroupWithIllegalMapKey("Illegal Map"); - - assertThatThrownBy(illegalMap::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("map entry is not a parameter group keyed by a string, key \"1\" " - + "in map \"badMap\" is not a string"); - } - - @Test - public void testBadMapValueValidation() { - ParameterGroupWithIllegalMapValue illegalMap = new ParameterGroupWithIllegalMapValue("Illegal Map"); - - assertThatThrownBy(illegalMap::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("map entry is not a parameter group keyed by a string, value \"1\" in " - + "map \"intMap\" is not a parameter group"); - } - - @Test - public void testMissingGetter() { - ParameterGroupMissingGetter badGetterName = new ParameterGroupMissingGetter("BGN"); - - assertThatThrownBy(badGetterName::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("could not get getter method for parameter \"value\""); - } - - @Test - public void testPrivateGetter() { - ParameterGroupPrivateGetter privateGetter = new ParameterGroupPrivateGetter("privateGetter"); - - assertThatThrownBy(privateGetter::isValid).isInstanceOf(ParameterRuntimeException.class) - .hasMessage("could not get getter method for parameter \"value\""); - } -} diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationResults.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationResults.java deleted file mode 100644 index 46360ef9..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestValidationResults.java +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.LinkedHashMap; -import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.TestParametersL10; -import org.onap.policy.common.parameters.testclasses.TestParametersLGeneric; - -public class TestValidationResults { - private static final String NON_EXISTANT_PARAMETER = "nonExistantParameter"; - private static final String L10L_GENERIC_NESTED_MAP_VAL0 = "l10LGenericNestedMapVal0"; - private static final String L10_INT_FIELD = "l10IntField"; - private static final String ENTRY0 = "entry0"; - private static final String THIS_VALUE_IS_INVALID = "This value is invalid"; - private static final String SOMETHING_WAS_OBSERVED = "Something was observed"; - private static final String PG_MAP = "pgMap"; - - private Map<String, ParameterGroup> pgMap = new LinkedHashMap<>(); - private ParameterGroup pg = new TestParametersL10("pg"); - - @Before - public void initMap() { - pgMap.put(ENTRY0, new TestParametersLGeneric(ENTRY0)); - } - - @Test - public void testGroupMapValidationResult() throws NoSuchFieldException { - GroupMapValidationResult result = new GroupMapValidationResult(this.getClass().getDeclaredField(PG_MAP), - pgMap); - - assertTrue(result.isValid()); - assertEquals(PG_MAP, result.getName()); - - result.setResult(ValidationStatus.OBSERVATION); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - - // Once the status is stepped, it can't be reset back because it is the status of map members - result.setResult(ValidationStatus.CLEAN); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - - result.setResult(ValidationStatus.OBSERVATION, SOMETHING_WAS_OBSERVED); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - assertEquals("parameter group map \"pgMap\" OBSERVATION, Something was observed", result.getResult().trim()); - - result.setResult(ENTRY0, new GroupValidationResult(pgMap.get(ENTRY0))); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - assertEquals("parameter group map \"pgMap\" OBSERVATION, Something was observed", result.getResult().trim()); - - assertThatThrownBy(() -> result.setResult("nonExistantEntry", new GroupValidationResult(pgMap.get(ENTRY0)))) - .hasMessage("no entry with name \"nonExistantEntry\" exists"); - } - - @Test - public void testGroupValidationResult() throws NoSuchFieldException { - GroupValidationResult result = new GroupValidationResult(pg); - - assertTrue(result.isValid()); - assertEquals(pg, result.getParameterGroup()); - assertEquals("pg", result.getName()); - - result.setResult(ValidationStatus.OBSERVATION); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - - // Once the status is stepped, it can't be reset back because it is the status of map members - result.setResult(ValidationStatus.CLEAN); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - - result.setResult(ValidationStatus.OBSERVATION, SOMETHING_WAS_OBSERVED); - assertTrue(result.isValid()); - assertEquals(ValidationStatus.OBSERVATION, result.getStatus()); - assertEquals("parameter group \"pg\" type \"org.onap.policy.common.parameters.testclasses.TestParametersL10\"" - + " OBSERVATION, Something was observed", result.getResult().trim()); - - assertThatThrownBy(() -> result.setResult(NON_EXISTANT_PARAMETER, ValidationStatus.OBSERVATION, - SOMETHING_WAS_OBSERVED)) - .hasMessage("no parameter field exists for parameter: nonExistantParameter"); - - result.setResult(L10_INT_FIELD, ValidationStatus.OBSERVATION, SOMETHING_WAS_OBSERVED); - assertTrue(result.isValid()); - - assertThatThrownBy(() -> result.setResult(NON_EXISTANT_PARAMETER, new GroupValidationResult(pg))) - .hasMessage("no nested parameter field exists for parameter: nonExistantParameter"); - - assertThatThrownBy(() -> result.setResult(L10_INT_FIELD, new GroupValidationResult(pg))) - .hasMessage("parameter is not a nested group parameter: l10IntField"); - - GroupMapValidationResult groupMapResult = new GroupMapValidationResult( - this.getClass().getDeclaredField(PG_MAP), pgMap); - - assertThatThrownBy(() -> result.setResult(NON_EXISTANT_PARAMETER, ENTRY0, groupMapResult)) - .hasMessage("no group map parameter field exists for parameter: nonExistantParameter"); - - assertThatThrownBy(() -> result.setResult(L10_INT_FIELD, ENTRY0, groupMapResult)) - .hasMessage("parameter is not a nested group map parameter: l10IntField"); - - result.setResult("l10LGenericNestedMap", L10L_GENERIC_NESTED_MAP_VAL0, ValidationStatus.INVALID, - THIS_VALUE_IS_INVALID); - assertEquals(ValidationStatus.INVALID, result.getStatus()); - - assertThatThrownBy(() -> result.setResult(L10_INT_FIELD, L10L_GENERIC_NESTED_MAP_VAL0, ValidationStatus.INVALID, - THIS_VALUE_IS_INVALID)) - .hasMessage("parameter is not a nested group map parameter: l10IntField"); - - assertThatThrownBy(() -> result.setResult(NON_EXISTANT_PARAMETER, L10L_GENERIC_NESTED_MAP_VAL0, - ValidationStatus.INVALID, THIS_VALUE_IS_INVALID)).hasMessage( - "no group map parameter field exists for parameter: nonExistantParameter"); - - assertThatThrownBy(() -> result.setResult("l10LGenericNestedMap", "NonExistantKey", ValidationStatus.INVALID, - THIS_VALUE_IS_INVALID)).hasMessage("no entry with name \"NonExistantKey\" exists"); - } -} diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java deleted file mode 100644 index 66656844..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/TestYamlInput.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.common.parameters; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import org.junit.Test; -import org.onap.policy.common.parameters.testclasses.TestParametersL00; -import org.yaml.snakeyaml.Yaml; - -public class TestYamlInput { - @Test - public void testYamlInput() throws IOException { - TestParametersL00 testParameterGroup = null; - - // Read the parameters from JSON using Gson - final Yaml yaml = new Yaml(); - testParameterGroup = yaml.loadAs(new FileReader("src/test/resources/parameters/TestParameters.yaml"), - TestParametersL00.class); - - GroupValidationResult validationResult = testParameterGroup.validate(); - assertTrue(validationResult.isValid()); - assertEquals("l00NameFromFile", testParameterGroup.getName()); - - String expectedResult = new String(Files.readAllBytes( - Paths.get("src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt"))) - .replaceAll("\\s+", ""); - assertEquals(expectedResult, validationResult.getResult("", " ", true).replaceAll("\\s+", "")); - } -} 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 deleted file mode 100644 index d1787482..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/EmptyParameterGroup.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============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.ParameterGroupImpl; - -public class EmptyParameterGroup extends ParameterGroupImpl { - - 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 deleted file mode 100644 index e6c85923..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupMissingGetter.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============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.ParameterGroupImpl; - -public class ParameterGroupMissingGetter extends ParameterGroupImpl { - private String value; - - public ParameterGroupMissingGetter(final String name) { - super(name); - } - - public String getTheValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} 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 deleted file mode 100644 index 1d90ca1f..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupPrivateGetter.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============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.ParameterGroupImpl; - -public class ParameterGroupPrivateGetter extends ParameterGroupImpl { - private String value; - - public ParameterGroupPrivateGetter(final String name) { - super(name); - } - - public String getTheValue() { - return getValue(); - } - - private String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} 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 deleted file mode 100644 index e37b47ae..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithArray.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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.ParameterGroupImpl; - -public class ParameterGroupWithArray extends ParameterGroupImpl { - private int[] intArray = {1, 2, 3}; - - public ParameterGroupWithArray(final String name) { - super(name); - } - - public int[] getIntArray() { - return intArray; - } -} 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 deleted file mode 100644 index ee7c1715..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithCollection.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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 java.util.ArrayList; -import java.util.List; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -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) { - super(name); - - intArrayList.add(1); - intArrayList.add(2); - intArrayList.add(3); - } - - public List<Integer> getIntArrayList() { - return intArrayList; - } -} 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 deleted file mode 100644 index b3c7d1b7..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapKey.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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 java.util.LinkedHashMap; -import java.util.Map; -import org.onap.policy.common.parameters.ParameterGroup; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithIllegalMapKey extends ParameterGroupImpl { - private Map<Integer, ParameterGroup> badMap = new LinkedHashMap<>(); - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithIllegalMapKey(final String name) { - super(name); - - badMap.put(1, new TestParametersLGeneric("One")); - badMap.put(2, new TestParametersLGeneric("Two")); - badMap.put(3, new TestParametersLGeneric("Three")); - } - - public Map<Integer, ParameterGroup> getBadMap() { - return badMap; - } -} 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 deleted file mode 100644 index 4df708a4..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithIllegalMapValue.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============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 java.util.LinkedHashMap; -import java.util.Map; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithIllegalMapValue extends ParameterGroupImpl { - private Map<String, Integer> intMap = new LinkedHashMap<>(); - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithIllegalMapValue(final String name) { - super(name); - - intMap.put("One", 1); - intMap.put("Two", 2); - intMap.put("Three", 3); - } - - public Map<String, Integer> getIntMap() { - return intMap; - } -} 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 deleted file mode 100644 index 35752c75..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullCollection.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============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 java.util.List; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithNullCollection extends ParameterGroupImpl { - private List<Integer> nullList = null; - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithNullCollection(final String name) { - super(name); - } - - public List<Integer> getNullList() { - return nullList; - } -} 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 deleted file mode 100644 index 1a640023..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullMapValue.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============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 java.util.Map; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithNullMapValue extends ParameterGroupImpl { - private Map<String, Integer> nullMap = null; - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithNullMapValue(final String name) { - super(name); - } - - public Map<String, Integer> getNullMap() { - return nullMap; - } -} 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 deleted file mode 100644 index 7fe1402f..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithNullSubGroup.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============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.ParameterGroup; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithNullSubGroup extends ParameterGroupImpl { - private ParameterGroup subGroup = null; - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithNullSubGroup(final String name) { - super(name); - } - - public ParameterGroup getSubGroup() { - return subGroup; - } -} 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 deleted file mode 100644 index 08c799f5..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/ParameterGroupWithParameterGroupCollection.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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 java.util.ArrayList; -import java.util.List; -import org.onap.policy.common.parameters.ParameterGroup; -import org.onap.policy.common.parameters.ParameterGroupImpl; - -public class ParameterGroupWithParameterGroupCollection extends ParameterGroupImpl { - private List<ParameterGroup> parameterGroupArrayList = new ArrayList<>(); - - /** - * Create a test parameter group. - * @param name the parameter group name - */ - public ParameterGroupWithParameterGroupCollection(final String name) { - super(name); - - parameterGroupArrayList.add(new TestParametersLGeneric("Generic0")); - parameterGroupArrayList.add(new TestParametersLGeneric("Generic1")); - parameterGroupArrayList.add(new TestParametersLGeneric("Generic2")); - } - - public List<ParameterGroup> getParameterGroupArrayList() { - return parameterGroupArrayList; - } -} 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 deleted file mode 100644 index 51440546..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * ============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 java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.parameters.GroupValidationResult; -import org.onap.policy.common.parameters.ParameterConstants; -import org.onap.policy.common.parameters.ParameterGroupImpl; -import org.onap.policy.common.parameters.ValidationStatus; - -public class TestParametersL00 extends ParameterGroupImpl { - private static final String L00_INT_FIELD = "l00IntField"; - private static final String L00_STRING_FIELD = "l00StringField"; - - private static final String A_CONSTANT = "A Constant"; - - private int l00IntField = 0; - private String l00StringField = "Legal " + this.getClass().getName(); - private TestParametersL10 l00L10Nested = new TestParametersL10("l00L10Nested"); - private TestParametersLGeneric l00LGenericNested = new TestParametersLGeneric("l00LGenericNested"); - private Map<String, TestParametersLGeneric> l00LGenericNestedMap = new LinkedHashMap<>(); - private boolean isSomeFlag; - private boolean someNonIsFlag; - - /** - * Default constructor. - */ - public TestParametersL00() { - super(A_CONSTANT); - } - - /** - * Create a test parameter group. - * - * @param name the parameter group name - */ - public TestParametersL00(final String name) { - super(name); - - TestParametersLGeneric l00LGenericNestedMapVal0 = new TestParametersLGeneric("l00LGenericNestedMapVal0"); - l00LGenericNestedMap.put(l00LGenericNestedMapVal0.getName(), l00LGenericNestedMapVal0); - TestParametersLGeneric l00LGenericNestedMapVal1 = new TestParametersLGeneric("l00LGenericNestedMapVal1"); - l00LGenericNestedMap.put(l00LGenericNestedMapVal1.getName(), l00LGenericNestedMapVal1); - } - - public int getL00IntField() { - return l00IntField; - } - - public String getL00StringField() { - return l00StringField; - } - - public TestParametersL10 getL00L10Nested() { - return l00L10Nested; - } - - public TestParametersLGeneric getL00LGenericNested() { - return l00LGenericNested; - } - - public Map<String, TestParametersLGeneric> getL00LGenericNestedMap() { - return l00LGenericNestedMap; - } - - public boolean isSomeFlag() { - return isSomeFlag; - } - - public boolean isSomeNonIsFlag() { - return someNonIsFlag; - } - - public void setSomeFlag(boolean isSomeFlag) { - this.isSomeFlag = isSomeFlag; - } - - public void setL00IntField(int l00IntField) { - this.l00IntField = l00IntField; - } - - public void setL00StringField(String l00StringField) { - this.l00StringField = l00StringField; - } - - public void setL00L10Nested(TestParametersL10 l00l10Nested) { - l00L10Nested = l00l10Nested; - } - - public void setL00LGenericNested(TestParametersLGeneric l00lGenericNested) { - l00LGenericNested = l00lGenericNested; - } - - public void setL00LGenericNestedMap(Map<String, TestParametersLGeneric> l00lGenericNestedMap) { - l00LGenericNestedMap = l00lGenericNestedMap; - } - - /** - * Trigger a validation message. - * - * @param triggerStatus Validation status to trigger - * @param level Number of levels to recurse before stopping - */ - public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) { - if (level == 0) { - return; - } else { - level--; - } - - switch (triggerStatus) { - case CLEAN: - l00StringField = "Legal " + this.getClass().getName(); - l00IntField = 0; - break; - case OBSERVATION: - l00StringField = "aString"; - l00IntField = 2; - break; - case WARNING: - l00StringField = L00_STRING_FIELD; - l00IntField = 3; - break; - case INVALID: - l00StringField = ""; - l00IntField = -1; - break; - default: - break; - } - - l00L10Nested.triggerValidationStatus(triggerStatus, level); - l00LGenericNested.triggerValidationStatus(triggerStatus, level); - - for (TestParametersLGeneric nestedParameterGroup : l00LGenericNestedMap.values()) { - nestedParameterGroup.triggerValidationStatus(triggerStatus, level); - } - - } - - @Override - public GroupValidationResult validate() { - GroupValidationResult validationResult = super.validate(); - - if (StringUtils.isBlank(getName())) { - validationResult.setResult("name", ValidationStatus.INVALID, "name must be a non-blank string"); - } - - if (StringUtils.isBlank(l00StringField)) { - validationResult.setResult(L00_STRING_FIELD, ValidationStatus.INVALID, - "l00StringField must be a non-blank string"); - } else if (l00StringField.equals(L00_STRING_FIELD)) { - validationResult.setResult(L00_STRING_FIELD, ValidationStatus.WARNING, - "using the field name for the parameter value is dangerous"); - } else if (l00StringField.equals("aString")) { - validationResult.setResult(L00_STRING_FIELD, ValidationStatus.OBSERVATION, - "this value for name is unhelpful"); - } else { - validationResult.setResult(L00_STRING_FIELD, ValidationStatus.CLEAN, - ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString()); - } - - if (l00IntField < 0) { - validationResult.setResult(L00_INT_FIELD, ValidationStatus.INVALID, - "l00IntField must be a positive integer"); - } else if (l00IntField > 2) { - validationResult.setResult(L00_INT_FIELD, ValidationStatus.WARNING, - "values greater than 2 are not recommended"); - } else if (l00IntField == 2) { - validationResult.setResult(L00_INT_FIELD, ValidationStatus.OBSERVATION, "this field has been set to 2"); - } else { - validationResult.setResult(L00_INT_FIELD, ValidationStatus.CLEAN, - ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString()); - } - - validationResult.setResult("l00L10Nested", l00L10Nested.validate()); - validationResult.setResult("l00LGenericNested", l00LGenericNested.validate()); - - for (Entry<String, TestParametersLGeneric> nestedGroupEntry : l00LGenericNestedMap.entrySet()) { - validationResult.setResult("l00LGenericNestedMap", nestedGroupEntry.getKey(), - nestedGroupEntry.getValue().validate()); - } - - return validationResult; - } -} 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 deleted file mode 100644 index bd2cf101..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java +++ /dev/null @@ -1,188 +0,0 @@ -/*- - * ============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 java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.parameters.GroupValidationResult; -import org.onap.policy.common.parameters.ParameterConstants; -import org.onap.policy.common.parameters.ParameterGroupImpl; -import org.onap.policy.common.parameters.ValidationStatus; - -public class TestParametersL10 extends ParameterGroupImpl { - private static final String L10_INT_FIELD = "l10IntField"; - private static final String L10_STRING_FIELD = "l10StringField"; - - private int l10IntField = 0; - private String l10StringField = "Legal " + this.getClass().getName(); - private TestParametersLGeneric l10LGenericNested0 = new TestParametersLGeneric("l10LGenericNested0"); - private TestParametersLGeneric l10LGenericNested1 = new TestParametersLGeneric("l10LGenericNested1"); - private Map<String, TestParametersLGeneric> l10LGenericNestedMap = new LinkedHashMap<>(); - - /** - * Default constructor. - */ - public TestParametersL10() { - // Default Constructor - } - - /** - * Create a test parameter group. - * - * @param name the parameter group name - */ - public TestParametersL10(final String name) { - super(name); - - TestParametersLGeneric l10LGenericNestedMapVal0 = new TestParametersLGeneric("l10LGenericNestedMapVal0"); - l10LGenericNestedMap.put(l10LGenericNestedMapVal0.getName(), l10LGenericNestedMapVal0); - TestParametersLGeneric l10LGenericNestedMapVal1 = new TestParametersLGeneric("l10LGenericNestedMapVal1"); - l10LGenericNestedMap.put(l10LGenericNestedMapVal1.getName(), l10LGenericNestedMapVal1); - } - - public int getL10IntField() { - return l10IntField; - } - - public String getL10StringField() { - return l10StringField; - } - - public TestParametersLGeneric getL10LGenericNested0() { - return l10LGenericNested0; - } - - public TestParametersLGeneric getL10LGenericNested1() { - return l10LGenericNested1; - } - - public Map<String, TestParametersLGeneric> getL10LGenericNestedMap() { - return l10LGenericNestedMap; - } - - public void setL10IntField(int l10IntField) { - this.l10IntField = l10IntField; - } - - public void setL10StringField(String l10StringField) { - this.l10StringField = l10StringField; - } - - public void setL10LGenericNested0(TestParametersLGeneric l10lGenericNested0) { - l10LGenericNested0 = l10lGenericNested0; - } - - public void setL10LGenericNested1(TestParametersLGeneric l10lGenericNested1) { - l10LGenericNested1 = l10lGenericNested1; - } - - public void setL10LGenericNestedMap(Map<String, TestParametersLGeneric> l10lGenericNestedMap) { - l10LGenericNestedMap = l10lGenericNestedMap; - } - - /** - * Trigger a validation message. - * - * @param level Number of levels to recurse before stopping - */ - public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) { - if (level == 0) { - return; - } else { - level--; - } - - switch (triggerStatus) { - case CLEAN: - l10StringField = "Legal " + this.getClass().getName(); - l10IntField = 0; - break; - case OBSERVATION: - l10StringField = "aString"; - l10IntField = 2; - break; - case WARNING: - l10StringField = L10_STRING_FIELD; - l10IntField = 3; - break; - case INVALID: - l10StringField = ""; - l10IntField = -1; - break; - default: - break; - } - - l10LGenericNested0.triggerValidationStatus(triggerStatus, level); - l10LGenericNested1.triggerValidationStatus(triggerStatus, level); - - for (TestParametersLGeneric nestedParameterGroup : l10LGenericNestedMap.values()) { - nestedParameterGroup.triggerValidationStatus(triggerStatus, level); - } - } - - @Override - public GroupValidationResult validate() { - GroupValidationResult validationResult = super.validate(); - - if (StringUtils.isBlank(l10StringField)) { - validationResult.setResult(L10_STRING_FIELD, ValidationStatus.INVALID, - "l10StringField must be a non-blank string"); - } else if (l10StringField.equals(L10_STRING_FIELD)) { - validationResult.setResult(L10_STRING_FIELD, ValidationStatus.WARNING, - "using the field name for the parameter value is dangerous"); - } else if (l10StringField.equals("aString")) { - validationResult.setResult(L10_STRING_FIELD, ValidationStatus.OBSERVATION, - "this value for name is unhelpful"); - } else { - validationResult.setResult(L10_STRING_FIELD, ValidationStatus.CLEAN, - ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString()); - } - - if (l10IntField < 0) { - validationResult.setResult(L10_INT_FIELD, ValidationStatus.INVALID, - "l10IntField must be a positive integer"); - } else if (l10IntField > 2) { - validationResult.setResult(L10_INT_FIELD, ValidationStatus.WARNING, - "values greater than 2 are not recommended"); - } else if (l10IntField == 2) { - validationResult.setResult(L10_INT_FIELD, ValidationStatus.OBSERVATION, "this field has been set to 2"); - } else { - validationResult.setResult(L10_INT_FIELD, ValidationStatus.CLEAN, - ParameterConstants.PARAMETER_HAS_STATUS_MESSAGE + ValidationStatus.CLEAN.toString()); - } - - if (l10LGenericNested0 != null) { - validationResult.setResult("l10LGenericNested0", l10LGenericNested0.validate()); - } - validationResult.setResult("l10LGenericNested1", l10LGenericNested1.validate()); - - for (Entry<String, TestParametersLGeneric> nestedGroupEntry : l10LGenericNestedMap.entrySet()) { - validationResult.setResult("l10LGenericNestedMap", nestedGroupEntry.getKey(), - nestedGroupEntry.getValue().validate()); - } - - return validationResult; - } -} 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 deleted file mode 100644 index f9d6cdc4..00000000 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications 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. - * - * 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.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 extends ParameterGroupImpl { - private static final String LGENERIC_INT_FIELD = "lgenericIntField"; - private static final String LGENERIC_STRING_FIELD = "lgenericStringField"; - - private int lgenericIntField = 0; - - @NotNull @NotBlank - private String lgenericStringField = "Legal " + this.getClass().getName(); - - /** - * Default constructor. - */ - public TestParametersLGeneric() { - // Default Constructor - } - - /** - * Create a test parameter group. - * - * @param name the parameter group name - */ - public TestParametersLGeneric(final String name) { - super(name); - } - - public int getLgenericIntField() { - return lgenericIntField; - } - - public String getLgenericStringField() { - return lgenericStringField; - } - - public void setLgenericIntField(int lgenericIntField) { - this.lgenericIntField = lgenericIntField; - } - - public void setLgenericStringField(String lgenericStringField) { - this.lgenericStringField = lgenericStringField; - } - - /** - * Trigger a validation message. - * - * @param level Number of levels to recurse before stopping - */ - public void triggerValidationStatus(final ValidationStatus triggerStatus, int level) { - if (level == 0) { - return; - } - - switch (triggerStatus) { - case CLEAN: - lgenericStringField = "Legal " + this.getClass().getName(); - lgenericIntField = 0; - break; - case OBSERVATION: - lgenericStringField = "aString"; - lgenericIntField = 2; - break; - case WARNING: - lgenericStringField = LGENERIC_STRING_FIELD; - lgenericIntField = 3; - break; - case INVALID: - lgenericStringField = ""; - lgenericIntField = -1; - break; - default: - break; - } - - } - - @Override - public GroupValidationResult validate() { - GroupValidationResult validationResult = super.validate(); - - if (LGENERIC_STRING_FIELD.equals(lgenericStringField)) { - validationResult.setResult(LGENERIC_STRING_FIELD, ValidationStatus.WARNING, - "using the field name for the parameter value is dangerous"); - } else if ("aString".equals(lgenericStringField)) { - validationResult.setResult(LGENERIC_STRING_FIELD, ValidationStatus.OBSERVATION, - "this value for name is unhelpful"); - } - - if (lgenericIntField < 0) { - validationResult.setResult(LGENERIC_INT_FIELD, ValidationStatus.INVALID, - "lgenericIntField must be a positive integer"); - } else if (lgenericIntField > 2) { - validationResult.setResult(LGENERIC_INT_FIELD, ValidationStatus.WARNING, - "values greater than 2 are not recommended"); - } else if (lgenericIntField == 2) { - validationResult.setResult(LGENERIC_INT_FIELD, ValidationStatus.OBSERVATION, - "this field has been set to 2"); - } - - return validationResult; - } -} diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt b/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt deleted file mode 100644 index 64af7247..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestJsonYamlValidationResult.txt +++ /dev/null @@ -1,41 +0,0 @@ -parameter group "l00NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter group has status CLEAN - field "l00IntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "l00StringField" type "java.lang.String" value "l00 string field value from file" CLEAN, parameter has status CLEAN - parameter group "l00L10NestedNameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter group has status CLEAN - field "l10IntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "l10StringField" type "java.lang.String" value "l00 L10 nested string field value from file" CLEAN, parameter has status CLEAN - parameter group "l10LGenericNested0NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "l10 generic nested 0 string field value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNested0NameFromFile" CLEAN, parameter has status CLEAN - parameter group "l10LGenericNested1NameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "l10 generic nested 1 string field value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNested1NameFromFile" CLEAN, parameter has status CLEAN - parameter group map "l10LGenericNestedMap" CLEAN, parameter group map has status CLEAN - parameter group "L10Entry0Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "L10Entry0 value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "L10Entry0Name" CLEAN, parameter has status CLEAN - parameter group "L10Entry1Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "L10Entry1 value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "L10Entry1Name" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00L10NestedNameFromFile" CLEAN, parameter has status CLEAN - parameter group "l00GenericNestedNameFromFile" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "l00 generic nested string field value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00GenericNestedNameFromFile" CLEAN, parameter has status CLEAN - parameter group map "l00LGenericNestedMap" CLEAN, parameter group map has status CLEAN - parameter group "L00Entry0Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "L00Entry0 value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "L00Entry0Name" CLEAN, parameter has status CLEAN - parameter group "L00Entry1Name" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "1" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "L00Entry1 value from file" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "L00Entry1Name" CLEAN, parameter has status CLEAN - field "isSomeFlag" type "boolean" value "false" CLEAN, parameter has status CLEAN - field "someNonIsFlag" type "boolean" value "false" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00NameFromFile" CLEAN, parameter has status CLEAN -
\ No newline at end of file diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt deleted file mode 100644 index d6b43312..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_0_OK.txt +++ /dev/null @@ -1,41 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter group has status CLEAN - field "l00IntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "l00StringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersL00" CLEAN, parameter has status CLEAN - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter group has status CLEAN - field "l10IntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "l10StringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersL10" CLEAN, parameter has status CLEAN - parameter group "l10LGenericNested0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNested0" CLEAN, parameter has status CLEAN - parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNested1" CLEAN, parameter has status CLEAN - parameter group map "l10LGenericNestedMap" CLEAN, parameter group map has status CLEAN - parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNestedMapVal0" CLEAN, parameter has status CLEAN - parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l10LGenericNestedMapVal1" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00L10Nested" CLEAN, parameter has status CLEAN - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00LGenericNested" CLEAN, parameter has status CLEAN - parameter group map "l00LGenericNestedMap" CLEAN, parameter group map has status CLEAN - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00LGenericNestedMapVal0" CLEAN, parameter has status CLEAN - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter group has status CLEAN - field "lgenericIntField" type "int" value "0" CLEAN, parameter has status CLEAN - field "lgenericStringField" type "java.lang.String" value "Legal org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l00LGenericNestedMapVal1" CLEAN, parameter has status CLEAN - field "isSomeFlag" type "boolean" value "false" CLEAN, parameter has status CLEAN - field "someNonIsFlag" type "boolean" value "false" CLEAN, parameter has status CLEAN - field "name" type "java.lang.String" value "l0Parameters" CLEAN, parameter has status CLEAN -
\ No newline at end of file diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt deleted file mode 100644 index dcc3cee3..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Invalid.txt +++ /dev/null @@ -1,3 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID - field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer - field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt deleted file mode 100644 index ae627926..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Observation.txt +++ /dev/null @@ -1,3 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION - field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt deleted file mode 100644 index 14a65aa8..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_1_Warning.txt +++ /dev/null @@ -1,3 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING - field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt deleted file mode 100644 index 412a36c1..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Invalid.txt +++ /dev/null @@ -1,16 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID - field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer - field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" INVALID, parameter group has status INVALID - field "l10IntField" type "int" value "-1" INVALID, l10IntField must be a positive integer - field "l10StringField" type "java.lang.String" value "" INVALID, l10StringField must be a non-blank string - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group map "l00LGenericNestedMap" INVALID, parameter group map has status INVALID - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string
\ No newline at end of file diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt deleted file mode 100644 index c1989226..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Observation.txt +++ /dev/null @@ -1,16 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION - field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" OBSERVATION, parameter group has status OBSERVATION - field "l10IntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "l10StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group map "l00LGenericNestedMap" OBSERVATION, parameter group map has status OBSERVATION - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt deleted file mode 100644 index 380ded8f..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_2_Warning.txt +++ /dev/null @@ -1,16 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING - field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" WARNING, parameter group has status WARNING - field "l10IntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "l10StringField" type "java.lang.String" value "l10StringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group map "l00LGenericNestedMap" WARNING, parameter group map has status WARNING - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
\ No newline at end of file diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt deleted file mode 100644 index 12bce5c3..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Invalid.txt +++ /dev/null @@ -1,29 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" INVALID, parameter group has status INVALID - field "l00IntField" type "int" value "-1" INVALID, l00IntField must be a positive integer - field "l00StringField" type "java.lang.String" value "" INVALID, l00StringField must be a non-blank string - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" INVALID, parameter group has status INVALID - field "l10IntField" type "int" value "-1" INVALID, l10IntField must be a positive integer - field "l10StringField" type "java.lang.String" value "" INVALID, l10StringField must be a non-blank string - parameter group "l10LGenericNested0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group map "l10LGenericNestedMap" INVALID, parameter group map has status INVALID - parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group map "l00LGenericNestedMap" INVALID, parameter group map has status INVALID - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" INVALID, parameter group has status INVALID - field "lgenericIntField" type "int" value "-1" INVALID, lgenericIntField must be a positive integer - field "lgenericStringField" type "java.lang.String" value "" INVALID, must be a non-blank string
\ No newline at end of file diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt deleted file mode 100644 index 36517cef..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Observation.txt +++ /dev/null @@ -1,29 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" OBSERVATION, parameter group has status OBSERVATION - field "l00IntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "l00StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" OBSERVATION, parameter group has status OBSERVATION - field "l10IntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "l10StringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l10LGenericNested0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group map "l10LGenericNestedMap" OBSERVATION, parameter group map has status OBSERVATION - parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group map "l00LGenericNestedMap" OBSERVATION, parameter group map has status OBSERVATION - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" OBSERVATION, parameter group has status OBSERVATION - field "lgenericIntField" type "int" value "2" OBSERVATION, this field has been set to 2 - field "lgenericStringField" type "java.lang.String" value "aString" OBSERVATION, this value for name is unhelpful diff --git a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt b/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt deleted file mode 100644 index 28747670..00000000 --- a/common-parameters/src/test/resources/expectedValidationResults/TestParametersL0_3_Warning.txt +++ /dev/null @@ -1,29 +0,0 @@ -parameter group "l0Parameters" type "org.onap.policy.common.parameters.testclasses.TestParametersL00" WARNING, parameter group has status WARNING - field "l00IntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "l00StringField" type "java.lang.String" value "l00StringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00L10Nested" type "org.onap.policy.common.parameters.testclasses.TestParametersL10" WARNING, parameter group has status WARNING - field "l10IntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "l10StringField" type "java.lang.String" value "l10StringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l10LGenericNested0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l10LGenericNested1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group map "l10LGenericNestedMap" WARNING, parameter group map has status WARNING - parameter group "l10LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l10LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00LGenericNested" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group map "l00LGenericNestedMap" WARNING, parameter group map has status WARNING - parameter group "l00LGenericNestedMapVal0" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous - parameter group "l00LGenericNestedMapVal1" type "org.onap.policy.common.parameters.testclasses.TestParametersLGeneric" WARNING, parameter group has status WARNING - field "lgenericIntField" type "int" value "3" WARNING, values greater than 2 are not recommended - field "lgenericStringField" type "java.lang.String" value "lgenericStringField" WARNING, using the field name for the parameter value is dangerous
\ No newline at end of file |