From ef2ff6bae65870a4fccc25373c0cfae881e14a81 Mon Sep 17 00:00:00 2001 From: ramverma Date: Thu, 23 Aug 2018 13:50:31 +0100 Subject: Fix sonar and checkstyle issues in distribution * Fixing all check style issues. * Fixing all sonar issues. * Adding maven check style plugin to fail at warning level. Change-Id: I791b8feef39a3a0c3e1e250efea7b6e78208bf07 Issue-ID: POLICY-1035 Signed-off-by: ramverma --- .../reception/decoding/pdpx/PdpxPolicy.java | 8 +- .../reception/handling/sdc/PSSDConfiguration.java | 126 --------------------- .../reception/handling/sdc/PssdConfiguration.java | 126 +++++++++++++++++++++ .../sdc/exceptions/PSSDControllerException.java | 54 --------- .../sdc/exceptions/PSSDDownloadException.java | 54 --------- .../sdc/exceptions/PSSDParametersException.java | 54 --------- .../sdc/exceptions/PssdControllerException.java | 54 +++++++++ .../sdc/exceptions/PssdDownloadException.java | 54 +++++++++ .../sdc/exceptions/PssdParametersException.java | 54 +++++++++ .../handling/sdc/PSSDConfigurationTest.java | 77 ------------- .../handling/sdc/PssdConfigurationTest.java | 75 ++++++++++++ .../exceptions/PSSDControllerExceptionTest.java | 36 ------ .../sdc/exceptions/PSSDDownloadExceptionTest.java | 36 ------ .../exceptions/PSSDParametersExceptionTest.java | 36 ------ .../exceptions/PssdControllerExceptionTest.java | 36 ++++++ .../sdc/exceptions/PssdDownloadExceptionTest.java | 36 ++++++ .../exceptions/PssdParametersExceptionTest.java | 36 ++++++ 17 files changed, 475 insertions(+), 477 deletions(-) delete mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java create mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfiguration.java delete mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java delete mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java delete mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java create mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java create mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdDownloadException.java create mode 100644 plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java delete mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java create mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfigurationTest.java delete mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java delete mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java delete mode 100644 plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.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') diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PdpxPolicy.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PdpxPolicy.java index 14d686be..6e0eb3bd 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PdpxPolicy.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PdpxPolicy.java @@ -5,15 +5,15 @@ * 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========================================================= */ @@ -24,7 +24,7 @@ import org.onap.policy.distribution.model.Policy; import org.onap.policy.distribution.reception.decoding.PolicyDecoder; /** - * A PDP-X Policy, decoded by a {@link PolicyDecoder} + * A PDP-X Policy, decoded by a {@link PolicyDecoder}. */ public class PdpxPolicy implements Policy { diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java deleted file mode 100644 index baba4d42..00000000 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfiguration.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============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; - -import java.util.List; - -import org.onap.sdc.api.consumer.IConfiguration; -import org.onap.policy.distribution.reception.parameters.PSSDConfigurationParametersGroup; - -/** - * Properties for the handling Sdc - * - */ -public class PSSDConfiguration implements IConfiguration { - - // Configuration file structure - - // Configuration file properties - private PSSDConfigurationParametersGroup configParameters = null; - - /** - * Original constructor - * - * @param configParameters properties needed to be configured for the model loader - */ - public PSSDConfiguration(final PSSDConfigurationParametersGroup configParameters) { - this.configParameters = configParameters; - - } - - - @Override - public String getAsdcAddress() { - return configParameters.getAsdcAddress(); - } - - @Override - public List getMsgBusAddress() { - return configParameters.getMsgBusAddress(); - } - - @Override - public String getUser() { - return configParameters.getUser(); - } - - @Override - public String getPassword() { - return configParameters.getPassword(); - } - - @Override - public int getPollingInterval() { - return configParameters.getPollingInterval(); - } - - @Override - public int getPollingTimeout() { - return configParameters.getPollingTimeout(); - } - - @Override - public List getRelevantArtifactTypes() { - return configParameters.getArtifactTypes(); - } - - @Override - public String getConsumerGroup() { - return configParameters.getConsumerGroup(); - } - - @Override - public String getEnvironmentName() { - return configParameters.getEnvironmentName(); - } - - @Override - public String getConsumerID() { - return configParameters.getConsumerID(); - } - - @Override - public String getKeyStorePassword() { - return configParameters.getKeyStorePassword(); - } - - @Override - public String getKeyStorePath() { - return configParameters.getKeyStorePath(); - } - - @Override - public boolean activateServerTLSAuth() { - return configParameters.activateServerTLSAuth(); - } - - @Override - public boolean isFilterInEmptyResources() { - return configParameters.isFilterInEmptyResources(); - } - - @Override - public Boolean isUseHttpsWithDmaap() { - return configParameters.isUseHttpsWithDmaap(); - } - - -} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfiguration.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfiguration.java new file mode 100644 index 00000000..c5c877e1 --- /dev/null +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfiguration.java @@ -0,0 +1,126 @@ +/*- + * ============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; + +import java.util.List; + +import org.onap.sdc.api.consumer.IConfiguration; +import org.onap.policy.distribution.reception.parameters.PssdConfigurationParametersGroup; + +/** + * Properties for the handling Sdc + * + */ +public class PssdConfiguration implements IConfiguration { + + // Configuration file structure + + // Configuration file properties + private PssdConfigurationParametersGroup configParameters = null; + + /** + * Original constructor + * + * @param configParameters properties needed to be configured for the model loader + */ + public PssdConfiguration(final PssdConfigurationParametersGroup configParameters) { + this.configParameters = configParameters; + + } + + + @Override + public String getAsdcAddress() { + return configParameters.getAsdcAddress(); + } + + @Override + public List getMsgBusAddress() { + return configParameters.getMsgBusAddress(); + } + + @Override + public String getUser() { + return configParameters.getUser(); + } + + @Override + public String getPassword() { + return configParameters.getPassword(); + } + + @Override + public int getPollingInterval() { + return configParameters.getPollingInterval(); + } + + @Override + public int getPollingTimeout() { + return configParameters.getPollingTimeout(); + } + + @Override + public List getRelevantArtifactTypes() { + return configParameters.getArtifactTypes(); + } + + @Override + public String getConsumerGroup() { + return configParameters.getConsumerGroup(); + } + + @Override + public String getEnvironmentName() { + return configParameters.getEnvironmentName(); + } + + @Override + public String getConsumerID() { + return configParameters.getConsumerID(); + } + + @Override + public String getKeyStorePassword() { + return configParameters.getKeyStorePassword(); + } + + @Override + public String getKeyStorePath() { + return configParameters.getKeyStorePath(); + } + + @Override + public boolean activateServerTLSAuth() { + return configParameters.activateServerTLSAuth(); + } + + @Override + public boolean isFilterInEmptyResources() { + return configParameters.isFilterInEmptyResources(); + } + + @Override + public Boolean isUseHttpsWithDmaap() { + return configParameters.isUseHttpsWithDmaap(); + } + + +} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java deleted file mode 100644 index ff9acfd0..00000000 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerException.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============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; - - -/** - * Exception of the PSSD controller. - */ -public class PSSDControllerException extends Exception { - - /** - * serialization id. - */ - private static final long serialVersionUID = -8507246953751956974L; - - /** - * Constructor for creating PSSDControllerException using message. - * - * @param message The message to dump - */ - public PSSDControllerException (final String message) { - super (message); - - } - - /** - * Constructor for creating PSSDControllerException using message and exception. - * - * @param message The message to dump - * @param e the exception that caused this exception to be thrown - */ - public PSSDControllerException (final String message, final Exception e) { - super (message, e); - - } -} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java deleted file mode 100644 index f95179c1..00000000 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadException.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============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; - - -/** - * Exception during download from PSSD. - */ -public class PSSDDownloadException extends Exception { - - /** - * serialization id. - */ - private static final long serialVersionUID = -8507246953751956974L; - - /** - * Constructor for creating PSSDDownloadException using message. - * - * @param message The message to dump - */ - public PSSDDownloadException (final String message) { - super (message); - - } - - /** - * Constructor for creating PSSDDownloadException using message and exception. - * - * @param message The message to dump - * @param e the exception that caused this exception to be thrown - */ - public PSSDDownloadException (final String message, final Exception e) { - super (message, e); - - } -} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java deleted file mode 100644 index 91922d7d..00000000 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersException.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============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; - - -/** - * Exception of the PSSD controller. - */ -public class PSSDParametersException extends Exception { - - /** - * serialization id. - */ - private static final long serialVersionUID = -8507246953751956974L; - - /** - * Constructor for creating PSSDParametersException using message. - * - * @param message The message to dump - */ - public PSSDParametersException (final String message) { - super (message); - - } - - /** - * Constructor for creating PSSDParametersException using message and exception. - * - * @param message The message to dump - * @param e the exception that caused this exception to be thrown - */ - public PSSDParametersException (final String message, final Exception e) { - super (message, e); - - } -} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java new file mode 100644 index 00000000..9dece808 --- /dev/null +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java @@ -0,0 +1,54 @@ +/*- + * ============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; + + +/** + * Exception of the Pssd controller. + */ +public class PssdControllerException extends Exception { + + /** + * serialization id. + */ + private static final long serialVersionUID = -8507246953751956974L; + + /** + * Constructor for creating PssdControllerException using message. + * + * @param message The message to dump + */ + public PssdControllerException (final String message) { + super (message); + + } + + /** + * Constructor for creating PssdControllerException using message and exception. + * + * @param message The message to dump + * @param e the exception that caused this exception to be thrown + */ + public PssdControllerException (final String message, final Exception e) { + super (message, e); + + } +} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdDownloadException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdDownloadException.java new file mode 100644 index 00000000..14c6b5ea --- /dev/null +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdDownloadException.java @@ -0,0 +1,54 @@ +/*- + * ============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; + + +/** + * Exception during download from Pssd. + */ +public class PssdDownloadException extends Exception { + + /** + * serialization id. + */ + private static final long serialVersionUID = -8507246953751956974L; + + /** + * Constructor for creating PssdDownloadException using message. + * + * @param message The message to dump + */ + public PssdDownloadException (final String message) { + super (message); + + } + + /** + * Constructor for creating PssdDownloadException using message and exception. + * + * @param message The message to dump + * @param e the exception that caused this exception to be thrown + */ + public PssdDownloadException (final String message, final Exception e) { + super (message, e); + + } +} diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java new file mode 100644 index 00000000..ca17796c --- /dev/null +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java @@ -0,0 +1,54 @@ +/*- + * ============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; + + +/** + * Exception of the Pssd controller. + */ +public class PssdParametersException extends Exception { + + /** + * serialization id. + */ + private static final long serialVersionUID = -8507246953751956974L; + + /** + * Constructor for creating PssdParametersException using message. + * + * @param message The message to dump + */ + public PssdParametersException (final String message) { + super (message); + + } + + /** + * Constructor for creating PssdParametersException using message and exception. + * + * @param message The message to dump + * @param e the exception that caused this exception to be thrown + */ + public PssdParametersException (final String message, final Exception e) { + super (message, e); + + } +} 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 deleted file mode 100644 index 435b7577..00000000 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.io.File; -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 - * - */ -public class PSSDConfigurationTest { - - @Test - public void testPSSDConfigurationParametersGroup() throws IOException { - PSSDConfigurationParametersGroup configParameters = null; - try { - final Gson gson = new GsonBuilder().create(); - configParameters = - gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"), - PSSDConfigurationParametersGroup.class); - } catch (final Exception e) { - fail("test should not thrown an exception here: " + e.getMessage()); - } - final GroupValidationResult validationResult = configParameters.validate(); - assertTrue(validationResult.isValid()); - PSSDConfiguration config = new PSSDConfiguration(configParameters); - assertEquals(20, config.getPollingInterval()); - assertEquals(30,config.getPollingTimeout()); - } - - @Test - public void testInvalidPSSDConfigurationParametersGroup() throws IOException { - PSSDConfigurationParametersGroup configParameters = null; - try { - final Gson gson = new GsonBuilder().create(); - configParameters = - gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"), - PSSDConfigurationParametersGroup.class); - } catch (final Exception e) { - fail("test should not thrown an exception here: " + e.getMessage()); - } - final GroupValidationResult validationResult = configParameters.validate(); - assertFalse(validationResult.isValid()); - - } -} 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 new file mode 100644 index 00000000..5c24a792 --- /dev/null +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/PssdConfigurationTest.java @@ -0,0 +1,75 @@ +/*- + * ============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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +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 + * + */ +public class PssdConfigurationTest { + + @Test + public void testPssdConfigurationParametersGroup() throws IOException { + PssdConfigurationParametersGroup configParameters = null; + try { + final Gson gson = new GsonBuilder().create(); + configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdc.json"), + PssdConfigurationParametersGroup.class); + } catch (final Exception e) { + fail("test should not thrown an exception here: " + e.getMessage()); + } + final GroupValidationResult validationResult = configParameters.validate(); + assertTrue(validationResult.isValid()); + final PssdConfiguration config = new PssdConfiguration(configParameters); + assertEquals(20, config.getPollingInterval()); + assertEquals(30, config.getPollingTimeout()); + } + + @Test + public void testInvalidPssdConfigurationParametersGroup() throws IOException { + PssdConfigurationParametersGroup configParameters = null; + try { + final Gson gson = new GsonBuilder().create(); + configParameters = gson.fromJson(new FileReader("src/test/resources/handling-sdcInvalid.json"), + PssdConfigurationParametersGroup.class); + } catch (final Exception e) { + fail("test should not thrown an exception here: " + e.getMessage()); + } + final GroupValidationResult validationResult = configParameters.validate(); + assertFalse(validationResult.isValid()); + + } +} 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 deleted file mode 100644 index b467cbad..00000000 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDControllerExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 0ca4330d..00000000 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDDownloadExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 040895e6..00000000 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PSSDParametersExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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())); - } -} 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..5f8e507a --- /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..9f76b375 --- /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..7a1f5512 --- /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