Migrate to servlet binder for web features
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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!!!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user