This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 2b448ae CAMEL-13673: Made the camel-ignite tests less dependent of producers lifecycle 2b448ae is described below commit 2b448aec3f7b28aa750ab9d5a9515ff9410060db Author: aldettinger <aldettin...@gmail.com> AuthorDate: Tue Jun 25 10:26:20 2019 +0200 CAMEL-13673: Made the camel-ignite tests less dependent of producers lifecycle --- components/camel-ignite/pom.xml | 2 +- .../ignite/queue/IgniteQueueEndpoint.java | 5 +- .../component/ignite/set/IgniteSetEndpoint.java | 5 +- .../camel/component/ignite/AbstractIgniteTest.java | 27 ++++- .../ignite/IgniteCacheContinuousQueryTest.java | 55 +++++----- .../camel/component/ignite/IgniteCacheTest.java | 69 ++++++------- .../camel/component/ignite/IgniteComputeTest.java | 42 ++++---- .../camel/component/ignite/IgniteEventsTest.java | 48 ++++----- .../camel/component/ignite/IgniteIdGenTest.java | 46 ++++----- .../component/ignite/IgniteMessagingTest.java | 13 +-- .../camel/component/ignite/IgniteQueueTest.java | 115 ++++++++++----------- .../camel/component/ignite/IgniteSetTest.java | 79 +++++++------- 12 files changed, 253 insertions(+), 253 deletions(-) diff --git a/components/camel-ignite/pom.xml b/components/camel-ignite/pom.xml index faf36ca..ab92a19 100644 --- a/components/camel-ignite/pom.xml +++ b/components/camel-ignite/pom.xml @@ -52,7 +52,7 @@ <!-- test dependencies --> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> + <artifactId>camel-test</artifactId> <scope>test</scope> </dependency> diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java index 303f486..55eaebd 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/queue/IgniteQueueEndpoint.java @@ -26,8 +26,8 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; -import org.apache.camel.support.EndpointHelper; import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.IgniteQueue; import org.apache.ignite.configuration.CollectionConfiguration; @@ -64,8 +64,7 @@ public class IgniteQueueEndpoint extends AbstractIgniteEndpoint { // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); - EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); - EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); + PropertyBindingSupport.bindProperties(this.getCamelContext(), configProps, parameters); } } diff --git a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java index 352fdd6..3b1b428 100644 --- a/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java +++ b/components/camel-ignite/src/main/java/org/apache/camel/component/ignite/set/IgniteSetEndpoint.java @@ -26,8 +26,8 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; -import org.apache.camel.support.EndpointHelper; import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.util.ObjectHelper; import org.apache.ignite.configuration.CollectionConfiguration; @@ -57,8 +57,7 @@ public class IgniteSetEndpoint extends AbstractIgniteEndpoint { // Set the configuration values. if (!parameters.containsKey("configuration")) { Map<String, Object> configProps = IntrospectionSupport.extractProperties(parameters, "config."); - EndpointHelper.setReferenceProperties(this.getCamelContext(), configProps, parameters); - EndpointHelper.setProperties(this.getCamelContext(), configProps, parameters); + PropertyBindingSupport.bindProperties(this.getCamelContext(), configProps, parameters); } } diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java index 9fd5b9d..a860b6f 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/AbstractIgniteTest.java @@ -27,16 +27,35 @@ import org.apache.ignite.events.EventType; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.junit.Rule; +import org.junit.rules.TestRule; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; public abstract class AbstractIgniteTest extends CamelTestSupport { - + /** Ip finder for TCP discovery. */ - private static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) { { + private static final TcpDiscoveryIpFinder LOCAL_IP_FINDER = new TcpDiscoveryVmIpFinder(false) { + { setAddresses(Collections.singleton("127.0.0.1:47500..47509")); - } }; - + } + }; + + /** + * A unique identifier for the ignite resource (cache, queue, set...) being + * tested. + */ + protected String resourceUid; + private Ignite ignite; + @Rule + public TestRule watcher = new TestWatcher() { + protected void starting(Description description) { + resourceUid = description.getMethodName() + UUID.randomUUID().toString(); + } + }; + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java index 91fb81b..c3e9c26 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheContinuousQueryTest.java @@ -28,12 +28,12 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; import com.google.common.collect.Maps; +import org.apache.camel.BindToRegistry; 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.cache.IgniteCacheComponent; -import org.apache.camel.impl.JndiRegistry; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; import org.apache.ignite.cache.query.ScanQuery; @@ -47,6 +47,26 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement private static final long serialVersionUID = 1L; + @BindToRegistry("query1") + private ScanQuery<Integer, Person> scanQuery1 = new ScanQuery<>(new IgniteBiPredicate<Integer, Person>() { + private static final long serialVersionUID = 1L; + + @Override + public boolean apply(Integer key, Person person) { + return person.getId() > 50; + } + }); + + @BindToRegistry("remoteFilter1") + private CacheEntryEventSerializableFilter<Integer, Person> remoteFilter = new CacheEntryEventSerializableFilter<Integer, IgniteCacheContinuousQueryTest.Person>() { + private static final long serialVersionUID = 5624973479995548199L; + + @Override + public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends Person> event) throws CacheEntryListenerException { + return event.getValue().getId() > 150; + } + }; + @Override protected String getScheme() { return "ignite-cache"; @@ -151,7 +171,8 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement from("ignite-cache:testcontinuous1?query=#query1&fireExistingQueryResults=true").routeId("continuousQuery.fireExistingEntries").noAutoStartup().to("mock:test2"); - from("ignite-cache:testcontinuous1?query=#query1&remoteFilter=#remoteFilter1&fireExistingQueryResults=true").routeId("remoteFilter").noAutoStartup().to("mock:test3"); + from("ignite-cache:testcontinuous1?query=#query1&remoteFilter=#remoteFilter1&fireExistingQueryResults=true").routeId("remoteFilter").noAutoStartup() + .to("mock:test3"); from("ignite-cache:testcontinuous1?pageSize=10&oneExchangePerUpdate=false").routeId("groupedUpdate").noAutoStartup().to("mock:test4"); @@ -196,34 +217,6 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement resetMocks(); } - @Override - protected JndiRegistry createRegistry() throws Exception { - JndiRegistry answer = super.createRegistry(); - - ScanQuery<Integer, Person> scanQuery1 = new ScanQuery<>(new IgniteBiPredicate<Integer, Person>() { - private static final long serialVersionUID = 1L; - - @Override - public boolean apply(Integer key, Person person) { - return person.getId() > 50; - } - }); - - CacheEntryEventSerializableFilter<Integer, Person> remoteFilter = new CacheEntryEventSerializableFilter<Integer, IgniteCacheContinuousQueryTest.Person>() { - private static final long serialVersionUID = 5624973479995548199L; - - @Override - public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends Person> event) throws CacheEntryListenerException { - return event.getValue().getId() > 150; - } - }; - - answer.bind("query1", scanQuery1); - answer.bind("remoteFilter1", remoteFilter); - - return answer; - } - public static class Person implements Serializable { private static final long serialVersionUID = -6582521698437964648L; @@ -283,7 +276,7 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement return true; } - Person other = (Person) obj; + Person other = (Person)obj; return Objects.equals(this.id, other.id) && Objects.equals(this.name, other.name) && Objects.equals(this.surname, other.surname); } diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java index 9ac387a..afb5a5a 100644 --- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java +++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteCacheTest.java @@ -24,7 +24,6 @@ import java.util.Set; import javax.cache.Cache.Entry; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import org.apache.camel.CamelException; import org.apache.camel.component.ignite.cache.IgniteCacheComponent; @@ -54,36 +53,37 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testAddEntry() { - template.requestBodyAndHeader("ignite-cache:testcache1?operation=PUT", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); + template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=PUT", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); - assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(1); - assert_().that(ignite().cache("testcache1").get("abcd")).isEqualTo("1234"); + assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); + assert_().that(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); } @Test public void testAddEntrySet() { - template.requestBody("ignite-cache:testcache1?operation=PUT", ImmutableMap.of("abcd", "1234", "efgh", "5678")); + template.requestBody("ignite-cache:" + resourceUid + "?operation=PUT", ImmutableMap.of("abcd", "1234", "efgh", "5678")); - assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(2); - assert_().that(ignite().cache("testcache1").get("abcd")).isEqualTo("1234"); - assert_().that(ignite().cache("testcache1").get("efgh")).isEqualTo("5678"); + assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(2); + assert_().that(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); + assert_().that(ignite().cache(resourceUid).get("efgh")).isEqualTo("5678"); } @Test public void testGetOne() { testAddEntry(); - String result = template.requestBody("ignite-cache:testcache1?operation=GET", "abcd", String.class); + String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET", "abcd", String.class); assert_().that(result).isEqualTo("1234"); - result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=GET", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "abcd", String.class); + result = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=GET", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "abcd", + String.class); assert_().that(result).isEqualTo("1234"); } @Test @SuppressWarnings("unchecked") public void testGetMany() { - IgniteCache<String, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); Set<String> keys = new HashSet<>(); for (int i = 0; i < 100; i++) { @@ -91,7 +91,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { keys.add("k" + i); } - Map<String, String> result = template.requestBody("ignite-cache:testcache1?operation=GET", keys, Map.class); + Map<String, String> result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET", keys, Map.class); for (String k : keys) { assert_().that(result.get(k)).isEqualTo(k.replace("k", "v")); } @@ -99,7 +99,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testGetSize() { - IgniteCache<String, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); Set<String> keys = new HashSet<>(); for (int i = 0; i < 100; i++) { @@ -107,13 +107,13 @@ public class IgniteCacheTest extends AbstractIgniteTest { keys.add("k" + i); } - Integer result = template.requestBody("ignite-cache:testcache1?operation=SIZE", keys, Integer.class); + Integer result = template.requestBody("ignite-cache:" + resourceUid + "?operation=SIZE", keys, Integer.class); assert_().that(result).isEqualTo(100); } @Test public void testQuery() { - IgniteCache<String, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); Set<String> keys = new HashSet<>(); for (int i = 0; i < 100; i++) { @@ -130,13 +130,13 @@ public class IgniteCacheTest extends AbstractIgniteTest { } }); - List results = template.requestBodyAndHeader("ignite-cache:testcache1?operation=QUERY", keys, IgniteConstants.IGNITE_CACHE_QUERY, query, List.class); + List<?> results = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=QUERY", keys, IgniteConstants.IGNITE_CACHE_QUERY, query, List.class); assert_().that(results.size()).isEqualTo(50); } @Test public void testGetManyTreatCollectionsAsCacheObjects() { - IgniteCache<Object, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<Object, String> cache = ignite().getOrCreateCache(resourceUid); Set<String> keys = new HashSet<>(); for (int i = 0; i < 100; i++) { @@ -147,25 +147,25 @@ public class IgniteCacheTest extends AbstractIgniteTest { // Also add a cache entry with the entire Set as a key. cache.put(keys, "---"); - String result = template.requestBody("ignite-cache:testcache1?operation=GET&treatCollectionsAsCacheObjects=true", keys, String.class); + String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET&treatCollectionsAsCacheObjects=true", keys, String.class); assert_().that(result).isEqualTo("---"); } @Test public void testRemoveEntry() { - IgniteCache<String, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); cache.put("abcd", "1234"); cache.put("efgh", "5678"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(2); - template.requestBody("ignite-cache:testcache1?operation=REMOVE", "abcd"); + template.requestBody("ignite-cache:" + resourceUid + "?operation=REMOVE", "abcd"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(1); assert_().that(cache.get("abcd")).isNull(); - template.requestBodyAndHeader("ignite-cache:testcache1?operation=REMOVE", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "efgh"); + template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=REMOVE", "this value won't be used", IgniteConstants.IGNITE_CACHE_KEY, "efgh"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(0); assert_().that(cache.get("efgh")).isNull(); @@ -174,14 +174,14 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testClearCache() { - IgniteCache<String, String> cache = ignite().getOrCreateCache("testcache1"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); for (int i = 0; i < 100; i++) { cache.put("k" + i, "v" + i); } assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(100); - template.requestBody("ignite-cache:testcache1?operation=CLEAR", "this value won't be used"); + template.requestBody("ignite-cache:" + resourceUid + "?operation=CLEAR", "this value won't be used"); assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(0); } @@ -190,14 +190,15 @@ public class IgniteCacheTest extends AbstractIgniteTest { public void testHeaderSetRemoveEntry() { testAddEntry(); - String result = template.requestBody("ignite-cache:testcache1?operation=GET", "abcd", String.class); + String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET", "abcd", String.class); assert_().that(result).isEqualTo("1234"); - result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=GET", "abcd", IgniteConstants.IGNITE_CACHE_OPERATION, IgniteCacheOperation.REMOVE, String.class); + result = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=GET", "abcd", IgniteConstants.IGNITE_CACHE_OPERATION, IgniteCacheOperation.REMOVE, + String.class); // The body has not changed, but the cache entry is gone. assert_().that(result).isEqualTo("abcd"); - assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(0); + assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(0); } @Test @@ -214,11 +215,11 @@ public class IgniteCacheTest extends AbstractIgniteTest { @Test public void testAddEntryDoNotPropagateIncomingBody() { - Object result = template.requestBodyAndHeader("ignite-cache:testcache1?operation=PUT&propagateIncomingBodyIfNoReturnValue=false", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd", - Object.class); + Object result = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=PUT&propagateIncomingBodyIfNoReturnValue=false", "1234", + IgniteConstants.IGNITE_CACHE_KEY, "abcd", Object.class); - assert_().that(ignite().cache("testcache1").size(CachePeekMode.ALL)).isEqualTo(1); - assert_().that(ignite().cache("testcache1").get("abcd")).isEqualTo("1234"); + assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); + assert_().that(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); assert_().that(result).isNull(); } @@ -230,13 +231,9 @@ public class IgniteCacheTest extends AbstractIgniteTest { @After public void deleteCaches() { - for (String cacheName : ImmutableSet.<String> of("testcache1", "testcache2")) { - IgniteCache<?, ?> cache = ignite().cache(cacheName); - if (cache == null) { - continue; - } + IgniteCache<?, ?> cache = ignite().cache(resourceUid); + if (cache != null) { cache.clear(); } } - } 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 a207722..80c8d06 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 @@ -55,7 +55,7 @@ public class IgniteComputeTest extends AbstractIgniteTest { @Test public void testExecuteWithWrongPayload() { try { - template.requestBody("ignite-compute:abc?executionType=EXECUTE", TestIgniteComputeResources.TEST_CALLABLE, String.class); + template.requestBody("ignite-compute:" + resourceUid + "?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; @@ -70,20 +70,20 @@ 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:" + resourceUid + "?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:" + resourceUid + "?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, - TestIgniteComputeResources.STRING_JOIN_REDUCER, String.class); + String reduced = template.requestBodyAndHeader("ignite-compute:" + resourceUid + "?executionType=CALL", Lists.newArrayList(callables), + IgniteConstants.IGNITE_COMPUTE_REDUCER, TestIgniteComputeResources.STRING_JOIN_REDUCER, String.class); assert_().that(reduced).isEqualTo("hellohellohellohellohello"); } @@ -93,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:" + resourceUid + "?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:" + resourceUid + "?executionType=RUN", Lists.newArrayList(runnables), Collection.class); assert_().that(result).isNull(); assert_().that(TestIgniteComputeResources.COUNTER.get()).isEqualTo(6); } @@ -117,18 +117,19 @@ 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:" + resourceUid + "?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:" + resourceUid + "?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", - Collection.class); + colResult = template.requestBodyAndHeader("ignite-compute:" + resourceUid + "?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(); } @@ -144,12 +145,14 @@ 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:" + resourceUid + "?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:" + resourceUid + "?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"); } @@ -160,18 +163,19 @@ 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:" + resourceUid + "?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, - Lists.newArrayList("Camel1", "Camel2", "Camel3"), Collection.class); + Collection<String> colResult = template.requestBodyAndHeader("ignite-compute:" + resourceUid + "?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); + 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:" + resourceUid + "?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, headers, String.class); assert_().that(result).isEqualTo("hello Camel1hello Camel2hello Camel3"); } 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 a3133d6..12be923 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 @@ -16,15 +16,16 @@ */ package org.apache.camel.component.ignite; - import java.util.List; import java.util.concurrent.TimeUnit; + import javax.cache.expiry.CreatedExpiryPolicy; import javax.cache.expiry.Duration; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Sets; + import org.apache.camel.Exchange; import org.apache.camel.Route; import org.apache.camel.ServiceStatus; @@ -56,30 +57,31 @@ public class IgniteEventsTest extends AbstractIgniteTest { context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { - from("ignite-events:abc").to("mock:test1"); + from("ignite-events:" + resourceUid).to("mock:test1"); } }); getMockEndpoint("mock:test1").expectedMinimumMessageCount(9); - IgniteCache<String, String> cache = ignite().getOrCreateCache("abc"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); // Generate cache activity. - cache.put("abc", "123"); - cache.get("abc"); - cache.remove("abc"); - cache.withExpiryPolicy(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MILLISECONDS, 100)).create()).put("abc", "123"); + cache.put(resourceUid, "123"); + cache.get(resourceUid); + cache.remove(resourceUid); + cache.withExpiryPolicy(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MILLISECONDS, 100)).create()).put(resourceUid, "123"); Thread.sleep(150); - cache.get("abc"); + cache.get(resourceUid); assertMockEndpointsSatisfied(); List<Integer> eventTypes = receivedEventTypes("mock:test1"); assert_().that(eventTypes).containsAllOf(EventType.EVT_CACHE_STARTED, EventType.EVT_CACHE_ENTRY_CREATED, EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_READ, - EventType.EVT_CACHE_OBJECT_REMOVED, EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_EXPIRED).inOrder(); + EventType.EVT_CACHE_OBJECT_REMOVED, EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_EXPIRED) + .inOrder(); } @@ -90,20 +92,20 @@ 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:" + resourceUid + "?events=#filter").to("mock:test2"); } }); getMockEndpoint("mock:test2").expectedMessageCount(2); - IgniteCache<String, String> cache = ignite().getOrCreateCache("abc"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); // Generate cache activity. - cache.put("abc", "123"); - cache.get("abc"); - cache.remove("abc"); - cache.get("abc"); - cache.put("abc", "123"); + cache.put(resourceUid, "123"); + cache.get(resourceUid); + cache.remove(resourceUid); + cache.get(resourceUid); + cache.put(resourceUid, "123"); assertMockEndpointsSatisfied(); @@ -117,20 +119,20 @@ 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:" + resourceUid + "?events=EVT_CACHE_OBJECT_PUT").to("mock:test3"); } }); getMockEndpoint("mock:test3").expectedMessageCount(2); - IgniteCache<String, String> cache = ignite().getOrCreateCache("abc"); + IgniteCache<String, String> cache = ignite().getOrCreateCache(resourceUid); // Generate cache activity. - cache.put("abc", "123"); - cache.get("abc"); - cache.remove("abc"); - cache.get("abc"); - cache.put("abc", "123"); + cache.put(resourceUid, "123"); + cache.get(resourceUid); + cache.remove(resourceUid); + cache.get(resourceUid); + cache.put(resourceUid, "123"); assertMockEndpointsSatisfied(); 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 a4de6f3..9e12e1f 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 @@ -16,8 +16,6 @@ */ 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; @@ -41,37 +39,39 @@ public class IgniteIdGenTest extends AbstractIgniteTest { @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:" + resourceUid + "?initialValue=0&operation=GET", null, Long.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET_AND_INCREMENT", null, Long.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=INCREMENT_AND_GET", null, Long.class)).isEqualTo(2); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=ADD_AND_GET", 5, Long.class)).isEqualTo(7); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET_AND_ADD", 5, Long.class)).isEqualTo(7); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?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:" + resourceUid + "?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET_AND_INCREMENT&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?operation=INCREMENT_AND_GET&initialValue=100", null, Long.class)).isEqualTo(102); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?operation=ADD_AND_GET&initialValue=100", 5, Long.class)).isEqualTo(107); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET_AND_ADD&initialValue=100", 5, Long.class)).isEqualTo(107); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?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, - IgniteIdGenOperation.INCREMENT_AND_GET, Long.class)).isEqualTo(101); + assert_().that(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + assert_().that(template.requestBodyAndHeader("ignite-idgen:" + resourceUid + "?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:" + resourceUid + "?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. + // Cannot test much here with a single Ignite instance, let's just test + // that the parameter could be set. assert_().that(endpoint.getBatchSize()); } @@ -82,13 +82,9 @@ public class IgniteIdGenTest extends AbstractIgniteTest { @After public void deleteSets() { - for (String name : ImmutableSet.<String> of("abc")) { - IgniteAtomicSequence seq = ignite().atomicSequence(name, 0, false); - if (seq == null) { - continue; - } + IgniteAtomicSequence seq = ignite().atomicSequence(resourceUid, 0, false); + if (seq != null) { seq.close(); } } - } 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 d3a6e42..eca360c 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 @@ -26,6 +26,7 @@ import com.google.common.collect.ContiguousSet; import com.google.common.collect.DiscreteDomain; import com.google.common.collect.Lists; import com.google.common.collect.Range; + import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -60,7 +61,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa 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).until(() -> messages.size() == 1); assert_().that(messages.get(0)).isEqualTo(1); @@ -74,7 +75,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); @@ -87,7 +88,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).until(() -> messages.size() == 100); assert_().that(messages).containsAllIn(request); @@ -100,7 +101,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).until(() -> messages.size() == 100); @@ -113,7 +114,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).until(() -> messages.size() == 1); assert_().that(messages.get(0)).isEqualTo(request); @@ -122,7 +123,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()); 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 2069ba8..de149cc 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 @@ -16,7 +16,6 @@ */ package org.apache.camel.component.ignite; - import java.util.Iterator; import java.util.List; import java.util.Set; @@ -26,10 +25,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import com.google.common.base.Stopwatch; -import com.google.common.collect.ImmutableSet; 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; @@ -40,7 +39,6 @@ import org.junit.Test; import static com.google.common.truth.Truth.assert_; - public class IgniteQueueTest extends AbstractIgniteTest { @Override @@ -55,19 +53,19 @@ public class IgniteQueueTest extends AbstractIgniteTest { @Test public void testOperations() { - boolean result = template.requestBody("ignite-queue:abc?operation=ADD", "hello", boolean.class); + boolean result = template.requestBody("ignite-queue:" + resourceUid + "?operation=ADD", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue(); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite-queue:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-queue:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue(); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite-queue:abc?operation=REMOVE", "hello", boolean.class); + result = template.requestBody("ignite-queue:" + resourceUid + "?operation=REMOVE", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isFalse(); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isFalse(); - result = template.requestBody("ignite-queue:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-queue:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isFalse(); } @@ -75,13 +73,13 @@ 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:" + resourceUid + "?operation=ADD", "hello" + i); } // SIZE - int size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-queue:" + resourceUid + "?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(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); List<String> toRetain = Lists.newArrayList(); for (int i = 0; i < 50; i++) { @@ -89,45 +87,46 @@ 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:" + resourceUid + "?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:" + resourceUid + "?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(50); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(50); + assert_().that(ignite().queue(resourceUid, 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?operation=CLEAR", "hello", String.class); assert_().that(result).isEqualTo("hello"); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); // SIZE - size = template.requestBody("ignite-queue:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(0); - assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); } @Test 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:" + resourceUid + "?operation=ADD", "hello" + i); } - boolean retained = template.requestBody("ignite-queue:abc?operation=RETAIN_ALL", "hello10", boolean.class); + boolean retained = template.requestBody("ignite-queue:" + resourceUid + "?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:" + resourceUid + "?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactly("hello10"); } @@ -135,31 +134,31 @@ 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?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(); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(101); + assert_().that(ignite().queue(resourceUid, 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?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(); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); + assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains(toAdd)).isFalse(); } @@ -170,10 +169,10 @@ public class IgniteQueueTest extends AbstractIgniteTest { context.getRegistry().bind("config", configuration); - IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite-queue:abc?operation=ADD&configuration=#config", IgniteQueueEndpoint.class); + IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite-queue:" + resourceUid + "?operation=ADD&configuration=#config", IgniteQueueEndpoint.class); template.requestBody(igniteEndpoint, "hello"); - assert_().that(ignite().queue("abc", 0, configuration).size()).isEqualTo(1); + assert_().that(ignite().queue(resourceUid, 0, configuration).size()).isEqualTo(1); assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration); } @@ -183,19 +182,20 @@ 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:" + resourceUid + "?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(); + // 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:" + resourceUid + "?operation=ADD&capacity=100", "hello101", boolean.class)).isFalse(); + assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?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:" + resourceUid + "?operation=PUT&capacity=100", "hello101", boolean.class)).isFalse(); latch.countDown(); } }); @@ -207,23 +207,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:" + resourceUid + "?operation=PEEK&capacity=100", null, String.class)).isEqualTo("hello0"); + assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?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:" + resourceUid + "?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello0"); + assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?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:" + resourceUid + "?operation=DRAIN&capacity=100", null, String[].class)).asList().hasSize(99); + assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE&capacity=100", null, int.class)).isEqualTo(0); + assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?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:" + resourceUid + "?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello102"); latch.countDown(); } }); @@ -231,7 +231,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:" + resourceUid + "?operation=ADD&capacity=100", "hello102", boolean.class)).isTrue(); assert_().that(latch.await(1000, TimeUnit.MILLISECONDS)).isTrue(); // POLL with a timeout. @@ -239,7 +239,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:" + resourceUid + "?operation=POLL&timeoutMillis=1000&capacity=100", null, String.class)).isNull(); return sw.elapsed(TimeUnit.MILLISECONDS); } }).get()).isAtLeast(1000L); @@ -252,15 +252,8 @@ public class IgniteQueueTest extends AbstractIgniteTest { } @After - public void deleteQueues() { - for (String queueName : ImmutableSet.<String> of("abc")) { - ignite().queue(queueName, 0, new CollectionConfiguration()).close(); - } - - // Bounded queues. - for (String queueName : ImmutableSet.<String> of("def")) { - ignite().queue(queueName, 100, new CollectionConfiguration()).close(); - } + public void deleteQueue() { + ignite().queue(resourceUid, 0, null).close(); } } 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 55fa77f..965ac5b 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 @@ -20,10 +20,10 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import com.google.common.collect.ImmutableSet; 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; @@ -48,19 +48,19 @@ public class IgniteSetTest extends AbstractIgniteTest { @Test public void testOperations() { - boolean result = template.requestBody("ignite-set:abc?operation=ADD", "hello", boolean.class); + boolean result = template.requestBody("ignite-set:" + resourceUid + "?operation=ADD", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue(); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite-set:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-set:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue(); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); - result = template.requestBody("ignite-set:abc?operation=REMOVE", "hello", boolean.class); + result = template.requestBody("ignite-set:" + resourceUid + "?operation=REMOVE", "hello", boolean.class); assert_().that(result).isTrue(); - assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isFalse(); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isFalse(); - result = template.requestBody("ignite-set:abc?operation=CONTAINS", "hello", boolean.class); + result = template.requestBody("ignite-set:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); assert_().that(result).isFalse(); } @@ -68,13 +68,13 @@ 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:" + resourceUid + "?operation=ADD", "hello" + i); } // SIZE - int size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); + int size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(100); - assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(100); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); List<String> toRetain = Lists.newArrayList(); for (int i = 0; i < 50; i++) { @@ -82,45 +82,46 @@ 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:" + resourceUid + "?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:" + resourceUid + "?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(50); - assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(50); + assert_().that(ignite().set(resourceUid, 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?operation=CLEAR", "hello", String.class); assert_().that(result).isEqualTo("hello"); - assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); // SIZE - size = template.requestBody("ignite-set:abc?operation=SIZE", "hello", int.class); + size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); assert_().that(size).isEqualTo(0); - assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); } @Test 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:" + resourceUid + "?operation=ADD", "hello" + i); } - boolean retained = template.requestBody("ignite-set:abc?operation=RETAIN_ALL", "hello10", boolean.class); + boolean retained = template.requestBody("ignite-set:" + resourceUid + "?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:" + resourceUid + "?operation=ARRAY", "hello", String[].class); assert_().that(array).asList().containsExactly("hello10"); } @@ -128,31 +129,31 @@ 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?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(); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(101); + assert_().that(ignite().set(resourceUid, 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:" + resourceUid + "?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:" + resourceUid + "?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:" + resourceUid + "?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(); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); + assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains(toAdd)).isFalse(); } @@ -163,11 +164,10 @@ public class IgniteSetTest extends AbstractIgniteTest { context.getRegistry().bind("config", configuration); - IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite-" - + "set:abc?operation=ADD&configuration=#config", IgniteSetEndpoint.class); + IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite-" + "set:" + resourceUid + "?operation=ADD&configuration=#config", IgniteSetEndpoint.class); template.requestBody(igniteEndpoint, "hello"); - assert_().that(ignite().set("abc", configuration).size()).isEqualTo(1); + assert_().that(ignite().set(resourceUid, configuration).size()).isEqualTo(1); assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration); } @@ -177,10 +177,7 @@ public class IgniteSetTest extends AbstractIgniteTest { } @After - public void deleteSets() { - for (String setName : ImmutableSet.<String> of("abc")) { - ignite().set(setName, new CollectionConfiguration()).close(); - } + public void deleteSet() { + ignite().set(resourceUid, null).close(); } - }