diff options
Diffstat (limited to 'policy-endpoints')
4 files changed, 22 insertions, 22 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java index 53154b9e..57aeb9dc 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2020-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. @@ -32,10 +32,10 @@ import org.onap.policy.common.parameters.annotations.NotNull; * * @author Ajith Sreekumar (ajith.sreekumar@est.tech) */ -@NotNull @NotBlank @Getter public class RestServerParameters extends ParameterGroupImpl { + @NotNull private String host; @Min(value = 1) diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java index 4cd3893d..427f0882 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroup.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * 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. @@ -25,7 +25,7 @@ import java.util.List; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.common.parameters.annotations.NotBlank; @@ -53,8 +53,8 @@ public class TopicParameterGroup extends ParameterGroupImpl { * {@inheritDoc}. */ @Override - public GroupValidationResult validate() { - GroupValidationResult result = super.validate(); + public BeanValidationResult validate() { + BeanValidationResult result = super.validate(); if (result.isValid()) { StringBuilder errorMsg = new StringBuilder(); StringBuilder missingSourceParams = checkMissingMandatoryParams(topicSources); diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/RestServerParametersTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/RestServerParametersTest.java index 58bf98b3..9f03150e 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/RestServerParametersTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/RestServerParametersTest.java @@ -1,8 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * 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. @@ -22,13 +21,14 @@ package org.onap.policy.common.endpoints.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 org.junit.Test; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.StandardCoder; @@ -46,7 +46,7 @@ public class RestServerParametersTest { public void test() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final GroupValidationResult validationResult = restServerParameters.validate(); + final ValidationResult validationResult = restServerParameters.validate(); assertTrue(validationResult.isValid()); assertEquals(CommonTestData.REST_SERVER_HOST, restServerParameters.getHost()); assertEquals(CommonTestData.REST_SERVER_PORT, restServerParameters.getPort()); @@ -60,7 +60,7 @@ public class RestServerParametersTest { public void testValidate() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final GroupValidationResult result = restServerParameters.validate(); + final ValidationResult result = restServerParameters.validate(); assertNull(result.getResult()); assertTrue(result.isValid()); } @@ -70,7 +70,7 @@ public class RestServerParametersTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/RestServerParameters_valid.json"); RestServerParameters restServerParameters = coder.decode(json, RestServerParameters.class); - final GroupValidationResult result = restServerParameters.validate(); + final ValidationResult result = restServerParameters.validate(); assertNull(result.getResult()); assertTrue(result.isValid()); } @@ -80,8 +80,8 @@ public class RestServerParametersTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/RestServerParameters_invalid.json"); RestServerParameters restServerParameters = coder.decode(json, RestServerParameters.class); - final GroupValidationResult result = restServerParameters.validate(); + final ValidationResult result = restServerParameters.validate(); assertFalse(result.isValid()); - assertTrue(result.getResult().contains("parameter group has status INVALID")); + assertThat(result.getResult()).contains("item has status INVALID"); } } diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroupTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroupTest.java index 98b3d84a..e4ac6c85 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroupTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/parameters/TopicParameterGroupTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * 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. @@ -33,7 +33,7 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -51,7 +51,7 @@ public class TopicParameterGroupTest { public void test() throws CoderException { final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParameterGroupMap(false), TopicParameterGroup.class); - final GroupValidationResult validationResult = topicParameterGroup.validate(); + final ValidationResult validationResult = topicParameterGroup.validate(); assertTrue(validationResult.isValid()); assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSinks()); assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSources()); @@ -68,7 +68,7 @@ public class TopicParameterGroupTest { public void testValidate() { final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParameterGroupMap(false), TopicParameterGroup.class); - final GroupValidationResult result = topicParameterGroup.validate(); + final ValidationResult result = topicParameterGroup.validate(); assertNull(result.getResult()); assertTrue(result.isValid()); } @@ -78,7 +78,7 @@ public class TopicParameterGroupTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/TopicParameters_valid.json"); TopicParameterGroup topicParameterGroup = coder.decode(json, TopicParameterGroup.class); - final GroupValidationResult result = topicParameterGroup.validate(); + final ValidationResult result = topicParameterGroup.validate(); assertNull(result.getResult()); assertTrue(result.isValid()); } @@ -88,7 +88,7 @@ public class TopicParameterGroupTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/TopicParameters_invalid.json"); TopicParameterGroup topicParameterGroup = coder.decode(json, TopicParameterGroup.class); - final GroupValidationResult result = topicParameterGroup.validate(); + final ValidationResult result = topicParameterGroup.validate(); assertFalse(result.isValid()); assertTrue(result.getResult().contains("INVALID")); } @@ -98,7 +98,7 @@ public class TopicParameterGroupTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/TopicParameters_missing_mandatory.json"); TopicParameterGroup topicParameterGroup = coder.decode(json, TopicParameterGroup.class); - final GroupValidationResult result = topicParameterGroup.validate(); + final ValidationResult result = topicParameterGroup.validate(); assertTrue(result.getResult().contains("Mandatory parameters are missing")); assertFalse(result.isValid()); } @@ -108,7 +108,7 @@ public class TopicParameterGroupTest { String json = testData.getParameterGroupAsString( "src/test/resources/org/onap/policy/common/endpoints/parameters/TopicParameters_all_params.json"); TopicParameterGroup topicParameterGroup = coder.decode(json, TopicParameterGroup.class); - final GroupValidationResult result = topicParameterGroup.validate(); + final ValidationResult result = topicParameterGroup.validate(); assertNull(result.getResult()); assertTrue(result.isValid()); assertTrue(checkIfAllParamsNotEmpty(topicParameterGroup.getTopicSinks())); |