aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-04-27 15:08:59 -0400
committerJim Hahn <jrh3@att.com>2021-04-29 14:49:33 -0400
commita05cc62b6426d31c23f60dbe4a6f367331431ea4 (patch)
treebb38e4b81c133004ab9541c15db030750957f5f3 /plugins/reception-plugins/src/test
parentadfc3ee02f3194a143bcea430e5e3aeb99a23206 (diff)
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: Ib5c0dc0ac3762e68307e63f5ce29efb49208e55d Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/reception-plugins/src/test')
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java12
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java7
2 files changed, 11 insertions, 8 deletions
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
index 03455b84..c8bcc7bd 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/file/TestFileSystemReceptionHandlerConfigurationParameterGroup.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Intel. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2020 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,6 +23,7 @@
package org.onap.policy.distribution.reception.handling.file;
+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.assertTrue;
@@ -33,7 +35,7 @@ import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
/**
* Class to perform unit test of {@link FileSystemReceptionHandlerConfigurationParameterGroup}.
@@ -54,7 +56,7 @@ public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
configParameters.setWatchPath(validPath);
configParameters.setMaxThread(2);
- final GroupValidationResult validationResult = configParameters.validate();
+ final ValidationResult validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
assertEquals(validPath, configParameters.getWatchPath());
assertEquals(2, configParameters.getMaxThread());
@@ -66,7 +68,7 @@ public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
final Gson gson = new GsonBuilder().create();
configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
FileSystemReceptionHandlerConfigurationParameterGroup.class);
- final GroupValidationResult validationResult = configParameters.validate();
+ final ValidationResult validationResult = configParameters.validate();
assertFalse(validationResult.isValid());
}
@@ -79,8 +81,8 @@ public class TestFileSystemReceptionHandlerConfigurationParameterGroup {
new FileSystemReceptionHandlerConfigurationParameterGroup();
configParameters.setWatchPath(invalidPath);
- final GroupValidationResult validateResult = configParameters.validate();
+ final ValidationResult validateResult = configParameters.validate();
assertFalse(validateResult.isValid());
- assertTrue(validateResult.getResult().contains("must be a valid directory"));
+ assertThat(validateResult.getResult()).contains("is not a valid directory");
}
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
index 51298c1e..cd7f2614 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Intel. All rights reserved.
* Modifications Copyright (C) 2019-2020 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.
@@ -31,7 +32,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
import org.junit.Test;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
/**
@@ -47,7 +48,7 @@ public class TestSdcReceptionHandlerConfigurationParameterGroup {
configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
- final GroupValidationResult validationResult = configParameters.validate();
+ final ValidationResult validationResult = configParameters.validate();
assertTrue(validationResult.isValid());
final SdcConfiguration config = new SdcConfiguration(configParameters);
assertEquals(Arrays.asList("a.com", "b.com", "c.com"), config.getMsgBusAddress());
@@ -75,7 +76,7 @@ public class TestSdcReceptionHandlerConfigurationParameterGroup {
configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"),
SdcReceptionHandlerConfigurationParameterGroup.class);
- final GroupValidationResult validationResult = configParameters.validate();
+ final ValidationResult validationResult = configParameters.validate();
assertFalse(validationResult.isValid());
}