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

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

commit 269135fd77d9b7a3249951897ca3c25864ff3bbd
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Tue May 15 15:06:54 2018 +0200

    fix consul kv test
---
 .../component/consul/ConsulClientKeyValueTest.java | 12 +++-
 .../component/consul/ConsulClientTestSupport.java  | 80 ----------------------
 2 files changed, 11 insertions(+), 81 deletions(-)

diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientKeyValueTest.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientKeyValueTest.java
index 7753245..360157d 100644
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientKeyValueTest.java
+++ 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientKeyValueTest.java
@@ -20,10 +20,20 @@ import java.util.Optional;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.consul.endpoint.ConsulKeyValueActions;
+import org.apache.camel.component.consul.support.ConsulTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
 
-public class ConsulClientKeyValueTest extends ConsulClientTestSupport {
+public class ConsulClientKeyValueTest extends ConsulTestSupport {
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("consulClient", getConsul());
+
+        return registry;
+    }
 
     @Test
     public void testKeyPut() throws Exception {
diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientTestSupport.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientTestSupport.java
deleted file mode 100644
index c0d9b78..0000000
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulClientTestSupport.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.consul;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import com.orbitz.consul.Consul;
-import com.orbitz.consul.KeyValueClient;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-public class ConsulClientTestSupport extends CamelTestSupport {
-    public static final String CONSUL_HOST = 
System.getProperty("camel.consul.host", Consul.DEFAULT_HTTP_HOST);
-    public static final int CONSUL_PORT = 
Integer.getInteger("camel.consul.port", Consul.DEFAULT_HTTP_PORT);
-    public static final String CONSUL_URL = String.format("http://%s:%d";, 
CONSUL_HOST, CONSUL_PORT);
-    public static final String KV_PREFIX = "/camel";
-
-    @Rule
-    public final TestName testName = new TestName();
-    
-    public Consul consul = Consul.builder().withUrl(CONSUL_URL).build();
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-
-        ConsulComponent component = new ConsulComponent();
-        component.setUrl(CONSUL_URL);
-
-        registry.bind("consul", component);
-        registry.bind("consulClient", consul);
-
-        return registry;
-    }
-
-    protected Consul getConsul() {
-        return consul;
-    }
-
-    protected KeyValueClient getKeyValueClient() {
-        return getConsul().keyValueClient();
-    }
-
-    protected String generateRandomString() {
-        return UUID.randomUUID().toString();
-    }
-
-    protected String[] generateRandomArrayOfStrings(int size) {
-        String[] array = new String[size];
-        Arrays.setAll(array, i -> generateRandomString());
-
-        return array;
-    }
-
-    protected List<String> generateRandomListOfStrings(int size) {
-        return Arrays.asList(generateRandomArrayOfStrings(size));
-    }
-
-    protected String generateKey() {
-        return KV_PREFIX + "/" + testName.getMethodName() + "/" + 
generateRandomString();
-    }
-}

-- 
To stop receiving notification emails like this one, please contact
lburgazz...@apache.org.

Reply via email to