aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/cds/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-13 10:39:55 -0400
committerJim Hahn <jrh3@att.com>2019-06-17 10:50:16 -0400
commitd37c71292d9cbdd892f328d63f49a8027b1f13c4 (patch)
tree615a8af45285d1032a02af1214c76b938c58044d /models-interactions/model-impl/cds/src
parentf59ec395bf1e41df894f884e70ff3185280668c0 (diff)
Fix simple sonar issues in models
Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Removed unused BeforeClass & AfterClass test methods. Removed some trailing spaces. Fixed: aai actor.appc actor.appclcm actor.sdnc actor.sdnr actor.so actor.vfc actorServiceProvider appc appclcm cds events Change-Id: I0e21cbb10db6d1217bbd0e00e6dd4fac3eb84e31 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/cds/src')
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptor.java7
-rw-r--r--models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/properties/CdsServerProperties.java1
-rw-r--r--models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java6
-rw-r--r--models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java8
4 files changed, 11 insertions, 11 deletions
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptor.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptor.java
index 3957fe5e4..17eefd227 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptor.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptor.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. 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.
@@ -49,12 +50,12 @@ public class BasicAuthClientHeaderInterceptor implements ClientInterceptor {
}
@Override
- public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method,
+ public <Q, P> ClientCall<Q, P> interceptCall(MethodDescriptor<Q, P> method,
CallOptions callOptions, Channel channel) {
Key<String> authHeader = Key.of(BASIC_AUTH_HEADER_KEY, Metadata.ASCII_STRING_MARSHALLER);
- return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(channel.newCall(method, callOptions)) {
+ return new ForwardingClientCall.SimpleForwardingClientCall<Q, P>(channel.newCall(method, callOptions)) {
@Override
- public void start(Listener<RespT> responseListener, Metadata headers) {
+ public void start(Listener<P> responseListener, Metadata headers) {
headers.put(authHeader, props.getBasicAuth());
super.start(responseListener, headers);
}
diff --git a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/properties/CdsServerProperties.java b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/properties/CdsServerProperties.java
index 94a336b6d..2e919814b 100644
--- a/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/properties/CdsServerProperties.java
+++ b/models-interactions/model-impl/cds/src/main/java/org/onap/policy/cds/properties/CdsServerProperties.java
@@ -39,7 +39,6 @@ public class CdsServerProperties implements ParameterGroup {
private static final int MIN_USER_PORT = 1024;
private static final int MAX_USER_PORT = 65535;
- private static final String INVALID_PROP = "Invalid CDS property: ";
private static final String SERVER_PROPERTIES_TYPE = "CDS gRPC Server Properties";
// CDS carrier properties
diff --git a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java
index 3b6ad7da1..fedf4703c 100644
--- a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java
+++ b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/BasicAuthClientHeaderInterceptorTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. 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.
@@ -127,9 +128,8 @@ public class BasicAuthClientHeaderInterceptorTest {
private static class TestServerInterceptor implements ServerInterceptor {
@Override
- public <ReqT, RespT> Listener<ReqT> interceptCall(final ServerCall<ReqT, RespT> serverCall,
- final Metadata metadata,
- final ServerCallHandler<ReqT, RespT> serverCallHandler) {
+ public <Q, P> Listener<Q> interceptCall(final ServerCall<Q, P> serverCall,
+ final Metadata metadata, final ServerCallHandler<Q, P> serverCallHandler) {
return serverCallHandler.startCall(serverCall, metadata);
}
}
diff --git a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java
index b9a9a84cd..17b4dc534 100644
--- a/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java
+++ b/models-interactions/model-impl/cds/src/test/java/org/onap/policy/cds/client/CdsProcessorGrpcClientTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. 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.
@@ -19,9 +20,8 @@
package org.onap.policy.cds.client;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
@@ -128,13 +128,13 @@ public class CdsProcessorGrpcClientTest {
@Test
public void testCdsProcessorGrpcClientConstructor() {
- new CdsProcessorGrpcClient(listener, props);
+ new CdsProcessorGrpcClient(listener, props).close();
}
@Test(expected = IllegalStateException.class)
public void testCdsProcessorGrpcClientConstructorFailure() {
props.setHost(null);
- new CdsProcessorGrpcClient(listener, props);
+ new CdsProcessorGrpcClient(listener, props).close();
}
@Test