Migrate to JUnit 5

spring-cloud-function-context

spring-cloud-function-context: fix

spring-cloud-function-web

spring-cloud-function-adapters

spring-cloud-function-samples

spring-cloud-function-deployer; spring-cloud-function-kotlin

Resolves #535
This commit is contained in:
anshlykov
2020-06-10 12:08:12 +03:00
committed by Oleg Zhurakousky
parent 6ea91a77a8
commit dfa02750c1
83 changed files with 290 additions and 430 deletions

View File

@@ -24,10 +24,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -44,7 +43,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -62,7 +60,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
// @checkstyle:off
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
// @checkstyle:on
@@ -79,7 +76,7 @@ public class FluxRestApplicationTests {
@Autowired
private TestConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}
@@ -100,7 +97,7 @@ public class FluxRestApplicationTests {
}
@Test
@Ignore("Fix error handling")
@Disabled("Fix error handling")
public void errorJson() throws Exception {
assertThat(this.rest
.exchange(RequestEntity.get(new URI("/bang"))
@@ -134,7 +131,7 @@ public class FluxRestApplicationTests {
}
@Test
@Ignore("Should this even work? Or do we need to be explicit about the JSON?")
@Disabled("Should this even work? Or do we need to be explicit about the JSON?")
public void updates() throws Exception {
ResponseEntity<String> result = this.rest.exchange(
RequestEntity.post(new URI("/updates")).body("one\ntwo"), String.class);

View File

@@ -24,10 +24,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -43,7 +42,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -64,7 +62,6 @@ import static org.assertj.core.api.Assertions.assertThat;
// @checkstyle:off
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet")
// @checkstyle:on
@RunWith(SpringRunner.class)
public class MvcRestApplicationTests {
private static final MediaType EVENT_STREAM = MediaType.valueOf("text/event-stream");
@@ -78,7 +75,7 @@ public class MvcRestApplicationTests {
@Autowired
private TestConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}
@@ -99,7 +96,7 @@ public class MvcRestApplicationTests {
}
@Test
@Ignore("Fix error handling")
@Disabled("Fix error handling")
public void errorJson() throws Exception {
assertThat(this.rest
.exchange(RequestEntity.get(new URI("/bang"))
@@ -133,7 +130,7 @@ public class MvcRestApplicationTests {
}
@Test
@Ignore("Should this even work? Or do we need to be explicit about the JSON?")
@Disabled("Should this even work? Or do we need to be explicit about the JSON?")
public void updates() throws Exception {
ResponseEntity<String> result = this.rest.exchange(
RequestEntity.post(new URI("/updates")).body("one\ntwo"), String.class);

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.scan;
import java.net.URI;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +34,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -43,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class ComponentTests {

View File

@@ -18,8 +18,7 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,14 +27,12 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest({ "spring.main.web-application-type=REACTIVE",
"spring.functional.enabled=false" })
@AutoConfigureWebTestClient

View File

@@ -20,10 +20,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
@@ -39,7 +38,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat;
@@ -48,7 +46,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
* @author Oleg Zhurakousky
*/
@RunWith(SpringRunner.class)
@FunctionalSpringBootTest(classes = ApplicationConfiguration.class, webEnvironment = WebEnvironment.NONE, properties = {
"spring.main.web-application-type=none",
"spring.cloud.function.web.export.sink.url=http://localhost:${my.port}",
@@ -67,7 +64,7 @@ public class FunctionalExporterTests {
private static Map<String, Object> headers = new HashMap<>();
@BeforeClass
@BeforeAll
public static void init() throws Exception {
headers.clear();
String port = "" + SocketUtils.findAvailableTcpPort();
@@ -80,7 +77,7 @@ public class FunctionalExporterTests {
Thread.sleep(500L);
}
@AfterClass
@AfterAll
public static void close() {
headers.clear();
System.clearProperty("server.port");

View File

@@ -18,22 +18,19 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
// Only need web-application-type because MVC is on the classpath
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
@AutoConfigureWebTestClient

View File

@@ -20,22 +20,19 @@ import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
@AutoConfigureWebTestClient
public class FunctionalWithInputListTests {

View File

@@ -20,15 +20,13 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,7 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
@AutoConfigureWebTestClient
public class FunctionalWithInputSetTests {

View File

@@ -18,8 +18,7 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,14 +27,12 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
// Only need web-application-type because MVC is on the classpath
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
@AutoConfigureWebTestClient

View File

@@ -18,8 +18,7 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,14 +28,12 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest("spring.main.web-application-type=REACTIVE")
@AutoConfigureWebTestClient
@DirtiesContext

View File

@@ -18,8 +18,7 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,14 +28,12 @@ import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWeb
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest({ "spring.main.web-application-type=REACTIVE",
"spring.functional.enabled=false",
"spring.cloud.function.definition=uppercase|reverse" })
@@ -48,7 +45,7 @@ public class MoreThenOneFunctionRootMappingTests {
private WebTestClient client;
@Test
public void words() throws Exception {
public void words() {
this.client.post().uri("/").body(Mono.just("star"), String.class).exchange()
.expectStatus().isOk().expectBody(String.class).isEqualTo("RATS");
}
@@ -59,7 +56,7 @@ public class MoreThenOneFunctionRootMappingTests {
@Bean
public Function<String, String> uppercase() {
return v -> v.toUpperCase();
return String::toUpperCase;
}
@Bean

View File

@@ -18,22 +18,19 @@ package org.springframework.cloud.function.test;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
// Only need web-application-type because MVC is on the classpath
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
@AutoConfigureWebTestClient

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.web.flux;
import java.net.URI;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -36,7 +35,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -45,7 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.cloud.function.web.path=/functions",
"spring.main.web-application-type=reactive" })

View File

@@ -27,9 +27,8 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,7 +47,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
@@ -57,7 +55,6 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
@ContextConfiguration(classes = { RestApplication.class, ApplicationConfiguration.class })
public class HttpGetIntegrationTests {
@@ -73,7 +70,7 @@ public class HttpGetIntegrationTests {
@Autowired
private ApplicationConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}

View File

@@ -26,10 +26,9 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -52,7 +51,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@@ -63,7 +61,6 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
@ContextConfiguration(classes = { RestApplication.class, ApplicationConfiguration.class })
public class HttpPostIntegrationTests {
@@ -79,7 +76,7 @@ public class HttpPostIntegrationTests {
@Autowired
private ApplicationConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}
@@ -182,7 +179,7 @@ public class HttpPostIntegrationTests {
}
@Test
@Ignore("WebFlux would split the request body into lines: TODO make this work the same")
@Disabled("WebFlux would split the request body into lines: TODO make this work the same")
public void uppercasePlainText() throws Exception {
ResponseEntity<String> result = this.rest.exchange(
RequestEntity.post(new URI("/uppercase"))

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.web.flux;
import java.net.URI;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,7 +35,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,7 +42,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.main.web-application-type=reactive",
"spring.cloud.function.web.path=/functions", "debug" })

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.web.flux;
import java.net.URI;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.BeansException;
@@ -41,7 +40,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -49,7 +47,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
@ContextConfiguration(classes = { RestApplication.class, TestConfiguration.class })
public class SingletonTests {

View File

@@ -19,9 +19,9 @@ package org.springframework.cloud.function.web.function;
import java.net.URI;
import java.util.function.Function;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -40,13 +40,13 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class FunctionEndpointInitializerMVCTests {
@Before
@BeforeEach
public void init() throws Exception {
String port = "" + SocketUtils.findAvailableTcpPort();
System.setProperty("server.port", port);
}
@After
@AfterEach
public void close() throws Exception {
System.clearProperty("server.port");
}

View File

@@ -20,9 +20,9 @@ import java.net.URI;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -45,13 +45,13 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class FunctionEndpointInitializerTests {
@Before
@BeforeEach
public void init() throws Exception {
String port = "" + SocketUtils.findAvailableTcpPort();
System.setProperty("server.port", port);
}
@After
@AfterEach
public void close() throws Exception {
System.clearProperty("server.port");
}

View File

@@ -19,9 +19,9 @@ package org.springframework.cloud.function.web.function;
import java.net.URI;
import java.util.function.Function;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -41,13 +41,13 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class UserSubmittedTests {
@Before
@BeforeEach
public void init() throws Exception {
String port = "" + SocketUtils.findAvailableTcpPort();
System.setProperty("server.port", port);
}
@After
@AfterEach
public void close() throws Exception {
System.clearProperty("server.port");
}

View File

@@ -19,9 +19,8 @@ package org.springframework.cloud.function.web.mvc;
import java.net.URI;
import java.util.function.Function;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,7 +36,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -45,7 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "")
@ContextConfiguration(classes = { RestApplication.class, TestConfiguration.class })
public class DefaultRouteTests {
@@ -57,7 +54,7 @@ public class DefaultRouteTests {
private TestRestTemplate rest;
@Test
@Ignore("FIXME")
@Disabled("FIXME")
public void explicit() throws Exception {
ResponseEntity<String> result = this.rest.exchange(
RequestEntity.post(new URI("/uppercase")).body("foo"), String.class);
@@ -66,7 +63,7 @@ public class DefaultRouteTests {
}
@Test
@Ignore("FIXME")
@Disabled("FIXME")
public void implicit() throws Exception {
ResponseEntity<String> result = this.rest
.exchange(RequestEntity.post(new URI("/")).body("foo"), String.class);

View File

@@ -21,8 +21,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -38,7 +37,6 @@ import org.springframework.http.RequestEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -46,7 +44,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.main.web-application-type=servlet",
"spring.cloud.function.web.path=/functions" })

View File

@@ -27,10 +27,9 @@ import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,7 +48,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
@@ -58,7 +56,6 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet")
@ContextConfiguration(classes = { RestApplication.class, ApplicationConfiguration.class })
public class HttpGetIntegrationTests {
@@ -74,7 +71,7 @@ public class HttpGetIntegrationTests {
@Autowired
private ApplicationConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}
@@ -101,7 +98,7 @@ public class HttpGetIntegrationTests {
}
@Test
@Ignore("Fix error handling")
@Disabled("Fix error handling")
public void errorJson() throws Exception {
assertThat(this.rest
.exchange(RequestEntity.get(new URI("/bang"))

View File

@@ -26,10 +26,9 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -52,7 +51,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
@@ -62,7 +60,6 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet")
@ContextConfiguration(classes = { RestApplication.class, ApplicationConfiguration.class })
public class HttpPostIntegrationTests {
@@ -78,13 +75,13 @@ public class HttpPostIntegrationTests {
@Autowired
private ApplicationConfiguration test;
@Before
@BeforeEach
public void init() {
this.test.list.clear();
}
@Test
@Ignore
@Disabled
public void qualifierFoos() throws Exception {
ResponseEntity<String> result = this.rest.exchange(RequestEntity
.post(new URI("/foos")).contentType(MediaType.APPLICATION_JSON)
@@ -177,7 +174,7 @@ public class HttpPostIntegrationTests {
}
@Test
@Ignore("WebFlux would split the request body into lines: TODO make this work the same")
@Disabled("WebFlux would split the request body into lines: TODO make this work the same")
public void uppercasePlainText() throws Exception {
ResponseEntity<String> result = this.rest.exchange(
RequestEntity.post(new URI("/uppercase"))

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.web.mvc;
import java.net.URI;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +27,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.function.web.RestApplication;
import org.springframework.cloud.function.web.mvc.PrefixTests.TestConfiguration;
import org.springframework.context.annotation.Bean;
@@ -36,7 +34,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,16 +41,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.main.web-application-type=servlet",
"spring.cloud.function.web.path=/functions" })
@ContextConfiguration(classes = { RestApplication.class, TestConfiguration.class })
public class PrefixTests {
@LocalServerPort
private int port;
@Autowired
private TestRestTemplate rest;

View File

@@ -21,9 +21,8 @@ import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,7 +44,6 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -53,7 +51,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.main.web-application-type=servlet",
"spring.cloud.function.web.path=/functions",
@@ -134,7 +131,7 @@ public class RoutingFunctionTests {
@Test
@DirtiesContext
@Ignore
@Disabled
public void testFluxConsumer() throws Exception {
ResponseEntity<String> postForEntity = this.rest
.exchange(RequestEntity.post(new URI("/functions/" + RoutingFunction.FUNCTION_NAME))
@@ -148,7 +145,7 @@ public class RoutingFunctionTests {
@Test
@DirtiesContext
@Ignore
@Disabled
public void testFunctionPojo() throws Exception {
ResponseEntity<String> postForEntity = this.rest
.exchange(RequestEntity.post(new URI("/functions/" + RoutingFunction.FUNCTION_NAME))
@@ -161,7 +158,7 @@ public class RoutingFunctionTests {
@Test
@DirtiesContext
@Ignore
@Disabled
public void testConsumerMessage() throws Exception {
ResponseEntity<String> postForEntity = this.rest
.exchange(RequestEntity.post(new URI("/functions/" + RoutingFunction.FUNCTION_NAME))

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.function.web.mvc;
import java.net.URI;
import java.util.function.Supplier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import org.springframework.beans.BeansException;
@@ -33,7 +32,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.function.web.RestApplication;
import org.springframework.cloud.function.web.mvc.SingletonTests.TestConfiguration;
import org.springframework.context.annotation.Bean;
@@ -41,7 +39,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -49,14 +46,10 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = { RestApplication.class, TestConfiguration.class })
public class SingletonTests {
@LocalServerPort
private int port;
@Autowired
private TestRestTemplate rest;

View File

@@ -24,10 +24,9 @@ import java.util.function.Function;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -38,7 +37,6 @@ import org.springframework.cloud.function.web.source.FunctionAutoConfigurationIn
import org.springframework.cloud.function.web.source.FunctionAutoConfigurationIntegrationTests.RestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -51,7 +49,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { RestConfiguration.class,
ApplicationConfiguration.class }, webEnvironment = WebEnvironment.DEFINED_PORT, properties = {
"spring.cloud.function.web.export.sink.url=http://localhost:${server.port}",
@@ -67,12 +64,12 @@ public class FunctionAutoConfigurationIntegrationTests {
@Autowired
private RestConfiguration app;
@BeforeClass
@BeforeAll
public static void init() {
System.setProperty("server.port", "" + SocketUtils.findAvailableTcpPort());
}
@AfterClass
@AfterAll
public static void close() {
System.clearProperty("server.port");
}

View File

@@ -22,11 +22,10 @@ import java.util.function.Function;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -37,7 +36,6 @@ import org.springframework.cloud.function.web.source.FunctionAutoConfigurationWi
import org.springframework.cloud.function.web.source.FunctionAutoConfigurationWithRetriesIntegrationTests.RestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -50,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Oleg Zhurakousky
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { RestConfiguration.class,
ApplicationConfiguration.class },
webEnvironment = WebEnvironment.DEFINED_PORT, properties = {
@@ -66,18 +63,18 @@ public class FunctionAutoConfigurationWithRetriesIntegrationTests {
@Autowired
private RestConfiguration app;
@BeforeClass
@BeforeAll
public static void init() {
System.setProperty("server.port", "" + SocketUtils.findAvailableTcpPort());
}
@AfterClass
@AfterAll
public static void close() {
System.clearProperty("server.port");
}
@Test
@Ignore
@Disabled
public void copiesMessages() throws Exception {
int count = 0;
while (this.forwarder.isRunning() && count++ < 30) {

View File

@@ -18,9 +18,8 @@ package org.springframework.cloud.function.web.source;
import java.util.function.Supplier;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -30,7 +29,6 @@ import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.cloud.function.web.source.SourceAutoConfigurationIntegrationTests.ApplicationConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,19 +36,18 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
// @formatter:off
@SpringBootTest(webEnvironment = WebEnvironment.NONE,
properties = "spring.cloud.function.web.export.sink.url=https://nosuchhost")
// @formatter:on
@ContextConfiguration(classes = { ApplicationConfiguration.class })
@Disabled
public class SourceAutoConfigurationIntegrationTests {
@Autowired
private SupplierExporter forwarder;
@Test
@Ignore
public void fails() throws Exception {
int count = 0;
while (this.forwarder.isRunning() && count++ < 1000) {

View File

@@ -24,11 +24,10 @@ import java.util.function.Supplier;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -38,7 +37,6 @@ import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.cloud.function.web.RestApplication;
import org.springframework.cloud.function.web.source.WebAppIntegrationTests.ApplicationConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -50,7 +48,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer
*
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = { RestApplication.class, ApplicationConfiguration.class },
webEnvironment = WebEnvironment.DEFINED_PORT, properties = {
"spring.main.web-application-type=reactive",
@@ -67,18 +64,18 @@ public class WebAppIntegrationTests {
@Autowired
private ApplicationConfiguration app;
@BeforeClass
@BeforeAll
public static void init() {
System.setProperty("server.port", "" + SocketUtils.findAvailableTcpPort());
}
@AfterClass
@AfterAll
public static void close() {
System.clearProperty("server.port");
}
@Test
@Ignore
@Disabled
public void posts() throws Exception {
this.forwarder.start();
this.app.latch.await(10, TimeUnit.SECONDS);