Java env alpha (#656)

This change adds support for JVM based environment for running Java functions. This is alpha release of JVM environment and might undergo changes.
This commit is contained in:
Vishal
2018-06-27 21:39:24 +05:30
committed by GitHub
parent a35cd7f4a4
commit 65fd1d9fbb
12 changed files with 387 additions and 0 deletions
@@ -0,0 +1,16 @@
package io.fission;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import io.fission.Function;
import io.fission.Context;
public class HelloWorld implements Function {
@Override
public ResponseEntity<?> call(RequestEntity req, Context context) {
return ResponseEntity.ok("Hello World!");
}
}
@@ -0,0 +1,24 @@
package io.fission;
import java.net.URI;
import java.net.URISyntaxException;
import org.springframework.http.HttpStatus;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
public class HelloWorldTest {
public void testResponse() {
HelloWorld hw = new HelloWorld();
RequestEntity request = null;
try {
request = RequestEntity.get(new URI("http://example.com/bar")).build();
} catch (URISyntaxException e) {
e.printStackTrace();
}
ResponseEntity resp = hw.call(request, null);
Assert.hasText(resp.getBody().toString(), "Hello World!");
}
}