diff options
author | 2018-08-16 16:43:20 +0100 | |
---|---|---|
committer | 2018-08-16 16:43:58 +0100 | |
commit | 612196451afe9b16b8914858dd58f3bb0dae8579 (patch) | |
tree | 0a3d2c5991fe33594224dbf359db8fcdda588084 /plugins/reception-plugins/src/main/java | |
parent | 84beaf8d12f1badc27b4744a4949f8a586370ea9 (diff) |
Adding termination code changes for distribution
* Code changes for terminating the handlers started by
distribution activator.
* More test cases to increase coverage.
* Fixes for checkstyle issues.
* Fixes for sonar issues.
Change-Id: I3299317c83fa643ac1d0ba1105ac1a932c0a83f6
Issue-ID: POLICY-1035
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'plugins/reception-plugins/src/main/java')
2 files changed, 53 insertions, 55 deletions
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 index 5f74e2b2..86d2a550 100644 --- 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 @@ -5,25 +5,23 @@ * 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.io.File; -import java.util.ArrayList; import java.util.List; -import java.util.Properties; + import org.onap.sdc.api.consumer.IConfiguration; /** @@ -35,14 +33,14 @@ public class PSSDConfiguration implements IConfiguration { // Configuration file structure // Configuration file properties - private PSSDConfigurationParametersGroup configParameters=null; + private PSSDConfigurationParametersGroup configParameters = null; /** * Original constructor * * @param configParameters properties needed to be configured for the model loader */ - public PSSDConfiguration(PSSDConfigurationParametersGroup configParameters) { + public PSSDConfiguration(final PSSDConfigurationParametersGroup configParameters) { this.configParameters = configParameters; } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java index da603359..7fa81149 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/PSSDConfigurationParametersGroup.java @@ -5,40 +5,36 @@ * 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 java.io.FileReader; -import java.io.IOException; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import java.util.List; import org.onap.policy.common.parameters.GroupValidationResult; -import org.onap.policy.common.parameters.ParameterConstants; import org.onap.policy.common.parameters.ParameterGroup; import org.onap.policy.common.parameters.ValidationStatus; /** -* This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json -* format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK. -*/ -public class PSSDConfigurationParametersGroup implements ParameterGroup { - //Policy SDC Service Distribution specified field. + * This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json + * format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK. + */ +public class PSSDConfigurationParametersGroup implements ParameterGroup { + // Policy SDC Service Distribution specified field. private String name; - - //Interface of IConfiguration item + + // Interface of IConfiguration item private String asdcAddress; private List<String> messageBusAddress; private String user; @@ -55,11 +51,11 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { private boolean isFilterinEmptyResources; private Boolean isUseHttpsWithDmaap; - public String getAsdcAddress(){ + public String getAsdcAddress() { return asdcAddress; } - public List<String> getMsgBusAddress(){ + public List<String> getMsgBusAddress() { return messageBusAddress; } @@ -74,7 +70,7 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { public int getPollingInterval() { return pollingInterval; } - + public int getPollingTimeout() { return pollingTimeout; } @@ -83,7 +79,7 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { return consumerId; } - public List<String> getArtifactTypes(){ + public List<String> getArtifactTypes() { return artifactTypes; } @@ -117,8 +113,8 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { @Override public String toString() { - return "name =" + name +",TestParameters:[asdcAddress = " + asdcAddress + ", messageBusAddress = " + messageBusAddress + - ", user = "+ user + "]"; + return "name =" + name + ",TestParameters:[asdcAddress = " + asdcAddress + ", messageBusAddress = " + + messageBusAddress + ", user = " + user + "]"; } @Override @@ -128,14 +124,15 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { @Override public GroupValidationResult validate() { - GroupValidationResult validationResult = new GroupValidationResult(this); + final GroupValidationResult validationResult = new GroupValidationResult(this); if (name == null || name.trim().length() == 0) { validationResult.setResult("name", ValidationStatus.INVALID, "name must be a non-blank string"); } if (asdcAddress == null || asdcAddress.trim().length() == 0) { - validationResult.setResult("asdcAddress", ValidationStatus.INVALID, "asdcAddress must be a non-blank string"); + validationResult.setResult("asdcAddress", ValidationStatus.INVALID, + "asdcAddress must be a non-blank string"); } if (user == null || user.trim().length() == 0) { @@ -147,49 +144,52 @@ public class PSSDConfigurationParametersGroup implements ParameterGroup { } if (consumerGroup == null || consumerGroup.trim().length() == 0) { - validationResult.setResult("consumerGroup", ValidationStatus.INVALID, "consumerGroup must be a non-blank string"); + validationResult.setResult("consumerGroup", ValidationStatus.INVALID, + "consumerGroup must be a non-blank string"); } if (keystorePath == null || keystorePath.trim().length() == 0) { - validationResult.setResult("keystorePath", ValidationStatus.INVALID, "keystorePath must be a non-blank string"); + validationResult.setResult("keystorePath", ValidationStatus.INVALID, + "keystorePath must be a non-blank string"); } if (keystorePassword == null || keystorePassword.trim().length() == 0) { - validationResult.setResult("keystorePassword", ValidationStatus.INVALID, "keystorePassword must be a non-blank string"); + validationResult.setResult("keystorePassword", ValidationStatus.INVALID, + "keystorePassword must be a non-blank string"); } - if(messageBusAddress == null){ - validationResult.setResult("messageBusAddress", ValidationStatus.INVALID, - "messageBusAddress must be a list of non-blank string"); - }else { - for(String temp:messageBusAddress){ - if(temp.trim().length() == 0){ + if (messageBusAddress == null) { + validationResult.setResult("messageBusAddress", ValidationStatus.INVALID, + "messageBusAddress must be a list of non-blank string"); + } else { + for (final String temp : messageBusAddress) { + if (temp.trim().length() == 0) { validationResult.setResult("messageBusAddress", ValidationStatus.INVALID, - "the string of messageBusAddress must be a non-blank string"); + "the string of messageBusAddress must be a non-blank string"); } } } - if(artifactTypes == null){ - validationResult.setResult("artifactTypes", ValidationStatus.INVALID, - "artifactTypes must be a list of non-blank string"); - }else { - for(String temp:artifactTypes){ - if(temp.trim().length() == 0){ + if (artifactTypes == null) { + validationResult.setResult("artifactTypes", ValidationStatus.INVALID, + "artifactTypes must be a list of non-blank string"); + } else { + for (final String temp : artifactTypes) { + if (temp.trim().length() == 0) { validationResult.setResult("artifactTypes", ValidationStatus.INVALID, - "the string of artifactTypes must be a non-blank string"); + "the string of artifactTypes must be a non-blank string"); } } } - if (pollingInterval <= 0){ - validationResult.setResult("pollingInterval", ValidationStatus.INVALID, - "pollingInterval must be a positive integer"); + if (pollingInterval <= 0) { + validationResult.setResult("pollingInterval", ValidationStatus.INVALID, + "pollingInterval must be a positive integer"); } - if (pollingTimeout <= 0){ - validationResult.setResult("pollingTimeout", ValidationStatus.INVALID, - "pollingTimeout must be a positive integer"); + if (pollingTimeout <= 0) { + validationResult.setResult("pollingTimeout", ValidationStatus.INVALID, + "pollingTimeout must be a positive integer"); } return validationResult; |