Added checkstyle for tests

This commit is contained in:
Marcin Grzejszczak
2019-02-03 15:34:10 +01:00
parent e4b08a083c
commit c6ddfe1af4
61 changed files with 273 additions and 228 deletions

View File

@@ -5,8 +5,8 @@ require './src/main/ruby/readme.rb'
options = {:mkdirs => true, :safe => :unsafe, :attributes => ['linkcss', 'allow-uri-read']} options = {:mkdirs => true, :safe => :unsafe, :attributes => ['linkcss', 'allow-uri-read']}
guard 'shell' do guard 'shell' do
watch(/^src\/[A-Z-a-z][^#]*\.adoc$/) {|m| watch(/^src\/[A-Z-a-z][^#]*\.adoc$/) {|m|
SpringCloud::Build.render_file('src/main/asciidoc/README.adoc', :to_file => './README.adoc') SpringCloud::Build.render_file('src/main/asciidoc/README.adoc', :to_file => './README.adoc')
Asciidoctor.render_file('src/main/asciidoc/spring-cloud-cli.adoc', options.merge(:to_dir => 'target/generated-docs')) Asciidoctor.render_file('src/main/asciidoc/spring-cloud-cli.adoc', options.merge(:to_dir => 'target/generated-docs'))
} }
end end

View File

@@ -26,6 +26,8 @@
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
<maven-checkstyle-plugin.failsOnViolation>true <maven-checkstyle-plugin.failsOnViolation>true
</maven-checkstyle-plugin.failsOnViolation> </maven-checkstyle-plugin.failsOnViolation>
<maven-checkstyle-plugin.includeTestSourceDirectory>true
</maven-checkstyle-plugin.includeTestSourceDirectory>
</properties> </properties>
<dependencyManagement> <dependencyManagement>

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.function.adapter.aws; package org.springframework.cloud.function.adapter.aws;
import java.util.Collections; import java.util.Collections;

View File

