This is an automated email from the ASF dual-hosted git repository. pascalschumacher 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 a63f87c Replace Google Truth test dependency with AssertJ. a63f87c is described below commit a63f87c213922a664906feb0f8c7d69dadca515e Author: Pascal Schumacher <pascalschumac...@gmx.net> AuthorDate: Sat Apr 11 14:05:04 2020 +0200 Replace Google Truth test dependency with AssertJ. --- components/camel-flink/pom.xml | 16 +--- .../camel/component/flink/FlinkProducerTest.java | 20 ++--- components/camel-ignite/pom.xml | 10 ++- .../ignite/IgniteCacheContinuousQueryTest.java | 17 ++-- .../camel/component/ignite/IgniteCacheTest.java | 53 ++++++------ .../camel/component/ignite/IgniteComputeTest.java | 45 +++++----- .../camel/component/ignite/IgniteEventsTest.java | 10 +-- .../camel/component/ignite/IgniteIdGenTest.java | 35 ++++---- .../component/ignite/IgniteMessagingTest.java | 14 ++-- .../camel/component/ignite/IgniteQueueTest.java | 95 +++++++++++----------- .../camel/component/ignite/IgniteSetTest.java | 61 +++++++------- components/camel-spark/pom.xml | 16 +--- .../camel/component/spark/SparkProducerTest.java | 30 +++---- parent/pom.xml | 6 -- 14 files changed, 198 insertions(+), 230 deletions(-) diff --git a/components/camel-flink/pom.xml b/components/camel-flink/pom.xml index 9a8948d..07e7661 100644 --- a/components/camel-flink/pom.xml +++ b/components/camel-flink/pom.xml @@ -103,20 +103,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.google.truth</groupId> - <artifactId>truth</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>28.2-jre</version> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-flink/src/test/java/org/apache/camel/component/flink/FlinkProducerTest.java b/components/camel-flink/src/test/java/org/apache/camel/component/flink/FlinkProducerTest.java index 4c54224..9daff8a 100644 --- a/components/camel-flink/src/test/java/org/apache/camel/component/flink/FlinkProducerTest.java +++ b/components/camel-flink/src/test/java/org/apache/camel/component/flink/FlinkProducerTest.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; -import com.google.common.truth.Truth; import org.apache.camel.BindToRegistry; import org.apache.camel.component.flink.annotations.AnnotatedDataSetCallback; import org.apache.camel.test.junit4.CamelTestSupport; @@ -30,6 +29,7 @@ import org.apache.flink.api.java.operators.DataSource; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.DataStreamSource; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.assertj.core.api.Assertions; import org.junit.Test; public class FlinkProducerTest extends CamelTestSupport { @@ -75,7 +75,7 @@ public class FlinkProducerTest extends CamelTestSupport { } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile); } @Test @@ -91,7 +91,7 @@ public class FlinkProducerTest extends CamelTestSupport { } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10); } @Test @@ -107,13 +107,13 @@ public class FlinkProducerTest extends CamelTestSupport { } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); } @Test public void shouldUseTransformationFromRegistry() { Long linesCount = template.requestBody(flinkDataSetUri + "&dataSetCallback=#countLinesContaining", null, Long.class); - Truth.assertThat(linesCount).isGreaterThan(0L); + Assertions.assertThat(linesCount).isGreaterThan(0L); } @Test @@ -128,7 +128,7 @@ public class FlinkProducerTest extends CamelTestSupport { } }); - Truth.assertThat(output.length()).isAtLeast(0L); + Assertions.assertThat(output.length()).isGreaterThanOrEqualTo(0L); } @Test @@ -146,7 +146,7 @@ public class FlinkProducerTest extends CamelTestSupport { long pomLinesCount = template.requestBodyAndHeader(flinkDataSetUri, null, FlinkConstants.FLINK_DATASET_CALLBACK_HEADER, dataSetCallback, Long.class); - Truth.assertThat(pomLinesCount).isEqualTo(19); + Assertions.assertThat(pomLinesCount).isEqualTo(19); } @Test @@ -163,7 +163,7 @@ public class FlinkProducerTest extends CamelTestSupport { template.sendBodyAndHeader(flinkDataSetUri, null, FlinkConstants.FLINK_DATASET_CALLBACK_HEADER, dataSetCallback); - Truth.assertThat(output.length()).isAtLeast(0L); + Assertions.assertThat(output.length()).isGreaterThanOrEqualTo(0L); } @Test @@ -181,7 +181,7 @@ public class FlinkProducerTest extends CamelTestSupport { long pomLinesCount = template.requestBodyAndHeader(flinkDataSetUri, Arrays.<Integer> asList(10, 10), FlinkConstants.FLINK_DATASET_CALLBACK_HEADER, dataSetCallback, Long.class); - Truth.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); + Assertions.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); } @Test @@ -196,6 +196,6 @@ public class FlinkProducerTest extends CamelTestSupport { } }); - Truth.assertThat(output.length()).isAtLeast(0L); + Assertions.assertThat(output.length()).isGreaterThanOrEqualTo(0L); } } diff --git a/components/camel-ignite/pom.xml b/components/camel-ignite/pom.xml index ff65de2..f42a4ce 100644 --- a/components/camel-ignite/pom.xml +++ b/components/camel-ignite/pom.xml @@ -78,8 +78,14 @@ </dependency> <dependency> - <groupId>com.google.truth</groupId> - <artifactId>truth</artifactId> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> <scope>test</scope> </dependency> 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 a58dfb9..6708d47 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 @@ -37,11 +37,10 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.lang.IgniteBiPredicate; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implements Serializable { private static final long serialVersionUID = 1L; @@ -89,10 +88,10 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement assertMockEndpointsSatisfied(); for (Exchange exchange : getMockEndpoint("mock:test1").getExchanges()) { - assert_().that(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_NAME)).isEqualTo("testcontinuous1"); - assert_().that(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_EVENT_TYPE)).isEqualTo(EventType.CREATED); - assert_().that(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_KEY)).isIn(persons.keySet()); - assert_().that(exchange.getIn().getBody()).isIn(persons.values()); + Assertions.assertThat(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_NAME)).isEqualTo("testcontinuous1"); + Assertions.assertThat(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_EVENT_TYPE)).isEqualTo(EventType.CREATED); + Assertions.assertThat(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_KEY)).isIn(persons.keySet()); + Assertions.assertThat(exchange.getIn().getBody()).isIn(persons.values()); } } @@ -154,9 +153,9 @@ public class IgniteCacheContinuousQueryTest extends AbstractIgniteTest implement assertMockEndpointsSatisfied(); for (Exchange exchange : getMockEndpoint("mock:test4").getExchanges()) { - assert_().that(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_NAME)).isEqualTo("testcontinuous1"); - assert_().that(exchange.getIn().getBody()).isInstanceOf(Iterable.class); - assert_().that(Iterators.size(exchange.getIn().getBody(Iterable.class).iterator())).isEqualTo(1); + Assertions.assertThat(exchange.getIn().getHeader(IgniteConstants.IGNITE_CACHE_NAME)).isEqualTo("testcontinuous1"); + Assertions.assertThat(exchange.getIn().getBody()).isInstanceOf(Iterable.class); + Assertions.assertThat(Iterators.size(exchange.getIn().getBody(Iterable.class).iterator())).isEqualTo(1); } } 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 6ffb21d..fc951dc 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 @@ -33,11 +33,10 @@ import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cache.query.Query; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.lang.IgniteBiPredicate; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteCacheTest extends AbstractIgniteTest { @Override @@ -54,17 +53,17 @@ public class IgniteCacheTest extends AbstractIgniteTest { public void testAddEntry() { template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=PUT", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); - assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); - assert_().that(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); + Assertions.assertThat(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); + Assertions.assertThat(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); } @Test public void testAddEntrySet() { template.requestBody("ignite-cache:" + resourceUid + "?operation=PUT", ImmutableMap.of("abcd", "1234", "efgh", "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"); + Assertions.assertThat(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(2); + Assertions.assertThat(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); + Assertions.assertThat(ignite().cache(resourceUid).get("efgh")).isEqualTo("5678"); } @Test @@ -72,11 +71,11 @@ public class IgniteCacheTest extends AbstractIgniteTest { testAddEntry(); String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET", "abcd", String.class); - assert_().that(result).isEqualTo("1234"); + Assertions.assertThat(result).isEqualTo("1234"); 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"); + Assertions.assertThat(result).isEqualTo("1234"); } @Test @@ -92,7 +91,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { 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")); + Assertions.assertThat(result.get(k)).isEqualTo(k.replace("k", "v")); } } @@ -107,7 +106,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { } Integer result = template.requestBody("ignite-cache:" + resourceUid + "?operation=SIZE", keys, Integer.class); - assert_().that(result).isEqualTo(100); + Assertions.assertThat(result).isEqualTo(100); } @Test @@ -130,7 +129,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { }); List<?> results = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=QUERY", keys, IgniteConstants.IGNITE_CACHE_QUERY, query, List.class); - assert_().that(results.size()).isEqualTo(50); + Assertions.assertThat(results.size()).isEqualTo(50); } @Test @@ -147,7 +146,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { cache.put(keys, "---"); String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET&treatCollectionsAsCacheObjects=true", keys, String.class); - assert_().that(result).isEqualTo("---"); + Assertions.assertThat(result).isEqualTo("---"); } @Test @@ -157,17 +156,17 @@ public class IgniteCacheTest extends AbstractIgniteTest { cache.put("abcd", "1234"); cache.put("efgh", "5678"); - assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(2); + Assertions.assertThat(cache.size(CachePeekMode.ALL)).isEqualTo(2); template.requestBody("ignite-cache:" + resourceUid + "?operation=REMOVE", "abcd"); - assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(1); - assert_().that(cache.get("abcd")).isNull(); + Assertions.assertThat(cache.size(CachePeekMode.ALL)).isEqualTo(1); + Assertions.assertThat(cache.get("abcd")).isNull(); 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(); + Assertions.assertThat(cache.size(CachePeekMode.ALL)).isEqualTo(0); + Assertions.assertThat(cache.get("efgh")).isNull(); } @@ -178,11 +177,11 @@ public class IgniteCacheTest extends AbstractIgniteTest { cache.put("k" + i, "v" + i); } - assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(100); + Assertions.assertThat(cache.size(CachePeekMode.ALL)).isEqualTo(100); template.requestBody("ignite-cache:" + resourceUid + "?operation=CLEAR", "this value won't be used"); - assert_().that(cache.size(CachePeekMode.ALL)).isEqualTo(0); + Assertions.assertThat(cache.size(CachePeekMode.ALL)).isEqualTo(0); } @Test @@ -190,14 +189,14 @@ public class IgniteCacheTest extends AbstractIgniteTest { testAddEntry(); String result = template.requestBody("ignite-cache:" + resourceUid + "?operation=GET", "abcd", String.class); - assert_().that(result).isEqualTo("1234"); + Assertions.assertThat(result).isEqualTo("1234"); 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(resourceUid).size(CachePeekMode.ALL)).isEqualTo(0); + Assertions.assertThat(result).isEqualTo("abcd"); + Assertions.assertThat(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(0); } @Test @@ -205,7 +204,7 @@ public class IgniteCacheTest extends AbstractIgniteTest { try { template.requestBodyAndHeader("ignite-cache:testcache2?operation=PUT&failIfInexistentCache=true", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd"); } catch (Exception e) { - assert_().that(ObjectHelper.getException(CamelException.class, e).getMessage()).startsWith("Ignite cache testcache2 doesn't exist"); + Assertions.assertThat(ObjectHelper.getException(CamelException.class, e).getMessage()).startsWith("Ignite cache testcache2 doesn't exist"); return; } @@ -217,10 +216,10 @@ public class IgniteCacheTest extends AbstractIgniteTest { Object result = template.requestBodyAndHeader("ignite-cache:" + resourceUid + "?operation=PUT&propagateIncomingBodyIfNoReturnValue=false", "1234", IgniteConstants.IGNITE_CACHE_KEY, "abcd", Object.class); - assert_().that(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); - assert_().that(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); + Assertions.assertThat(ignite().cache(resourceUid).size(CachePeekMode.ALL)).isEqualTo(1); + Assertions.assertThat(ignite().cache(resourceUid).get("abcd")).isEqualTo("1234"); - assert_().that(result).isNull(); + Assertions.assertThat(result).isNull(); } @Override 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 5706c68..be5f3d8 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 @@ -31,11 +31,10 @@ import org.apache.camel.util.ObjectHelper; import org.apache.ignite.Ignite; import org.apache.ignite.Ignition; import org.apache.ignite.events.EventType; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteComputeTest extends AbstractIgniteTest { private static final List<Ignite> ADDITIONAL_INSTANCES = Lists.newArrayList(); @@ -56,7 +55,7 @@ public class IgniteComputeTest extends AbstractIgniteTest { try { 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"); + Assertions.assertThat(ObjectHelper.getException(RuntimeCamelException.class, e).getMessage()).startsWith("Ignite Compute endpoint with EXECUTE"); return; } @@ -71,20 +70,20 @@ public class IgniteComputeTest extends AbstractIgniteTest { // Single Callable. String result = template.requestBody("ignite-compute:" + resourceUid + "?executionType=CALL", TestIgniteComputeResources.TEST_CALLABLE, String.class); - assert_().that(result).isEqualTo("hello"); + Assertions.assertThat(result).isEqualTo("hello"); // Collection of Callables. Object[] callables = new Object[5]; Arrays.fill(callables, TestIgniteComputeResources.TEST_CALLABLE); 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(); + Assertions.assertThat(colResult).containsExactly("hello", "hello", "hello", "hello", "hello"); // Callables with a Reducer. 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"); + Assertions.assertThat(reduced).isEqualTo("hellohellohellohellohello"); } @Test @@ -93,15 +92,15 @@ public class IgniteComputeTest extends AbstractIgniteTest { // Single Runnable. 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); + Assertions.assertThat(result).isNull(); + Assertions.assertThat(TestIgniteComputeResources.COUNTER.get()).isEqualTo(1); // Multiple Runnables. Object[] runnables = new Object[5]; Arrays.fill(runnables, TestIgniteComputeResources.TEST_RUNNABLE_COUNTER); result = template.requestBody("ignite-compute:" + resourceUid + "?executionType=RUN", Lists.newArrayList(runnables), Collection.class); - assert_().that(result).isNull(); - assert_().that(TestIgniteComputeResources.COUNTER.get()).isEqualTo(6); + Assertions.assertThat(result).isNull(); + Assertions.assertThat(TestIgniteComputeResources.COUNTER.get()).isEqualTo(6); } @Test @@ -117,20 +116,20 @@ public class IgniteComputeTest extends AbstractIgniteTest { // Single Runnable. 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); + Assertions.assertThat(result).isNull(); + Assertions.assertThat(TestIgniteComputeResources.COUNTER.get()).isEqualTo(3); // Single Callable. 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(); + Assertions.assertThat(colResult).isNotNull(); + Assertions.assertThat(colResult).containsExactly("hello", "hello", "hello"); // Single Closure. 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(); + Assertions.assertThat(colResult).isNotNull(); + Assertions.assertThat(colResult).containsExactly("hello Camel", "hello Camel", "hello Camel"); } @Test @@ -146,14 +145,14 @@ public class IgniteComputeTest extends AbstractIgniteTest { // ComputeTask instance. 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"); + Assertions.assertThat(result).isNotNull(); + Assertions.assertThat(Splitter.on(",").splitToList(result)).contains("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"); // ComputeTask 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"); + Assertions.assertThat(result).isNotNull(); + Assertions.assertThat(Splitter.on(",").splitToList(result)).contains("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9"); } @Test @@ -164,18 +163,18 @@ public class IgniteComputeTest extends AbstractIgniteTest { // Closure with a single parameter. 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"); + Assertions.assertThat(result).isEqualTo("hello Camel"); // Closure with a Collection of parameters. 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"); + Assertions.assertThat(colResult).contains("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:" + resourceUid + "?executionType=APPLY", TestIgniteComputeResources.TEST_CLOSURE, headers, String.class); - assert_().that(result).isEqualTo("hello Camel1hello Camel2hello Camel3"); + Assertions.assertThat(result).isEqualTo("hello Camel1hello Camel2hello Camel3"); } @Override 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 90323bd..77e6f79 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 @@ -33,11 +33,10 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.events.Event; import org.apache.ignite.events.EventType; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteEventsTest extends AbstractIgniteTest { @Override @@ -77,9 +76,8 @@ public class IgniteEventsTest extends AbstractIgniteTest { 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(); + Assertions.assertThat(eventTypes).containsSubsequence(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); } @@ -107,7 +105,7 @@ public class IgniteEventsTest extends AbstractIgniteTest { List<Integer> eventTypes = receivedEventTypes("mock:test3"); - assert_().that(eventTypes).containsExactly(EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_PUT).inOrder(); + Assertions.assertThat(eventTypes).containsExactly(EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_PUT); } 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 9e12e1f..ed8bd64 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 @@ -20,11 +20,10 @@ 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; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteIdGenTest extends AbstractIgniteTest { @Override @@ -39,28 +38,28 @@ public class IgniteIdGenTest extends AbstractIgniteTest { @Test public void testOperations() { - 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); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET", null, Long.class)).isEqualTo(0); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET_AND_INCREMENT", null, Long.class)).isEqualTo(0); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=INCREMENT_AND_GET", null, Long.class)).isEqualTo(2); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=ADD_AND_GET", 5, Long.class)).isEqualTo(7); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET_AND_ADD", 5, Long.class)).isEqualTo(7); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?initialValue=0&operation=GET", 5, Long.class)).isEqualTo(12); } @Test public void testInitialValue() { - 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); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET_AND_INCREMENT&initialValue=100", null, Long.class)).isEqualTo(100); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=INCREMENT_AND_GET&initialValue=100", null, Long.class)).isEqualTo(102); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=ADD_AND_GET&initialValue=100", 5, Long.class)).isEqualTo(107); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET_AND_ADD&initialValue=100", 5, Long.class)).isEqualTo(107); + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET&initialValue=100", 5, Long.class)).isEqualTo(112); } @Test public void testDifferentOperation() { - 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, + Assertions.assertThat(template.requestBody("ignite-idgen:" + resourceUid + "?operation=GET&initialValue=100", null, Long.class)).isEqualTo(100); + Assertions.assertThat(template.requestBodyAndHeader("ignite-idgen:" + resourceUid + "?operation=GET_AND_INCREMENT&initialValue=100", null, IgniteConstants.IGNITE_IDGEN_OPERATION, IgniteIdGenOperation.INCREMENT_AND_GET, Long.class)) .isEqualTo(101); } @@ -68,11 +67,11 @@ public class IgniteIdGenTest extends AbstractIgniteTest { @Test public void testBatchSize() { 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); + Assertions.assertThat(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. - assert_().that(endpoint.getBatchSize()); + Assertions.assertThat(endpoint.getBatchSize()); } @Override 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 04b91b7..f5b460e 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 @@ -31,10 +31,10 @@ 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.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; import static org.awaitility.Awaitility.await; public class IgniteMessagingTest extends AbstractIgniteTest implements Serializable { @@ -63,7 +63,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa template.requestBody("ignite-messaging:" + TOPIC1, 1); await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 1); - assert_().that(messages.get(0)).isEqualTo(1); + Assertions.assertThat(messages.get(0)).isEqualTo(1); } @Test @@ -77,8 +77,8 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa template.requestBodyAndHeader("ignite-messaging:" + TOPIC1, 1, IgniteConstants.IGNITE_MESSAGING_TOPIC, "TOPIC2"); Thread.sleep(1000); - assert_().that(messages1.size()).isEqualTo(0); - assert_().that(messages2.size()).isEqualTo(1); + Assertions.assertThat(messages1.size()).isEqualTo(0); + Assertions.assertThat(messages2.size()).isEqualTo(1); } @Test @@ -90,7 +90,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa template.requestBody("ignite-messaging:" + TOPIC1, request); await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 100); - assert_().that(messages).containsAllIn(request); + Assertions.assertThat(messages).containsAll(request); } @Test @@ -104,7 +104,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa } await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 100); - assert_().that(messages).containsAllIn(set); + Assertions.assertThat(messages).containsAll(set); } @Test @@ -116,7 +116,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa template.requestBody("ignite-messaging:" + TOPIC1 + "?treatCollectionsAsCacheObjects=true", request); await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 1); - assert_().that(messages.get(0)).isEqualTo(request); + Assertions.assertThat(messages.get(0)).isEqualTo(request); } @Test 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 70d5dd3..254fdd1 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 @@ -33,11 +33,10 @@ import org.apache.camel.component.ignite.queue.IgniteQueueEndpoint; import org.apache.camel.component.ignite.queue.IgniteQueueOperation; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.CollectionConfiguration; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteQueueTest extends AbstractIgniteTest { @Override @@ -53,19 +52,19 @@ public class IgniteQueueTest extends AbstractIgniteTest { @Test public void testOperations() { boolean result = template.requestBody("ignite-queue:" + resourceUid + "?operation=ADD", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); result = template.requestBody("ignite-queue:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isTrue(); result = template.requestBody("ignite-queue:" + resourceUid + "?operation=REMOVE", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isFalse(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains("hello")).isFalse(); result = template.requestBody("ignite-queue:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); - assert_().that(result).isFalse(); + Assertions.assertThat(result).isFalse(); } @Test @@ -77,8 +76,8 @@ public class IgniteQueueTest extends AbstractIgniteTest { // SIZE int size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(100); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); + Assertions.assertThat(size).isEqualTo(100); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); List<String> toRetain = Lists.newArrayList(); for (int i = 0; i < 50; i++) { @@ -88,30 +87,30 @@ public class IgniteQueueTest extends AbstractIgniteTest { // RETAIN_ALL boolean retained = template.requestBodyAndHeader("ignite-queue:" + resourceUid + "?operation=CLEAR", toRetain, IgniteConstants.IGNITE_QUEUE_OPERATION, IgniteQueueOperation.RETAIN_ALL, boolean.class); - assert_().that(retained).isTrue(); + Assertions.assertThat(retained).isTrue(); // SIZE size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(50); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(50); + Assertions.assertThat(size).isEqualTo(50); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(50); // ITERATOR Iterator<String> iterator = template.requestBody("ignite-queue:" + resourceUid + "?operation=ITERATOR", "hello", Iterator.class); - assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain).inOrder(); + Assertions.assertThat(Iterators.toArray(iterator, String.class)).containsExactlyElementsOf(toRetain); // ARRAY String[] array = template.requestBody("ignite-queue:" + resourceUid + "?operation=ARRAY", "hello", String[].class); - assert_().that(array).asList().containsExactlyElementsIn(toRetain).inOrder(); + Assertions.assertThat(array).containsExactlyElementsOf(toRetain); // CLEAR Object result = template.requestBody("ignite-queue:" + resourceUid + "?operation=CLEAR", "hello", String.class); - assert_().that(result).isEqualTo("hello"); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); + Assertions.assertThat(result).isEqualTo("hello"); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); // SIZE size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(0); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); + Assertions.assertThat(size).isEqualTo(0); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(0); } @Test @@ -122,11 +121,11 @@ public class IgniteQueueTest extends AbstractIgniteTest { } boolean retained = template.requestBody("ignite-queue:" + resourceUid + "?operation=RETAIN_ALL", "hello10", boolean.class); - assert_().that(retained).isTrue(); + Assertions.assertThat(retained).isTrue(); // ARRAY String[] array = template.requestBody("ignite-queue:" + resourceUid + "?operation=ARRAY", "hello", String[].class); - assert_().that(array).asList().containsExactly("hello10"); + Assertions.assertThat(array).containsExactly("hello10"); } @Test @@ -142,22 +141,22 @@ public class IgniteQueueTest extends AbstractIgniteTest { // Size must be 101, not 103. int size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(101); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(101); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains(toAdd)).isTrue(); + Assertions.assertThat(size).isEqualTo(101); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(101); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains(toAdd)).isTrue(); // Check whether the Set contains the Set. boolean contains = template.requestBody("ignite-queue:" + resourceUid + "?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); - assert_().that(contains).isTrue(); + Assertions.assertThat(contains).isTrue(); // Delete the Set. template.requestBody("ignite-queue:" + resourceUid + "?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 100 again. size = template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(100); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); - assert_().that(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains(toAdd)).isFalse(); + Assertions.assertThat(size).isEqualTo(100); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).size()).isEqualTo(100); + Assertions.assertThat(ignite().queue(resourceUid, 0, new CollectionConfiguration()).contains(toAdd)).isFalse(); } @@ -171,8 +170,8 @@ public class IgniteQueueTest extends AbstractIgniteTest { IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite-queue:" + resourceUid + "?operation=ADD&configuration=#config", IgniteQueueEndpoint.class); template.requestBody(igniteEndpoint, "hello"); - assert_().that(ignite().queue(resourceUid, 0, configuration).size()).isEqualTo(1); - assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration); + Assertions.assertThat(ignite().queue(resourceUid, 0, configuration).size()).isEqualTo(1); + Assertions.assertThat(igniteEndpoint.getConfiguration()).isEqualTo(configuration); } @Test @@ -187,14 +186,14 @@ public class IgniteQueueTest extends AbstractIgniteTest { // 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(); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=ADD&capacity=100", "hello101", boolean.class)).isFalse(); + Assertions.assertThat(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:" + resourceUid + "?operation=PUT&capacity=100", "hello101", boolean.class)).isFalse(); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=PUT&capacity=100", "hello101", boolean.class)).isFalse(); latch.countDown(); } }); @@ -202,27 +201,27 @@ public class IgniteQueueTest extends AbstractIgniteTest { t.start(); // Wait 2 seconds and check that the thread was blocked. - assert_().that(latch.await(2000, TimeUnit.MILLISECONDS)).isFalse(); + Assertions.assertThat(latch.await(2000, TimeUnit.MILLISECONDS)).isFalse(); t.interrupt(); // PEEK and ELEMENT. - 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"); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=PEEK&capacity=100", null, String.class)).isEqualTo("hello0"); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=ELEMENT&capacity=100", null, String.class)).isEqualTo("hello0"); // TAKE. - 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); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello0"); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE&capacity=100", null, int.class)).isEqualTo(99); // Now drain. - 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(); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=DRAIN&capacity=100", null, String[].class)).hasSize(99); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=SIZE&capacity=100", null, int.class)).isEqualTo(0); + Assertions.assertThat(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:" + resourceUid + "?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello102"); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=TAKE&capacity=100", null, String.class)).isEqualTo("hello102"); latch.countDown(); } }); @@ -230,18 +229,18 @@ public class IgniteQueueTest extends AbstractIgniteTest { t.start(); // Element was returned. - assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?operation=ADD&capacity=100", "hello102", boolean.class)).isTrue(); - assert_().that(latch.await(1000, TimeUnit.MILLISECONDS)).isTrue(); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=ADD&capacity=100", "hello102", boolean.class)).isTrue(); + Assertions.assertThat(latch.await(1000, TimeUnit.MILLISECONDS)).isTrue(); // POLL with a timeout. - assert_().that(Executors.newSingleThreadExecutor().submit(new Callable<Long>() { + Assertions.assertThat(Executors.newSingleThreadExecutor().submit(new Callable<Long>() { @Override public Long call() throws Exception { Stopwatch sw = Stopwatch.createStarted(); - assert_().that(template.requestBody("ignite-queue:" + resourceUid + "?operation=POLL&timeoutMillis=1000&capacity=100", null, String.class)).isNull(); + Assertions.assertThat(template.requestBody("ignite-queue:" + resourceUid + "?operation=POLL&timeoutMillis=1000&capacity=100", null, String.class)).isNull(); return sw.elapsed(TimeUnit.MILLISECONDS); } - }).get()).isAtLeast(1000L); + }).get()).isGreaterThanOrEqualTo(1000L); } 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 88119c6..2db63a4 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 @@ -28,11 +28,10 @@ import org.apache.camel.component.ignite.set.IgniteSetEndpoint; import org.apache.camel.component.ignite.set.IgniteSetOperation; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.CollectionConfiguration; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; -import static com.google.common.truth.Truth.assert_; - public class IgniteSetTest extends AbstractIgniteTest { @Override @@ -48,19 +47,19 @@ public class IgniteSetTest extends AbstractIgniteTest { @Test public void testOperations() { boolean result = template.requestBody("ignite-set:" + resourceUid + "?operation=ADD", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); result = template.requestBody("ignite-set:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isTrue(); result = template.requestBody("ignite-set:" + resourceUid + "?operation=REMOVE", "hello", boolean.class); - assert_().that(result).isTrue(); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isFalse(); + Assertions.assertThat(result).isTrue(); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).contains("hello")).isFalse(); result = template.requestBody("ignite-set:" + resourceUid + "?operation=CONTAINS", "hello", boolean.class); - assert_().that(result).isFalse(); + Assertions.assertThat(result).isFalse(); } @Test @@ -72,8 +71,8 @@ public class IgniteSetTest extends AbstractIgniteTest { // SIZE int size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(100); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); + Assertions.assertThat(size).isEqualTo(100); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); List<String> toRetain = Lists.newArrayList(); for (int i = 0; i < 50; i++) { @@ -83,30 +82,30 @@ public class IgniteSetTest extends AbstractIgniteTest { // RETAIN_ALL boolean retained = template.requestBodyAndHeader("ignite-set:" + resourceUid + "?operation=CLEAR", toRetain, IgniteConstants.IGNITE_SETS_OPERATION, IgniteSetOperation.RETAIN_ALL, boolean.class); - assert_().that(retained).isTrue(); + Assertions.assertThat(retained).isTrue(); // SIZE size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(50); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(50); + Assertions.assertThat(size).isEqualTo(50); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(50); // ITERATOR Iterator<String> iterator = template.requestBody("ignite-set:" + resourceUid + "?operation=ITERATOR", "hello", Iterator.class); - assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain); + Assertions.assertThat(Iterators.toArray(iterator, String.class)).containsAll(toRetain); // ARRAY String[] array = template.requestBody("ignite-set:" + resourceUid + "?operation=ARRAY", "hello", String[].class); - assert_().that(array).asList().containsExactlyElementsIn(toRetain); + Assertions.assertThat(array).containsAll(toRetain); // CLEAR Object result = template.requestBody("ignite-set:" + resourceUid + "?operation=CLEAR", "hello", String.class); - assert_().that(result).isEqualTo("hello"); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); + Assertions.assertThat(result).isEqualTo("hello"); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); // SIZE size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(0); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); + Assertions.assertThat(size).isEqualTo(0); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(0); } @Test @@ -117,11 +116,11 @@ public class IgniteSetTest extends AbstractIgniteTest { } boolean retained = template.requestBody("ignite-set:" + resourceUid + "?operation=RETAIN_ALL", "hello10", boolean.class); - assert_().that(retained).isTrue(); + Assertions.assertThat(retained).isTrue(); // ARRAY String[] array = template.requestBody("ignite-set:" + resourceUid + "?operation=ARRAY", "hello", String[].class); - assert_().that(array).asList().containsExactly("hello10"); + Assertions.assertThat(array).containsExactly("hello10"); } @Test @@ -137,22 +136,22 @@ public class IgniteSetTest extends AbstractIgniteTest { // Size must be 101, not 103. int size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(101); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(101); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains(toAdd)).isTrue(); + Assertions.assertThat(size).isEqualTo(101); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(101); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).contains(toAdd)).isTrue(); // Check whether the Set contains the Set. boolean contains = template.requestBody("ignite-set:" + resourceUid + "?operation=CONTAINS&treatCollectionsAsCacheObjects=true", toAdd, boolean.class); - assert_().that(contains).isTrue(); + Assertions.assertThat(contains).isTrue(); // Delete the Set. template.requestBody("ignite-set:" + resourceUid + "?operation=REMOVE&treatCollectionsAsCacheObjects=true", toAdd); // Size must be 100 again. size = template.requestBody("ignite-set:" + resourceUid + "?operation=SIZE", "hello", int.class); - assert_().that(size).isEqualTo(100); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); - assert_().that(ignite().set(resourceUid, new CollectionConfiguration()).contains(toAdd)).isFalse(); + Assertions.assertThat(size).isEqualTo(100); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).size()).isEqualTo(100); + Assertions.assertThat(ignite().set(resourceUid, new CollectionConfiguration()).contains(toAdd)).isFalse(); } @@ -166,8 +165,8 @@ public class IgniteSetTest extends AbstractIgniteTest { IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite-" + "set:" + resourceUid + "?operation=ADD&configuration=#config", IgniteSetEndpoint.class); template.requestBody(igniteEndpoint, "hello"); - assert_().that(ignite().set(resourceUid, configuration).size()).isEqualTo(1); - assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration); + Assertions.assertThat(ignite().set(resourceUid, configuration).size()).isEqualTo(1); + Assertions.assertThat(igniteEndpoint.getConfiguration()).isEqualTo(configuration); } @Override diff --git a/components/camel-spark/pom.xml b/components/camel-spark/pom.xml index ce0f59a..5fb687b 100644 --- a/components/camel-spark/pom.xml +++ b/components/camel-spark/pom.xml @@ -180,20 +180,8 @@ <!-- Testing --> <dependency> - <groupId>com.google.truth</groupId> - <artifactId>truth</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>28.2-jre</version> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java index 4fb2b25..6c960d2 100644 --- a/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java +++ b/components/camel-spark/src/test/java/org/apache/camel/component/spark/SparkProducerTest.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.IOException; import java.util.List; -import com.google.common.truth.Truth; import org.apache.camel.component.spark.annotations.RddCallback; import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; @@ -31,6 +30,7 @@ import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.hive.HiveContext; +import org.assertj.core.api.Assertions; import org.junit.BeforeClass; import org.junit.Test; @@ -101,7 +101,7 @@ public class SparkProducerTest extends CamelTestSupport { return rdd.count(); } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile); } @Test @@ -112,7 +112,7 @@ public class SparkProducerTest extends CamelTestSupport { return rdd.count() * (int)payloads[0]; } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10); } @Test @@ -123,7 +123,7 @@ public class SparkProducerTest extends CamelTestSupport { return rdd.count() * (int)payloads[0] * (int)payloads[1]; } }, Long.class); - Truth.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); + Assertions.assertThat(linesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); } @Test @@ -135,13 +135,13 @@ public class SparkProducerTest extends CamelTestSupport { } }; long linesCount = template.requestBodyAndHeader(sparkUri, asList("10", "10"), SPARK_RDD_CALLBACK_HEADER, rddCallback, Long.class); - Truth.assertThat(linesCount).isEqualTo(1900); + Assertions.assertThat(linesCount).isEqualTo(1900); } @Test public void shouldUseTransformationFromRegistry() { long linesCount = template.requestBody(sparkUri + "&rddCallback=#countLinesTransformation", null, Long.class); - Truth.assertThat(linesCount).isGreaterThan(0L); + Assertions.assertThat(linesCount).isGreaterThan(0L); } @Test @@ -159,7 +159,7 @@ public class SparkProducerTest extends CamelTestSupport { }); // Then - Truth.assertThat(output.length()).isGreaterThan(0L); + Assertions.assertThat(output.length()).isGreaterThan(0L); } @Test @@ -171,7 +171,7 @@ public class SparkProducerTest extends CamelTestSupport { } }); long pomLinesCount = template.requestBodyAndHeader(sparkUri, null, SPARK_RDD_CALLBACK_HEADER, rddCallback, Long.class); - Truth.assertThat(pomLinesCount).isEqualTo(19); + Assertions.assertThat(pomLinesCount).isEqualTo(19); } @Test @@ -190,7 +190,7 @@ public class SparkProducerTest extends CamelTestSupport { template.sendBodyAndHeader(sparkUri, null, SPARK_RDD_CALLBACK_HEADER, rddCallback); // Then - Truth.assertThat(output.length()).isGreaterThan(0L); + Assertions.assertThat(output.length()).isGreaterThan(0L); } @Test @@ -202,7 +202,7 @@ public class SparkProducerTest extends CamelTestSupport { } }); long pomLinesCount = template.requestBodyAndHeader(sparkUri, asList(10, 10), SPARK_RDD_CALLBACK_HEADER, rddCallback, Long.class); - Truth.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); + Assertions.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); } @Test @@ -214,7 +214,7 @@ public class SparkProducerTest extends CamelTestSupport { } }, context); long pomLinesCount = template.requestBodyAndHeader(sparkUri, asList(10, "10"), SPARK_RDD_CALLBACK_HEADER, rddCallback, Long.class); - Truth.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); + Assertions.assertThat(pomLinesCount).isEqualTo(numberOfLinesInTestFile * 10 * 10); } // Hive tests @@ -223,14 +223,14 @@ public class SparkProducerTest extends CamelTestSupport { public void shouldExecuteHiveQuery() { assumeTrue(shouldRunHive); List<Row> cars = template.requestBody(sparkHiveUri, "SELECT * FROM cars", List.class); - Truth.assertThat(cars.get(0).getString(1)).isEqualTo("X-trail"); + Assertions.assertThat(cars.get(0).getString(1)).isEqualTo("X-trail"); } @Test public void shouldExecuteHiveCountQuery() { assumeTrue(shouldRunHive); long carsCount = template.requestBody(sparkHiveUri + "?collect=false", "SELECT * FROM cars", Long.class); - Truth.assertThat(carsCount).isEqualTo(2); + Assertions.assertThat(carsCount).isEqualTo(2); } // Data frames tests @@ -245,7 +245,7 @@ public class SparkProducerTest extends CamelTestSupport { } }; long tablesCount = template.requestBodyAndHeader(sparkDataFrameUri, null, SPARK_DATAFRAME_CALLBACK_HEADER, callback, Long.class); - Truth.assertThat(tablesCount).isEqualTo(2); + Assertions.assertThat(tablesCount).isEqualTo(2); } @Test @@ -259,7 +259,7 @@ public class SparkProducerTest extends CamelTestSupport { } }; long tablesCount = template.requestBodyAndHeader(sparkDataFrameUri, "Micra", SPARK_DATAFRAME_CALLBACK_HEADER, callback, Long.class); - Truth.assertThat(tablesCount).isEqualTo(1); + Assertions.assertThat(tablesCount).isEqualTo(1); } } diff --git a/parent/pom.xml b/parent/pom.xml index c8c6a73..cd80831 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -216,7 +216,6 @@ <google-http-jackson2-version>1.32.1</google-http-jackson2-version> <google-j2objc-version>1.3</google-j2objc-version> <google-mail-guava-version>17.0</google-mail-guava-version> - <google-truth-version>0.30</google-truth-version> <google-proto-common-version>1.17.0</google-proto-common-version> <google-proto-pubsub-version>1.84.0</google-proto-pubsub-version> <google-proto-iam-version>0.13.0</google-proto-iam-version> @@ -3362,11 +3361,6 @@ <scope>import</scope> </dependency> <dependency> - <groupId>com.google.truth</groupId> - <artifactId>truth</artifactId> - <version>${google-truth-version}</version> - </dependency> - <dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility</artifactId> <version>${awaitility-version}</version>