Migrate to servlet binder for web features

This commit is contained in:
Dave Syer
2017-08-08 08:27:04 +01:00
parent 540b4d378e
commit 1af0d451cf
107 changed files with 4055 additions and 2010 deletions

View File

@@ -26,17 +26,13 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
<artifactId>spring-cloud-stream-binder-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
@@ -65,6 +61,11 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-servlet</artifactId>
<version>${spring-cloud-stream-servlet.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@@ -16,8 +16,6 @@
package com.example;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,17 +26,16 @@ import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
/**
* @author Mark Fisher
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {
"spring.cloud.function.compile.test.lambda=com.example.SampleCompiledConsumerTests.Reference::set",
"spring.cloud.function.compile.test.inputType=String",
"spring.cloud.function.compile.test.type=consumer"
})
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.cloud.function.compile.test.lambda=com.example.SampleCompiledConsumerTests.Reference::set",
"spring.cloud.function.compile.test.inputType=String",
"spring.cloud.function.compile.test.type=consumer" })
public class SampleCompiledConsumerTests {
@LocalServerPort
@@ -47,8 +44,8 @@ public class SampleCompiledConsumerTests {
@Test
public void print() {
assertThat(new TestRestTemplate().postForObject(
"http://localhost:" + port + "/test", "it works",
String.class)).isEqualTo("it works");
"http://localhost:" + port + "/stream/test", "it works", String.class))
.isEqualTo("it works");
assertEquals("it works", Reference.instance);
}

View File

@@ -43,7 +43,7 @@ public class SampleCompiledFunctionTests {
@Test
public void lowercase() {
assertThat(new TestRestTemplate().postForObject(
"http://localhost:" + port + "/test", "it works", String.class))
"http://localhost:" + port + "/stream/test", "it works", String.class))
.isEqualTo("it works!!!");
}