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

commit ecfbfa3f04112a1654daa663b556f9908ca6869c
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun May 26 11:08:52 2019 +0200

    CAMEL-13557: Fixed test to use property binding support as the old has 
removed the legacy JDK PropertyEditor in CAMEL-13566
---
 .../couchbase/CouchbaseComponentTest.java          | 29 +++++----------
 .../component/couchbase/CouchbaseConsumerTest.java | 41 ----------------------
 .../drive/AbstractGoogleDriveTestSupport.java      |  3 +-
 .../google/drive/CustomClientFactoryTest.java      |  9 -----
 4 files changed, 10 insertions(+), 72 deletions(-)

diff --git 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
 
b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
index ad4928d..6af8326 100644
--- 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
+++ 
b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
@@ -29,7 +29,9 @@ import org.mockito.junit.MockitoJUnitRunner;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-
+import static org.mockito.AdditionalAnswers.returnsFirstArg;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
 public class CouchbaseComponentTest {
@@ -50,6 +52,8 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testPropertiesSet() throws Exception {
+        
when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+
         Map<String, Object> params = new HashMap<>();
         params.put("username", "ugol");
         params.put("password", "pwd");
@@ -75,18 +79,17 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testCouchbaseURI() throws Exception {
-
         Map<String, Object> params = new HashMap<>();
         String uri = "couchbase:http://localhost/bucket?param=true";;
         String remaining = "http://localhost/bucket?param=true";;
 
         CouchbaseEndpoint endpoint = new 
CouchbaseComponent(context).createEndpoint(uri, remaining, params);
         assertEquals(new URI("http://localhost:8091/pools";), 
endpoint.makeBootstrapURI()[0]);
-
     }
 
     @Test
     public void testCouchbaseAdditionalHosts() throws Exception {
+        
when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
 
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", "127.0.0.1,example.com,another-host");
@@ -101,11 +104,11 @@ public class CouchbaseComponentTest {
         assertEquals(new URI("http://example.com:8091/pools";), 
endpointArray[2]);
         assertEquals(new URI("http://another-host:8091/pools";), 
endpointArray[3]);
         assertEquals(4, endpointArray.length);
-
     }
 
     @Test
     public void testCouchbaseAdditionalHostsWithSpaces() throws Exception {
+        
when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
 
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", " 127.0.0.1, example.com, another-host 
");
@@ -120,11 +123,11 @@ public class CouchbaseComponentTest {
         assertEquals(new URI("http://example.com:8091/pools";), 
endpointArray[2]);
         assertEquals(new URI("http://another-host:8091/pools";), 
endpointArray[3]);
         assertEquals(4, endpointArray.length);
-
     }
 
     @Test
     public void testCouchbaseDuplicateAdditionalHosts() throws Exception {
+        
when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
 
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", "127.0.0.1,localhost, localhost");
@@ -136,11 +139,11 @@ public class CouchbaseComponentTest {
         assertEquals(2, endpointArray.length);
         assertEquals(new URI("http://localhost:8091/pools";), endpointArray[0]);
         assertEquals(new URI("http://127.0.0.1:8091/pools";), endpointArray[1]);
-
     }
 
     @Test
     public void testCouchbaseNullAdditionalHosts() throws Exception {
+        
when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
 
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", null);
@@ -154,18 +157,4 @@ public class CouchbaseComponentTest {
         assertEquals(1, endpointArray.length);
     }
 
-    @Test
-    public void testCouchbasePersistToAndReplicateToParameters() throws 
Exception {
-
-        Map<String, Object> params = new HashMap<>();
-        params.put("persistTo", "1");
-        params.put("replicateTo", "2");
-        String uri = "couchbase:http://localhost/bucket?param=true";;
-        String remaining = "http://localhost/bucket?param=true";;
-
-        CouchbaseEndpoint endpoint = new 
CouchbaseComponent(context).createEndpoint(uri, remaining, params);
-
-        assertEquals(1, endpoint.getPersistTo());
-        assertEquals(2, endpoint.getReplicateTo());
-    }
 }
diff --git 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerTest.java
 
b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerTest.java
deleted file mode 100644
index 2ba014e..0000000
--- 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerTest.java
+++ /dev/null
@@ -1,41 +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.couchbase;
-
-
-import java.net.URI;
-import java.util.ArrayList;
-
-import com.couchbase.client.CouchbaseClient;
-import com.couchbase.client.vbucket.ConfigurationException;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.junit.Test;
-
-public class CouchbaseConsumerTest {
-
-    @Test(expected = ConfigurationException.class)
-    public void testNewCouchbaseConsumer() throws Exception {
-        new CouchbaseConsumer(new CouchbaseEndpoint(), new CouchbaseClient(new 
ArrayList<URI>(), "bucketName", "pwd"), new Processor() {
-            @Override
-            public void process(Exchange exchange) throws Exception {
-                // Nothing to do
-            }
-        });
-    }
-}
diff --git 
a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
 
b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
index 332b484..9a847c1 100644
--- 
a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
+++ 
b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/AbstractGoogleDriveTestSupport.java
@@ -78,6 +78,7 @@ public abstract class AbstractGoogleDriveTestSupport extends 
CamelTestSupport {
     
     @Override
     protected CamelContext createCamelContext() throws Exception {
+        final CamelContext context = super.createCamelContext();
 
         final InputStream in = 
getClass().getResourceAsStream(TEST_OPTIONS_PROPERTIES);
         if (in == null) {
@@ -115,9 +116,7 @@ public abstract class AbstractGoogleDriveTestSupport 
extends CamelTestSupport {
         PropertyBindingSupport.bindProperties(context, configuration, options);
 
         // add GoogleDriveComponent  to Camel context
-        final CamelContext context = super.createCamelContext();
         final GoogleDriveComponent component = new 
GoogleDriveComponent(context);
-
         component.setConfiguration(configuration);
         context.addComponent("google-drive", component);
 
diff --git 
a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/CustomClientFactoryTest.java
 
b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/CustomClientFactoryTest.java
index 2f99887..1a2eaac 100644
--- 
a/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/CustomClientFactoryTest.java
+++ 
b/components/camel-google-drive/src/test/java/org/apache/camel/component/google/drive/CustomClientFactoryTest.java
@@ -16,25 +16,16 @@
  */
 package org.apache.camel.component.google.drive;
 
-
-
 import org.apache.camel.Endpoint;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
-import 
org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
 import org.apache.camel.impl.JndiRegistry;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Test class for com.google.api.services.drive.Drive$Files APIs.
  */
 public class CustomClientFactoryTest extends AbstractGoogleDriveTestSupport {
 
-    private static final Logger LOG = 
LoggerFactory.getLogger(CustomClientFactoryTest.class);
-    private static final String PATH_PREFIX = 
GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
-    
     @Test
     public void testClientFactoryUpdated() throws Exception {
         Endpoint endpoint = 
context.getEndpoint("google-drive://drive-files/list?clientFactory=#myAuth");

Reply via email to