From 6a7af8fde2a01caa8fcd2132fbe02f878a8b3ca3 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Fri, 13 Feb 2026 11:16:39 -0400 Subject: [PATCH 1/2] test: add JAX-RS/serde test suite module Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- gradle/libs.versions.toml | 7 +++++ settings.gradle | 3 ++ .../build.gradle | 30 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 test-suite-rxjava2-jaxrs-serialization/build.gradle diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index de91eb85..8bed949e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,15 +3,22 @@ managed-rxjava2 = "2.2.21" groovy = '4.0.29' spock = "2.3-groovy-4.0" +junit-platform = "1.11.4" micronaut = "4.10.8" micronaut-docs = "3.0.0" micronaut-test = "4.9.0" micronaut-validation = "4.11.0" +micronaut-jaxrs = "4.9.2" +micronaut-serialization = "2.15.5" [libraries] micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' } managed-rxjava2 = { module = "io.reactivex.rxjava2:rxjava", version.ref = "managed-rxjava2" } +managed-junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" } groovy-json = { module = "org.apache.groovy:groovy-json", version.ref = "groovy" } +spock-core = { module = "org.spockframework:spock-core", version.ref = "spock" } micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } +micronaut-jaxrs = { module = "io.micronaut.jaxrs:micronaut-jaxrs-bom", version.ref = "micronaut-jaxrs" } +micronaut-serialization = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serialization" } diff --git a/settings.gradle b/settings.gradle index f407de71..0f3da027 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,6 +15,7 @@ include 'rxjava2' include 'rxjava2-bom' include 'rxjava2-http-client' include 'rxjava2-http-server-netty' +include 'test-suite-rxjava2-jaxrs-serialization' enableFeaturePreview 'TYPESAFE_PROJECT_ACCESSORS' @@ -22,4 +23,6 @@ micronautBuild { useStandardizedProjectNames = true importMicronautCatalog() importMicronautCatalog("micronaut-validation") + importMicronautCatalog("micronaut-jaxrs") + importMicronautCatalog("micronaut-serialization") } diff --git a/test-suite-rxjava2-jaxrs-serialization/build.gradle b/test-suite-rxjava2-jaxrs-serialization/build.gradle new file mode 100644 index 00000000..d45edc4e --- /dev/null +++ b/test-suite-rxjava2-jaxrs-serialization/build.gradle @@ -0,0 +1,30 @@ +plugins { + id 'java-library' + id 'groovy' +} + +repositories { + mavenCentral() +} + +dependencies { + testAnnotationProcessor mn.micronaut.inject.java + testAnnotationProcessor mnJaxrs.micronaut.jaxrs.processor + testAnnotationProcessor mnSerde.micronaut.serde.processor + + testCompileOnly mn.micronaut.inject.groovy + + testImplementation libs.spock.core + + testRuntimeOnly libs.managed.junit.platform.launcher + + testImplementation projects.micronautRxjava2 + testImplementation projects.micronautRxjava2HttpServerNetty + testImplementation mn.micronaut.http.client + testImplementation mnJaxrs.micronaut.jaxrs.server + testImplementation mnSerde.micronaut.serde.jackson +} + +tasks.withType(Test).configureEach { + useJUnitPlatform() +} From 5d408737aff08ee0267c251ad96f2924f3395299 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Fri, 13 Feb 2026 11:16:52 -0400 Subject: [PATCH 2/2] test: add #12154 reproducer (pending) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- .../ObservableJaxRsSerializationSpec.groovy | 47 +++++++++++++++++++ .../io/micronaut/rxjava2/jaxrs/NameDto.java | 31 ++++++++++++ .../micronaut/rxjava2/jaxrs/PetResource.java | 34 ++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 test-suite-rxjava2-jaxrs-serialization/src/test/groovy/io/micronaut/rxjava2/jaxrs/ObservableJaxRsSerializationSpec.groovy create mode 100644 test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/NameDto.java create mode 100644 test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/PetResource.java diff --git a/test-suite-rxjava2-jaxrs-serialization/src/test/groovy/io/micronaut/rxjava2/jaxrs/ObservableJaxRsSerializationSpec.groovy b/test-suite-rxjava2-jaxrs-serialization/src/test/groovy/io/micronaut/rxjava2/jaxrs/ObservableJaxRsSerializationSpec.groovy new file mode 100644 index 00000000..fd51de87 --- /dev/null +++ b/test-suite-rxjava2-jaxrs-serialization/src/test/groovy/io/micronaut/rxjava2/jaxrs/ObservableJaxRsSerializationSpec.groovy @@ -0,0 +1,47 @@ +/* + * Copyright 2017-2026 original authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.micronaut.rxjava2.jaxrs + +import io.micronaut.context.ApplicationContext +import io.micronaut.http.HttpRequest +import io.micronaut.http.client.HttpClient +import io.micronaut.runtime.server.EmbeddedServer +import spock.lang.AutoCleanup +import spock.lang.PendingFeature +import spock.lang.Shared +import spock.lang.Specification + +class ObservableJaxRsSerializationSpec extends Specification { + + @Shared + @AutoCleanup + EmbeddedServer embeddedServer = ApplicationContext.run(EmbeddedServer, [ + 'spec.name': 'ObservableJaxRsSerializationSpec' + ]) + + @Shared + @AutoCleanup + HttpClient client = embeddedServer.applicationContext.createBean(HttpClient, embeddedServer.getURL()) + + @PendingFeature(reason = 'micronaut-core#12154') + void "rxjava2 Observable response should be serialized (micronaut-core#12154)"() { + when: + String body = client.toBlocking().retrieve(HttpRequest.GET('/pets/observable')) + + then: + body.contains('Fluffy') + } +} diff --git a/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/NameDto.java b/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/NameDto.java new file mode 100644 index 00000000..7ae851ee --- /dev/null +++ b/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/NameDto.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017-2026 original authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.micronaut.rxjava2.jaxrs; + +import io.micronaut.serde.annotation.Serdeable; + +@Serdeable +public class NameDto { + private final String name; + + public NameDto(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/PetResource.java b/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/PetResource.java new file mode 100644 index 00000000..368e4b56 --- /dev/null +++ b/test-suite-rxjava2-jaxrs-serialization/src/test/java/io/micronaut/rxjava2/jaxrs/PetResource.java @@ -0,0 +1,34 @@ +/* + * Copyright 2017-2026 original authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.micronaut.rxjava2.jaxrs; + +import io.reactivex.Observable; +import jakarta.inject.Singleton; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; + +@Singleton +@Path("/pets") +public class PetResource { + + @GET + @Path("observable") + @Produces(jakarta.ws.rs.core.MediaType.APPLICATION_JSON) + public Observable allObservable() { + return Observable.just(new NameDto("Fluffy")); + } +}