From 51f57140fb3ad53f0bcba14b583ad704138c9fa1 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Fri, 21 Apr 2023 12:05:05 +0200 Subject: [PATCH] Use test resources, fix GraalVM metadata and add GraalVM tests --- buildSrc/build.gradle | 3 - buildSrc/settings.gradle | 1 + ...naut.build.internal.jms-application.gradle | 25 + ...cronaut.build.internal.jms-examples.gradle | 9 +- ...aut.build.internal.jms-native-tests.gradle | 12 + ....micronaut.build.internal.jms-tests.gradle | 17 +- docs-examples/example-groovy/build.gradle | 1 - docs-examples/example-java/build.gradle | 4 +- .../jms/docs/binding/MapConsumer.java | 2 +- .../jms/docs/binding/SelectorConsumer.java | 4 +- .../exceptions/ErrorThrowingConsumer.java | 2 +- .../jms/docs/quickstart/TextConsumer.java | 2 +- .../SuccessHandlingConsumer.java | 2 +- docs-examples/example-kotlin/build.gradle | 1 - gradle/libs.versions.toml | 10 +- .../reflect-config.json | 696 +++++++++++------- .../jms-activemq-classic/reflect-config.json | 29 +- .../jms-activemq-classic/resource-config.json | 9 + .../jms/bind/AbstractJmsArgumentBinder.java | 7 +- .../jms/bind/JMSArgumentBinderRegistry.java | 14 +- settings.gradle | 2 +- tests/tasks-activemq-artemis/build.gradle | 5 + .../src/main/java/example/TasksListener.java | 4 +- .../src/main/resources/application.yml | 14 +- .../src/main/resources/logback.xml | 1 - .../src/test/groovy/example/TasksSpec.groovy | 49 -- .../src/test/java/example/TasksTest.java | 23 + tests/tasks-activemq-classic/build.gradle | 5 + .../src/main/resources/application.yml | 9 +- .../src/main/resources/logback.xml | 1 - .../src/test/groovy/example/TasksSpec.groovy | 46 -- .../src/test/java/example/TasksTest.java | 23 + tests/tasks-sqs/build.gradle | 4 + 33 files changed, 626 insertions(+), 410 deletions(-) create mode 100644 buildSrc/src/main/groovy/io.micronaut.build.internal.jms-application.gradle create mode 100644 buildSrc/src/main/groovy/io.micronaut.build.internal.jms-native-tests.gradle delete mode 100644 tests/tasks-activemq-artemis/src/test/groovy/example/TasksSpec.groovy create mode 100644 tests/tasks-activemq-artemis/src/test/java/example/TasksTest.java delete mode 100644 tests/tasks-activemq-classic/src/test/groovy/example/TasksSpec.groovy create mode 100644 tests/tasks-activemq-classic/src/test/java/example/TasksTest.java diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index f432cdd7..4099d1e2 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -5,9 +5,6 @@ plugins { repositories { gradlePluginPortal() mavenCentral() - // need to pull in micronaut-gradle-plugin:4.0.0-SNAPSHOT - // to prevent leaking codehaus groovy from micronaut-test 3.x - maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } } dependencies { diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle index 6f31e6ef..341f75e7 100644 --- a/buildSrc/settings.gradle +++ b/buildSrc/settings.gradle @@ -1,3 +1,4 @@ +rootProject.name = 'jms-parent' dependencyResolutionManagement { versionCatalogs { libs { diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-application.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-application.gradle new file mode 100644 index 00000000..6bdaaeb8 --- /dev/null +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-application.gradle @@ -0,0 +1,25 @@ +plugins { + id 'io.micronaut.build.internal.jms-base' + id 'io.micronaut.application' +} +configurations.all { + resolutionStrategy.dependencySubstitution { + substitute module('io.micronaut.jms:micronaut-jms-core') using project(':micronaut-jms-core') + substitute module('io.micronaut.jms:micronaut-jms-activemq-classic') using project(':micronaut-jms-activemq-classic') + substitute module('io.micronaut.jms:micronaut-jms-activemq-artemis') using project(':micronaut-jms-activemq-artemis') + substitute module('io.micronaut.jms:micronaut-jms-sqs') using project(':micronaut-jms-sqs') + } +} +micronaut { + version libs.versions.micronaut.platform.get() + runtime "netty" +} + +application { + mainClass = 'example.Application' +} + +dependencies { + runtimeOnly(mn.snakeyaml) + testImplementation(mn.logback.classic) +} diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-examples.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-examples.gradle index d45b6738..891e58e7 100644 --- a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-examples.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-examples.gradle @@ -1,15 +1,10 @@ plugins { - id 'io.micronaut.build.internal.jms-base' - id 'io.micronaut.minimal.application' -} - -micronaut { - version libs.versions.micronaut - runtime 'netty' + id 'io.micronaut.build.internal.jms-application' } dependencies { testCompileOnly libs.jsr305 // for "warning: unknown enum constant When.MAYBE" testImplementation projects.micronautJmsActivemqClassic testImplementation libs.activemq.broker + testImplementation(mn.logback.classic) } diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-native-tests.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-native-tests.gradle new file mode 100644 index 00000000..4f86822f --- /dev/null +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-native-tests.gradle @@ -0,0 +1,12 @@ +plugins { + id 'io.micronaut.build.internal.jms-application' +} + +tasks.named("check") { task -> + def graal = ["jvmci.Compiler", "java.vendor.version", "java.vendor"].any { + System.getProperty(it)?.toLowerCase(Locale.ENGLISH)?.contains("graal") + } + if (graal) { + task.dependsOn("nativeTest") + } +} diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-tests.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-tests.gradle index 1b723d38..7684dc4d 100644 --- a/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-tests.gradle +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.jms-tests.gradle @@ -1,25 +1,18 @@ plugins { id 'groovy' - id 'io.micronaut.build.internal.jms-base' - id 'io.micronaut.application' -} - -application { - mainClass = 'example.Application' + id 'io.micronaut.build.internal.jms-application' + id 'io.micronaut.test-resources' } micronaut { - version '4.0.0-SNAPSHOT' - runtime 'netty' - testRuntime 'spock' + testResources { + clientTimeout = 300 + } } - - dependencies { testImplementation mnTest.micronaut.test.core testImplementation mn.micronaut.http.client - testImplementation libs.testcontainers.spock // without this :tests:tasks-activemq-artemis TasksSpec fails with ClassNotFoundException for javax.json.JsonValue runtimeOnly(libs.javax.json.api) diff --git a/docs-examples/example-groovy/build.gradle b/docs-examples/example-groovy/build.gradle index 9ccedf25..ec0c1946 100644 --- a/docs-examples/example-groovy/build.gradle +++ b/docs-examples/example-groovy/build.gradle @@ -4,7 +4,6 @@ plugins { } micronaut { - version = '4.0.0-SNAPSHOT' testRuntime 'spock' } diff --git a/docs-examples/example-java/build.gradle b/docs-examples/example-java/build.gradle index 2893772b..5a47a218 100644 --- a/docs-examples/example-java/build.gradle +++ b/docs-examples/example-java/build.gradle @@ -1,7 +1,6 @@ plugins { id 'io.micronaut.build.internal.jms-examples' - id 'io.micronaut.application' - id 'java' + id 'io.micronaut.build.internal.jms-native-tests' } dependencies { @@ -9,7 +8,6 @@ dependencies { } micronaut { - version = '4.0.0-SNAPSHOT' testRuntime 'junit5' } diff --git a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/MapConsumer.java b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/MapConsumer.java index e2cbaba9..8ebce9ae 100644 --- a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/MapConsumer.java +++ b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/MapConsumer.java @@ -39,7 +39,7 @@ public class MapConsumer { List> messageHeaders = Collections.synchronizedList(new ArrayList<>()); List messages = Collections.synchronizedList(new ArrayList<>()); - @Queue(value = "queue_map", concurrency = "1-5") + @Queue(value = "queue_map") public void receive(@MessageBody Map body, @Message javax.jms.Message message, @MessageHeader(JMS_CORRELATION_ID) @Nullable String correlationId, diff --git a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/SelectorConsumer.java b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/SelectorConsumer.java index 4a51b434..7c642b71 100644 --- a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/SelectorConsumer.java +++ b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/binding/SelectorConsumer.java @@ -25,12 +25,12 @@ public class SelectorConsumer { List messageBodiesTopic = Collections.synchronizedList(new ArrayList<>()); - @Queue(value = "selector_queue", concurrency = "1-5", messageSelector = "CustomBooleanHeader=true") + @Queue(value = "selector_queue", messageSelector = "CustomBooleanHeader=true") public void receive(@MessageBody String body) { messageBodiesTrue.add(body); } - @Queue(value = "selector_queue", concurrency = "1-5", messageSelector = "CustomBooleanHeader=false") + @Queue(value = "selector_queue", messageSelector = "CustomBooleanHeader=false") public void receive2(@MessageBody String body) { messageBodiesFalse.add(body); } diff --git a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/exceptions/ErrorThrowingConsumer.java b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/exceptions/ErrorThrowingConsumer.java index 0e717f0b..43563d29 100644 --- a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/exceptions/ErrorThrowingConsumer.java +++ b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/exceptions/ErrorThrowingConsumer.java @@ -25,7 +25,7 @@ class ErrorThrowingConsumer { Collection messages = Collections.synchronizedSet(new HashSet<>()); - @Queue(value = "error-queue", concurrency = "1-1", errorHandlers = {CountingErrorHandler.class}) // <2> + @Queue(value = "error-queue", errorHandlers = {CountingErrorHandler.class}) // <2> void receive(@MessageBody String message) { if ("throw an error".equalsIgnoreCase(message)) { throw new RuntimeException("this is an error"); // <3> diff --git a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/quickstart/TextConsumer.java b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/quickstart/TextConsumer.java index 69ba5778..3b36b8e2 100644 --- a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/quickstart/TextConsumer.java +++ b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/quickstart/TextConsumer.java @@ -20,7 +20,7 @@ public class TextConsumer { List messages = Collections.synchronizedList(new ArrayList<>()); - @Queue(value = "queue_text", concurrency = "1-5") // <2> + @Queue(value = "queue_text") // <2> public void receive(@MessageBody String body) { // <3> messages.add(body); } diff --git a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/successhandler/SuccessHandlingConsumer.java b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/successhandler/SuccessHandlingConsumer.java index f1575a8f..3eb769b5 100644 --- a/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/successhandler/SuccessHandlingConsumer.java +++ b/docs-examples/example-java/src/test/java/io/micronaut/jms/docs/successhandler/SuccessHandlingConsumer.java @@ -28,7 +28,7 @@ class SuccessHandlingConsumer { Collection messages = Collections.synchronizedSet(new HashSet<>()); - @Queue(value = "success-queue", concurrency = "1-1", successHandlers = {CountingSuccessHandler.class}) // <2> + @Queue(value = "success-queue", successHandlers = {CountingSuccessHandler.class}) // <2> void receive(@MessageBody String message) throws JMSException { messages.add(message); } diff --git a/docs-examples/example-kotlin/build.gradle b/docs-examples/example-kotlin/build.gradle index 3ae88624..9e34710d 100644 --- a/docs-examples/example-kotlin/build.gradle +++ b/docs-examples/example-kotlin/build.gradle @@ -11,7 +11,6 @@ dependencies { } micronaut { - version = '4.0.0-SNAPSHOT' testRuntime 'kotest5' } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0c765cb2..fa3b0435 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] micronaut-docs = "2.0.0" -micronaut = "4.0.0-M1" -micronaut-test = "4.0.0-SNAPSHOT" - +micronaut = "4.0.0-M2" +micronaut-test = "4.0.0-M1" +micronaut-platform = "4.0.0-M1" activemq = '5.17.3' amazon-sqs-messaging = '2.0.3' artemis-client = '2.28.0' @@ -18,12 +18,12 @@ jsr305 = "3.0.2" kotlin = '1.8.10' spock = "2.3-groovy-4.0" spotbugs = "4.7.1" -testcontainers = '1.17.6' +testcontainers = '1.18.0' lombok = '1.18.26' micronaut-aws-v2 = '3.13.1' micronaut-validation = "4.0.0-M2" -micronaut-gradle-plugin = "4.0.0-SNAPSHOT" +micronaut-gradle-plugin = "4.0.0-M1" [libraries] micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } diff --git a/jms-activemq-artemis/src/main/resources/META-INF/native-image/io.micronaut.jms.sql/micronaut-jms-activemq-artemis/reflect-config.json b/jms-activemq-artemis/src/main/resources/META-INF/native-image/io.micronaut.jms.sql/micronaut-jms-activemq-artemis/reflect-config.json index 7fc4f08f..8f89234d 100644 --- a/jms-activemq-artemis/src/main/resources/META-INF/native-image/io.micronaut.jms.sql/micronaut-jms-activemq-artemis/reflect-config.json +++ b/jms-activemq-artemis/src/main/resources/META-INF/native-image/io.micronaut.jms.sql/micronaut-jms-activemq-artemis/reflect-config.json @@ -1,365 +1,545 @@ [ { - "name":"boolean[]" + "name": "[B" }, { - "name":"byte[]" + "name": "[C" }, { - "name":"ch.qos.logback.classic.Logger" + "name": "[D" }, { - "name":"char[]" + "name": "[F" }, { - "name":"double[]" + "name": "[I" }, { - "name":"float[]" + "name": "[J" }, { - "name":"int[]" + "name": "[S" }, { - "name":"java.io.Closeable", - "allDeclaredMethods":true + "name": "[Z" }, { - "name":"java.io.FileDescriptor" + "name": "[Ljava.io.File;" }, { - "name":"java.io.File[]" + "name": "[Ljava.lang.Boolean;" }, { - "name":"java.io.IOException" + "name": "[Ljava.lang.Byte;" }, { - "name":"java.io.Serializable", - "allDeclaredFields":true, - "allDeclaredMethods":true + "name": "[Ljava.lang.Character;" }, { - "name":"java.lang.AutoCloseable", - "allDeclaredMethods":true + "name": "[Ljava.lang.Class;" }, { - "name":"java.lang.Boolean", - "allDeclaredFields":true, - "allDeclaredMethods":true, - "allDeclaredConstructors":true + "name": "[Ljava.lang.Double;" }, { - "name":"java.lang.Boolean[]" + "name": "[Ljava.lang.Float;" }, { - "name":"java.lang.Byte[]" + "name": "[Ljava.lang.Integer;" }, { - "name":"java.lang.CharSequence", - "allDeclaredFields":true, - "allDeclaredMethods":true + "name": "[Ljava.lang.Long;" }, { - "name":"java.lang.Character[]" + "name": "[Ljava.lang.Object;" }, { - "name":"java.lang.Class[]" + "name": "[Ljava.lang.Short;" }, { - "name":"java.lang.Comparable", - "allDeclaredFields":true, - "allDeclaredMethods":true + "name": "[Ljava.lang.String;" }, { - "name":"java.lang.Double[]" + "name": "[Ljava.math.BigDecimal;" }, { - "name":"java.lang.Enum", - "allDeclaredMethods":true + "name": "[Ljava.math.BigInteger;" }, { - "name":"java.lang.Float[]" + "name": "[Ljava.net.URL;" }, { - "name":"java.lang.Integer", - "allDeclaredFields":true, - "allDeclaredMethods":true, - "allDeclaredConstructors":true + "name": "[Ljava.sql.Date;" }, { - "name":"java.lang.Integer[]" + "name": "[Ljava.sql.Time;" }, { - "name":"java.lang.Long", - "allDeclaredFields":true, - "allDeclaredMethods":true, - "allDeclaredConstructors":true + "name": "[Ljava.sql.Timestamp;" }, { - "name":"java.lang.Long[]" + "name": "[Ljava.util.Calendar;" }, { - "name":"java.lang.Number", - "allDeclaredFields":true, - "allDeclaredMethods":true + "name": "[Ljava.util.Date;" }, { - "name":"java.lang.Object", - "allDeclaredMethods":true + "name": "[Lorg.apache.activemq.artemis.api.core.Pair;" }, { - "name":"java.lang.OutOfMemoryError" + "name": "[Lorg.apache.activemq.artemis.utils.collections.LinkedListImpl$Iterator;" }, { - "name":"java.lang.RuntimeException" + "name": "[Lorg.apache.activemq.artemis.utils.collections.LinkedListImpl;" }, { - "name":"java.lang.Short[]" + "name": "org.apache.activemq.artemis.api.core.client.ServerLocator", + "queryAllDeclaredMethods": true }, { - "name":"java.lang.String" - }, - { - "name":"java.lang.String[]" - }, - { - "name":"java.lang.Throwable", - "methods":[ - {"name":"addSuppressed","parameterTypes":["java.lang.Throwable"] }, - {"name":"initCause","parameterTypes":["java.lang.Throwable"] } + "name": "org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy", + "methods": [ + { + "name": "", + "parameterTypes": [ + + ] + } ] }, { - "name":"java.lang.invoke.MethodHandle" - }, - { - "name":"java.lang.management.ManagementFactory", - "methods":[{"name":"getRuntimeMXBean","parameterTypes":[] }] - }, - { - "name":"java.lang.management.RuntimeMXBean", - "methods":[ - {"name":"getInputArguments","parameterTypes":[] }, - {"name":"getName","parameterTypes":[] } + "name": "org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle_impl", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.slf4j.Logger" + ] + } ] }, { - "name":"java.lang.reflect.Method", - "methods":[{"name":"isVarArgs","parameterTypes":[] }] - }, - { - "name":"java.math.BigDecimal[]" - }, - { - "name":"java.math.BigInteger[]" - }, - { - "name":"java.net.InetSocketAddress" - }, - { - "name":"java.net.PortUnreachableException" - }, - { - "name":"java.net.URL[]" - }, - { - "name":"java.nio.Bits", - "fields":[{"name":"UNALIGNED"}] - }, - { - "name":"java.nio.Buffer", - "fields":[{"name":"address", "allowUnsafeAccess":true}] - }, - { - "name":"java.nio.ByteBuffer", - "methods":[{"name":"alignedSlice","parameterTypes":["int"] }] - }, - { - "name":"java.nio.DirectByteBuffer", - "methods":[{"name":"","parameterTypes":["long","int"] }] - }, - { - "name":"java.nio.channels.ClosedChannelException" - }, - { - "name":"java.nio.channels.FileChannel" - }, - { - "name":"java.security.AlgorithmParametersSpi" - }, - { - "name":"java.security.KeyStoreSpi" - }, - { - "name":"java.security.MessageDigestSpi" - }, - { - "name":"java.security.SecureRandomParameters" - }, - { - "name":"java.sql.Date" - }, - { - "name":"java.sql.Date[]" - }, - { - "name":"java.sql.Time[]" - }, - { - "name":"java.sql.Timestamp" - }, - { - "name":"java.sql.Timestamp[]" - }, - { - "name":"java.util.ArrayList", - "allDeclaredMethods":true, - "allDeclaredConstructors":true - }, - { - "name":"java.util.Calendar[]" - }, - { - "name":"java.util.Date" - }, - { - "name":"java.util.Date[]" - }, - { - "name":"java.util.HashSet" - }, - { - "name":"java.util.LinkedHashMap", - "allDeclaredMethods":true, - "allDeclaredConstructors":true - }, - { - "name":"java.util.LinkedHashSet" - }, - { - "name":"java.util.function.Supplier", - "allDeclaredFields":true, - "allDeclaredMethods":true - }, - { - "name":"javax.jms.ConnectionFactory", - "allDeclaredMethods":true - }, - { - "name":"javax.jms.QueueConnectionFactory", - "allDeclaredMethods":true - }, - { - "name":"javax.jms.TopicConnectionFactory", - "allDeclaredMethods":true - }, - { - "name":"javax.net.ssl.SSLParameters", - "methods":[{"name":"setApplicationProtocols","parameterTypes":["java.lang.String[]"] }] - }, - { - "name":"javax.net.ssl.SSLSocket", - "methods":[{"name":"getApplicationProtocol","parameterTypes":[] }] - }, - { - "name":"javax.security.auth.x500.X500Principal", - "fields":[{"name":"thisX500Name"}], - "methods":[{"name":"","parameterTypes":["sun.security.x509.X500Name"] }] - }, - { - "name":"jdk.internal.misc.Unsafe", - "methods":[{"name":"getUnsafe","parameterTypes":[] }] - }, - { - "name":"long[]" - }, - { - "name":"org.apache.activemq.artemis.api.core.Pair[]" - }, - { - "name":"org.apache.activemq.artemis.api.core.client.ServerLocator", - "allDeclaredMethods":true - }, - { - "name":"org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"org.apache.activemq.artemis.core.client.ActiveMQClientLogger_$logger", - "methods":[{"name":"","parameterTypes":["org.jboss.logging.Logger"] }] - }, - { - "name":"org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle_$bundle", - "fields":[{"name":"INSTANCE"}] + "name": "org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl", + "queryAllDeclaredMethods": true, + "queryAllPublicMethods": true + }, + { + "name": "org.apache.activemq.artemis.core.client.impl.ServerLocatorImplBeanInfo" + }, + { + "name": "org.apache.activemq.artemis.core.client.impl.ServerLocatorImplCustomizer" + }, + { + "name": "org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal", + "queryAllDeclaredMethods": true + }, + { + "name": "org.apache.activemq.artemis.core.cluster.DiscoveryListener", + "queryAllDeclaredMethods": true + }, + { + "name": "org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler", + "methods": [ + { + "name": "channelActive", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext" + ] + }, + { + "name": "channelInactive", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext" + ] + }, + { + "name": "channelRead", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext", + "java.lang.Object" + ] + }, + { + "name": "channelReadComplete", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext" + ] + }, + { + "name": "channelWritabilityChanged", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext" + ] + }, + { + "name": "exceptionCaught", + "parameterTypes": [ + "io.netty.channel.ChannelHandlerContext", + "java.lang.Throwable" + ] + } + ] }, { - "name":"org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl", - "allDeclaredMethods":true, - "allPublicMethods":true + "name": "org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQFrameDecoder2" }, { - "name":"org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal", - "allDeclaredMethods":true + "name": "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$1" }, { - "name":"org.apache.activemq.artemis.core.cluster.DiscoveryListener", - "allDeclaredMethods":true + "name": "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$ActiveMQClientChannelHandler" }, { - "name":"org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler", - "methods":[ - {"name":"channelActive","parameterTypes":["io.netty.channel.ChannelHandlerContext"] }, - {"name":"channelInactive","parameterTypes":["io.netty.channel.ChannelHandlerContext"] }, - {"name":"channelRead","parameterTypes":["io.netty.channel.ChannelHandlerContext","java.lang.Object"] }, - {"name":"channelReadComplete","parameterTypes":["io.netty.channel.ChannelHandlerContext"] }, - {"name":"channelWritabilityChanged","parameterTypes":["io.netty.channel.ChannelHandlerContext"] }, - {"name":"exceptionCaught","parameterTypes":["io.netty.channel.ChannelHandlerContext","java.lang.Throwable"] } + "name": "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory", + "methods": [ + { + "name": "", + "parameterTypes": [ + + ] + } ] }, { - "name":"org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQFrameDecoder2" + "name": "org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory", + "queryAllDeclaredMethods": true, + "queryAllPublicMethods": true, + "methods": [ + { + "name": "getCallFailoverTimeout", + "parameterTypes": [ + + ] + }, + { + "name": "getCallTimeout", + "parameterTypes": [ + + ] + }, + { + "name": "getClientFailureCheckPeriod", + "parameterTypes": [ + + ] + }, + { + "name": "getClientID", + "parameterTypes": [ + + ] + }, + { + "name": "getConfirmationWindowSize", + "parameterTypes": [ + + ] + }, + { + "name": "getConnectionLoadBalancingPolicyClassName", + "parameterTypes": [ + + ] + }, + { + "name": "getConnectionTTL", + "parameterTypes": [ + + ] + }, + { + "name": "getConsumerMaxRate", + "parameterTypes": [ + + ] + }, + { + "name": "getConsumerWindowSize", + "parameterTypes": [ + + ] + }, + { + "name": "getDeserializationBlackList", + "parameterTypes": [ + + ] + }, + { + "name": "getDeserializationWhiteList", + "parameterTypes": [ + + ] + }, + { + "name": "getDupsOKBatchSize", + "parameterTypes": [ + + ] + }, + { + "name": "getFactoryType", + "parameterTypes": [ + + ] + }, + { + "name": "getGroupID", + "parameterTypes": [ + + ] + }, + { + "name": "getIncomingInterceptorList", + "parameterTypes": [ + + ] + }, + { + "name": "getInitialConnectAttempts", + "parameterTypes": [ + + ] + }, + { + "name": "getInitialMessagePacketSize", + "parameterTypes": [ + + ] + }, + { + "name": "getMaxRetryInterval", + "parameterTypes": [ + + ] + }, + { + "name": "getMinLargeMessageSize", + "parameterTypes": [ + + ] + }, + { + "name": "getOutgoingInterceptorList", + "parameterTypes": [ + + ] + }, + { + "name": "getPassword", + "parameterTypes": [ + + ] + }, + { + "name": "getPasswordCodec", + "parameterTypes": [ + + ] + }, + { + "name": "getProducerMaxRate", + "parameterTypes": [ + + ] + }, + { + "name": "getProducerWindowSize", + "parameterTypes": [ + + ] + }, + { + "name": "getProtocolManagerFactoryStr", + "parameterTypes": [ + + ] + }, + { + "name": "getReconnectAttempts", + "parameterTypes": [ + + ] + }, + { + "name": "getRetryInterval", + "parameterTypes": [ + + ] + }, + { + "name": "getRetryIntervalMultiplier", + "parameterTypes": [ + + ] + }, + { + "name": "getScheduledThreadPoolMaxSize", + "parameterTypes": [ + + ] + }, + { + "name": "getThreadPoolMaxSize", + "parameterTypes": [ + + ] + }, + { + "name": "getTransactionBatchSize", + "parameterTypes": [ + + ] + }, + { + "name": "getUser", + "parameterTypes": [ + + ] + }, + { + "name": "isAutoGroup", + "parameterTypes": [ + + ] + }, + { + "name": "isBlockOnAcknowledge", + "parameterTypes": [ + + ] + }, + { + "name": "isBlockOnDurableSend", + "parameterTypes": [ + + ] + }, + { + "name": "isBlockOnNonDurableSend", + "parameterTypes": [ + + ] + }, + { + "name": "isCacheDestinations", + "parameterTypes": [ + + ] + }, + { + "name": "isCacheLargeMessagesClient", + "parameterTypes": [ + + ] + }, + { + "name": "isCompressLargeMessage", + "parameterTypes": [ + + ] + }, + { + "name": "isEnable1xPrefixes", + "parameterTypes": [ + + ] + }, + { + "name": "isEnableSharedClientID", + "parameterTypes": [ + + ] + }, + { + "name": "isFailoverOnInitialConnection", + "parameterTypes": [ + + ] + }, + { + "name": "isHA", + "parameterTypes": [ + + ] + }, + { + "name": "isIgnoreJTA", + "parameterTypes": [ + + ] + }, + { + "name": "isPreAcknowledge", + "parameterTypes": [ + + ] + }, + { + "name": "isUseGlobalPools", + "parameterTypes": [ + + ] + }, + { + "name": "isUseTopologyForLoadBalancing", + "parameterTypes": [ + + ] + } + ] }, { - "name":"org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$1" + "name": "org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactoryBeanInfo" }, { - "name":"org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector$ActiveMQClientChannelHandler" + "name": "org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactoryCustomizer" }, { - "name":"org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory", - "methods":[{"name":"","parameterTypes":[] }] + "name": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory", + "queryAllDeclaredMethods": true, + "queryAllPublicMethods": true }, { - "name":"org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory", - "allDeclaredMethods":true, - "allPublicMethods":true + "name": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactoryBeanInfo" }, { - "name":"org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory", - "allDeclaredMethods":true, - "allPublicMethods":true + "name": "org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactoryCustomizer" }, { - "name":"org.apache.activemq.artemis.jndi.JNDIStorable", - "allDeclaredMethods":true, - "allPublicMethods":true + "name": "org.apache.activemq.artemis.jndi.JNDIStorable", + "queryAllDeclaredMethods": true, + "queryAllPublicMethods": true }, { - "name":"org.apache.activemq.artemis.logs.ActiveMQUtilLogger_$logger", - "methods":[{"name":"","parameterTypes":["org.jboss.logging.Logger"] }] + "name": "org.apache.activemq.artemis.jndi.JNDIStorableBeanInfo" }, { - "name":"org.apache.activemq.artemis.uri.schema.serverLocator.ConnectionOptions", - "allDeclaredMethods":true, - "allPublicMethods":true + "name": "org.apache.activemq.artemis.jndi.JNDIStorableCustomizer" }, { - "name":"org.apache.activemq.artemis.utils.collections.LinkedListImpl$Iterator[]" + "name": "org.apache.activemq.artemis.uri.schema.serverLocator.ConnectionOptions", + "queryAllDeclaredMethods": true, + "queryAllPublicMethods": true, + "methods": [ + { + "name": "setHost", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setPort", + "parameterTypes": [ + "int" + ] + } + ] }, { - "name":"org.apache.activemq.artemis.utils.collections.LinkedListImpl[]" + "name": "org.apache.activemq.artemis.uri.schema.serverLocator.ConnectionOptionsBeanInfo" }, { - "name":"short[]" + "name": "org.apache.activemq.artemis.uri.schema.serverLocator.ConnectionOptionsCustomizer" } ] diff --git a/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/reflect-config.json b/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/reflect-config.json index e0af6586..a3b59b41 100644 --- a/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/reflect-config.json +++ b/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/reflect-config.json @@ -39,5 +39,32 @@ "parameterTypes": [] } ] + }, + { + "name": "org.apache.activemq.transport.vm.VMTransportFactory", + "methods": [ + { + "name": "", + "parameterTypes": [ + + ] + } + ] + }, + { + "name": "org.apache.activemq.broker.DefaultBrokerFactory", + "methods": [ + { + "name": "", + "parameterTypes": [ + + ] + } + ] + }, + { + "name": "org.apache.activemq.broker.BrokerService", + "queryAllPublicMethods": true, + "allPublicMethods": true } -] \ No newline at end of file +] diff --git a/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/resource-config.json b/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/resource-config.json index 7de009d1..696c95f1 100644 --- a/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/resource-config.json +++ b/jms-activemq-classic/src/main/resources/META-INF/native-image/io.micronaut.jms/jms-activemq-classic/resource-config.json @@ -6,6 +6,15 @@ }, { "pattern": "META-INF/services/org/apache/activemq/wireformat/default" + }, + { + "pattern": "\\QMETA-INF/services/org/apache/activemq/broker/broker\\E" + }, + { + "pattern": "\\QMETA-INF/services/org/apache/activemq/transport/vm\\E" + }, + { + "pattern": "\\Qorg/apache/activemq/version.txt\\E" } ] } diff --git a/jms-core/src/main/java/io/micronaut/jms/bind/AbstractJmsArgumentBinder.java b/jms-core/src/main/java/io/micronaut/jms/bind/AbstractJmsArgumentBinder.java index efb0027a..128825a9 100644 --- a/jms-core/src/main/java/io/micronaut/jms/bind/AbstractJmsArgumentBinder.java +++ b/jms-core/src/main/java/io/micronaut/jms/bind/AbstractJmsArgumentBinder.java @@ -15,7 +15,8 @@ */ package io.micronaut.jms.bind; -import io.micronaut.core.bind.annotation.AbstractAnnotatedArgumentBinder; +import io.micronaut.core.bind.annotation.AbstractArgumentBinder; +import io.micronaut.core.bind.annotation.AnnotatedArgumentBinder; import io.micronaut.core.convert.ConversionService; import io.micronaut.core.order.Ordered; @@ -30,8 +31,8 @@ * @since 1.0.0 */ public abstract class AbstractJmsArgumentBinder - extends AbstractAnnotatedArgumentBinder - implements Ordered { + extends AbstractArgumentBinder + implements Ordered, AnnotatedArgumentBinder { /** * Constructor. diff --git a/jms-core/src/main/java/io/micronaut/jms/bind/JMSArgumentBinderRegistry.java b/jms-core/src/main/java/io/micronaut/jms/bind/JMSArgumentBinderRegistry.java index 30ad2086..c04cff71 100644 --- a/jms-core/src/main/java/io/micronaut/jms/bind/JMSArgumentBinderRegistry.java +++ b/jms-core/src/main/java/io/micronaut/jms/bind/JMSArgumentBinderRegistry.java @@ -19,7 +19,7 @@ import io.micronaut.core.annotation.Internal; import io.micronaut.core.bind.ArgumentBinder; import io.micronaut.core.bind.ArgumentBinderRegistry; -import io.micronaut.core.bind.annotation.AbstractAnnotatedArgumentBinder; +import io.micronaut.core.bind.annotation.AnnotatedArgumentBinder; import io.micronaut.core.convert.ConversionService; import io.micronaut.core.order.OrderUtil; import io.micronaut.core.type.Argument; @@ -49,7 +49,7 @@ public class JMSArgumentBinderRegistry implements ArgumentBinderRegistry> binders = new LinkedList<>(); + private final List> binders = new LinkedList<>(); public JMSArgumentBinderRegistry(ConversionService conversionService, Deserializer deserializer) { registerArgumentBinder(new DefaultBodyArgumentBinder(conversionService, deserializer)); @@ -64,7 +64,7 @@ public JMSArgumentBinderRegistry(ConversionService conversionService, Deserializ * * @param binder the binder */ - public void registerArgumentBinder(AbstractAnnotatedArgumentBinder binder) { + public void registerArgumentBinder(AnnotatedArgumentBinder binder) { binders.add(binder); binders.sort(OrderUtil.COMPARATOR); logger.debug("registered binder {}", binder); @@ -75,17 +75,15 @@ public void registerArgumentBinder(AbstractAnnotatedArgumentBinder binder) { + public void unregisterArgumentBinder(AnnotatedArgumentBinder binder) { binders.remove(binder); logger.debug("unregistered binder {}", binder); } - @SuppressWarnings("unchecked") @Override - public Optional> findArgumentBinder(Argument argument, - Message source) { + public Optional> findArgumentBinder(Argument argument) { AnnotationMetadata annotationMetadata = argument.getAnnotationMetadata(); - for (AbstractAnnotatedArgumentBinder binder: binders) { + for (AnnotatedArgumentBinder binder: binders) { if (annotationMetadata.hasAnnotation(binder.getAnnotationType())) { return (Optional) Optional.of(binder); } diff --git a/settings.gradle b/settings.gradle index 0c207e00..6f0026c5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id("io.micronaut.build.shared.settings") version "6.3.5" + id("io.micronaut.build.shared.settings") version "6.4.1" } rootProject.name = 'jms-parent' diff --git a/tests/tasks-activemq-artemis/build.gradle b/tests/tasks-activemq-artemis/build.gradle index 5c50b3ab..a5d956b9 100644 --- a/tests/tasks-activemq-artemis/build.gradle +++ b/tests/tasks-activemq-artemis/build.gradle @@ -1,7 +1,12 @@ plugins { id 'io.micronaut.build.internal.jms-tests' + id 'io.micronaut.build.internal.jms-native-tests' } dependencies { implementation projects.micronautJmsActivemqArtemis + testImplementation libs.awaitility +} +micronaut { + testRuntime "junit5" } diff --git a/tests/tasks-activemq-artemis/src/main/java/example/TasksListener.java b/tests/tasks-activemq-artemis/src/main/java/example/TasksListener.java index ee66b1db..65127fba 100644 --- a/tests/tasks-activemq-artemis/src/main/java/example/TasksListener.java +++ b/tests/tasks-activemq-artemis/src/main/java/example/TasksListener.java @@ -17,10 +17,10 @@ public class TasksListener { public static final AtomicInteger TASKS_PROCESSED = new AtomicInteger(); - @Queue(value = TaskConstants.FIFO_QUEUE, concurrency = "1-1") + @Queue(value = TaskConstants.FIFO_QUEUE) public void receive(@MessageBody Task task) { LOGGER.info("Received task with id: " + task.getId()); TASKS_PROCESSED.incrementAndGet(); } -} \ No newline at end of file +} diff --git a/tests/tasks-activemq-artemis/src/main/resources/application.yml b/tests/tasks-activemq-artemis/src/main/resources/application.yml index 347fb46c..307c3790 100644 --- a/tests/tasks-activemq-artemis/src/main/resources/application.yml +++ b/tests/tasks-activemq-artemis/src/main/resources/application.yml @@ -3,4 +3,16 @@ micronaut: activemq: artemis: enabled: true - + connection-string: "tcp://localhost:${activemq.port}" + username: artemis + password: artemis +test-resources: + containers: + activemq: + startup-timeout: 600s + image-name: makyo/activemq-artemis:latest + exposed-ports: + - activemq.port: 61616 + env: + ARTEMIS_USERNAME: artemis + ARTEMIS_PASSWORD: artemis diff --git a/tests/tasks-activemq-artemis/src/main/resources/logback.xml b/tests/tasks-activemq-artemis/src/main/resources/logback.xml index cfa1077b..ce54c2d0 100644 --- a/tests/tasks-activemq-artemis/src/main/resources/logback.xml +++ b/tests/tasks-activemq-artemis/src/main/resources/logback.xml @@ -1,7 +1,6 @@ - true diff --git a/tests/tasks-activemq-artemis/src/test/groovy/example/TasksSpec.groovy b/tests/tasks-activemq-artemis/src/test/groovy/example/TasksSpec.groovy deleted file mode 100644 index 6097a02a..00000000 --- a/tests/tasks-activemq-artemis/src/test/groovy/example/TasksSpec.groovy +++ /dev/null @@ -1,49 +0,0 @@ -package example - -import io.micronaut.http.client.HttpClient -import io.micronaut.http.client.annotation.Client -import io.micronaut.test.extensions.spock.annotation.MicronautTest -import io.micronaut.test.support.TestPropertyProvider -import jakarta.inject.Inject -import org.testcontainers.containers.GenericContainer -import spock.lang.AutoCleanup -import spock.lang.Shared -import spock.lang.Specification -import spock.util.concurrent.PollingConditions - -@MicronautTest -class TasksSpec extends Specification implements TestPropertyProvider { - - @Shared - @AutoCleanup - public static GenericContainer activeMQContainer = new GenericContainer<>("makyo/activemq-artemis:latest") - .withEnv([ - "ARTEMIS_USERNAME": "artemis", - "ARTEMIS_PASSWORD": "artemis" - ]) - .withExposedPorts(61616) - @Inject - @Client("/") - HttpClient client - - PollingConditions pollingConditions = new PollingConditions(initialDelay: 2, timeout: 100) - - def 'should process tasks'() { - expect: - pollingConditions.eventually { - client.toBlocking().retrieve("/tasks/processed-count", Integer) > 3 - } - } - - @Override - Map getProperties() { - activeMQContainer.start() - return [ - "micronaut.jms.activemq.artemis.enabled": "true", - "micronaut.jms.activemq.artemis.connection-string": "tcp://${activeMQContainer.getHost()}:${activeMQContainer.getMappedPort(61616)}", - "micronaut.jms.activemq.artemis.username": "artemis", - "micronaut.jms.activemq.artemis.password": "artemis" - ] - } -} - diff --git a/tests/tasks-activemq-artemis/src/test/java/example/TasksTest.java b/tests/tasks-activemq-artemis/src/test/java/example/TasksTest.java new file mode 100644 index 00000000..30065aa9 --- /dev/null +++ b/tests/tasks-activemq-artemis/src/test/java/example/TasksTest.java @@ -0,0 +1,23 @@ +package example; + +import io.micronaut.http.client.HttpClient; +import io.micronaut.http.client.annotation.Client; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; + +@MicronautTest +class TasksTest { + + @Test + void testShouldProcessTasks(@Client("/") HttpClient client) { + await().atMost(30, SECONDS).until(() -> + { + Integer result = client.toBlocking().retrieve("/tasks/processed-count", Integer.class); + return result != null && result > 3; + } + ); + } +} diff --git a/tests/tasks-activemq-classic/build.gradle b/tests/tasks-activemq-classic/build.gradle index 5b66701f..710360c6 100644 --- a/tests/tasks-activemq-classic/build.gradle +++ b/tests/tasks-activemq-classic/build.gradle @@ -1,7 +1,12 @@ plugins { id 'io.micronaut.build.internal.jms-tests' + id 'io.micronaut.build.internal.jms-native-tests' } dependencies { implementation projects.micronautJmsActivemqClassic + testImplementation libs.awaitility +} +micronaut { + testRuntime "junit5" } diff --git a/tests/tasks-activemq-classic/src/main/resources/application.yml b/tests/tasks-activemq-classic/src/main/resources/application.yml index 9a9333eb..df564453 100644 --- a/tests/tasks-activemq-classic/src/main/resources/application.yml +++ b/tests/tasks-activemq-classic/src/main/resources/application.yml @@ -3,4 +3,11 @@ micronaut: activemq: classic: enabled: true - + connection-string: "tcp://localhost:${activemq.port}" +test-resources: + containers: + activemq: + startup-timeout: 600s + image-name: rmohr/activemq:5.15.9 + exposed-ports: + - activemq.port: 61616 diff --git a/tests/tasks-activemq-classic/src/main/resources/logback.xml b/tests/tasks-activemq-classic/src/main/resources/logback.xml index cfa1077b..ce54c2d0 100644 --- a/tests/tasks-activemq-classic/src/main/resources/logback.xml +++ b/tests/tasks-activemq-classic/src/main/resources/logback.xml @@ -1,7 +1,6 @@ - true diff --git a/tests/tasks-activemq-classic/src/test/groovy/example/TasksSpec.groovy b/tests/tasks-activemq-classic/src/test/groovy/example/TasksSpec.groovy deleted file mode 100644 index a2025700..00000000 --- a/tests/tasks-activemq-classic/src/test/groovy/example/TasksSpec.groovy +++ /dev/null @@ -1,46 +0,0 @@ -package example - -import io.micronaut.http.client.HttpClient -import io.micronaut.http.client.annotation.Client -import io.micronaut.test.extensions.spock.annotation.MicronautTest -import io.micronaut.test.support.TestPropertyProvider -import jakarta.inject.Inject -import org.testcontainers.containers.GenericContainer -import spock.lang.AutoCleanup -import spock.lang.Shared -import spock.lang.Specification -import spock.util.concurrent.PollingConditions - -@MicronautTest -class TasksSpec extends Specification implements TestPropertyProvider { - - @Shared - @AutoCleanup - public static GenericContainer activeMQContainer = new GenericContainer<>("rmohr/activemq:5.15.9") - .withExposedPorts(61616) - - @Inject - @Client("/") - HttpClient client - - PollingConditions pollingConditions = new PollingConditions(initialDelay: 2, timeout: 100) - - def 'should process tasks'() { - expect: - pollingConditions.eventually { - client.toBlocking().retrieve("/tasks/processed-count", Integer) > 3 - } - } - - @Override - Map getProperties() { - activeMQContainer.start() - return [ - "micronaut.jms.activemq.classic.enabled" : "true", - "micronaut.jms.activemq.classic.connection-string": "tcp://${activeMQContainer.getHost()}:${activeMQContainer.getMappedPort(61616)}", - "micronaut.jms.activemq.classic.username" : "admin", - "micronaut.jms.activemq.classic.password" : "admin" - ] - } -} - diff --git a/tests/tasks-activemq-classic/src/test/java/example/TasksTest.java b/tests/tasks-activemq-classic/src/test/java/example/TasksTest.java new file mode 100644 index 00000000..30065aa9 --- /dev/null +++ b/tests/tasks-activemq-classic/src/test/java/example/TasksTest.java @@ -0,0 +1,23 @@ +package example; + +import io.micronaut.http.client.HttpClient; +import io.micronaut.http.client.annotation.Client; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import org.junit.jupiter.api.Test; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; + +@MicronautTest +class TasksTest { + + @Test + void testShouldProcessTasks(@Client("/") HttpClient client) { + await().atMost(30, SECONDS).until(() -> + { + Integer result = client.toBlocking().retrieve("/tasks/processed-count", Integer.class); + return result != null && result > 3; + } + ); + } +} diff --git a/tests/tasks-sqs/build.gradle b/tests/tasks-sqs/build.gradle index e46b7570..aa83f4b0 100644 --- a/tests/tasks-sqs/build.gradle +++ b/tests/tasks-sqs/build.gradle @@ -8,3 +8,7 @@ dependencies { testCompileOnly libs.lombok testAnnotationProcessor libs.lombok } + +micronaut { + testRuntime "spock" +}