From e168ce2fad71650ad730519c772a9b093c0a8f43 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 28 Apr 2021 15:45:22 -0400 Subject: Remove GroupValidationResult Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: I2c0c01fac355e6cde4d8d6998dc42f8a2e2ebb65 Signed-off-by: Jim Hahn --- .../restclient/TestExecutionPropertyRest.java | 6 +++-- .../uservice/adapt/restserver/TestRestServer.java | 11 ++++---- .../DummyCarrierTechnologyParameters.java | 30 ++++------------------ 3 files changed, 14 insertions(+), 33 deletions(-) (limited to 'testsuites/integration/integration-uservice-test/src/test/java') diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java index b3f27c52e..8596ceec9 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 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. @@ -158,8 +159,9 @@ public class TestExecutionPropertyRest { final String outString = outContent.toString(); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertThat(outString).contains("invalid URL http://localhost:32801/TestExecutionRest/apex/event/tagId}" - + " has been set for event sending on RESTCLIENT"); + assertThat(outString).contains("item \"url\" " + + "value \"http://localhost:32801/TestExecutionRest/apex/event/tagId}\" INVALID, " + + "invalid URL has been set for event sending on RESTCLIENT"); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java index 0596a65e8..7f460bb15 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java @@ -3,6 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 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. @@ -316,8 +317,7 @@ public class TestRestServer { final String outString = outContent.toString(); - assertThat(outString) - .contains("the parameters \"host\", \"port\", and \"standalone\" are illegal on REST Server producer"); + assertThat(outString).contains("\"host\" value \"null\" INVALID, is blank"); LOGGER.debug("testRestServerProducerStandalone end"); } @@ -341,7 +341,7 @@ public class TestRestServer { await().atMost(10L, TimeUnit.SECONDS).until(() -> !apexMain.isAlive()); final String outString = outContent.toString(); - assertThat(outString).contains(" host is specified only in standalone mode"); + assertThat(outString).contains("\"host\"", "should be specified only in standalone mode"); LOGGER.debug("testRestServerProducerHost end"); } @@ -365,7 +365,7 @@ public class TestRestServer { await().atMost(10L, TimeUnit.SECONDS).until(() -> !apexMain.isAlive()); final String outString = outContent.toString(); - assertThat(outString).contains(" port is specified only in standalone mode"); + assertThat(outString).contains("\"port\"", "should be specified only in standalone mode"); LOGGER.debug("testRestServerProducerPort end"); } @@ -387,8 +387,7 @@ public class TestRestServer { await().atMost(10L, TimeUnit.SECONDS).until(() -> !apexMain.isAlive()); final String outString = outContent.toString(); - assertThat(outString).contains("the parameters \"host\" and \"port\" must be defined for REST Server consumer " - + "(FirstConsumer) in standalone mode"); + assertThat(outString).contains("\"host\" value \"null\" INVALID, is blank"); LOGGER.debug("testRestServerConsumerStandaloneNoHost end"); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java index fca676b9b..bf645a1ac 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 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,10 +23,9 @@ package org.onap.policy.apex.testsuites.integration.uservice.executionproperties import lombok.Data; import lombok.EqualsAndHashCode; -import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; -import org.onap.policy.common.parameters.GroupValidationResult; -import org.onap.policy.common.parameters.ValidationStatus; +import org.onap.policy.common.parameters.annotations.NotBlank; +import org.onap.policy.common.parameters.annotations.NotNull; /** * Dummy carrier technology parameters. @@ -48,8 +48,8 @@ public class DummyCarrierTechnologyParameters extends CarrierTechnologyParameter /** The consumer plugin class for the dummy carrier technology. */ public static final String DUMMY_EVENT_CONSUMER_PLUGIN_CLASS = DummyApexEventConsumer.class.getName(); - private String testToRun = null; - private String propertyFileName = null; + private @NotNull @NotBlank String testToRun = null; + private @NotNull @NotBlank String propertyFileName = null; /** * Constructor to create a dummy carrier technology parameters instance and register the instance with the parameter @@ -64,24 +64,4 @@ public class DummyCarrierTechnologyParameters extends CarrierTechnologyParameter this.setEventConsumerPluginClass(DUMMY_EVENT_CONSUMER_PLUGIN_CLASS); } - - /** - * {@inheritDoc}. - */ - @Override - public GroupValidationResult validate() { - final GroupValidationResult result = super.validate(); - - if (StringUtils.isEmpty(testToRun)) { - result.setResult("testToRun", ValidationStatus.INVALID, - "no test has been specified on the dummy carrier technology plugin"); - } - - if (StringUtils.isEmpty(propertyFileName)) { - result.setResult("propertyFileName", ValidationStatus.INVALID, - "no propertyFileName has been specified on the dummy carrier technology plugin"); - } - - return result; - } } -- cgit 1.2.3-korg