Merge pull request #31913 from quaff
* pr/31913: Update copyright year of changed files Cleanup kotlin sources Closes gh-31913
This commit is contained in:
commit
c3b5f5bf90
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or 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 org.springframework.aop.framework.autoproxy
|
||||
|
||||
import kotlinx.coroutines.delay
|
||||
|
|
@ -94,12 +110,12 @@ class AspectJAutoProxyInterceptorKotlinIntegrationTests(
|
|||
open class Echo {
|
||||
|
||||
open fun echo(value: String): String {
|
||||
return value;
|
||||
return value
|
||||
}
|
||||
|
||||
open suspend fun suspendingEcho(value: String): String {
|
||||
delay(1)
|
||||
return value;
|
||||
return value
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class AopUtilsKotlinTests {
|
|||
@Suppress("unused")
|
||||
suspend fun suspendingFunction(value: String): String {
|
||||
delay(1)
|
||||
return value;
|
||||
return value
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.beans
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
import org.openjdk.jmh.annotations.Benchmark
|
||||
import org.openjdk.jmh.annotations.BenchmarkMode
|
||||
|
|
@ -30,22 +30,22 @@ import org.openjdk.jmh.annotations.State
|
|||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||
open class KotlinBeanUtilsBenchmark {
|
||||
|
||||
private val noArgConstructor = TestClass1::class.java.getDeclaredConstructor()
|
||||
private val constructor = TestClass2::class.java.getDeclaredConstructor(Int::class.java, String::class.java)
|
||||
private val noArgConstructor = TestClass1::class.java.getDeclaredConstructor()
|
||||
private val constructor = TestClass2::class.java.getDeclaredConstructor(Int::class.java, String::class.java)
|
||||
|
||||
@Benchmark
|
||||
fun emptyConstructor(): Any {
|
||||
@Benchmark
|
||||
fun emptyConstructor(): Any {
|
||||
return BeanUtils.instantiateClass(noArgConstructor)
|
||||
}
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
fun nonEmptyConstructor(): Any {
|
||||
@Benchmark
|
||||
fun nonEmptyConstructor(): Any {
|
||||
return BeanUtils.instantiateClass(constructor, 1, "str")
|
||||
}
|
||||
}
|
||||
|
||||
class TestClass1()
|
||||
class TestClass1
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class TestClass2(int: Int, string: String)
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class TestClass2(int: Int, string: String)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors
|
||||
* Copyright 2002-2023 the original author or 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
|
||||
* 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,
|
||||
|
|
@ -35,7 +35,7 @@ inline fun <reified T> JdbcOperations.queryForObject(sql: String): T =
|
|||
* @since 5.0
|
||||
*/
|
||||
inline fun <reified T> JdbcOperations.queryForObject(sql: String, vararg args: Any, crossinline function: (ResultSet, Int) -> T): T =
|
||||
queryForObject(sql, RowMapper { resultSet, i -> function(resultSet, i) }, *args) as T
|
||||
queryForObject(sql, { resultSet, i -> function(resultSet, i) }, *args) as T
|
||||
|
||||
/**
|
||||
* Extension for [JdbcOperations.queryForObject] providing a
|
||||
|
|
@ -113,7 +113,7 @@ inline fun <reified T> JdbcOperations.query(sql: String, vararg args: Any,
|
|||
* @since 5.0
|
||||
*/
|
||||
fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet) -> Unit): Unit =
|
||||
query(sql, RowCallbackHandler { function(it) }, *args)
|
||||
query(sql, { function(it) }, *args)
|
||||
|
||||
/**
|
||||
* Extensions for [JdbcOperations.query] providing a RowMapper-like function variant:
|
||||
|
|
@ -123,4 +123,4 @@ fun JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet) ->
|
|||
* @since 5.0
|
||||
*/
|
||||
fun <T> JdbcOperations.query(sql: String, vararg args: Any, function: (ResultSet, Int) -> T): List<T> =
|
||||
query(sql, RowMapper { rs, i -> function(rs, i) }, *args)
|
||||
query(sql, { rs, i -> function(rs, i) }, *args)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -174,7 +174,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun GET(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.GET(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.GET(predicate, { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,7 +185,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun GET(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.GET(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.GET(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -219,7 +219,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun HEAD(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.HEAD(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.HEAD(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -230,7 +230,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun HEAD(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.HEAD(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.HEAD(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -264,7 +264,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun POST(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.POST(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.POST(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -275,7 +275,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun POST(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.POST(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.POST(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -309,7 +309,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun PUT(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.PUT(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.PUT(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -320,7 +320,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun PUT(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.PUT(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.PUT(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -354,7 +354,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun PATCH(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.PATCH(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.PATCH(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -365,7 +365,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun PATCH(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.PATCH(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.PATCH(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -401,7 +401,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun DELETE(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.DELETE(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.DELETE(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -412,7 +412,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun DELETE(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.DELETE(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.DELETE(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -448,7 +448,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.3
|
||||
*/
|
||||
fun OPTIONS(predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.OPTIONS(predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.OPTIONS(predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -459,7 +459,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @since 5.2
|
||||
*/
|
||||
fun OPTIONS(pattern: String, predicate: RequestPredicate, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.OPTIONS(pattern, predicate, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) })
|
||||
builder.OPTIONS(pattern, predicate, HandlerFunction { f(it).cast(ServerResponse::class.java) })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -476,7 +476,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun accept(mediaType: MediaType, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.accept(mediaType), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.accept(mediaType), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -493,7 +493,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun contentType(mediaTypes: MediaType, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.contentType(mediaTypes), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.contentType(mediaTypes), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -510,7 +510,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun headers(headersPredicate: (ServerRequest.Headers) -> Boolean, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.headers(headersPredicate), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.headers(headersPredicate), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -526,7 +526,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun method(httpMethod: HttpMethod, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.method(httpMethod), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.method(httpMethod), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -541,7 +541,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun path(pattern: String, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.path(pattern), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.path(pattern), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -555,7 +555,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun pathExtension(extension: String, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.pathExtension(extension), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.pathExtension(extension), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -570,7 +570,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun pathExtension(predicate: (String) -> Boolean, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.pathExtension(predicate), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.pathExtension(predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -586,7 +586,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
fun queryParam(name: String, predicate: (String) -> Boolean, f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.queryParam(name, predicate), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.queryParam(name, predicate), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -605,7 +605,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
operator fun RequestPredicate.invoke(f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(this, HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(this, HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -614,7 +614,7 @@ class RouterFunctionDsl internal constructor (private val init: RouterFunctionDs
|
|||
* @see RouterFunctions.route
|
||||
*/
|
||||
operator fun String.invoke(f: (ServerRequest) -> Mono<out ServerResponse>) {
|
||||
builder.add(RouterFunctions.route(RequestPredicates.path(this), HandlerFunction<ServerResponse> { f(it).cast(ServerResponse::class.java) }))
|
||||
builder.add(RouterFunctions.route(RequestPredicates.path(this), HandlerFunction { f(it).cast(ServerResponse::class.java) }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -281,8 +281,8 @@ class CoRouterFunctionDslTests {
|
|||
listOf(mapOf("foo" to "bar"), mapOf("foo" to "n1")),
|
||||
listOf(mapOf("baz" to "qux"), mapOf("foo" to "n1")),
|
||||
listOf(mapOf("foo" to "n3"), mapOf("foo" to "n2"), mapOf("foo" to "n1"))
|
||||
);
|
||||
assertThat(visitor.visitCount()).isEqualTo(7);
|
||||
)
|
||||
assertThat(visitor.visitCount()).isEqualTo(7)
|
||||
}
|
||||
|
||||
private fun sampleRouter() = coRouter {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -27,7 +27,6 @@ import org.springframework.http.MediaType.*
|
|||
import org.springframework.web.reactive.function.server.support.ServerRequestWrapper
|
||||
import org.springframework.web.testfixture.http.server.reactive.MockServerHttpRequest.*
|
||||
import org.springframework.web.testfixture.server.MockServerWebExchange
|
||||
import org.springframework.web.reactive.function.server.AttributesTestVisitor
|
||||
import reactor.core.publisher.Mono
|
||||
import reactor.test.StepVerifier
|
||||
import java.security.Principal
|
||||
|
|
@ -167,8 +166,8 @@ class RouterFunctionDslTests {
|
|||
listOf(mapOf("foo" to "bar"), mapOf("foo" to "n1")),
|
||||
listOf(mapOf("baz" to "qux"), mapOf("foo" to "n1")),
|
||||
listOf(mapOf("foo" to "n3"), mapOf("foo" to "n2"), mapOf("foo" to "n1"))
|
||||
);
|
||||
assertThat(visitor.visitCount()).isEqualTo(7);
|
||||
)
|
||||
assertThat(visitor.visitCount()).isEqualTo(7)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class InvocableHandlerMethodKotlinTests {
|
|||
|
||||
private var exchange = MockServerWebExchange.from(get("http://localhost:8080/path"))
|
||||
|
||||
private val resolvers = mutableListOf<HandlerMethodArgumentResolver>(ContinuationHandlerMethodArgumentResolver(),
|
||||
private val resolvers = mutableListOf(ContinuationHandlerMethodArgumentResolver(),
|
||||
RequestParamMethodArgumentResolver(null, ReactiveAdapterRegistry.getSharedInstance(), false))
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Suspending handler method`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/suspend", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/suspend", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foo")
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Handler method returning Deferred`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/deferred", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/deferred", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foo")
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Suspending ResponseEntity handler method`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/suspend-response-entity", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/suspend-response-entity", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("{\"value\":\"foo\"}")
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Handler method returning Flow`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/flow", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/flow", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foobar")
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Suspending handler method returning Flow`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/suspending-flow", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/suspending-flow", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foobar")
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
startServer(httpServer)
|
||||
|
||||
assertThatExceptionOfType(HttpServerErrorException.InternalServerError::class.java).isThrownBy {
|
||||
performGet<String>("/error", HttpHeaders.EMPTY, String::class.java)
|
||||
performGet("/error", HttpHeaders.EMPTY, String::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
startServer(httpServer)
|
||||
|
||||
assertThatExceptionOfType(HttpServerErrorException.InternalServerError::class.java).isThrownBy {
|
||||
performGet<String>("/flow-error", HttpHeaders.EMPTY, String::class.java)
|
||||
performGet("/flow-error", HttpHeaders.EMPTY, String::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/entity-flux", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/entity-flux", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foobar")
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
fun `Suspending handler method returning ResponseEntity of Flow`(httpServer: HttpServer) {
|
||||
startServer(httpServer)
|
||||
|
||||
val entity = performGet<String>("/entity-flow", HttpHeaders.EMPTY, String::class.java)
|
||||
val entity = performGet("/entity-flow", HttpHeaders.EMPTY, String::class.java)
|
||||
assertThat(entity.statusCode).isEqualTo(HttpStatus.OK)
|
||||
assertThat(entity.body).isEqualTo("foobar")
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ class CoroutinesIntegrationTests : AbstractRequestMappingIntegrationTests() {
|
|||
|
||||
@GetMapping("/entity-flux")
|
||||
suspend fun entityFlux() : ResponseEntity<Flux<String>> {
|
||||
val strings = Flux.just("foo", "bar");
|
||||
val strings = Flux.just("foo", "bar")
|
||||
delay(1)
|
||||
return ResponseEntity.ok().body(strings)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import org.springframework.web.testfixture.server.MockServerWebExchange
|
|||
import reactor.test.StepVerifier
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.time.Duration
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Kotlin unit tests for [AbstractMessageWriterResultHandler].
|
||||
|
|
|
|||
Loading…
Reference in New Issue