http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteComputeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteComputeTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteComputeTest.java index fd66450..2588135 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteComputeTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteComputeTest.java @@ -27,6 +27,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.component.ignite.compute.IgniteComputeComponent; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; @@ -41,10 +42,20 @@ public class IgniteComputeTest extends AbstractIgniteTest { private static final List<Ignite> ADDITIONAL_INSTANCES = Lists.newArrayList(); private static final List<UUID> LISTENERS = Lists.newArrayList(); + @Override + protected String getScheme() { + return "ignite-compute"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteComputeComponent.fromConfiguration(createConfiguration()); + } + @Test public void testExecuteWithWrongPayload() { try { - template.requestBody("ignite:compute:abc?executionType=EXECUTE", TestIgniteComputeResources.TEST_CALLABLE, String.class); + template.requestBody("ignite-compute:abc?executionType=EXECUTE", TestIgniteComputeResources.TEST_CALLABLE, String.class); } catch (Exception e) { assert_().that(ObjectHelper.getException(RuntimeCamelException.class, e).getMessage()).startsWith("Ignite Compute endpoint with EXECUTE"); return; @@ -59,19 +70,19 @@ public class IgniteComputeTest extends AbstractIgniteTest { TestIgniteComputeResources.COUNTER.set(0); // Single Callable. - String result = template.requestBody("ignite:compute:abc?executionType=CALL", TestIgniteComputeResources.TEST_CALLABLE, String.class); + String result = template.requestBody("ignite-compute:abc?executionType=CALL", TestIgniteComputeResources.TEST_CALLABLE, String.class); assert_().that(result).isEqualTo("hello"); // Collection of Callables. Object[] callables = new Object[5]; Arrays.fill(callables, TestIgniteComputeResources.TEST_CALLABLE); - Collection<String> colResult = template.requestBody("ignite:compute:abc?executionType=CALL", Lists.newArrayList(callables), Collection.class); + Collection<String> colResult = template.requestBody("ignite-compute:abc?executionType=CALL", Lists.newArrayList(callables), Collection.class); assert_().that(colResult).containsExactly("hello", "hello", "hello", "hello", "hello").inOrder(); // Callables with a Reducer. - String reduced = template.requestBodyAndHeader("ignite:compute:abc?executionType=CALL", Lists.newArrayList(callables), IgniteConstants.IGNITE_COMPUTE_REDUCER, + String reduced = template.requestBodyAndHeader("ignite-compute:abc?executionType=CALL", Lists.newArrayList(callables), IgniteConstants.IGNITE_COMPUTE_REDUCER, TestIgniteComputeResources.STRING_JOIN_REDUCER, String.class); assert_().that(reduced).isEqualTo("hellohellohellohellohello"); @@ -82,14 +93,14 @@ public class IgniteComputeTest extends AbstractIgniteTest { TestIgniteComputeResources.COUNTER.set(0); // Single Runnable. - Object result = template.requestBody("ignite:compute:abc?executionType=RUN", TestIgniteComputeResources.TEST_RUNNABLE_COUNTER, Object.class); + Object result = template.requestBody("ignite-compute:abc?executionType=RUN", TestIgniteComputeResources.TEST_RUNNABLE_COUNTER, Object.class); assert_().that(result).isNull(); assert_().that(TestIgniteComputeResources.COUNTER.get()).isEqualTo(1); // Multiple Runnables. Object[] runnables = new Object[5]; Arrays.fill(runnables, TestIgniteComputeResources.TEST_RUNNABLE_COUNTER); - result = template.requestBody("ignite:compute:abc?executionType=RUN", Lists.newArrayList(runnables), Collection.class); + result = template.requestBody("ignite-compute:abc?executionType=RUN", Lists.newArrayList(runnables), Collection.class); assert_().that(result).isNull(); assert_().that(TestIgniteComputeResources.COUNTER.get()).isEqualTo(6); } @@ -106,17 +117,17 @@ public class IgniteComputeTest extends AbstractIgniteTest { LISTENERS.add(ignite().events().remoteListen(null, TestIgniteComputeResources.EVENT_COUNTER, EventType.EVT_JOB_FINISHED)); // Single Runnable. - Object result = template.requestBody("ignite:compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_RUNNABLE, Object.class); + Object result = template.requestBody("ignite-compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_RUNNABLE, Object.class); assert_().that(result).isNull(); assert_().that(TestIgniteComputeResources.COUNTER.get()).isEqualTo(3); // Single Callable. - Collection<String> colResult = template.requestBody("ignite:compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_CALLABLE, Collection.class); + Collection<String> colResult = template.requestBody("ignite-compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_CALLABLE, Collection.class); assert_().that(colResult).isNotNull(); assert_().that(colResult).containsExactly("hello", "hello", "hello").inOrder(); // Single Closure. - colResult = template.requestBodyAndHeader("ignite:compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, "Camel", + colResult = template.requestBodyAndHeader("ignite-compute:abc?executionType=BROADCAST", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, "Camel", Collection.class); assert_().that(colResult).isNotNull(); assert_().that(colResult).containsExactly("hello Camel", "hello Camel", "hello Camel").inOrder(); @@ -133,12 +144,12 @@ public class IgniteComputeTest extends AbstractIgniteTest { LISTENERS.add(ignite().events().remoteListen(null, TestIgniteComputeResources.EVENT_COUNTER, EventType.EVT_JOB_RESULTED)); // ComputeTask instance. - String result = template.requestBodyAndHeader("ignite:compute:abc?executionType=EXECUTE", TestIgniteComputeResources.COMPUTE_TASK, IgniteConstants.IGNITE_COMPUTE_PARAMS, 10, String.class); + String result = template.requestBodyAndHeader("ignite-compute:abc?executionType=EXECUTE", TestIgniteComputeResources.COMPUTE_TASK, IgniteConstants.IGNITE_COMPUTE_PARAMS, 10, String.class); assert_().that(result).isNotNull(); assert_().that(Splitter.on(",").splitToList(result)).containsAllOf("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"); // ComputeTask class. - result = template.requestBodyAndHeader("ignite:compute:abc?executionType=EXECUTE", TestIgniteComputeResources.COMPUTE_TASK.getClass(), IgniteConstants.IGNITE_COMPUTE_PARAMS, 10, String.class); + result = template.requestBodyAndHeader("ignite-compute:abc?executionType=EXECUTE", TestIgniteComputeResources.COMPUTE_TASK.getClass(), IgniteConstants.IGNITE_COMPUTE_PARAMS, 10, String.class); assert_().that(result).isNotNull(); assert_().that(Splitter.on(",").splitToList(result)).containsAllOf("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"); } @@ -149,18 +160,18 @@ public class IgniteComputeTest extends AbstractIgniteTest { TestIgniteComputeResources.COUNTER.set(0); // Closure with a single parameter. - String result = template.requestBodyAndHeader("ignite:compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, "Camel", String.class); + String result = template.requestBodyAndHeader("ignite-compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, "Camel", String.class); assert_().that(result).isEqualTo("hello Camel"); // Closure with a Collection of parameters. - Collection<String> colResult = template.requestBodyAndHeader("ignite:compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, + Collection<String> colResult = template.requestBodyAndHeader("ignite-compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, IgniteConstants.IGNITE_COMPUTE_PARAMS, Lists.newArrayList("Camel1", "Camel2", "Camel3"), Collection.class); assert_().that(colResult).containsAllOf("hello Camel1", "hello Camel2", "hello Camel3"); // Closure with a Collection of parameters and a Reducer. Map<String, Object> headers = ImmutableMap.<String, Object> of(IgniteConstants.IGNITE_COMPUTE_PARAMS, Lists.newArrayList("Camel1", "Camel2", "Camel3"), IgniteConstants.IGNITE_COMPUTE_REDUCER, TestIgniteComputeResources.STRING_JOIN_REDUCER); - result = template.requestBodyAndHeaders("ignite:compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, headers, String.class); + result = template.requestBodyAndHeaders("ignite-compute:abc?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, headers, String.class); assert_().that(result).isEqualTo("hello Camel1hello Camel2hello Camel3"); } @@ -170,7 +181,7 @@ public class IgniteComputeTest extends AbstractIgniteTest { } private void startAdditionalGridInstance() { - ADDITIONAL_INSTANCES.add(Ignition.start(buildComponent().getIgniteConfiguration())); + ADDITIONAL_INSTANCES.add(Ignition.start(createConfiguration())); } @After
http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java index 57a1428..ec025f1 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java @@ -31,6 +31,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Route; import org.apache.camel.ServiceStatus; import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.ignite.events.IgniteEventsComponent; import org.apache.camel.impl.JndiRegistry; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.IgniteConfiguration; @@ -43,12 +44,22 @@ import static com.google.common.truth.Truth.assert_; public class IgniteEventsTest extends AbstractIgniteTest { + @Override + protected String getScheme() { + return "ignite-events"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteEventsComponent.fromConfiguration(createConfiguration()); + } + @Test public void testConsumeAllEvents() throws Exception { context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { - from("ignite:events:abc").to("mock:test1"); + from("ignite-events:abc").to("mock:test1"); } }); @@ -82,7 +93,7 @@ public class IgniteEventsTest extends AbstractIgniteTest { context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { - from("ignite:events:abc?events=#filter").to("mock:test2"); + from("ignite-events:abc?events=#filter").to("mock:test2"); } }); @@ -109,7 +120,7 @@ public class IgniteEventsTest extends AbstractIgniteTest { context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { - from("ignite:events:abc?events=EVT_CACHE_OBJECT_PUT").to("mock:test3"); + from("ignite-events:abc?events=EVT_CACHE_OBJECT_PUT").to("mock:test3"); } }); @@ -159,10 +170,10 @@ public class IgniteEventsTest extends AbstractIgniteTest { } @Override - protected IgniteComponent buildComponent() { + protected IgniteConfiguration createConfiguration() { IgniteConfiguration config = new IgniteConfiguration(); config.setIncludeEventTypes(EventType.EVTS_ALL_MINUS_METRIC_UPDATE); - return IgniteComponent.fromConfiguration(config); + return config; } } http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteIdGenTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteIdGenTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteIdGenTest.java index c310e41..5066849 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteIdGenTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteIdGenTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.ignite; import com.google.common.collect.ImmutableSet; +import org.apache.camel.component.ignite.idgen.IgniteIdGenComponent; import org.apache.camel.component.ignite.idgen.IgniteIdGenEndpoint; import org.apache.camel.component.ignite.idgen.IgniteIdGenOperation; import org.apache.ignite.IgniteAtomicSequence; @@ -28,36 +29,46 @@ import static com.google.common.truth.Truth.assert_; public class IgniteIdGenTest extends AbstractIgniteTest { + @Override + protected String getScheme() { + return "ignite-idgen"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteIdGenComponent.fromConfiguration(createConfiguration()); + } + @Test public void testOperations() { - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=GET", null, Long.class)).isEqualTo(0); - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=GET_AND_INCREMENT", null, Long.class)).isEqualTo(0); - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=INCREMENT_AND_GET", null, Long.class)).isEqualTo(2); - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=ADD_AND_GET", 5, Long.class)).isEqualTo(7); - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=GET_AND_ADD", 5, Long.class)).isEqualTo(7); - assert_().that(template.requestBody("ignite:idgen:abc?initialValue=0&operation=GET", 5, Long.class)).isEqualTo(12); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=GET", null, Long.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=GET_AND_INCREMENT", null, Long.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=INCREMENT_AND_GET", null, Long.class)).isEqualTo(2); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=ADD_AND_GET", 5, Long.class)).isEqualTo(7); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=GET_AND_ADD", 5, Long.class)).isEqualTo(7); + assert_().that(template.requestBody("ignite-idgen:abc?initialValue=0&operation=GET", 5, Long.class)).isEqualTo(12); } @Test public void testInitialValue() { - assert_().that(template.requestBody("ignite:idgen:abc?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); - assert_().that(template.requestBody("ignite:idgen:abc?operation=GET_AND_INCREMENT&initialValue=100", null, Long.class)).isEqualTo(100); - assert_().that(template.requestBody("ignite:idgen:abc?operation=INCREMENT_AND_GET&initialValue=100", null, Long.class)).isEqualTo(102); - assert_().that(template.requestBody("ignite:idgen:abc?operation=ADD_AND_GET&initialValue=100", 5, Long.class)).isEqualTo(107); - assert_().that(template.requestBody("ignite:idgen:abc?operation=GET_AND_ADD&initialValue=100", 5, Long.class)).isEqualTo(107); - assert_().that(template.requestBody("ignite:idgen:abc?operation=GET&initialValue=100", 5, Long.class)).isEqualTo(112); + assert_().that(template.requestBody("ignite-idgen:abc?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBody("ignite-idgen:abc?operation=GET_AND_INCREMENT&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBody("ignite-idgen:abc?operation=INCREMENT_AND_GET&initialValue=100", null, Long.class)).isEqualTo(102); + assert_().that(template.requestBody("ignite-idgen:abc?operation=ADD_AND_GET&initialValue=100", 5, Long.class)).isEqualTo(107); + assert_().that(template.requestBody("ignite-idgen:abc?operation=GET_AND_ADD&initialValue=100", 5, Long.class)).isEqualTo(107); + assert_().that(template.requestBody("ignite-idgen:abc?operation=GET&initialValue=100", 5, Long.class)).isEqualTo(112); } @Test public void testDifferentOperation() { - assert_().that(template.requestBody("ignite:idgen:abc?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); - assert_().that(template.requestBodyAndHeader("ignite:idgen:abc?operation=GET_AND_INCREMENT&initialValue=100", null, IgniteConstants.IGNITE_IDGEN_OPERATION, + assert_().that(template.requestBody("ignite-idgen:abc?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBodyAndHeader("ignite-idgen:abc?operation=GET_AND_INCREMENT&initialValue=100", null, IgniteConstants.IGNITE_IDGEN_OPERATION, IgniteIdGenOperation.INCREMENT_AND_GET, Long.class)).isEqualTo(101); } @Test public void testBatchSize() { - IgniteIdGenEndpoint endpoint = context.getEndpoint("ignite:idgen:abc?operation=GET&initialValue=100&batchSize=100", IgniteIdGenEndpoint.class); + IgniteIdGenEndpoint endpoint = context.getEndpoint("ignite-idgen:abc?operation=GET&initialValue=100&batchSize=100", IgniteIdGenEndpoint.class); assert_().that(template.requestBody(endpoint, null, Long.class)).isEqualTo(100); // Cannot test much here with a single Ignite instance, let's just test that the parameter could be set. http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java index a1cee04..a90de6d 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java @@ -30,6 +30,7 @@ import com.google.common.collect.Range; import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; +import org.apache.camel.component.ignite.messaging.IgniteMessagingComponent; import org.apache.ignite.lang.IgniteBiPredicate; import org.junit.After; import org.junit.Test; @@ -47,12 +48,22 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa private static final String TOPIC2 = "TOPIC2"; private UUID uuid; + @Override + protected String getScheme() { + return "ignite-messaging"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteMessagingComponent.fromConfiguration(createConfiguration()); + } + @Test public void testProducerSendMessage() { List<Object> messages = Lists.newArrayList(); setupMessageListener(TOPIC1, messages); - template.requestBody("ignite:messaging:TOPIC1", 1); + template.requestBody("ignite-messaging:TOPIC1", 1); await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(1)); assert_().that(messages.get(0)).isEqualTo(1); @@ -66,7 +77,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa List<Object> messages2 = Lists.newArrayList(); setupMessageListener(TOPIC2, messages2); - template.requestBodyAndHeader("ignite:messaging:TOPIC1", 1, IgniteConstants.IGNITE_MESSAGING_TOPIC, "TOPIC2"); + template.requestBodyAndHeader("ignite-messaging:TOPIC1", 1, IgniteConstants.IGNITE_MESSAGING_TOPIC, "TOPIC2"); Thread.sleep(1000); assert_().that(messages1.size()).isEqualTo(0); @@ -79,7 +90,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa setupMessageListener(TOPIC1, messages); Set<Integer> request = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers()); - template.requestBody("ignite:messaging:TOPIC1", request); + template.requestBody("ignite-messaging:TOPIC1", request); await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100)); assert_().that(messages).containsAllIn(request); @@ -92,7 +103,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa ContiguousSet<Integer> set = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers()); for (int i : set) { - template.requestBody("ignite:messaging:TOPIC1?sendMode=ORDERED&timeout=1000", i); + template.requestBody("ignite-messaging:TOPIC1?sendMode=ORDERED&timeout=1000", i); } await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100)); @@ -105,7 +116,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa setupMessageListener(TOPIC1, messages); Set<Integer> request = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers()); - template.requestBody("ignite:messaging:TOPIC1?treatCollectionsAsCacheObjects=true", request); + template.requestBody("ignite-messaging:TOPIC1?treatCollectionsAsCacheObjects=true", request); await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(1)); assert_().that(messages.get(0)).isEqualTo(request); @@ -114,7 +125,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa @Test public void testConsumerManyMessages() throws Exception { List<Object> messages = Lists.newArrayList(); - Consumer consumer = context.getEndpoint("ignite:messaging:TOPIC1").createConsumer(storeBodyInListProcessor(messages)); + Consumer consumer = context.getEndpoint("ignite-messaging:TOPIC1").createConsumer(storeBodyInListProcessor(messages)); consumer.start(); Set<Integer> messagesToSend = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers()); http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteQueueTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteQueueTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteQueueTest.java index 77fb769..f1eb3f7 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteQueueTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteQueueTest.java @@ -31,6 +31,7 @@ import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import org.apache.camel.component.ignite.queue.IgniteQueueComponent; import org.apache.camel.component.ignite.queue.IgniteQueueEndpoint; import org.apache.camel.component.ignite.queue.IgniteQueueOperation; import org.apache.camel.impl.JndiRegistry; @@ -44,21 +45,31 @@ import static com.google.common.truth.Truth.assert_; public class IgniteQueueTest extends AbstractIgniteTest { + @Override + protected String getScheme() { + return "ignite-queue"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteQueueComponent.fromConfiguration(createConfiguration()); + } + @Test public void testOperations() { - boolean result = template.requestBody("ignite:queue:abc?operation=ADD", "hello", boolean.class); + boolean result = template.requestBody("ignite-queue:abc?operation=ADD", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite:queue:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-queue:abc?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite:queue:abc?operation=REMOVE", "hello", boolean.class); + result = template.requestBody("ignite-queue:abc?operation=REMOVE", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isFalse(); - result = template.requestBody("ignite:queue:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-queue:abc?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isFalse(); } @@ -66,11 +77,11 @@ public class IgniteQueueTest extends AbstractIgniteTest { @SuppressWarnings("unchecked") public void testOperations2() { for (int i = 0; i < 100; i++) { - template.requestBody("ignite:queue:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-queue:abc?operation=ADD", "hello" + i); } // SIZE - int size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(100); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(100); @@ -80,29 +91,29 @@ public class IgniteQueueTest extends AbstractIgniteTest { } // RETAIN_ALL - boolean retained = template.requestBodyAndHeader("ignite:queue:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_QUEUE_OPERATION, IgniteQueueOperation.RETAIN_ALL, boolean.class); + boolean retained = template.requestBodyAndHeader("ignite-queue:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_QUEUE_OPERATION, IgniteQueueOperation.RETAIN_ALL, boolean.class); assert_().that(retained).isTrue(); // SIZE - size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(50); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(50); // ITERATOR - Iterator<String> iterator = template.requestBody("ignite:queue:abc?operation=ITERATOR", "hello", Iterator.class); + Iterator<String> iterator = template.requestBody("ignite-queue:abc?operation=ITERATOR", "hello", Iterator.class); assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain).inOrder(); // ARRAY - String[] array = template.requestBody("ignite:queue:abc?operation=ARRAY", "hello", String[].class); + String[] array = template.requestBody("ignite-queue:abc?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactlyElementsIn(toRetain).inOrder(); // CLEAR - Object result = template.requestBody("ignite:queue:abc?operation=CLEAR", "hello", String.class); + Object result = template.requestBody("ignite-queue:abc?operation=CLEAR", "hello", String.class); assert_().that(result).isEqualTo("hello"); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0); // SIZE - size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(0); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0); } @@ -111,14 +122,14 @@ public class IgniteQueueTest extends AbstractIgniteTest { public void testRetainSingle() { // Fill data. for (int i = 0; i < 100; i++) { - template.requestBody("ignite:queue:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-queue:abc?operation=ADD", "hello" + i); } - boolean retained = template.requestBody("ignite:queue:abc?operation=RETAIN_ALL", "hello10", boolean.class); + boolean retained = template.requestBody("ignite-queue:abc?operation=RETAIN_ALL", "hello10", boolean.class); assert_().that(retained).isTrue(); // ARRAY - String[] array = template.requestBody("ignite:queue:abc?operation=ARRAY", "hello", String[].class); + String[] array = template.requestBody("ignite-queue:abc?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactly("hello10"); } @@ -126,28 +137,28 @@ public class IgniteQueueTest extends AbstractIgniteTest { public void testCollectionsAsCacheObject() { // Fill data. for (int i = 0; i < 100; i++) { - template.requestBody("ignite:queue:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-queue:abc?operation=ADD", "hello" + i); } // Add the set. Set<String> toAdd = Sets.newHashSet("hello101", "hello102", "hello103"); - template.requestBody("ignite:queue:abc?operation=ADD&treatCollectionsAsCacheObjects=true", toAdd); + template.requestBody("ignite-queue:abc?operation=ADD&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 101, not 103. - int size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(101); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(101); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains(toAdd)).isTrue(); // Check whether the Set contains the Set. - boolean contains = template.requestBody("ignite:queue:abc?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); + boolean contains = template.requestBody("ignite-queue:abc?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); assert_().that(contains).isTrue(); // Delete the Set. - template.requestBody("ignite:queue:abc?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); + template.requestBody("ignite-queue:abc?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 100 again. - size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(100); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(100); assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains(toAdd)).isFalse(); @@ -161,7 +172,7 @@ public class IgniteQueueTest extends AbstractIgniteTest { context.getRegistry(JndiRegistry.class).bind("config", configuration); - IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite:queue:abc?operation=ADD&configuration=#config", IgniteQueueEndpoint.class); + IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite-queue:abc?operation=ADD&configuration=#config", IgniteQueueEndpoint.class); template.requestBody(igniteEndpoint, "hello"); assert_().that(ignite().queue("abc", 0, configuration).size()).isEqualTo(1); @@ -174,19 +185,19 @@ public class IgniteQueueTest extends AbstractIgniteTest { // Fill data. for (int i = 0; i < 100; i++) { - template.requestBody("ignite:queue:def?operation=ADD&capacity=100", "hello" + i); + template.requestBody("ignite-queue:def?operation=ADD&capacity=100", "hello" + i); list.add("hello" + i); } // NOTE: Unfortunately the behaviour of IgniteQueue doesn't adhere to the overridden ADD method. It should return an Exception. - assert_().that(template.requestBody("ignite:queue:def?operation=ADD&capacity=100", "hello101", boolean.class)).isFalse(); - assert_().that(template.requestBody("ignite:queue:def?operation=OFFER&capacity=100", "hello101", boolean.class)).isFalse(); + assert_().that(template.requestBody("ignite-queue:def?operation=ADD&capacity=100", "hello101", boolean.class)).isFalse(); + assert_().that(template.requestBody("ignite-queue:def?operation=OFFER&capacity=100", "hello101", boolean.class)).isFalse(); final CountDownLatch latch = new CountDownLatch(1); Thread t = new Thread(new Runnable() { @Override public void run() { - assert_().that(template.requestBody("ignite:queue:def?operation=PUT&capacity=100", "hello101", boolean.class)).isFalse(); + assert_().that(template.requestBody("ignite-queue:def?operation=PUT&capacity=100", "hello101", boolean.class)).isFalse(); latch.countDown(); } }); @@ -198,23 +209,23 @@ public class IgniteQueueTest extends AbstractIgniteTest { t.interrupt(); // PEEK and ELEMENT. - assert_().that(template.requestBody("ignite:queue:def?operation=PEEK&capacity=100", null, String.class)).isEqualTo("hello0"); - assert_().that(template.requestBody("ignite:queue:def?operation=ELEMENT&capacity=100", null, String.class)).isEqualTo("hello0"); + assert_().that(template.requestBody("ignite-queue:def?operation=PEEK&capacity=100", null, String.class)).isEqualTo("hello0"); + assert_().that(template.requestBody("ignite-queue:def?operation=ELEMENT&capacity=100", null, String.class)).isEqualTo("hello0"); // TAKE. - assert_().that(template.requestBody("ignite:queue:def?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello0"); - assert_().that(template.requestBody("ignite:queue:def?operation=SIZE&capacity=100", null, int.class)).isEqualTo(99); + assert_().that(template.requestBody("ignite-queue:def?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello0"); + assert_().that(template.requestBody("ignite-queue:def?operation=SIZE&capacity=100", null, int.class)).isEqualTo(99); // Now drain. - assert_().that(template.requestBody("ignite:queue:def?operation=DRAIN&capacity=100", null, String[].class)).asList().hasSize(99); - assert_().that(template.requestBody("ignite:queue:def?operation=SIZE&capacity=100", null, int.class)).isEqualTo(0); - assert_().that(template.requestBody("ignite:queue:def?operation=POLL&capacity=100", null, String.class)).isNull(); + assert_().that(template.requestBody("ignite-queue:def?operation=DRAIN&capacity=100", null, String[].class)).asList().hasSize(99); + assert_().that(template.requestBody("ignite-queue:def?operation=SIZE&capacity=100", null, int.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-queue:def?operation=POLL&capacity=100", null, String.class)).isNull(); // TAKE. t = new Thread(new Runnable() { @Override public void run() { - assert_().that(template.requestBody("ignite:queue:def?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello102"); + assert_().that(template.requestBody("ignite-queue:def?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello102"); latch.countDown(); } }); @@ -222,7 +233,7 @@ public class IgniteQueueTest extends AbstractIgniteTest { t.start(); // Element was returned. - assert_().that(template.requestBody("ignite:queue:def?operation=ADD&capacity=100", "hello102", boolean.class)).isTrue(); + assert_().that(template.requestBody("ignite-queue:def?operation=ADD&capacity=100", "hello102", boolean.class)).isTrue(); assert_().that(latch.await(1000, TimeUnit.MILLISECONDS)).isTrue(); // POLL with a timeout. @@ -230,7 +241,7 @@ public class IgniteQueueTest extends AbstractIgniteTest { @Override public Long call() throws Exception { Stopwatch sw = Stopwatch.createStarted(); - assert_().that(template.requestBody("ignite:queue:def?operation=POLL&timeoutMillis=1000&capacity=100", null, String.class)).isNull(); + assert_().that(template.requestBody("ignite-queue:def?operation=POLL&timeoutMillis=1000&capacity=100", null, String.class)).isNull(); return sw.elapsed(TimeUnit.MILLISECONDS); } }).get()).isAtLeast(1000L); http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteSetTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteSetTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteSetTest.java index 3c3c627..edb96ba 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteSetTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteSetTest.java @@ -25,6 +25,7 @@ import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import org.apache.camel.component.ignite.set.IgniteSetComponent; import org.apache.camel.component.ignite.set.IgniteSetEndpoint; import org.apache.camel.component.ignite.set.IgniteSetOperation; import org.apache.camel.impl.JndiRegistry; @@ -37,21 +38,31 @@ import static com.google.common.truth.Truth.assert_; public class IgniteSetTest extends AbstractIgniteTest { + @Override + protected String getScheme() { + return "ignite-set"; + } + + @Override + protected AbstractIgniteComponent createComponent() { + return IgniteSetComponent.fromConfiguration(createConfiguration()); + } + @Test public void testOperations() { - boolean result = template.requestBody("ignite:set:abc?operation=ADD", "hello", boolean.class); + boolean result = template.requestBody("ignite-set:abc?operation=ADD", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite:set:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-set:abc?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite:set:abc?operation=REMOVE", "hello", boolean.class); + result = template.requestBody("ignite-set:abc?operation=REMOVE", "hello", boolean.class); assert_().that(result).isTrue(); assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isFalse(); - result = template.requestBody("ignite:set:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-set:abc?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isFalse(); } @@ -59,11 +70,11 @@ public class IgniteSetTest extends AbstractIgniteTest { @SuppressWarnings("unchecked") public void testOperations2() { for (int i = 0; i < 100; i++) { - template.requestBody("ignite:set:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-set:abc?operation=ADD", "hello" + i); } // SIZE - int size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(100); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(100); @@ -73,29 +84,29 @@ public class IgniteSetTest extends AbstractIgniteTest { } // RETAIN_ALL - boolean retained = template.requestBodyAndHeader("ignite:set:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_SETS_OPERATION, IgniteSetOperation.RETAIN_ALL, boolean.class); + boolean retained = template.requestBodyAndHeader("ignite-set:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_SETS_OPERATION, IgniteSetOperation.RETAIN_ALL, boolean.class); assert_().that(retained).isTrue(); // SIZE - size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(50); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(50); // ITERATOR - Iterator<String> iterator = template.requestBody("ignite:set:abc?operation=ITERATOR", "hello", Iterator.class); + Iterator<String> iterator = template.requestBody("ignite-set:abc?operation=ITERATOR", "hello", Iterator.class); assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain); // ARRAY - String[] array = template.requestBody("ignite:set:abc?operation=ARRAY", "hello", String[].class); + String[] array = template.requestBody("ignite-set:abc?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactlyElementsIn(toRetain); // CLEAR - Object result = template.requestBody("ignite:set:abc?operation=CLEAR", "hello", String.class); + Object result = template.requestBody("ignite-set:abc?operation=CLEAR", "hello", String.class); assert_().that(result).isEqualTo("hello"); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0); // SIZE - size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(0); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0); } @@ -104,14 +115,14 @@ public class IgniteSetTest extends AbstractIgniteTest { public void testRetainSingle() { // Fill data. for (int i = 0; i < 100; i++) { - template.requestBody("ignite:set:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-set:abc?operation=ADD", "hello" + i); } - boolean retained = template.requestBody("ignite:set:abc?operation=RETAIN_ALL", "hello10", boolean.class); + boolean retained = template.requestBody("ignite-set:abc?operation=RETAIN_ALL", "hello10", boolean.class); assert_().that(retained).isTrue(); // ARRAY - String[] array = template.requestBody("ignite:set:abc?operation=ARRAY", "hello", String[].class); + String[] array = template.requestBody("ignite-set:abc?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactly("hello10"); } @@ -119,28 +130,28 @@ public class IgniteSetTest extends AbstractIgniteTest { public void testCollectionsAsCacheObject() { // Fill data. for (int i = 0; i < 100; i++) { - template.requestBody("ignite:set:abc?operation=ADD", "hello" + i); + template.requestBody("ignite-set:abc?operation=ADD", "hello" + i); } // Add the set. Set<String> toAdd = Sets.newHashSet("hello101", "hello102", "hello103"); - template.requestBody("ignite:set:abc?operation=ADD&treatCollectionsAsCacheObjects=true", toAdd); + template.requestBody("ignite-set:abc?operation=ADD&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 101, not 103. - int size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(101); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(101); assert_().that(ignite().set("abc", new CollectionConfiguration()).contains(toAdd)).isTrue(); // Check whether the Set contains the Set. - boolean contains = template.requestBody("ignite:set:abc?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); + boolean contains = template.requestBody("ignite-set:abc?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); assert_().that(contains).isTrue(); // Delete the Set. - template.requestBody("ignite:set:abc?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); + template.requestBody("ignite-set:abc?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 100 again. - size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(100); assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(100); assert_().that(ignite().set("abc", new CollectionConfiguration()).contains(toAdd)).isFalse(); @@ -154,7 +165,8 @@ public class IgniteSetTest extends AbstractIgniteTest { context.getRegistry(JndiRegistry.class).bind("config", configuration); - IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite:set:abc?operation=ADD&configuration=#config", IgniteSetEndpoint.class); + IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite-" + + "set:abc?operation=ADD&configuration=#config", IgniteSetEndpoint.class); template.requestBody(igniteEndpoint, "hello"); assert_().that(ignite().set("abc", configuration).size()).isEqualTo(1); http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/camel-ignite/src/test/resources/log4j2.properties ---------------------------------------------------------------------- diff --git a/components/camel-ignite/src/test/resources/log4j2.properties b/components/camel-ignite/src/test/resources/log4j2.properties index f982316..3e63da5 100644 --- a/components/camel-ignite/src/test/resources/log4j2.properties +++ b/components/camel-ignite/src/test/resources/log4j2.properties @@ -17,7 +17,7 @@ appender.file.type = File appender.file.name = file -appender.file.fileName = target/camel-mongodb-test.log +appender.file.fileName = target/camel-ignite-test.log appender.file.layout.type = PatternLayout appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n appender.out.type = Console http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/components/readme.adoc ---------------------------------------------------------------------- diff --git a/components/readme.adoc b/components/readme.adoc index 09c9bf1..2c3bb8f 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -2,7 +2,7 @@ Components ^^^^^^^^^^ // components: START -Number of Components: 231 in 184 JAR artifacts (14 deprecated) +Number of Components: 238 in 185 JAR artifacts (14 deprecated) [width="100%",cols="4,1,5",options="header"] |======================================================================= @@ -293,6 +293,27 @@ Number of Components: 231 in 184 JAR artifacts (14 deprecated) | link:camel-ibatis/src/main/docs/ibatis-component.adoc[iBatis] (camel-ibatis) + `ibatis:statement` | 1.2 | *deprecated* Performs a query poll insert update or delete in a relational database using Apache iBATIS. +| link:camel-ignite/src/main/docs/ignite-cache-component.adoc[Ignite Cache] (camel-ignite) + +`ignite-cache:[cacheName]` | 2.17 | Ignite Cache endpoint. + +| link:camel-ignite/src/main/docs/ignite-compute-component.adoc[Ignite Compute] (camel-ignite) + +`ignite-compute:[endpointId]` | 2.17 | Ignite Compute endpoint. + +| link:camel-ignite/src/main/docs/ignite-events-component.adoc[Ignite Events] (camel-ignite) + +`ignite-events:[endpointId]` | 2.17 | Ignite Events endpoint. Only supports consumers. + +| link:camel-ignite/src/main/docs/ignite-idgen-component.adoc[Ignite ID Generator] (camel-ignite) + +`ignite-idgen:[name]` | 2.17 | Ignite ID Generator endpoint. + +| link:camel-ignite/src/main/docs/ignite-messaging-component.adoc[Ignite Messaging] (camel-ignite) + +`ignite-messaging:[topic]` | 2.17 | Ignite Messaging endpoint. + +| link:camel-ignite/src/main/docs/ignite-queue-component.adoc[Ignite Queues] (camel-ignite) + +`ignite-queue:[name]` | 2.17 | Ignite Queue endpoint. + +| link:camel-ignite/src/main/docs/ignite-set-component.adoc[Ignite Sets] (camel-ignite) + +`ignite-set:[name]` | 2.17 | Ignite Set endpoint. + | link:camel-infinispan/src/main/docs/infinispan-component.adoc[Infinispan] (camel-infinispan) + `infinispan:cacheName` | 2.13 | For reading/writing from/to Infinispan distributed key/value store and data grid. http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 25968df..c0787de 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -209,6 +209,13 @@ * [HTTP](http-component.adoc) * [HTTP4](http4-component.adoc) * [iBatis](ibatis-component.adoc) + * [Ignite Cache](ignite-cache-component.adoc) + * [Ignite Compute](ignite-compute-component.adoc) + * [Ignite Events](ignite-events-component.adoc) + * [Ignite ID Generator](ignite-idgen-component.adoc) + * [Ignite Messaging](ignite-messaging-component.adoc) + * [Ignite Queues](ignite-queue-component.adoc) + * [Ignite Sets](ignite-set-component.adoc) * [IMAP](imap-component.adoc) * [Infinispan](infinispan-component.adoc) * [InfluxDB](influxdb-component.adoc) http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java new file mode 100644 index 0000000..211fc3e --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java @@ -0,0 +1,114 @@ +/** + * 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.ignite.cache.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.ignite.cache.IgniteCacheComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.type.AnnotatedTypeMetadata; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(IgniteCacheComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(IgniteCacheComponentConfiguration.class) +public class IgniteCacheComponentAutoConfiguration { + + @Lazy + @Bean(name = "ignite-cache-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(IgniteCacheComponent.class) + public IgniteCacheComponent configureIgniteCacheComponent( + CamelContext camelContext, + IgniteCacheComponentConfiguration configuration) throws Exception { + IgniteCacheComponent component = new IgniteCacheComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + return component; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.ignite-cache"); + if (isEnabled(conditionContext, "camel.component.ignite-cache.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentConfiguration.java new file mode 100644 index 0000000..5e41e4b --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentConfiguration.java @@ -0,0 +1,88 @@ +/** + * 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.ignite.cache.springboot; + +import javax.annotation.Generated; +import org.apache.ignite.Ignite; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Ignite Cache endpoint. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.ignite-cache") +public class IgniteCacheComponentConfiguration { + + /** + * Sets the Ignite instance. + */ + @NestedConfigurationProperty + private Ignite ignite; + /** + * Sets the resource from where to load the configuration. It can be a: URI + * String (URI) or an InputStream. + */ + private Object configurationResource; + /** + * Allows the user to set a programmatic IgniteConfiguration. + */ + @NestedConfigurationProperty + private IgniteConfiguration igniteConfiguration; + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Ignite getIgnite() { + return ignite; + } + + public void setIgnite(Ignite ignite) { + this.ignite = ignite; + } + + public Object getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(Object configurationResource) { + this.configurationResource = configurationResource; + } + + public IgniteConfiguration getIgniteConfiguration() { + return igniteConfiguration; + } + + public void setIgniteConfiguration(IgniteConfiguration igniteConfiguration) { + this.igniteConfiguration = igniteConfiguration; + } + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java new file mode 100644 index 0000000..731d594 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java @@ -0,0 +1,114 @@ +/** + * 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.ignite.compute.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.ignite.compute.IgniteComputeComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.type.AnnotatedTypeMetadata; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(IgniteComputeComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(IgniteComputeComponentConfiguration.class) +public class IgniteComputeComponentAutoConfiguration { + + @Lazy + @Bean(name = "ignite-compute-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(IgniteComputeComponent.class) + public IgniteComputeComponent configureIgniteComputeComponent( + CamelContext camelContext, + IgniteComputeComponentConfiguration configuration) throws Exception { + IgniteComputeComponent component = new IgniteComputeComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + return component; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.ignite-compute"); + if (isEnabled(conditionContext, "camel.component.ignite-compute.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentConfiguration.java new file mode 100644 index 0000000..920de79 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentConfiguration.java @@ -0,0 +1,88 @@ +/** + * 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.ignite.compute.springboot; + +import javax.annotation.Generated; +import org.apache.ignite.Ignite; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Ignite Compute endpoint. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.ignite-compute") +public class IgniteComputeComponentConfiguration { + + /** + * Sets the Ignite instance. + */ + @NestedConfigurationProperty + private Ignite ignite; + /** + * Sets the resource from where to load the configuration. It can be a: URI + * String (URI) or an InputStream. + */ + private Object configurationResource; + /** + * Allows the user to set a programmatic IgniteConfiguration. + */ + @NestedConfigurationProperty + private IgniteConfiguration igniteConfiguration; + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Ignite getIgnite() { + return ignite; + } + + public void setIgnite(Ignite ignite) { + this.ignite = ignite; + } + + public Object getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(Object configurationResource) { + this.configurationResource = configurationResource; + } + + public IgniteConfiguration getIgniteConfiguration() { + return igniteConfiguration; + } + + public void setIgniteConfiguration(IgniteConfiguration igniteConfiguration) { + this.igniteConfiguration = igniteConfiguration; + } + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java new file mode 100644 index 0000000..a91d8a6 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java @@ -0,0 +1,114 @@ +/** + * 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.ignite.events.springboot; + +import java.util.HashMap; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.ignite.events.IgniteEventsComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.bind.RelaxedPropertyResolver; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.type.AnnotatedTypeMetadata; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@Conditional(IgniteEventsComponentAutoConfiguration.Condition.class) +@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(IgniteEventsComponentConfiguration.class) +public class IgniteEventsComponentAutoConfiguration { + + @Lazy + @Bean(name = "ignite-events-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(IgniteEventsComponent.class) + public IgniteEventsComponent configureIgniteEventsComponent( + CamelContext camelContext, + IgniteEventsComponentConfiguration configuration) throws Exception { + IgniteEventsComponent component = new IgniteEventsComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + return component; + } + + @Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") + public static class Condition extends SpringBootCondition { + @Override + public ConditionOutcome getMatchOutcome( + ConditionContext conditionContext, + AnnotatedTypeMetadata annotatedTypeMetadata) { + boolean groupEnabled = isEnabled(conditionContext, + "camel.component.", true); + ConditionMessage.Builder message = ConditionMessage + .forCondition("camel.component.ignite-events"); + if (isEnabled(conditionContext, "camel.component.ignite-events.", + groupEnabled)) { + return ConditionOutcome.match(message.because("enabled")); + } + return ConditionOutcome.noMatch(message.because("not enabled")); + } + + private boolean isEnabled( + org.springframework.context.annotation.ConditionContext context, + java.lang.String prefix, boolean defaultValue) { + RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( + context.getEnvironment(), prefix); + return resolver.getProperty("enabled", Boolean.class, defaultValue); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/df656782/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentConfiguration.java new file mode 100644 index 0000000..db3ff99 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentConfiguration.java @@ -0,0 +1,88 @@ +/** + * 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.ignite.events.springboot; + +import javax.annotation.Generated; +import org.apache.ignite.Ignite; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Ignite Events endpoint. Only supports consumers. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.ignite-events") +public class IgniteEventsComponentConfiguration { + + /** + * Sets the Ignite instance. + */ + @NestedConfigurationProperty + private Ignite ignite; + /** + * Sets the resource from where to load the configuration. It can be a: URI + * String (URI) or an InputStream. + */ + private Object configurationResource; + /** + * Allows the user to set a programmatic IgniteConfiguration. + */ + @NestedConfigurationProperty + private IgniteConfiguration igniteConfiguration; + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Ignite getIgnite() { + return ignite; + } + + public void setIgnite(Ignite ignite) { + this.ignite = ignite; + } + + public Object getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(Object configurationResource) { + this.configurationResource = configurationResource; + } + + public IgniteConfiguration getIgniteConfiguration() { + return igniteConfiguration; + } + + public void setIgniteConfiguration(IgniteConfiguration igniteConfiguration) { + this.igniteConfiguration = igniteConfiguration; + } + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file