@@ -188,7 +188,7 @@ class Foo {
Foo() { Foo() {
} }
public Foo(String value) { Foo(String value) {
this.value = value; this.value = value;
} }
@@ -217,7 +217,7 @@ class Bar {
Bar() { Bar() {
} }
public Bar(String value) { Bar(String value) {
this.value = value; this.value = value;
} }

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.adapter.azure; package org.springframework.cloud.function.adapter.azure;
import java.io.IOException; import java.io.IOException;

View File

@@ -36,14 +36,13 @@ import org.springframework.context.annotation.Scope;
import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
/** /**
* @author Kamesh Sampath * @author Kamesh Sampath
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest() @SpringBootTest
@EnableAutoConfiguration @EnableAutoConfiguration
@TestPropertySource(locations = "classpath:/application-test.properties") @TestPropertySource(locations = "classpath:/application-test.properties")
public class OpenWhiskActionHandlerTest { public class OpenWhiskActionHandlerTest {
@@ -65,9 +64,9 @@ public class OpenWhiskActionHandlerTest {
actionRequest.setActionName("test_action"); actionRequest.setActionName("test_action");
actionRequest.setValue(eventData); actionRequest.setValue(eventData);
Object result = this.actionHandler.run(actionRequest); Object result = this.actionHandler.run(actionRequest);
assertNotNull(result); assertThat(result).isNotNull();
assertEquals("{\"result\":{\"name\":\"Spring\",\"message\":\"Hello, Spring\"}}", assertThat(result).isEqualTo(
result); "{\"result\":{\"name\":\"Spring\",\"message\":\"Hello, Spring\"}}");
} }
@Test @Test
@@ -78,8 +77,8 @@ public class OpenWhiskActionHandlerTest {
OpenWhiskActionRequest actionRequest = new OpenWhiskActionRequest(); OpenWhiskActionRequest actionRequest = new OpenWhiskActionRequest();
actionRequest.setActionName("test_action"); actionRequest.setActionName("test_action");
Object result = this.actionHandler.run(actionRequest); Object result = this.actionHandler.run(actionRequest);
assertNotNull(result); assertThat(result).isNotNull();
assertEquals("{\"result\":\"No input provided\"}", result); assertThat(result).isEqualTo("{\"result\":\"No input provided\"}");
} }
@Configuration @Configuration

View File

@@ -43,7 +43,7 @@ public class CompilationMessage {
this.sourceCode = sourceCode; this.sourceCode = sourceCode;
this.startPosition = startPosition; this.startPosition = startPosition;
this.endPosition = endPosition; this.endPosition = endPosition;
}; }
/** /**
* @return the type of message * @return the type of message
@@ -84,7 +84,7 @@ public class CompilationMessage {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append("==========\n"); s.append("==========\n");
if (this.sourceCode != null) { // Cannot include source context if no source if (this.sourceCode != null) { // Cannot include source context if no source
// available // available
int[] lineStartEnd = getLineStartEnd(this.startPosition); int[] lineStartEnd = getLineStartEnd(this.startPosition);
s.append(this.sourceCode.substring(lineStartEnd[0], lineStartEnd[1])) s.append(this.sourceCode.substring(lineStartEnd[0], lineStartEnd[1]))
.append("\n"); .append("\n");

View File

@@ -201,7 +201,7 @@ public final class InMemoryJavaFileObject implements JavaFileObject {
InMemoryJavaFileObject.this.lastModifiedTime = System.currentTimeMillis(); InMemoryJavaFileObject.this.lastModifiedTime = System.currentTimeMillis();
InMemoryJavaFileObject.this.content = new String(toCharArray()) InMemoryJavaFileObject.this.content = new String(toCharArray())
.getBytes(); // Ignoring encoding... .getBytes(); // Ignoring encoding...
}; }
}; };
} }

View File

@@ -48,7 +48,7 @@ public class JrtEntryJavaFileObject implements JavaFileObject {
*/ */
public JrtEntryJavaFileObject(Path path) { public JrtEntryJavaFileObject(Path path) {
this.pathToClassString = path.subpath(2, path.getNameCount()).toString(); // e.g. this.pathToClassString = path.subpath(2, path.getNameCount()).toString(); // e.g.
// java/lang/Object.class // java/lang/Object.class
this.path = path; this.path = path;
} }

View File

@@ -127,8 +127,8 @@ public class JrtFsEnumeration implements Enumeration<JrtEntryJavaFileObject> {
throws IOException { throws IOException {
int fnc = file.getNameCount(); int fnc = file.getNameCount();
if (fnc >= 3 && file.toString().endsWith(".class")) { // There is a preceeding if (fnc >= 3 && file.toString().endsWith(".class")) { // There is a preceeding
// module name - e.g. // module name - e.g.
// /modules/java.base/java/lang/Object.class // /modules/java.base/java/lang/Object.class
// file.subpath(2, fnc); // e.g. java/lang/Object.class // file.subpath(2, fnc); // e.g. java/lang/Object.class
JrtFsEnumeration.this.jfos.add(new JrtEntryJavaFileObject(file)); JrtFsEnumeration.this.jfos.add(new JrtEntryJavaFileObject(file));
} }

View File

@@ -207,8 +207,8 @@ public class MemoryBasedJavaFileManager implements JavaFileManager {
URL[] urls = loader.getURLs(); URL[] urls = loader.getURLs();
if (urls.length > 1) { // heuristic that catches Maven surefire tests if (urls.length > 1) { // heuristic that catches Maven surefire tests
if (!urls[0].toString().startsWith("jar:file:")) { // heuristic for if (!urls[0].toString().startsWith("jar:file:")) { // heuristic for
// Spring Boot fat // Spring Boot fat
// jar // jar
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for (URL url : urls) { for (URL url : urls) {
if (builder.length() > 0) { if (builder.length() > 0) {
@@ -627,7 +627,7 @@ public class MemoryBasedJavaFileManager implements JavaFileManager {
if (file.getNameCount() > 3 && file.toString().endsWith(".class")) { if (file.getNameCount() > 3 && file.toString().endsWith(".class")) {
int fnc = file.getNameCount(); int fnc = file.getNameCount();
if (fnc > 3) { // There is a package name - e.g. if (fnc > 3) { // There is a package name - e.g.
// /modules/java.base/java/lang/Object.class // /modules/java.base/java/lang/Object.class
Path packagePath = file.subpath(2, fnc - 1); // e.g. java/lang Path packagePath = file.subpath(2, fnc - 1); // e.g. java/lang
String packagePathString = packagePath.toString() + "/"; String packagePathString = packagePath.toString() + "/";
CompilationInfoCache.this.packageCache.put(packagePathString, CompilationInfoCache.this.packageCache.put(packagePathString,

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.compiler; package org.springframework.cloud.function.compiler;
import java.io.File; import java.io.File;
@@ -42,8 +43,6 @@ import org.springframework.cloud.function.compiler.java.RuntimeJavaCompiler;
import org.springframework.cloud.function.core.FunctionFactoryUtils; import org.springframework.cloud.function.core.FunctionFactoryUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/** /**
* Tests that verify dependency resolution. Dependencies can be resolved against simple * Tests that verify dependency resolution. Dependencies can be resolved against simple
@@ -60,7 +59,7 @@ public class CompilerDependencyResolutionTests {
ClassDescriptor t1 = compile("Test1", ClassDescriptor t1 = compile("Test1",
"package com.test;\npublic class Test1 { public static String doit() { return \"T1\";}}\n"); "package com.test;\npublic class Test1 { public static String doit() { return \"T1\";}}\n");
String result = (String) t1.clazz.getDeclaredMethod("doit").invoke(null); String result = (String) t1.clazz.getDeclaredMethod("doit").invoke(null);
assertEquals("T1", result); assertThat(result).isEqualTo("T1");
} }
@Test @Test
@@ -140,12 +139,12 @@ public class CompilerDependencyResolutionTests {
"public class A {\n" + " public static Object run() {\n" "public class A {\n" + " public static Object run() {\n"
+ " return new TestX();\n" + " }\n" + "}", + " return new TestX();\n" + " }\n" + "}",
jar.toURI().toString()); jar.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(tx, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(tx, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(tx.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(tx.name);
} }
} }
@@ -162,12 +161,12 @@ public class CompilerDependencyResolutionTests {
"public class A {\n" + " public static Object run() {\n" "public class A {\n" + " public static Object run() {\n"
+ " return new TestX();\n" + " }\n" + "}", + " return new TestX();\n" + " }\n" + "}",
jar.toURI().toString()); jar.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(t1.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(t1.name);
} }
} }
@@ -185,12 +184,12 @@ public class CompilerDependencyResolutionTests {
"public class A {\n" + " public static Object run() {\n" "public class A {\n" + " public static Object run() {\n"
+ " return new TestX();\n" + " }\n" + "}", + " return new TestX();\n" + " }\n" + "}",
jar2.toURI().toString()); jar2.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(t1.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(t1.name);
} }
} }
@@ -205,12 +204,12 @@ public class CompilerDependencyResolutionTests {
+ " public static Object run() {\n" + " return new Test1();\n" + " public static Object run() {\n" + " return new Test1();\n"
+ " }\n" + "}", + " }\n" + "}",
jar.toURI().toString()); jar.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(t1.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(t1.name);
} }
} }
@@ -226,12 +225,12 @@ public class CompilerDependencyResolutionTests {
+ " public static Object run() {\n" + " return new Test1();\n" + " public static Object run() {\n" + " return new Test1();\n"
+ " }\n" + "}", + " }\n" + "}",
jar.toURI().toString()); jar.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(t1.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(t1.name);
} }
} }
@@ -248,12 +247,12 @@ public class CompilerDependencyResolutionTests {
+ " public static Object run() {\n" + " return new Test1();\n" + " public static Object run() {\n" + " return new Test1();\n"
+ " }\n" + "}", + " }\n" + "}",
jar2.toURI().toString()); jar2.toURI().toString());
assertTrue("Should be no problems: " + result.getCompilationMessages(), assertThat(result.getCompilationMessages().isEmpty())
result.getCompilationMessages().isEmpty()); .as("Should be no problems: " + result.getCompilationMessages()).isTrue();
try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) { try (URLClassLoader cl = new TestClassLoader(t1, descriptorFromResult(result))) {
Class<?> class1 = cl.loadClass("A"); Class<?> class1 = cl.loadClass("A");
Object invoke = class1.getDeclaredMethod("run").invoke(null); Object invoke = class1.getDeclaredMethod("run").invoke(null);
assertEquals(t1.name, invoke.getClass().getName()); assertThat(invoke.getClass().getName()).isEqualTo(t1.name);
} }
} }
@@ -268,8 +267,8 @@ public class CompilerDependencyResolutionTests {
private ClassDescriptor compile(String className, String classSourceCode) { private ClassDescriptor compile(String className, String classSourceCode) {
CompilationResult compile = new RuntimeJavaCompiler().compile(className, CompilationResult compile = new RuntimeJavaCompiler().compile(className,
classSourceCode); classSourceCode);
assertTrue("Should be empty: \n" + compile.getCompilationMessages(), assertThat(compile.getCompilationMessages().isEmpty())
compile.getCompilationMessages().isEmpty()); .as("Should be empty: \n" + compile.getCompilationMessages()).isTrue();
Class<?> clazz = compile.getCompiledClasses().get(0); Class<?> clazz = compile.getCompiledClasses().get(0);
return new ClassDescriptor(clazz.getName(), return new ClassDescriptor(clazz.getName(),
compile.getClassBytes(clazz.getName()), compile.getClassBytes(clazz.getName()),
@@ -299,7 +298,7 @@ public class CompilerDependencyResolutionTests {
clazzes.add(prefix + classDescriptor.name.replace('.', '/') + ".class"); clazzes.add(prefix + classDescriptor.name.replace('.', '/') + ".class");
} }
walkJar(jar, (entry) -> clazzes.remove(entry.getName())); walkJar(jar, (entry) -> clazzes.remove(entry.getName()));
assertTrue("Should be empty: " + clazzes, clazzes.isEmpty()); assertThat(clazzes.isEmpty()).as("Should be empty: " + clazzes).isTrue();
} }
private void walkJar(File jar, Consumer<JarEntry> fn) { private void walkJar(File jar, Consumer<JarEntry> fn) {
@@ -336,7 +335,7 @@ public class CompilerDependencyResolutionTests {
final Class<?> clazz; final Class<?> clazz;
public ClassDescriptor(String name, byte[] bytes, Class<?> clazz) { ClassDescriptor(String name, byte[] bytes, Class<?> clazz) {
this.name = name; this.name = name;
this.bytes = bytes; this.bytes = bytes;
this.clazz = clazz; this.clazz = clazz;
@@ -344,7 +343,7 @@ public class CompilerDependencyResolutionTests {
} }
static class JarBuilder { static final class JarBuilder {
File jarFile; File jarFile;
@@ -446,7 +445,7 @@ public class CompilerDependencyResolutionTests {
ClassDescriptor[] descriptors; ClassDescriptor[] descriptors;
public TestClassLoader(ClassDescriptor... descriptors) { TestClassLoader(ClassDescriptor... descriptors) {
super(new URL[0], TestClassLoader.class.getClassLoader()); super(new URL[0], TestClassLoader.class.getClassLoader());
this.descriptors = descriptors; this.descriptors = descriptors;
} }

View File

@@ -23,8 +23,7 @@ import java.util.function.Supplier;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
/** /**
* @author Andy Clement * @author Andy Clement
@@ -37,7 +36,7 @@ public class RuntimeJavaCompilerTests {
RuntimeJavaCompiler rjc = new RuntimeJavaCompiler(); RuntimeJavaCompiler rjc = new RuntimeJavaCompiler();
CompilationResult cr = rjc.compile("A", "public class A {}"); CompilationResult cr = rjc.compile("A", "public class A {}");
List<CompilationMessage> compilationMessages = cr.getCompilationMessages(); List<CompilationMessage> compilationMessages = cr.getCompilationMessages();
assertTrue(compilationMessages.isEmpty()); assertThat(compilationMessages.isEmpty()).isTrue();
} }
@Test @Test
@@ -52,18 +51,19 @@ public class RuntimeJavaCompilerTests {
+ " String message = (String) exp.getValue();" + " String message = (String) exp.getValue();"
+ " return message;\n" + " }\n" + "}"); + " return message;\n" + " }\n" + "}");
List<CompilationMessage> compilationMessages = cr.getCompilationMessages(); List<CompilationMessage> compilationMessages = cr.getCompilationMessages();
assertEquals(3, compilationMessages.size()); assertThat(compilationMessages.size()).isEqualTo(3);
assertTrue( assertThat(compilationMessages.get(0).getMessage().contains("cannot find symbol"))
compilationMessages.get(0).getMessage().contains("cannot find symbol")); .isTrue();
assertTrue(compilationMessages.get(0).getMessage() assertThat(compilationMessages.get(0).getMessage()
.contains("class ExpressionParser")); .contains("class ExpressionParser")).isTrue();
assertTrue( assertThat(compilationMessages.get(1).getMessage().contains("cannot find symbol"))
compilationMessages.get(1).getMessage().contains("cannot find symbol")); .isTrue();
assertTrue(compilationMessages.get(1).getMessage() assertThat(compilationMessages.get(1).getMessage()
.contains("class SpelExpressionParser")); .contains("class SpelExpressionParser")).isTrue();
assertTrue( assertThat(compilationMessages.get(2).getMessage().contains("cannot find symbol"))
compilationMessages.get(2).getMessage().contains("cannot find symbol")); .isTrue();
assertTrue(compilationMessages.get(2).getMessage().contains("class Expression")); assertThat(compilationMessages.get(2).getMessage().contains("class Expression"))
.isTrue();
} }
@Test @Test
@@ -80,12 +80,12 @@ public class RuntimeJavaCompilerTests {
+ " return message;\n" + " }\n" + "}", + " return message;\n" + " }\n" + "}",
"maven://org.springframework:spring-expression:4.3.9.RELEASE"); "maven://org.springframework:spring-expression:4.3.9.RELEASE");
List<CompilationMessage> compilationMessages = cr.getCompilationMessages(); List<CompilationMessage> compilationMessages = cr.getCompilationMessages();
assertTrue(compilationMessages.isEmpty()); assertThat(compilationMessages.isEmpty()).isTrue();
try (SimpleClassLoader cl = new SimpleClassLoader( try (SimpleClassLoader cl = new SimpleClassLoader(
this.getClass().getClassLoader())) { this.getClass().getClassLoader())) {
Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A")); Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A"));
Supplier<String> supplier = (Supplier<String>) clazz.newInstance(); Supplier<String> supplier = (Supplier<String>) clazz.newInstance();
assertEquals("Hello World", supplier.get()); assertThat(supplier.get()).isEqualTo("Hello World");
} }
} }
@@ -100,27 +100,27 @@ public class RuntimeJavaCompilerTests {
CompilationResult cr = rjc.compile("A", source, CompilationResult cr = rjc.compile("A", source,
"maven://joda-time:joda-time:2.9.9"); "maven://joda-time:joda-time:2.9.9");
List<CompilationMessage> compilationMessages = cr.getCompilationMessages(); List<CompilationMessage> compilationMessages = cr.getCompilationMessages();
assertTrue(compilationMessages.isEmpty()); assertThat(compilationMessages.isEmpty()).isTrue();
List<File> resolvedAdditionalDependencies = cr List<File> resolvedAdditionalDependencies = cr
.getResolvedAdditionalDependencies(); .getResolvedAdditionalDependencies();
try (SimpleClassLoader cl = new SimpleClassLoader(resolvedAdditionalDependencies, try (SimpleClassLoader cl = new SimpleClassLoader(resolvedAdditionalDependencies,
this.getClass().getClassLoader())) { this.getClass().getClassLoader())) {
Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A")); Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A"));
Supplier<String> supplier = (Supplier<String>) clazz.newInstance(); Supplier<String> supplier = (Supplier<String>) clazz.newInstance();
assertEquals("true", supplier.get()); assertThat(supplier.get()).isEqualTo("true");
} }
cr = rjc.compile("A", source, cr = rjc.compile("A", source,
"maven://org.springframework:spring-expression:4.3.9.RELEASE", "maven://org.springframework:spring-expression:4.3.9.RELEASE",
"maven://joda-time:joda-time:2.9.9"); "maven://joda-time:joda-time:2.9.9");
compilationMessages = cr.getCompilationMessages(); compilationMessages = cr.getCompilationMessages();
assertTrue(compilationMessages.isEmpty()); assertThat(compilationMessages.isEmpty()).isTrue();
resolvedAdditionalDependencies = cr.getResolvedAdditionalDependencies(); resolvedAdditionalDependencies = cr.getResolvedAdditionalDependencies();
try (SimpleClassLoader cl = new SimpleClassLoader(resolvedAdditionalDependencies, try (SimpleClassLoader cl = new SimpleClassLoader(resolvedAdditionalDependencies,
this.getClass().getClassLoader())) { this.getClass().getClassLoader())) {
Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A")); Class<?> clazz = cl.defineClass("A", cr.getClassBytes("A"));
Supplier<String> supplier = (Supplier<String>) clazz.newInstance(); Supplier<String> supplier = (Supplier<String>) clazz.newInstance();
assertEquals("true", supplier.get()); assertThat(supplier.get()).isEqualTo("true");
} }
} }
@@ -130,43 +130,45 @@ public class RuntimeJavaCompilerTests {
RuntimeJavaCompiler rjc = new RuntimeJavaCompiler(); RuntimeJavaCompiler rjc = new RuntimeJavaCompiler();
CompilationResult cr = rjc.compile("A", "public class A {}", CompilationResult cr = rjc.compile("A", "public class A {}",
"maven://org.springframework:spring-expression2:4.3.9.RELEASE"); // extra "maven://org.springframework:spring-expression2:4.3.9.RELEASE"); // extra
// '2' // '2'
// in // in
// there // there
List<CompilationMessage> compilationMessages = cr.getCompilationMessages(); List<CompilationMessage> compilationMessages = cr.getCompilationMessages();
assertEquals(1, compilationMessages.size()); assertThat(compilationMessages.size()).isEqualTo(1);
// ERROR:org.eclipse.aether.resolution.ArtifactResolutionException: Could not find // ERROR:org.eclipse.aether.resolution.ArtifactResolutionException: Could not find
// artifact org.springframework:spring-expression2:jar:4.3.9.RELEASE in // artifact org.springframework:spring-expression2:jar:4.3.9.RELEASE in
// spring-snapshots (https://repo.spring.io/libs-snapshot) // spring-snapshots (https://repo.spring.io/libs-snapshot)
assertTrue(compilationMessages.get(0).getMessage().contains( assertThat(compilationMessages.get(0).getMessage().contains(
"Could not find artifact org.springframework:spring-expression2:jar:4.3.9.RELEASE")); "Could not find artifact org.springframework:spring-expression2:jar:4.3.9.RELEASE"))
.isTrue();
// Failure: // Failure:
rjc = new RuntimeJavaCompiler(); rjc = new RuntimeJavaCompiler();
cr = rjc.compile("A", "public class A {}", cr = rjc.compile("A", "public class A {}",
"trouble://org.springframework:spring-expression:4.3.9.RELEASE"); // rogue "trouble://org.springframework:spring-expression:4.3.9.RELEASE"); // rogue
// prefix // prefix
// (should // (should
// be // be
// "maven:") // "maven:")
compilationMessages = cr.getCompilationMessages(); compilationMessages = cr.getCompilationMessages();
assertEquals(1, compilationMessages.size()); assertThat(compilationMessages.size()).isEqualTo(1);
assertTrue(compilationMessages.get(0).toString(), compilationMessages.get(0) assertThat(compilationMessages.get(0).getMessage()
.getMessage().contains("Unrecognized dependency: ")); .contains("Unrecognized dependency: "))
.as(compilationMessages.get(0).toString()).isTrue();
// Success // Success
rjc = new RuntimeJavaCompiler(); rjc = new RuntimeJavaCompiler();
cr = rjc.compile("A", "public class A {}", "maven://joda-time:joda-time:2.9.9"); cr = rjc.compile("A", "public class A {}", "maven://joda-time:joda-time:2.9.9");
compilationMessages = cr.getCompilationMessages(); compilationMessages = cr.getCompilationMessages();
assertEquals(0, compilationMessages.size()); assertThat(compilationMessages.size()).isEqualTo(0);
List<File> resolvedAdditionalDependencies = cr List<File> resolvedAdditionalDependencies = cr
.getResolvedAdditionalDependencies(); .getResolvedAdditionalDependencies();
assertEquals(1, resolvedAdditionalDependencies.size()); assertThat(resolvedAdditionalDependencies.size()).isEqualTo(1);
assertTrue( assertThat(resolvedAdditionalDependencies.get(0).toString()
"Expected this to end with 'joda-time-2.9.9.jar': " .endsWith("joda-time-2.9.9.jar"))
+ resolvedAdditionalDependencies.get(0).toString(), .as("Expected this to end with 'joda-time-2.9.9.jar': "
resolvedAdditionalDependencies.get(0).toString() + resolvedAdditionalDependencies.get(0).toString())
.endsWith("joda-time-2.9.9.jar")); .isTrue();
} }
} }

View File

@@ -87,7 +87,8 @@ public class ByteCodeLoadingFunctionTests {
@Test @Test
public void compileFluxFunction() throws Exception { public void compileFluxFunction() throws Exception {
CompiledFunctionFactory<Function<Flux<String>, Flux<String>>> compiled = new FunctionCompiler<Flux<String>, Flux<String>>( CompiledFunctionFactory<Function<Flux<String>, Flux<String>>> compiled = null;
compiled = new FunctionCompiler<Flux<String>, Flux<String>>(
String.class.getName()).compile("foos", String.class.getName()).compile("foos",
"flux -> flux.map(v -> v.toUpperCase())", "Flux<String>", "flux -> flux.map(v -> v.toUpperCase())", "Flux<String>",
"Flux<String>"); "Flux<String>");

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.context; package org.springframework.cloud.function.context;
import java.util.function.Function; import java.util.function.Function;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.context; package org.springframework.cloud.function.context;
import java.lang.reflect.Type; import java.lang.reflect.Type;

View File

@@ -24,10 +24,7 @@ import org.springframework.cloud.function.context.FunctionRegistration;
import org.springframework.cloud.function.context.FunctionType; import org.springframework.cloud.function.context.FunctionType;
import org.springframework.cloud.function.core.FluxFunction; import org.springframework.cloud.function.core.FluxFunction;
import static org.junit.Assert.assertNotNull; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
/** /**
* @author Oleg Zhurakousky * @author Oleg Zhurakousky
@@ -43,7 +40,7 @@ public class InMemoryFunctionCatalogTests {
InMemoryFunctionCatalog catalog = new InMemoryFunctionCatalog(); InMemoryFunctionCatalog catalog = new InMemoryFunctionCatalog();
catalog.register(registration); catalog.register(registration);
FunctionRegistration<?> registration2 = catalog.getRegistration(function); FunctionRegistration<?> registration2 = catalog.getRegistration(function);
assertSame(registration, registration2); assertThat(registration2).isSameAs(registration);
} }
@Test @Test
@@ -55,11 +52,11 @@ public class InMemoryFunctionCatalogTests {
catalog.register(registration); catalog.register(registration);
Object lookedUpFunction = catalog.lookup("hello"); Object lookedUpFunction = catalog.lookup("hello");
assertNull(lookedUpFunction); assertThat(lookedUpFunction).isNull();
lookedUpFunction = catalog.lookup("foo"); lookedUpFunction = catalog.lookup("foo");
assertNotNull(lookedUpFunction); assertThat(lookedUpFunction).isNotNull();
assertTrue(lookedUpFunction instanceof FluxFunction); assertThat(lookedUpFunction instanceof FluxFunction).isTrue();
} }
private static class TestFunction implements Function<Integer, String> { private static class TestFunction implements Function<Integer, String> {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -40,7 +40,6 @@ import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNull;
/** /**
* @author Dave Syer * @author Dave Syer
@@ -132,7 +131,7 @@ public class ContextFunctionPostProcessorTests {
System.out::println, "consumer")); System.out::println, "consumer"));
Supplier<Mono<Void>> supplier = (Supplier<Mono<Void>>) this.processor Supplier<Mono<Void>> supplier = (Supplier<Mono<Void>>) this.processor
.lookupSupplier("supplier|consumer"); .lookupSupplier("supplier|consumer");
assertNull(supplier.get().block()); assertThat(supplier.get().block()).isNull();
} }
@Test @Test

View File

@@ -36,7 +36,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* *
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
// @checkstyle:off
@FunctionalSpringBootTest(classes = Object.class, properties = "spring.main.sources=org.springframework.cloud.function.context.string.FunctionalStringSourceTests.TestConfiguration") @FunctionalSpringBootTest(classes = Object.class, properties = "spring.main.sources=org.springframework.cloud.function.context.string.FunctionalStringSourceTests.TestConfiguration")
// @checkstyle:on
public class FunctionalStringSourceTests { public class FunctionalStringSourceTests {
@Autowired @Autowired

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.inject; package org.springframework.cloud.function.inject;
import java.util.function.Function; import java.util.function.Function;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.util; package org.springframework.cloud.function.util;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -25,7 +25,7 @@ public class Emitter implements Supplier<String> {
private int i = 0; private int i = 0;
private String[] values = { "one", "two", "three", "four" }; private String[] values = {"one", "two", "three", "four"};
@Override @Override
public String get() { public String get() {

View File

@@ -21,6 +21,7 @@ import java.io.IOException;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
// @checkstyle:off // @checkstyle:off
/** /**
* @author Mark Fisher * @author Mark Fisher
* @author Dave Syer * @author Dave Syer

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019-2018 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.deployer; package org.springframework.cloud.function.deployer;
import java.util.function.Function; import java.util.function.Function;

View File

@@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = FunctionDeployerConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) @SpringBootTest(classes = FunctionDeployerConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
@TestPropertySource(properties = { @TestPropertySource(properties = {
"function.location=file:target/it/support/target/function-sample-1.0.0.M1-exec.jar", }) "function.location=file:target/it/support/target/function-sample-1.0.0.M1-exec.jar" })
public abstract class SpringFunctionAppConfigurationTests { public abstract class SpringFunctionAppConfigurationTests {
@Autowired @Autowired

View File

@@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = FunctionDeployerConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE) @SpringBootTest(classes = FunctionDeployerConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.NONE)
@TestPropertySource(properties = { @TestPropertySource(properties = {
"function.location=file:target/it/support/target/dependency", }) "function.location=file:target/it/support/target/dependency" })
public abstract class SpringFunctionAppExplodedConfigurationTests { public abstract class SpringFunctionAppExplodedConfigurationTests {
@Autowired @Autowired

View File

@@ -98,10 +98,10 @@ class Foo {
private String value; private String value;
public Foo() { Foo() {
} }
public Foo(String value) { Foo(String value) {
this.value = value; this.value = value;
} }

View File

@@ -48,7 +48,8 @@ public class Config implements ApplicationContextInitializer<GenericApplicationC
@Bean @Bean
public Function<Foo, Bar> function() { public Function<Foo, Bar> function() {
return value -> new Bar( return value -> new Bar(
value.uppercase() + (this.props.getFoo() != null ? "-" + this.props.getFoo() : "")); value.uppercase() + (this.props.getFoo() != null ? "-" + this.props
.getFoo() : ""));
} }
@Override @Override
@@ -57,8 +58,8 @@ public class Config implements ApplicationContextInitializer<GenericApplicationC
this.props = properties; this.props = properties;
context.registerBean(Properties.class, () -> properties); context.registerBean(Properties.class, () -> properties);
context.registerBean("function", FunctionRegistration.class, context.registerBean("function", FunctionRegistration.class,
() -> new FunctionRegistration<Function<Foo, Bar>>(function()) () -> new FunctionRegistration<Function<Foo, Bar>>(function())
.type(FunctionType.from(Foo.class).to(Bar.class).getType())); .type(FunctionType.from(Foo.class).to(Bar.class).getType()));
} }
} }

View File

@@ -37,7 +37,7 @@ public class MapTests {
@Test @Test
public void start() throws Exception { public void start() throws Exception {
SpringBootRequestHandler<Object, Object> handler = new SpringBootRequestHandler<>( SpringBootRequestHandler<Object, Object> handler = new SpringBootRequestHandler<>(
Config.class); Config.class);
handler.handleRequest(new Foo("foo"), null); handler.handleRequest(new Foo("foo"), null);
handler.close(); handler.close();
} }

View File

@@ -31,9 +31,9 @@ public class FooHandler extends AzureSpringBootRequestHandler<Foo, Bar> {
@FunctionName("uppercase") @FunctionName("uppercase")
public Bar execute( public Bar execute(
@HttpTrigger(name = "req", methods = { HttpMethod.GET, @HttpTrigger(name = "req", methods = {HttpMethod.GET,
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) Foo foo, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) Foo foo,
ExecutionContext context) { ExecutionContext context) {
return handleRequest(foo, context); return handleRequest(foo, context);
} }

View File

@@ -37,7 +37,7 @@ public class MapTests {
@Test @Test
public void start() throws Exception { public void start() throws Exception {
AzureSpringBootRequestHandler<Foo, Bar> handler = new AzureSpringBootRequestHandler<>( AzureSpringBootRequestHandler<Foo, Bar> handler = new AzureSpringBootRequestHandler<>(
Config.class); Config.class);
Bar result = handler.handleRequest(new Foo("foo"), null); Bar result = handler.handleRequest(new Foo("foo"), null);
handler.close(); handler.close();
assertThat(result.getValue()).isEqualTo("FOO"); assertThat(result.getValue()).isEqualTo("FOO");

View File

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

View File

@@ -32,9 +32,9 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"spring.cloud.function.compile.test.lambda=f->f.map(s->s+\"!!!\")", "spring.cloud.function.compile.test.lambda=f->f.map(s->s+\"!!!\")",
"spring.cloud.function.compile.test.inputType=Flux<String>", "spring.cloud.function.compile.test.inputType=Flux<String>",
"spring.cloud.function.compile.test.outputType=Flux<String>" }) "spring.cloud.function.compile.test.outputType=Flux<String>"})
public class SampleCompiledFunctionTests { public class SampleCompiledFunctionTests {
@LocalServerPort @LocalServerPort
@@ -43,8 +43,8 @@ public class SampleCompiledFunctionTests {
@Test @Test
public void lowercase() { public void lowercase() {
assertThat(new TestRestTemplate().postForObject( assertThat(new TestRestTemplate().postForObject(
"http://localhost:" + this.port + "/test", "it works", String.class)) "http://localhost:" + this.port + "/test", "it works", String.class))
.contains("it works!!!"); .contains("it works!!!");
} }
} }

View File

@@ -46,14 +46,14 @@ public class SampleApplication {
return multiValueMap -> { return multiValueMap -> {
Map<String, Integer> result = new HashMap<>(); Map<String, Integer> result = new HashMap<>();
multiValueMap.forEach((s, strings) -> result.put(s, multiValueMap.forEach((s, strings) -> result.put(s,
strings.stream().mapToInt(Integer::parseInt).sum())); strings.stream().mapToInt(Integer::parseInt).sum()));
return result; return result;
}; };
} }
@Bean @Bean
public Supplier<Flux<Foo>> words() { public Supplier<Flux<Foo>> words() {
return () -> Flux.fromArray(new Foo[] { new Foo("foo"), new Foo("bar") }).log(); return () -> Flux.fromArray(new Foo[] {new Foo("foo"), new Foo("bar")}).log();
} }
} }

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.example; package com.example;
import java.net.URI; import java.net.URI;
@@ -43,10 +44,11 @@ public class SampleApplicationMvcTests {
@Test @Test
public void words() throws Exception { public void words() throws Exception {
ResponseEntity<String> result = this.rest.exchange(RequestEntity.get(new URI("/words")) ResponseEntity<String> result = this.rest
.exchange(RequestEntity.get(new URI("/words"))
.accept(MediaType.APPLICATION_JSON).build(), String.class); .accept(MediaType.APPLICATION_JSON).build(), String.class);
assertThat(result.getBody()) assertThat(result.getBody())
.isEqualTo("[{\"value\":\"foo\"},{\"value\":\"bar\"}]"); .isEqualTo("[{\"value\":\"foo\"},{\"value\":\"bar\"}]");
} }
} }

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.example; package com.example;
import java.net.URI; import java.net.URI;
@@ -58,35 +59,37 @@ public class SampleApplicationTests {
@Test @Test
public void words() { public void words() {
assertThat(this.rest.getForObject("http://localhost:" + this.port + "/words", String.class)) assertThat(this.rest
.isEqualTo("[{\"value\":\"foo\"},{\"value\":\"bar\"}]"); .getForObject("http://localhost:" + this.port + "/words", String.class))
.isEqualTo("[{\"value\":\"foo\"},{\"value\":\"bar\"}]");
} }
@Test @Test
public void uppercase() { public void uppercase() {
assertThat(this.rest.postForObject("http://localhost:" + this.port + "/uppercase", assertThat(this.rest.postForObject("http://localhost:" + this.port + "/uppercase",
new HttpEntity<>("[{\"value\":\"foo\"}]", this.headers), String.class)) new HttpEntity<>("[{\"value\":\"foo\"}]", this.headers), String.class))
.isEqualTo("[{\"value\":\"FOO\"}]"); .isEqualTo("[{\"value\":\"FOO\"}]");
} }
@Test @Test
public void composite() { public void composite() {
assertThat(this.rest.getForObject("http://localhost:" + this.port + "/words,uppercase", assertThat(this.rest
.getForObject("http://localhost:" + this.port + "/words,uppercase",
String.class)).isEqualTo("[{\"value\":\"FOO\"},{\"value\":\"BAR\"}]"); String.class)).isEqualTo("[{\"value\":\"FOO\"},{\"value\":\"BAR\"}]");
} }
@Test @Test
public void single() { public void single() {
assertThat(this.rest.postForObject("http://localhost:" + this.port + "/uppercase", assertThat(this.rest.postForObject("http://localhost:" + this.port + "/uppercase",
new HttpEntity<>("{\"value\":\"foo\"}", this.headers), String.class)) new HttpEntity<>("{\"value\":\"foo\"}", this.headers), String.class))
.isEqualTo("{\"value\":\"FOO\"}"); .isEqualTo("{\"value\":\"FOO\"}");
} }
@Test @Test
public void lowercase() { public void lowercase() {
assertThat(this.rest.postForObject("http://localhost:" + this.port + "/lowercase", assertThat(this.rest.postForObject("http://localhost:" + this.port + "/lowercase",
new HttpEntity<>("[{\"value\":\"Foo\"}]", this.headers), String.class)) new HttpEntity<>("[{\"value\":\"Foo\"}]", this.headers), String.class))
.isEqualTo("[{\"value\":\"foo\"}]"); .isEqualTo("[{\"value\":\"foo\"}]");
} }
@Test @Test
@@ -98,10 +101,10 @@ public class SampleApplicationTests {
map.put("B", Arrays.asList("5", "6")); map.put("B", Arrays.asList("5", "6"));
assertThat(this.rest.exchange( assertThat(this.rest.exchange(
RequestEntity.post(new URI("http://localhost:" + this.port + "/sum")) RequestEntity.post(new URI("http://localhost:" + this.port + "/sum"))
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_FORM_URLENCODED).body(map), .contentType(MediaType.APPLICATION_FORM_URLENCODED).body(map),
String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]"); String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]");
} }
@Test @Test
@@ -114,10 +117,10 @@ public class SampleApplicationTests {
map.put("B", Arrays.asList("5", "6")); map.put("B", Arrays.asList("5", "6"));
assertThat(this.rest.exchange( assertThat(this.rest.exchange(
RequestEntity.post(new URI("http://localhost:" + this.port + "/sum")) RequestEntity.post(new URI("http://localhost:" + this.port + "/sum"))
.accept(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.MULTIPART_FORM_DATA).body(map), .contentType(MediaType.MULTIPART_FORM_DATA).body(map),
String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]"); String.class).getBody()).isEqualTo("[{\"A\":6,\"B\":11}]");
} }
} }

View File

@@ -53,25 +53,25 @@ public class SampleApplication {
@Bean @Bean
public Supplier<Flux<String>> words() { public Supplier<Flux<String>> words() {
return () -> Flux.fromArray(new String[] { "foo", "bar" }); return () -> Flux.fromArray(new String[] {"foo", "bar"});
} }
@Bean @Bean
public Function<String, String> compiledUppercase( public Function<String, String> compiledUppercase(
FunctionCompiler<String, String> compiler) { FunctionCompiler<String, String> compiler) {
String lambda = "s -> s.toUpperCase()"; String lambda = "s -> s.toUpperCase()";
LambdaCompilingFunction<String, String> function = new LambdaCompilingFunction<>( LambdaCompilingFunction<String, String> function = new LambdaCompilingFunction<>(
new ByteArrayResource(lambda.getBytes()), compiler); new ByteArrayResource(lambda.getBytes()), compiler);
function.setTypeParameterizations("String", "String"); function.setTypeParameterizations("String", "String");
return function; return function;
} }
@Bean @Bean
public Function<Flux<String>, Flux<String>> compiledLowercase( public Function<Flux<String>, Flux<String>> compiledLowercase(
FunctionCompiler<Flux<String>, Flux<String>> compiler) { FunctionCompiler<Flux<String>, Flux<String>> compiler) {
String lambda = "f->f.map(o->o.toString().toLowerCase())"; String lambda = "f->f.map(o->o.toString().toLowerCase())";
return new LambdaCompilingFunction<>(new ByteArrayResource(lambda.getBytes()), return new LambdaCompilingFunction<>(new ByteArrayResource(lambda.getBytes()),
compiler); compiler);
} }
@Bean @Bean

View File

@@ -24,7 +24,7 @@ import com.example.functions.Greeter;
import org.junit.Test; import org.junit.Test;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
public class FunctionTests { public class FunctionTests {
@@ -33,36 +33,36 @@ public class FunctionTests {
@Test @Test
public void testUppercase() { public void testUppercase() {
String output = this.functions.uppercase().apply("foobar"); String output = this.functions.uppercase().apply("foobar");
assertEquals("FOOBAR", output); assertThat(output).isEqualTo("FOOBAR");
} }
@Test @Test
public void testLowercase() { public void testLowercase() {
Flux<String> output = this.functions.lowercase().apply(Flux.just("FOO", "BAR")); Flux<String> output = this.functions.lowercase().apply(Flux.just("FOO", "BAR"));
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo", results.get(0)); assertThat(results.get(0)).isEqualTo("foo");
assertEquals("bar", results.get(1)); assertThat(results.get(1)).isEqualTo("bar");
} }
@Test @Test
public void testHello() { public void testHello() {
String output = this.functions.hello().get(); String output = this.functions.hello().get();
assertEquals("hello", output); assertThat(output).isEqualTo("hello");
} }
@Test @Test
public void testWords() { public void testWords() {
Flux<String> output = this.functions.words().get(); Flux<String> output = this.functions.words().get();
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo", results.get(0)); assertThat(results.get(0)).isEqualTo("foo");
assertEquals("bar", results.get(1)); assertThat(results.get(1)).isEqualTo("bar");
} }
@Test @Test
public void testGreeter() { public void testGreeter() {
assertEquals("Hello World", new Greeter().apply("World")); assertThat(new Greeter().apply("World")).isEqualTo("Hello World");
} }
@Test @Test
@@ -70,14 +70,15 @@ public class FunctionTests {
Flux<String> input = Flux.just("foo", "bar"); Flux<String> input = Flux.just("foo", "bar");
Flux<String> output = new Exclaimer().apply(input); Flux<String> output = new Exclaimer().apply(input);
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo!!!", results.get(0)); assertThat(results.get(0)).isEqualTo("foo!!!");
assertEquals("bar!!!", results.get(1)); assertThat(results.get(1)).isEqualTo("bar!!!");
} }
@Test @Test
public void testCharCounter() { public void testCharCounter() {
assertEquals((Integer) 21, new CharCounter().apply("this is 21 chars long")); assertThat(new CharCounter().apply("this is 21 chars long"))
.isEqualTo((Integer) 21);
} }
} }

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.example; package com.example;
import org.junit.Ignore; import org.junit.Ignore;
@@ -40,7 +41,8 @@ public class SampleApplicationMvcTests {
@Test @Test
@Ignore("FIXME") @Ignore("FIXME")
public void words() throws Exception { public void words() throws Exception {
this.mockMvc.perform(get("/words")).andExpect(content().string("[\"foo\",\"bar\"]")); this.mockMvc.perform(get("/words"))
.andExpect(content().string("[\"foo\",\"bar\"]"));
} }
} }

View File

@@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@@ -60,22 +60,22 @@ public class SampleApplicationTests {
@Test @Test
public void testUppercase() { public void testUppercase() {
String output = this.uppercase.apply("foobar"); String output = this.uppercase.apply("foobar");
assertEquals("FOOBAR", output); assertThat(output).isEqualTo("FOOBAR");
} }
@Test @Test
public void testLowercase() { public void testLowercase() {
Flux<String> output = this.lowercase.apply(Flux.just("FOO", "BAR")); Flux<String> output = this.lowercase.apply(Flux.just("FOO", "BAR"));
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo", results.get(0)); assertThat(results.get(0)).isEqualTo("foo");
assertEquals("bar", results.get(1)); assertThat(results.get(1)).isEqualTo("bar");
} }
@Test @Test
public void testHello() { public void testHello() {
String output = this.hello.get(); String output = this.hello.get();
assertEquals("hello", output); assertThat(output).isEqualTo("hello");
} }
// the following are contributed via @FunctionScan: // the following are contributed via @FunctionScan:
@@ -84,15 +84,15 @@ public class SampleApplicationTests {
public void testWords() { public void testWords() {
Flux<String> output = this.words.get(); Flux<String> output = this.words.get();
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo", results.get(0)); assertThat(results.get(0)).isEqualTo("foo");
assertEquals("bar", results.get(1)); assertThat(results.get(1)).isEqualTo("bar");
} }
@Test @Test
public void testCompiledUppercase() { public void testCompiledUppercase() {
String output = this.compiledUppercase.apply("foobar"); String output = this.compiledUppercase.apply("foobar");
assertEquals("FOOBAR", output); assertThat(output).isEqualTo("FOOBAR");
} }
@Test @Test
@@ -100,15 +100,15 @@ public class SampleApplicationTests {
Flux<String> input = Flux.just("FOO", "BAR"); Flux<String> input = Flux.just("FOO", "BAR");
Flux<String> output = this.compiledLowercase.apply(input); Flux<String> output = this.compiledLowercase.apply(input);
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo", results.get(0)); assertThat(results.get(0)).isEqualTo("foo");
assertEquals("bar", results.get(1)); assertThat(results.get(1)).isEqualTo("bar");
} }
@Test @Test
public void testGreeter() { public void testGreeter() {
String greeting = this.greeter.apply("World"); String greeting = this.greeter.apply("World");
assertEquals("Hello World", greeting); assertThat(greeting).isEqualTo("Hello World");
} }
@Test @Test
@@ -116,15 +116,15 @@ public class SampleApplicationTests {
Flux<String> input = Flux.just("foo", "bar"); Flux<String> input = Flux.just("foo", "bar");
Flux<String> output = this.exclaimer.apply(input); Flux<String> output = this.exclaimer.apply(input);
List<String> results = output.collectList().block(); List<String> results = output.collectList().block();
assertEquals(2, results.size()); assertThat(results.size()).isEqualTo(2);
assertEquals("foo!!!", results.get(0)); assertThat(results.get(0)).isEqualTo("foo!!!");
assertEquals("bar!!!", results.get(1)); assertThat(results.get(1)).isEqualTo("bar!!!");
} }
@Test @Test
public void testCharCounter() { public void testCharCounter() {
Integer length = this.charCounter.apply("the quick brown fox"); Integer length = this.charCounter.apply("the quick brown fox");
assertEquals(new Integer(19), length); assertThat(length).isEqualTo(new Integer(19));
} }
} }

View File

@@ -35,10 +35,6 @@ public final class HeaderUtils {
private static HttpHeaders REQUEST_ONLY = new HttpHeaders(); private static HttpHeaders REQUEST_ONLY = new HttpHeaders();
private HeaderUtils() {
throw new IllegalStateException("Can't instantiate a utility class");
}
static { static {
IGNORED.add(MessageHeaders.ID, ""); IGNORED.add(MessageHeaders.ID, "");
IGNORED.add(HttpHeaders.CONTENT_LENGTH, "0"); IGNORED.add(HttpHeaders.CONTENT_LENGTH, "0");
@@ -49,6 +45,10 @@ public final class HeaderUtils {
REQUEST_ONLY.add(HttpHeaders.HOST, ""); REQUEST_ONLY.add(HttpHeaders.HOST, "");
} }
private HeaderUtils() {
throw new IllegalStateException("Can't instantiate a utility class");
}
public static HttpHeaders fromMessage(MessageHeaders headers) { public static HttpHeaders fromMessage(MessageHeaders headers) {
HttpHeaders result = new HttpHeaders(); HttpHeaders result = new HttpHeaders();
for (String name : headers.keySet()) { for (String name : headers.keySet()) {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.flux; package org.springframework.cloud.function.flux;
import java.net.URI; import java.net.URI;
@@ -62,7 +63,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* *
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
// @checkstyle:off
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive") @SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
// @checkstyle:on
public class FluxRestApplicationTests { public class FluxRestApplicationTests {
private static final MediaType EVENT_STREAM = MediaType.valueOf("text/event-stream"); private static final MediaType EVENT_STREAM = MediaType.valueOf("text/event-stream");

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.mvc; package org.springframework.cloud.function.mvc;
import java.net.URI; import java.net.URI;
@@ -60,7 +61,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Dave Syer * @author Dave Syer
* *
*/ */
// @checkstyle:off
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet") @SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet")
// @checkstyle:on
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class MvcRestApplicationTests { public class MvcRestApplicationTests {

View File

@@ -31,7 +31,7 @@ import org.springframework.cloud.function.context.test.FunctionalSpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient;
import static org.junit.Assert.assertTrue; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* @author Dave Syer * @author Dave Syer
@@ -52,9 +52,9 @@ public class FunctionalWithInputSetTests {
String.class) String.class)
.exchange().expectStatus().isOk().expectBody(String.class).returnResult() .exchange().expectStatus().isOk().expectBody(String.class).returnResult()
.getResponseBody(); .getResponseBody();
assertTrue(reply.contains("FOO")); assertThat(reply.contains("FOO")).isTrue();
assertTrue(reply.contains("BAR")); assertThat(reply.contains("BAR")).isTrue();
assertTrue(reply.contains("{\"value\":\"")); assertThat(reply.contains("{\"value\":\"")).isTrue();
} }
@SpringBootConfiguration @SpringBootConfiguration

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.test; package org.springframework.cloud.function.test;
import java.util.function.Function; import java.util.function.Function;

View File

@@ -74,10 +74,10 @@ class Foo {
private String value; private String value;
public Foo() { Foo() {
} }
public Foo(String value) { Foo(String value) {
this.value = value; this.value = value;
} }

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.flux; package org.springframework.cloud.function.web.flux;
import java.net.URI; import java.net.URI;
@@ -37,8 +38,7 @@ import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
/** /**
* @author Dave Syer * @author Dave Syer
@@ -62,20 +62,20 @@ public class HeadersToMessageTests {
.exchange(RequestEntity.post(new URI("/functions/employee")) .exchange(RequestEntity.post(new URI("/functions/employee"))
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.body("{\"name\":\"Bob\",\"age\":25}"), String.class); .body("{\"name\":\"Bob\",\"age\":25}"), String.class);
assertEquals("{\"name\":\"Bob\",\"age\":25}", postForEntity.getBody()); assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
assertTrue(postForEntity.getHeaders().containsKey("x-content-type")); assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
assertEquals("application/xml", assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
postForEntity.getHeaders().get("x-content-type").get(0)); .isEqualTo("application/xml");
assertEquals("bar", postForEntity.getHeaders().get("foo").get(0)); assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
// test simple type payload // test simple type payload
postForEntity = this.rest.postForEntity(new URI("/functions/string"), postForEntity = this.rest.postForEntity(new URI("/functions/string"),
"{\"name\":\"Bob\",\"age\":25}", String.class); "{\"name\":\"Bob\",\"age\":25}", String.class);
assertEquals("{\"name\":\"Bob\",\"age\":25}", postForEntity.getBody()); assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
assertTrue(postForEntity.getHeaders().containsKey("x-content-type")); assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
assertEquals("application/xml", assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
postForEntity.getHeaders().get("x-content-type").get(0)); .isEqualTo("application/xml");
assertEquals("bar", postForEntity.getHeaders().get("foo").get(0)); assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
} }
@EnableAutoConfiguration @EnableAutoConfiguration

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.flux; package org.springframework.cloud.function.web.flux;
import java.net.URI; import java.net.URI;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.flux; package org.springframework.cloud.function.web.flux;
import java.net.URI; import java.net.URI;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.mvc; package org.springframework.cloud.function.web.mvc;
import java.net.URI; import java.net.URI;
@@ -39,8 +40,7 @@ import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
/** /**
* @author Oleg Zhurakousky * @author Oleg Zhurakousky
@@ -62,11 +62,11 @@ public class HeadersToMessageTests {
.exchange(RequestEntity.post(new URI("/functions/employee")) .exchange(RequestEntity.post(new URI("/functions/employee"))
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.body("{\"name\":\"Bob\",\"age\":25}"), String.class); .body("{\"name\":\"Bob\",\"age\":25}"), String.class);
assertEquals("{\"name\":\"Bob\",\"age\":25}", postForEntity.getBody()); assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
assertTrue(postForEntity.getHeaders().containsKey("x-content-type")); assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
assertEquals("application/xml", assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
postForEntity.getHeaders().get("x-content-type").get(0)); .isEqualTo("application/xml");
assertEquals("bar", postForEntity.getHeaders().get("foo").get(0)); assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
} }
@Test @Test
@@ -76,10 +76,11 @@ public class HeadersToMessageTests {
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
.header("x-context-type", "rubbish") .header("x-context-type", "rubbish")
.body("{\"name\":\"Bob\",\"age\":25}"), String.class); .body("{\"name\":\"Bob\",\"age\":25}"), String.class);
assertEquals("{\"name\":\"Bob\",\"age\":25,\"foo\":\"bar\"}", assertThat(postForEntity.getBody())
postForEntity.getBody()); .isEqualTo("{\"name\":\"Bob\",\"age\":25,\"foo\":\"bar\"}");
assertTrue(postForEntity.getHeaders().containsKey("x-context-type")); assertThat(postForEntity.getHeaders().containsKey("x-context-type")).isTrue();
assertEquals("rubbish", postForEntity.getHeaders().get("x-context-type").get(0)); assertThat(postForEntity.getHeaders().get("x-context-type").get(0))
.isEqualTo("rubbish");
} }
@EnableAutoConfiguration @EnableAutoConfiguration

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.mvc; package org.springframework.cloud.function.web.mvc;
import java.net.URI; import java.net.URI;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.cloud.function.web.mvc; package org.springframework.cloud.function.web.mvc;
import java.net.URI; import java.net.URI;