diff options
author | a.sreekumar <ajith.sreekumar@est.tech> | 2019-06-20 09:39:59 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@est.tech> | 2019-06-20 09:39:59 +0000 |
commit | 0fbf039020488215008a2c1fef8a7801bade9177 (patch) | |
tree | 04187de83d54715d49d8fc4ba24bb92fc7e55523 /plugins/plugins-event | |
parent | 7b945416da394a3ae3e53a1a9ae8d21f6a4e761e (diff) |
Enable maven-checkstyle-plugin in apex-pdp
Enable maven-checkstyle-plugin in apex-pdp/pom.xml to fail the build at warning level.
Fix all the existing check style issues in the component.
Change-Id: I4de9c1bd9ca5a2876de9086d2d3526cbdc25c080
Issue-ID: POLICY-1732
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'plugins/plugins-event')
-rw-r--r-- | plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java index 1b2b44382..b34f29ef1 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,16 +23,15 @@ package org.onap.policy.apex.plugins.event.carrier.jms; import java.util.Base64; import java.util.Properties; - import javax.naming.Context; - +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; /** * Apex parameters for JMS as an event carrier technology. - * + * * <p>The parameters for this plugin are: * <ol> * <li>initialContextFactory: JMS uses a naming {@link Context} object to look up the locations of JMS servers and JMS @@ -329,38 +329,38 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters public GroupValidationResult validate() { final GroupValidationResult result = super.validate(); - if (isNullOrBlank(initialContextFactory)) { + if (StringUtils.isBlank(initialContextFactory)) { result.setResult("initialContextFactory", ValidationStatus.INVALID, "initialContextFactory must be specified as a string that is a class that implements the " + "interface org.jboss.naming.remote.client.InitialContextFactory"); } - if (isNullOrBlank(providerUrl)) { + if (StringUtils.isBlank(providerUrl)) { result.setResult("providerUrl", ValidationStatus.INVALID, "providerUrl must be specified as a URL string that specifies the location of " + "configuration information for the service provider to use " + "such as remote://localhost:4447"); } - if (isNullOrBlank(securityPrincipal)) { + if (StringUtils.isBlank(securityPrincipal)) { result.setResult("securityPrincipal", ValidationStatus.INVALID, "securityPrincipal must be specified the identity of the principal for authenticating " + "the caller to the service"); } - if (isNullOrBlank(securityCredentials)) { + if (StringUtils.isBlank(securityCredentials)) { result.setResult("securityCredentials", ValidationStatus.INVALID, " securityCredentials must be specified as the credentials of the " + "principal for authenticating the caller to the service"); } - if (isNullOrBlank(producerTopic)) { + if (StringUtils.isBlank(producerTopic)) { result.setResult("producerTopic", ValidationStatus.INVALID, " producerTopic must be a string that identifies the JMS topic " + "on which Apex will send events"); } - if (isNullOrBlank(consumerTopic)) { + if (StringUtils.isBlank(consumerTopic)) { result.setResult("consumerTopic", ValidationStatus.INVALID, " consumerTopic must be a string that identifies the JMS topic " + "on which Apex will recieve events"); @@ -374,16 +374,6 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters return result; } - /** - * Check if the string is null or blank. - * - * @param stringValue the string value - * @return - */ - private boolean isNullOrBlank(final String stringValue) { - return stringValue == null || stringValue.trim().length() == 0; - } - private String getDefaultCredential() { return new String(Base64.getDecoder().decode(DEFAULT_SECURITY_CREDENTIALS.getBytes())); } |