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 2019/05/26 09:09:05 UTC
[camel] branch master updated (65f4843 -> ecfbfa3)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from 65f4843 camel3 - Stop type converter registry as late as possible during shutdown of CamelContext as it may be in use during the stopping procedure.
new 466ee95 CAMEL-13557: Fixed test to use property binding support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566
new 93aeabd Fixed test
new ecfbfa3 CAMEL-13557: Fixed test to use property binding support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../camel/component/atmos/AtmosComponentTest.java | 7 ++++
.../lambda/LambdaComponentClientRegistryTest.java | 3 +-
.../couchbase/CouchbaseComponentTest.java | 29 +++++----------
.../component/couchbase/CouchbaseConsumerTest.java | 41 ----------------------
.../component/couchdb/CouchDbComponentTest.java | 5 +++
.../camel/component/exec/ExecJavaProcessTest.java | 3 +-
.../drive/AbstractGoogleDriveTestSupport.java | 3 +-
.../google/drive/CustomClientFactoryTest.java | 9 -----
8 files changed, 26 insertions(+), 74 deletions(-)
delete mode 100644 components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseConsumerTest.java
[camel] 02/03: Fixed test
Posted by da...@apache.org.
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 93aeabd48174f97ec47e16869a505a6a62ed6c66
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun May 26 10:59:44 2019 +0200
Fixed test
---
.../test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
index becf81d..e35ec5d 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
@@ -411,11 +411,12 @@ public class ExecJavaProcessTest extends CamelTestSupport {
context.start();
output.setExpectedMessageCount(0);
+
Exchange out = sendFailExchange(EXIT_WITH_VALUE_0, NO_TIMEOUT);
//test if exitValue and stderr are accessible through thrown ExecException
ExecException ee = (ExecException) out.getException();
- assertNotNull(ee.getExitValue());
+ assertTrue(ee.getExitValue() > 0);
assertNotNull(ee.getStderr());
output.assertIsSatisfied();
[camel] 03/03: CAMEL-13557: Fixed test to use property binding
support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566
Posted by da...@apache.org.
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 <cl...@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");
[camel] 01/03: CAMEL-13557: Fixed test to use property binding
support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566
Posted by da...@apache.org.
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 466ee956e4d99aa66f563cb6143cea8c1d6b0b45
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun May 26 10:54:58 2019 +0200
CAMEL-13557: Fixed test to use property binding support as the old has removed the legacy JDK PropertyEditor in CAMEL-13566
---
.../java/org/apache/camel/component/atmos/AtmosComponentTest.java | 7 +++++++
.../component/aws/lambda/LambdaComponentClientRegistryTest.java | 3 ++-
.../org/apache/camel/component/couchdb/CouchDbComponentTest.java | 5 +++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java b/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java
index b5a3051..20ab324 100644
--- a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java
+++ b/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java
@@ -26,6 +26,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import static org.junit.Assert.assertEquals;
+import static org.mockito.AdditionalAnswers.returnsFirstArg;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class AtmosComponentTest {
@@ -40,6 +43,8 @@ public class AtmosComponentTest {
@Test
public void testComponentOptions() throws Exception {
+ when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+
AtmosComponent component = new AtmosComponent(context);
component.setFullTokenId(FAKE_TOKEN);
component.setSecretKey(FAKE_SECRET);
@@ -60,6 +65,8 @@ public class AtmosComponentTest {
@Test
public void testUriParamsOverrideComponentOptions() throws Exception {
+ when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+
AtmosComponent component = new AtmosComponent(context);
component.setFullTokenId("fakeTokenToBeOverridden");
component.setSecretKey("fakeSecretToBeOverridden");
diff --git a/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentClientRegistryTest.java b/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentClientRegistryTest.java
index 293a6c8..5ab2f29 100644
--- a/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentClientRegistryTest.java
+++ b/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentClientRegistryTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.aws.lambda;
import com.amazonaws.services.lambda.AWSLambdaClient;
+import org.apache.camel.PropertyBindingException;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -37,7 +38,7 @@ public class LambdaComponentClientRegistryTest extends CamelTestSupport {
assertNotNull(endpoint.getConfiguration().getAwsLambdaClient());
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = PropertyBindingException.class)
public void createEndpointWithMinimalKMSClientMisconfiguration() throws Exception {
LambdaComponent component = new LambdaComponent(context);
diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
index ad8b029..c375dd0 100644
--- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
+++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
@@ -30,6 +30,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.AdditionalAnswers.returnsFirstArg;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class CouchDbComponentTest {
@@ -50,6 +53,8 @@ public class CouchDbComponentTest {
@Test
public void testPropertiesSet() throws Exception {
+ when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+
Map<String, Object> params = new HashMap<>();
params.put("createDatabase", true);
params.put("username", "coldplay");