From 43e3cb4f276859b22669e8df06fc62a5150beb93 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 15 Mar 2018 09:22:51 -0400 Subject: [PATCH] Fix deployer tests to not use the Boot 2.0 sample --- spring-cloud-function-deployer/pom.xml | 1 + .../src/main/resources/core-pom.xml | 2 +- ...actingFunctionCatalogIntegrationTests.java | 32 +++++++++++-------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/spring-cloud-function-deployer/pom.xml b/spring-cloud-function-deployer/pom.xml index 38f324251..2be3bcdff 100644 --- a/spring-cloud-function-deployer/pom.xml +++ b/spring-cloud-function-deployer/pom.xml @@ -16,6 +16,7 @@ 1.0.10.BUILD-SNAPSHOT + 1.0.10.BUILD-SNAPSHOT diff --git a/spring-cloud-function-deployer/src/main/resources/core-pom.xml b/spring-cloud-function-deployer/src/main/resources/core-pom.xml index 4d4ecc552..c1a3f3fe9 100644 --- a/spring-cloud-function-deployer/src/main/resources/core-pom.xml +++ b/spring-cloud-function-deployer/src/main/resources/core-pom.xml @@ -15,7 +15,7 @@ - 3.1.1.RELEASE + 3.1.4.RELEASE diff --git a/spring-cloud-function-deployer/src/test/java/org/springframework/cloud/function/deployer/FunctionExtractingFunctionCatalogIntegrationTests.java b/spring-cloud-function-deployer/src/test/java/org/springframework/cloud/function/deployer/FunctionExtractingFunctionCatalogIntegrationTests.java index 447392682..a22467008 100644 --- a/spring-cloud-function-deployer/src/test/java/org/springframework/cloud/function/deployer/FunctionExtractingFunctionCatalogIntegrationTests.java +++ b/spring-cloud-function-deployer/src/test/java/org/springframework/cloud/function/deployer/FunctionExtractingFunctionCatalogIntegrationTests.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.RequestEntity; import org.springframework.http.ResponseEntity; import org.springframework.util.SocketUtils; @@ -45,7 +46,7 @@ public class FunctionExtractingFunctionCatalogIntegrationTests { // System.setProperty("debug", "true"); context = new ApplicationRunner().start("--server.port=" + port, "--debug", "--logging.level.org.springframework.cloud.function=DEBUG"); - deploy("sample", "maven://io.spring.sample:function-sample-pojo:1.0.0.BUILD-SNAPSHOT"); + deploy("sample", "maven://io.spring.sample:function-sample:1.0.0.BUILD-SNAPSHOT"); } private static void deploy(String name, String path) throws Exception { @@ -81,7 +82,7 @@ public class FunctionExtractingFunctionCatalogIntegrationTests { public void words() { assertThat(new TestRestTemplate().getForObject( "http://localhost:" + port + "/stream/sample/words", String.class)) - .isEqualTo("[{\"value\":\"foo\"},{\"value\":\"bar\"}]"); + .isEqualTo("[\"foo\",\"bar\"]"); } @Test @@ -93,18 +94,21 @@ public class FunctionExtractingFunctionCatalogIntegrationTests { } @Test - public void uppercase() { - assertThat(new TestRestTemplate().postForObject( - "http://localhost:" + port + "/stream/sample/uppercase", - "{\"value\":\"foo\"}", String.class)).isEqualTo("{\"value\":\"FOO\"}"); + public void uppercase() throws Exception { + ResponseEntity result = new TestRestTemplate().exchange(RequestEntity + .post(new URI("http://localhost:" + port + "/stream/sample/uppercase")) + .contentType(MediaType.TEXT_PLAIN) + .body("foo"), String.class); + assertThat(result.getBody()).isEqualTo("FOO"); } @Test public void another() throws Exception { - deploy("strings", "maven://io.spring.sample:function-sample:1.0.0.BUILD-SNAPSHOT"); - assertThat(new TestRestTemplate().getForObject( - "http://localhost:" + port + "/stream/strings/words", String.class)) - .isEqualTo("[\"foo\",\"bar\"]"); + deploy("pof", + "maven://io.spring.sample:function-sample-pof:jar:exec:1.0.0.BUILD-SNAPSHOT"); + assertThat(new TestRestTemplate().postForObject( + "http://localhost:" + port + "/stream/pof/greeter", "Foo", + String.class)).isEqualTo("Hello Foo"); } @Test @@ -112,15 +116,15 @@ public class FunctionExtractingFunctionCatalogIntegrationTests { String undeploy = undeploy("sample"); assertThat(undeploy.contains("\"name\":\"sample\"")); assertThat(undeploy.contains( - "\"path\":\"maven://io.spring.sample:function-sample-pojo:1.0.0.BUILD-SNAPSHOT\"")); + "\"path\":\"maven://io.spring.sample:function-sample:1.0.0.BUILD-SNAPSHOT\"")); ResponseEntity result = new TestRestTemplate().exchange(RequestEntity .get(new URI("http://localhost:" + port + "/stream/sample/words")) .build(), String.class); assertThat(result.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); - deploy("sample", "maven://io.spring.sample:function-sample-pojo:1.0.0.BUILD-SNAPSHOT"); + deploy("sample", "maven://io.spring.sample:function-sample:1.0.0.BUILD-SNAPSHOT"); assertThat(new TestRestTemplate().postForObject( - "http://localhost:" + port + "/stream/sample/uppercase", - "{\"value\":\"foo\"}", String.class)).isEqualTo("{\"value\":\"FOO\"}"); + "http://localhost:" + port + "/stream/sample/uppercase", "foo", + String.class)).isEqualTo("FOO"); } }