diff options
author | 2019-04-04 19:04:18 +0900 | |
---|---|---|
committer | 2019-04-09 15:36:11 +0000 | |
commit | 2087350f76e33578212d5488bb9bcc96b3cbfefd (patch) | |
tree | e6eb2e05965491b3bf0995e49caef0f41d65e6f6 /UniversalVesAdapter/src/main/java/org | |
parent | 5d104a528594352889c2297781a70eec50bdd960 (diff) |
Fix sonar issues in universalvesadapter/configs
Fix Constructor has 10 parameters, which is greater than 7 authorized.
Fix Constructor has 14 parameters, which is greater than 7 authorized.
Issue-ID: DCAEGEN2-1384
Change-Id: I33d32a9c85fa942b2e17a1dd3d4b45a2b0643cec
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
Diffstat (limited to 'UniversalVesAdapter/src/main/java/org')
2 files changed, 35 insertions, 56 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java index 70fcf58..137e3af 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java @@ -57,22 +57,20 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig { /** * Default uri path prefix */ - private String dmaapUriPathPrefix ; - - private DMaaPMRPublisherConfig(@Nonnull String hostName, @Nonnull Integer portNumber, @Nonnull String topicName, - @Nonnull String protocol, String userName, String userPassword, @Nonnull String contentType, - int maxBatchSize, int maxRecoveryQueueSize,String dmaapUriPathPrefix) { - this.hostName = hostName; - this.portNumber = portNumber; - this.topicName = topicName; - this.protocol = protocol; - this.userName = userName; - this.userPassword = userPassword; - this.contentType = contentType; - this.maxBatchSize = maxBatchSize; - this.maxRecoveryQueueSize = maxRecoveryQueueSize; - this.dmaapUriPathPrefix =dmaapUriPathPrefix; - } + private String dmaapUriPathPrefix ; + + private DMaaPMRPublisherConfig(Builder builder) { + this.hostName = builder.hostName; + this.portNumber = builder.portNumber; + this.topicName = builder.topicName; + this.protocol = builder.protocol; + this.userName = builder.userName; + this.userPassword = builder.userPassword; + this.contentType = builder.contentType; + this.maxBatchSize = builder.maxBatchSize; + this.maxRecoveryQueueSize = builder.maxRecoveryQueueSize; + this.dmaapUriPathPrefix = builder.dmaapUriPathPrefix; + } /** * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object @@ -204,10 +202,9 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig { * @return Builds and returns thread safe, immutable * {@link DMaaPMRPublisherConfig} object */ - public DMaaPMRPublisherConfig build() { - return new DMaaPMRPublisherConfig(hostName, portNumber, topicName, protocol, userName, userPassword, - contentType, maxBatchSize, maxRecoveryQueueSize,dmaapUriPathPrefix); - } + public DMaaPMRPublisherConfig build() { + return new DMaaPMRPublisherConfig(this); + } } public String getDmaapUriPathPrefix() { diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java index 72a7d9c..703684f 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRSubscriberConfig.java @@ -46,37 +46,22 @@ public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig { private String timeoutMSParam; private String messageLimitParam; private String uriPrefix; - - private DMaaPMRSubscriberConfig(@Nonnull String hostName, - @Nonnull Integer portNumber, - @Nonnull String topicName, - @Nonnull String protocol, - String userName, - String userPassword, - @Nonnull String contentType, - @Nonnull String consumerId, - @Nonnull String consumerGroup, - @Nonnull int timeoutMS, - @Nonnull int messageLimit, - String timeoutMSParam, - String messageLimitParam, - String uriPrefix) { - this.hostName = hostName; - this.portNumber = portNumber; - this.topicName = topicName; - this.protocol = protocol; - this.userName = userName; - this.userPassword = userPassword; - this.contentType = contentType; - this.consumerId = consumerId; - this.consumerGroup = consumerGroup; - this.timeoutMS = timeoutMS; - this.messageLimit = messageLimit; - this.timeoutMSParam=timeoutMSParam; - this.messageLimitParam=messageLimitParam; - this.uriPrefix=uriPrefix; - - + + public DMaaPMRSubscriberConfig(Builder builder) { + this.hostName = builder.hostName; + this.portNumber = builder.portNumber; + this.topicName = builder.topicName; + this.protocol = builder.protocol; + this.userName = builder.userName; + this.userPassword = builder.userPassword; + this.contentType = builder.contentType; + this.consumerId = builder.consumerId; + this.consumerGroup = builder.consumerGroup; + this.timeoutMS = builder.timeoutMS; + this.messageLimit = builder.messageLimit; + this.timeoutMSParam = builder.timeoutMSParam; + this.messageLimitParam = builder.messageLimitParam; + this.uriPrefix = builder.uriPreifix; } /** @@ -234,12 +219,9 @@ public final class DMaaPMRSubscriberConfig extends DMaaPMRBaseConfig { * Builds Immutable instance of {@link DMaaPMRSubscriberConfig} * * @return immutable DMaaP Subscriber Config Object - * @throws IOException */ - public DMaaPMRSubscriberConfig build() throws IOException { - return new DMaaPMRSubscriberConfig(hostName, portNumber, topicName, protocol, userName, userPassword, - contentType, consumerId, consumerGroup, timeoutMS, messageLimit, timeoutMSParam, messageLimitParam, - uriPreifix); + public DMaaPMRSubscriberConfig build() { + return new DMaaPMRSubscriberConfig(this); } } |