Reflect grouping in directory structure
This commit is contained in:
1
cloud/cloud-function-web/README.adoc
Normal file
1
cloud/cloud-function-web/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
Tests if Spring Cloud Function Web works
|
||||
26
cloud/cloud-function-web/build.gradle
Normal file
26
cloud/cloud-function-web/build.gradle
Normal file
@@ -0,0 +1,26 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot'
|
||||
id 'org.springframework.aot.smoke-test'
|
||||
id 'org.graalvm.buildtools.native'
|
||||
}
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "2022.0.0-SNAPSHOT")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation(platform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
implementation("org.springframework.cloud:spring-cloud-starter-function-web")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
|
||||
appTestImplementation(project(":aot-smoke-test-support"))
|
||||
appTestImplementation("org.awaitility:awaitility:4.2.0")
|
||||
}
|
||||
|
||||
aotSmokeTest {
|
||||
webApplication = true
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.cloud.function.web;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.smoketest.support.junit.ApplicationTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ApplicationTest
|
||||
class CloudFunctionWebApplicationAotTests {
|
||||
|
||||
@Test
|
||||
void uppercaseShouldBeInvokable(WebTestClient webTestClient) {
|
||||
webTestClient.post().uri("/uppercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("hello")
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("HELLO"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void lowercaseShouldBeInvokable(WebTestClient webTestClient) {
|
||||
webTestClient.post().uri("/lowercase").header("Content-Type", MediaType.TEXT_PLAIN_VALUE).bodyValue("HELLO")
|
||||
.exchange().expectStatus().isOk().expectBody()
|
||||
.consumeWith((result) -> assertThat(new String(result.getResponseBodyContent())).isEqualTo("hello"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.example.cloud.function.web;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CloudFunctionWebApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudFunctionWebApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.cloud.function.web;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
class Lowercase implements Function<String, String> {
|
||||
|
||||
@Override
|
||||
public String apply(String input) {
|
||||
return input.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.cloud.function.web;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
class Uppercase implements Function<String, String> {
|
||||
|
||||
@Override
|
||||
public String apply(String input) {
|
||||
return input.toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user