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

[camel] branch camel-2.x updated: Backporting atmos test fix

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

coheigea pushed a commit to branch camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.x by this push:
     new 86b60a3  Backporting atmos test fix
86b60a3 is described below

commit 86b60a30de35207d2e20e6c029d316ba5e9a6edf
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri Aug 16 09:38:55 2019 +0100

    Backporting atmos test fix
---
 .../apache/camel/component/atmos/AtmosConsumerTest.java | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosConsumerTest.java b/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosConsumerTest.java
index cb587a4..f297caf 100644
--- a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosConsumerTest.java
+++ b/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosConsumerTest.java
@@ -16,8 +16,9 @@
  */
 package org.apache.camel.component.atmos;
 
+import java.util.Base64;
+
 import org.apache.camel.Consumer;
-import org.apache.camel.EndpointInject;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -26,15 +27,14 @@ import org.junit.Test;
 
 public class AtmosConsumerTest extends CamelTestSupport {
 
-    @EndpointInject(uri = "atmos:foo/get?remotePath=/path&fullTokenId=fakeToken&secretKey=fakeSecret&uri=https://fake/uri")
-    private AtmosEndpoint atmosEndpoint;
+    private String fake = Base64.getEncoder().encodeToString("fakeSecret".getBytes());
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from(atmosEndpoint)
+                fromF("atmos:foo/get?remotePath=/path&fullTokenId=fakeToken&secretKey=%s&uri=https://fake/uri", fake)
                     .to("mock:test");
             }
         };
@@ -42,9 +42,12 @@ public class AtmosConsumerTest extends CamelTestSupport {
 
     @Test
     public void shouldCreateGetConsumer() throws Exception {
-        Consumer consumer = atmosEndpoint.createConsumer(null);
+        AtmosEndpoint endpoint = (AtmosEndpoint) context.getEndpoints().stream().filter(e -> e instanceof AtmosEndpoint).findFirst().orElse(null);
+        assertNotNull(endpoint);
+
+        Consumer consumer = endpoint.createConsumer(null);
         Assert.assertTrue(consumer instanceof AtmosScheduledPollGetConsumer);
-        assertEquals("foo", atmosEndpoint.getConfiguration().getName());
+        assertEquals("foo", endpoint.getConfiguration().getName());
     }
 
-}
\ No newline at end of file
+}