Fixed docs home page
fixed some formatting issues
This commit is contained in:
@@ -34,7 +34,8 @@ public final class FunctionWebUtils {
|
||||
|
||||
}
|
||||
|
||||
public static Object findFunction(HttpMethod method, FunctionCatalog functionCatalog, Map<String, Object> attributes, String path) {
|
||||
public static Object findFunction(HttpMethod method, FunctionCatalog functionCatalog,
|
||||
Map<String, Object> attributes, String path) {
|
||||
if (method.equals(HttpMethod.GET)) {
|
||||
return findFunctionForGet(functionCatalog, attributes, path);
|
||||
}
|
||||
@@ -46,7 +47,8 @@ public final class FunctionWebUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static Object findFunctionForGet(FunctionCatalog functionCatalog, Map<String, Object> attributes, String path) {
|
||||
private static Object findFunctionForGet(FunctionCatalog functionCatalog,
|
||||
Map<String, Object> attributes, String path) {
|
||||
path = path.startsWith("/") ? path.substring(1) : path;
|
||||
|
||||
Object functionForGet = null;
|
||||
@@ -82,7 +84,8 @@ public final class FunctionWebUtils {
|
||||
return functionForGet;
|
||||
}
|
||||
|
||||
private static Object findFunctionForPost(FunctionCatalog functionCatalog, Map<String, Object> attributes, String path) {
|
||||
private static Object findFunctionForPost(FunctionCatalog functionCatalog,
|
||||
Map<String, Object> attributes, String path) {
|
||||
path = path.startsWith("/") ? path.substring(1) : path;
|
||||
Consumer<Publisher<?>> consumer = functionCatalog.lookup(Consumer.class, path);
|
||||
if (consumer != null) {
|
||||
|
||||
@@ -32,7 +32,12 @@ import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public class FunctionEndpointInitializerMVCTests {
|
||||
|
||||
@Before
|
||||
@@ -51,7 +56,8 @@ public class FunctionEndpointInitializerMVCTests {
|
||||
SpringApplication.run(ApplicationConfiguration.class);
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
String port = System.getProperty("server.port");
|
||||
ResponseEntity<String> response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/uppercase"), "stressed", String.class);
|
||||
ResponseEntity<String> response = testRestTemplate
|
||||
.postForEntity(new URI("http://localhost:" + port + "/uppercase"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("STRESSED");
|
||||
response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/reverse"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("desserts");
|
||||
@@ -62,7 +68,8 @@ public class FunctionEndpointInitializerMVCTests {
|
||||
SpringApplication.run(ApplicationConfiguration.class);
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
String port = System.getProperty("server.port");
|
||||
ResponseEntity<String> response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/uppercase,lowercase,reverse"), "stressed", String.class);
|
||||
ResponseEntity<String> response = testRestTemplate
|
||||
.postForEntity(new URI("http://localhost:" + port + "/uppercase,lowercase,reverse"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("desserts");
|
||||
}
|
||||
|
||||
@@ -84,20 +91,6 @@ public class FunctionEndpointInitializerMVCTests {
|
||||
public Function<String, String> reverse() {
|
||||
return s -> new StringBuilder(s).reverse().toString();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void initialize(GenericApplicationContext applicationContext) {
|
||||
// applicationContext.registerBean("uppercase", FunctionRegistration.class,
|
||||
// () -> new FunctionRegistration<>(uppercase())
|
||||
// .type(FunctionType.from(String.class).to(String.class)));
|
||||
// applicationContext.registerBean("reverse", FunctionRegistration.class,
|
||||
// () -> new FunctionRegistration<>(reverse())
|
||||
// .type(FunctionType.from(String.class).to(String.class)));
|
||||
// applicationContext.registerBean("lowercase", FunctionRegistration.class,
|
||||
// () -> new FunctionRegistration<>(lowercase())
|
||||
// .type(FunctionType.from(String.class).to(String.class)));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,12 @@ import org.springframework.util.SocketUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
public class FunctionEndpointInitializerTests {
|
||||
|
||||
@Before
|
||||
@@ -55,7 +60,8 @@ public class FunctionEndpointInitializerTests {
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
String port = System.getProperty("server.port");
|
||||
Thread.sleep(200);
|
||||
ResponseEntity<String> response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/uppercase"), "stressed", String.class);
|
||||
ResponseEntity<String> response = testRestTemplate
|
||||
.postForEntity(new URI("http://localhost:" + port + "/uppercase"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("STRESSED");
|
||||
response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/reverse"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("desserts");
|
||||
@@ -67,7 +73,8 @@ public class FunctionEndpointInitializerTests {
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
String port = System.getProperty("server.port");
|
||||
Thread.sleep(200);
|
||||
ResponseEntity<String> response = testRestTemplate.postForEntity(new URI("http://localhost:" + port + "/uppercase,lowercase,reverse"), "stressed", String.class);
|
||||
ResponseEntity<String> response = testRestTemplate
|
||||
.postForEntity(new URI("http://localhost:" + port + "/uppercase,lowercase,reverse"), "stressed", String.class);
|
||||
assertThat(response.getBody()).isEqualTo("desserts");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user