You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/11/05 05:51:51 UTC

[camel] branch master updated: CAMEL-15813: Fixed CS and polished

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new eede0f3  CAMEL-15813: Fixed CS and polished
eede0f3 is described below

commit eede0f344bdbac4fc2f24cff99469b3f5f09db84
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 5 06:51:29 2020 +0100

    CAMEL-15813: Fixed CS and polished
---
 .../apache/camel/component/grpc/GrpcComponent.java |  7 +++----
 .../component/grpc/GrpcMockClientInterceptor.java  | 16 +++++++++++++++
 .../grpc/GrpcProducerClientInterceptorTest.java    | 23 ++++++++++++++++++----
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcComponent.java b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcComponent.java
index ab5c52c..5d691da 100644
--- a/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcComponent.java
+++ b/components/camel-grpc/src/main/java/org/apache/camel/component/grpc/GrpcComponent.java
@@ -26,9 +26,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 
-/**
- * Represents the component that manages {@link GrpcEndpoint}.
- */
 @Component("grpc")
 public class GrpcComponent extends DefaultComponent {
 
@@ -57,6 +54,8 @@ public class GrpcComponent extends DefaultComponent {
 
     private void checkAndSetRegistryClientInterceptors(GrpcConfiguration configuration) {
         Set<ClientInterceptor> clientInterceptors = getCamelContext().getRegistry().findByType(ClientInterceptor.class);
-        configuration.setClientInterceptors(new ArrayList<>(clientInterceptors));
+        if (!clientInterceptors.isEmpty()) {
+            configuration.setClientInterceptors(new ArrayList<>(clientInterceptors));
+        }
     }
 }
diff --git a/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcMockClientInterceptor.java b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcMockClientInterceptor.java
index 0526242..18ed7d0 100644
--- a/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcMockClientInterceptor.java
+++ b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcMockClientInterceptor.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
 package org.apache.camel.component.grpc;
 
 import io.grpc.CallOptions;
diff --git a/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcProducerClientInterceptorTest.java b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcProducerClientInterceptorTest.java
index ed9a650..5ba2aff 100644
--- a/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcProducerClientInterceptorTest.java
+++ b/components/camel-grpc/src/test/java/org/apache/camel/component/grpc/GrpcProducerClientInterceptorTest.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
 package org.apache.camel.component.grpc;
 
 import java.io.IOException;
@@ -32,8 +48,8 @@ public class GrpcProducerClientInterceptorTest extends CamelTestSupport {
     private static final String GRPC_TEST_PONG_VALUE = "PONG";
 
     private static Server grpcServer;
-    private static final GrpcMockClientInterceptor mockClientInterceptor = mock(GrpcMockClientInterceptor.class);
-    private static final GrpcMockClientInterceptor mockClientInterceptor2 = mock(GrpcMockClientInterceptor.class);
+    private final GrpcMockClientInterceptor mockClientInterceptor = mock(GrpcMockClientInterceptor.class);
+    private final GrpcMockClientInterceptor mockClientInterceptor2 = mock(GrpcMockClientInterceptor.class);
 
     @BeforeAll
     public static void startGrpcServer() throws Exception {
@@ -46,7 +62,7 @@ public class GrpcProducerClientInterceptorTest extends CamelTestSupport {
     public static void stopGrpcServer() throws IOException {
         if (grpcServer != null) {
             grpcServer.shutdown();
-            LOG.info("gRPC server stoped");
+            LOG.info("gRPC server stopped");
         }
     }
 
@@ -72,7 +88,6 @@ public class GrpcProducerClientInterceptorTest extends CamelTestSupport {
 
         assertFalse(endpoint.getConfiguration().isAutoDiscoverClientInterceptors());
         assertEquals(endpoint.getConfiguration().getClientInterceptors().size(), 0);
-
     }
 
     @Override