You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/08/02 08:44:17 UTC

[camel] 01/02: CAMEL-13801 - camel3 - Use @BindToRegistry wherever possible, Camel-Web3j

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

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

commit f4ea2b6957f32ffd683d0869fc2d9d3ca250f52f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Aug 2 10:42:12 2019 +0200

    CAMEL-13801 - camel3 - Use @BindToRegistry wherever possible, Camel-Web3j
---
 .../org/apache/camel/component/web3j/Web3jMockTestSupport.java   | 9 ++-------
 .../apache/camel/component/web3j/Web3jQuorumProducerTest.java    | 9 ++-------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jMockTestSupport.java b/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jMockTestSupport.java
index 6080dd0..53d2f80 100755
--- a/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jMockTestSupport.java
+++ b/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jMockTestSupport.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.web3j;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -39,6 +40,7 @@ public class Web3jMockTestSupport extends CamelTestSupport {
     protected MockEndpoint mockError;
 
     @Mock
+    @BindToRegistry("mockWeb3j")
     protected Web3j mockWeb3j;
 
     @Mock
@@ -49,13 +51,6 @@ public class Web3jMockTestSupport extends CamelTestSupport {
         return true;
     }
 
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("mockWeb3j", mockWeb3j);
-        return registry;
-    }
-
     protected String getUrl() {
         return "web3j://http://127.0.0.1:8545?web3j=#mockWeb3j&";
     }
diff --git a/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jQuorumProducerTest.java b/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jQuorumProducerTest.java
index 3f8965d..033a8d7 100644
--- a/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jQuorumProducerTest.java
+++ b/components/camel-web3j/src/test/java/org/apache/camel/component/web3j/Web3jQuorumProducerTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.web3j;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
@@ -42,6 +43,7 @@ import static org.mockito.ArgumentMatchers.any;
 public class Web3jQuorumProducerTest extends Web3jMockTestSupport {
 
     @Mock
+    @BindToRegistry("mockQuorum")
     protected Quorum mockQuorum;
 
     @Produce("direct:start")
@@ -55,13 +57,6 @@ public class Web3jQuorumProducerTest extends Web3jMockTestSupport {
     }
 
     @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("mockQuorum", mockQuorum);
-        return registry;
-    }
-
-    @Override
     public boolean isUseAdviceWith() {
         return false;
     }