diff --git a/spring-boot-tests/spring-boot-smoke-tests/pom.xml b/spring-boot-tests/spring-boot-smoke-tests/pom.xml index da356cdd12..03ef348817 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/pom.xml +++ b/spring-boot-tests/spring-boot-smoke-tests/pom.xml @@ -70,6 +70,7 @@ spring-boot-smoke-test-quartz spring-boot-smoke-test-reactive-oauth2-client spring-boot-smoke-test-reactive-oauth2-resource-server + spring-boot-smoke-test-rsocket spring-boot-smoke-test-secure spring-boot-smoke-test-secure-jersey spring-boot-smoke-test-secure-webflux diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/pom.xml b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/pom.xml new file mode 100644 index 0000000000..c231b86eb8 --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/pom.xml @@ -0,0 +1,59 @@ + + + + + 4.0.0 + + org.springframework.boot + spring-boot-smoke-tests + ${revision} + + spring-boot-smoke-test-rsocket + Spring Boot RSocket Smoke Test + Spring Boot RSocket Smoke Test + + ${basedir}/../../.. + / + + + + + org.springframework.boot + spring-boot-starter-rsocket + + + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/Project.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/Project.java new file mode 100644 index 0000000000..02fb3a93cd --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/Project.java @@ -0,0 +1,38 @@ +/* + * Copyright 2012-2019 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 smoketest.rsocket; + +public class Project { + + private String name; + + public Project() { + } + + public Project(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/ProjectController.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/ProjectController.java new file mode 100644 index 0000000000..8dd830ae48 --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/ProjectController.java @@ -0,0 +1,33 @@ +/* + * Copyright 2012-2019 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 smoketest.rsocket; + +import reactor.core.publisher.Mono; + +import org.springframework.messaging.handler.annotation.DestinationVariable; +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.stereotype.Controller; + +@Controller +public class ProjectController { + + @MessageMapping("find.project.{name}") + public Mono findProject(@DestinationVariable String name) { + return Mono.just(new Project(name)); + } + +} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/SampleRSocketApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/SampleRSocketApplication.java new file mode 100644 index 0000000000..00f71b9269 --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/java/smoketest/rsocket/SampleRSocketApplication.java @@ -0,0 +1,29 @@ +/* + * Copyright 2012-2019 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 smoketest.rsocket; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SampleRSocketApplication { + + public static void main(String[] args) { + SpringApplication.run(SampleRSocketApplication.class, args); + } + +} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/resources/application.properties b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/resources/application.properties new file mode 100644 index 0000000000..5e4aaaf7f7 --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.rsocket.server.port=0 diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java new file mode 100644 index 0000000000..55ab627902 --- /dev/null +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-rsocket/src/test/java/smoketest/rsocket/SampleRSocketApplicationTests.java @@ -0,0 +1,49 @@ +/* + * Copyright 2012-2019 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 smoketest.rsocket; + +import java.time.Duration; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.rsocket.context.LocalRSocketServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.messaging.rsocket.RSocketRequester; + +@SpringBootTest(properties = "spring.rsocket.server.port=0") +public class SampleRSocketApplicationTests { + + @LocalRSocketServerPort + private int port; + + @Autowired + private RSocketRequester.Builder builder; + + @Test + void testRSocketEndpoint() { + RSocketRequester requester = this.builder.connectTcp("localhost", this.port).block(Duration.ofSeconds(5)); + Mono result = requester.route("find.project.spring-boot").retrieveMono(Project.class); + StepVerifier.create(result) + .assertNext((project) -> Assertions.assertThat(project.getName()).isEqualTo("spring-boot")) + .verifyComplete(); + } + +}