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

Use core M2 #428

Merged
merged 4 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
micronaut = "4.0.0-M1"
micronaut = "4.0.0-M2"
micronaut-docs = "2.0.0"
micronaut-test = "4.0.0-SNAPSHOT"
micronaut-test = "4.0.0-M1"
groovy = "4.0.10"
spock = "2.3-groovy-4.0"

Expand All @@ -18,7 +18,7 @@ micronaut-reactor = "3.0.0-M1"
micronaut-security = "4.0.0-M1"
micronaut-serde = "2.0.0-M1"
micronaut-session = "4.0.0-M1"
micronaut-validation = "4.0.0-M2"
micronaut-validation = "4.0.0-M3"
google-cloud-functions = '1.0.4'
kotlin = "1.8.10"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ class JettyExceptionHandlerSpec extends Specification {

void "test an exception handler returning the body"() {
when:
client.toBlocking().retrieve("/exception/my")
def resp = client.toBlocking().exchange("/exception/my", String)

then:
def ex = thrown(HttpClientResponseException)
ex.response.status() == HttpStatus.INTERNAL_SERVER_ERROR
ex.response.getBody().get() == "hello"
resp.status() == HttpStatus.OK
resp.getBody().get() == "hello"
}

void "test a filter throwing an exception on a 404"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected ServletBodyBinder newServletBodyBinder(
}

@Override
public <T> Optional<ArgumentBinder<T, HttpRequest<?>>> findArgumentBinder(Argument<T> argument, HttpRequest<?> source) {
public <T> Optional<ArgumentBinder<T, HttpRequest<?>>> findArgumentBinder(Argument<T> argument) {
final Class<? extends Annotation> annotation = argument.getAnnotationMetadata().getAnnotationTypeByStereotype(BINDABLE_ANN).orElse(null);
if (annotation != null) {
final RequestArgumentBinder binder = byAnnotation.get(annotation);
Expand All @@ -87,7 +87,7 @@ public <T> Optional<ArgumentBinder<T, HttpRequest<?>>> findArgumentBinder(Argume
if (requestArgumentBinder != null) {
return Optional.of(requestArgumentBinder);
} else {
return this.defaultRegistry.findArgumentBinder(argument, source);
return this.defaultRegistry.findArgumentBinder(argument);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected Object buildBody() {
private Argument<?> resolveBodyType() {
RouteMatch<?> route = this.getAttribute(HttpAttributes.ROUTE_MATCH, RouteMatch.class).orElse(null);
if (route != null) {
Argument<?> bodyType = route.getBodyArgument()
Argument<?> bodyType = route.getRouteInfo().getFullBodyArgument()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graemerocher Is this the correct replacement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems not (or something else has changed) as now this is failing

void "test an exception handler returning the body"() {
when:
client.toBlocking().retrieve("/exception/my")
then:
def ex = thrown(HttpClientResponseException)
ex.response.status() == HttpStatus.INTERNAL_SERVER_ERROR
ex.response.getBody().get() == "hello"
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dstepanov There's also route.getRouteInfo().getBodyArgument()... What's the difference?

/*
The getBodyArgument() method returns arguments for functions where it is
not possible to dictate whether the argument is supposed to bind the entire
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
@SuiteDisplayName("HTTP Server TCK for Jetty")
@ExcludeClassNamePatterns({
"io.micronaut.http.server.tck.tests.cors.CorsSimpleRequestTest",
"io.micronaut.http.server.tck.tests.staticresources.StaticResourceTest", // fails on GraalVm
"io.micronaut.http.server.tck.tests.filter.ClientResponseFilterTest", // fails on GraalVM
"io.micronaut.http.server.tck.tests.ErrorHandlerTest" // fails on GraalVM

})
public class JettytHttpServerTestSuite {
public class JettyHttpServerTestSuite {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"resources": {
"includes": [
{
"pattern": "\\Qassets\\E"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@SuiteDisplayName("HTTP Server TCK for Tomcat")
@ExcludeClassNamePatterns({
"io.micronaut.http.server.tck.tests.cors.CorsSimpleRequestTest",
"io.micronaut.http.server.tck.tests.staticresources.StaticResourceTest", // fails on GraalVm
"io.micronaut.http.server.tck.tests.filter.ClientResponseFilterTest", // fails on GraalVM
"io.micronaut.http.server.tck.tests.ErrorHandlerTest" // fails on GraalVM
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"resources": {
"includes": [
{
"pattern": "\\Qassets\\E"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@ExcludeClassNamePatterns({
"io.micronaut.http.server.tck.tests.cors.CorsSimpleRequestTest",
"io.micronaut.http.server.tck.tests.RemoteAddressTest",
"io.micronaut.http.server.tck.tests.staticresources.StaticResourceTest", // fails on GraalVm
"io.micronaut.http.server.tck.tests.filter.ClientResponseFilterTest", // fails on GraalVM
"io.micronaut.http.server.tck.tests.ErrorHandlerTest" // fails on GraalVM
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"resources": {
"includes": [
{
"pattern": "\\Qassets\\E"
}
]
}
}