From 742c4b2ed82860e2a74f3db3b2048173fbc530d8 Mon Sep 17 00:00:00 2001 From: liboNet Date: Sat, 18 Aug 2018 03:15:59 +0800 Subject: integrate PSSDConfiguration to distribution * Integrate the PSSDConfiguration to distribution config parameter. * Moved related PSSDConfigurationParameterGroup classes from "handling" to "parameters" to avoid specified sdc dependency. * Modify all the test case since the distribution config parameter has been changed, update CommonTestData to wrap it. * Add neccessnary SDC handling exceptions which to be used for SDC handler integration. * update the PSSDCOnfiguraitonParameterGroup to add UUID to the setName function to generate unique name for each instance. * use builder to create PSSDConfigurationParametersGroup instead of using many parameters Change-Id: I3c78bc2a51ebc84761bc9458096d6ffa18070b47 Issue-ID: POLICY-956 Signed-off-by: liboNet --- .../handling/sdc/PSSDConfigurationTest.java | 4 +-- .../exceptions/ArtifactInstallerExceptionTest.java | 36 ++++++++++++++++++++++ .../exceptions/PSSDControllerExceptionTest.java | 36 ++++++++++++++++++++++ .../sdc/exceptions/PSSDDownloadExceptionTest.java | 36 ++++++++++++++++++++++ .../exceptions/PSSDParametersExceptionTest.java | 36 ++++++++++++++++++++++ 5 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java create mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java create mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java create mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java (limited to 'plugins/reception-plugins/src/test/java/org') diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java index bcb7ac80..435b7577 100644 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java @@ -33,6 +33,7 @@ import java.io.FileReader; import java.io.IOException; import org.junit.Test; import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup; /*- * Tests for PSSDConfiguration class @@ -53,8 +54,6 @@ public class PSSDConfigurationTest { } final GroupValidationResult validationResult = configParameters.validate(); assertTrue(validationResult.isValid()); - assertEquals("parameterConfig1", configParameters.getName()); - PSSDConfiguration config = new PSSDConfiguration(configParameters); assertEquals(20, config.getPollingInterval()); assertEquals(30,config.getPollingTimeout()); @@ -73,7 +72,6 @@ public class PSSDConfigurationTest { } final GroupValidationResult validationResult = configParameters.validate(); assertFalse(validationResult.isValid()); - assertEquals("parameterConfig1", configParameters.getName()); } } diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java new file mode 100644 index 00000000..6c524ffe --- /dev/null +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerExceptionTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Intel. 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.distribution.reception.handling.sdc.exceptions; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; + +public class ArtifactInstallerExceptionTest { + + @Test + public void test() { + assertNotNull(new ArtifactInstallerException("Message")); + assertNotNull(new ArtifactInstallerException("Message", new IOException())); + } +} diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java new file mode 100644 index 00000000..b467cbad --- /dev/null +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Intel. 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.distribution.reception.handling.sdc.exceptions; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; + +public class PSSDControllerExceptionTest { + + @Test + public void test() { + assertNotNull(new PSSDControllerException("Message")); + assertNotNull(new PSSDControllerException("Message", new IOException())); + } +} diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java new file mode 100644 index 00000000..0ca4330d --- /dev/null +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Intel. 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.distribution.reception.handling.sdc.exceptions; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; + +public class PSSDDownloadExceptionTest { + + @Test + public void test() { + assertNotNull(new PSSDDownloadException("Message")); + assertNotNull(new PSSDDownloadException("Message", new IOException())); + } +} diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java new file mode 100644 index 00000000..040895e6 --- /dev/null +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Intel. 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.distribution.reception.handling.sdc.exceptions; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; + +public class PSSDParametersExceptionTest { + + @Test + public void test() { + assertNotNull(new PSSDParametersException("Message")); + assertNotNull(new PSSDParametersException("Message", new IOException())); + } +} -- cgit 1.2.3-korg