Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Micronaut Framework to 3.8.3 #1231

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.StreamingHttpClient
import io.micronaut.http.client.annotation.Client
import io.micronaut.test.extensions.spock.annotation.MicronautTest
import jakarta.inject.Inject
import reactor.core.publisher.Flux
import spock.lang.Shared
import spock.lang.Specification
import java.util.regex.Pattern
import java.util.stream.Stream

@MicronautTest // <1>
class GithubControllerSpec extends Specification {
Expand All @@ -19,8 +22,12 @@ class GithubControllerSpec extends Specification {
@Client("/")
HttpClient client // <2>

@Inject
@Client("/")
StreamingHttpClient streamingClient

@Shared
Pattern MICRONAUT_RELEASE = Pattern.compile("[Micronaut|Micronaut Framework] [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?");
Pattern MICRONAUT_RELEASE = Pattern.compile("([Micronaut|Micronaut Framework] [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?|v3.6.5)");


void 'verify github releases can be fetched with low level HttpClient'() {
Expand All @@ -47,12 +54,12 @@ class GithubControllerSpec extends Specification {

void 'verify github releases can be fetched with compile-time autogenerated @Client'() {
when:
HttpRequest request = HttpRequest.GET('/github/releases-lowlevel')
HttpRequest request = HttpRequest.GET('/github/releases')

List<GithubRelease> githubReleases = client.toBlocking().retrieve(request, Argument.listOf(GithubRelease)) // <7>
Stream<GithubRelease> githubReleases = Flux.from(streamingClient.jsonStream(request, GithubRelease)).toStream() // <7>

then:
githubReleases.stream()
githubReleases
.map(GithubRelease::getName)
.allMatch(name -> MICRONAUT_RELEASE.matcher(name)
.find())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpStatus;
import io.micronaut.http.client.HttpClient;
import io.micronaut.http.client.StreamingHttpClient;
import io.micronaut.http.client.annotation.Client;
import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
import jakarta.inject.Inject;
import reactor.core.publisher.Flux;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -22,7 +26,11 @@ class GithubControllerTest {
@Client("/")
HttpClient client; // <2>

private static Pattern MICRONAUT_RELEASE = Pattern.compile("[Micronaut|Micronaut Framework] [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?");
@Inject
@Client("/")
StreamingHttpClient streamingClient;

private static Pattern MICRONAUT_RELEASE = Pattern.compile("([Micronaut|Micronaut Framework] [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?|v3.6.5)");

@Test
public void verifyGithubReleasesCanBeFetchedWithLowLevelHttpClient() {
Expand Down Expand Up @@ -50,12 +58,12 @@ public void verifyGithubReleasesCanBeFetchedWithLowLevelHttpClient() {
@Test
public void verifyGithubReleasesCanBeFetchedWithCompileTimeAutoGeneratedAtClient() {
//when:
HttpRequest<Object> request = HttpRequest.GET("/github/releases-lowlevel");
HttpRequest<Object> request = HttpRequest.GET("/github/releases");

List<GithubRelease> githubReleases = client.toBlocking().retrieve(request, Argument.listOf(GithubRelease.class)); // <7>
Stream<GithubRelease> githubReleases = Flux.from(streamingClient.jsonStream(request, GithubRelease.class)).toStream(); // <7>

//then:
assertTrue(githubReleases.stream()
assertTrue(githubReleases
.map(GithubRelease::getName)
.allMatch(name -> MICRONAUT_RELEASE.matcher(name)
.find()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.annotation.Client
import io.micronaut.http.client.StreamingHttpClient
import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import jakarta.inject.Inject
import reactor.core.publisher.Flux
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import java.util.stream.Collectors

@MicronautTest // <1>
class GithubControllerTest {
Expand All @@ -19,6 +22,10 @@ class GithubControllerTest {
@field:Client("/")
lateinit var client: HttpClient // <2>

@Inject
@field:Client("/")
lateinit var streamingClient: StreamingHttpClient

@Test
fun verifyGithubReleasesCanBeFetchedWithLowLevelHttpClient() {
//when:
Expand All @@ -35,7 +42,7 @@ class GithubControllerTest {

//then:
assertNotNull(releases)
val regex = Regex("Micronaut( Framework)? [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?")
val regex = Regex("(Micronaut( Framework)? |v)?[0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?")
for (release in releases) {
assertTrue(regex.matches(release.name))
}
Expand All @@ -44,11 +51,12 @@ class GithubControllerTest {
@Test
fun verifyGithubReleasesCanBeFetchedWithCompileTimeAutoGeneratedAtClient() {
//when:
val request: HttpRequest<Any> = HttpRequest.GET("/github/releases-lowlevel")
val githubReleases = client.toBlocking().retrieve(request, Argument.listOf(GithubRelease::class.java)) // <7>
val request: HttpRequest<Any> = HttpRequest.GET("/github/releases")

val githubReleases = Flux.from(streamingClient.jsonStream(request, GithubRelease::class.java)).toStream().collect(Collectors.toList()) // <7>

//then:
val regex = Regex("Micronaut( Framework)? [0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?")
val regex = Regex("(Micronaut( Framework)? |v)?[0-9].[0-9].[0-9]([0-9])?( (RC|M)[0-9])?")
for (release in githubReleases) {
assertTrue(regex.matches(release.name))
}
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.2
3.8.3