-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create request-id to be set as a header on the request for oracle pro…
…vider requests.
- Loading branch information
1 parent
687df96
commit 735b2eb
Showing
12 changed files
with
232 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM alpine | ||
COPY java-init.tar / | ||
CMD ["cat", "/java-init.tar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
runtime: java | ||
cmd: com.example.fn.HelloFunction::handleRequest | ||
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.64 | ||
run_image: fnproject/fn-java-fdk:jdk9-1.0.64 | ||
format: http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: new-func | ||
version: 0.0.1 | ||
runtime: java | ||
cmd: com.example.fn.HelloFunction::handleRequest | ||
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.64 | ||
run_image: fnproject/fn-java-fdk:jdk9-1.0.64 | ||
format: http |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<fdk.version>1.0.64</fdk.version> | ||
</properties> | ||
<groupId>com.example.fn</groupId> | ||
<artifactId>hello</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>fn-release-repo</id> | ||
<url>https://dl.bintray.com/fnproject/fnproject</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>api</artifactId> | ||
<version>${fdk.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>testing-core</artifactId> | ||
<version>${fdk.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>testing-junit4</artifactId> | ||
<version>${fdk.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.3</version> | ||
<configuration> | ||
<source>9</source> | ||
<target>9</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.example.fn; | ||
|
||
public class HelloFunction { | ||
|
||
public String handleRequest(String input) { | ||
String name = (input == null || input.isEmpty()) ? "world" : input; | ||
|
||
return "Hello, " + name + "!"; | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
new-func/src/test/java/com/example/fn/HelloFunctionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.example.fn; | ||
|
||
import com.fnproject.fn.testing.*; | ||
import org.junit.*; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class HelloFunctionTest { | ||
|
||
@Rule | ||
public final FnTestingRule testing = FnTestingRule.createDefault(); | ||
|
||
@Test | ||
public void shouldReturnGreeting() { | ||
testing.givenEvent().enqueue(); | ||
testing.thenRun(HelloFunction.class, "handleRequest"); | ||
|
||
FnResult result = testing.getOnlyResult(); | ||
assertEquals("Hello, world!", result.getBodyAsString()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<fdk.version>1.0.64</fdk.version> | ||
</properties> | ||
<groupId>com.example.fn</groupId> | ||
<artifactId>hello</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>fn-release-repo</id> | ||
<url>https://dl.bintray.com/fnproject/fnproject</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>api</artifactId> | ||
<version>${fdk.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>testing-core</artifactId> | ||
<version>${fdk.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fnproject.fn</groupId> | ||
<artifactId>testing-junit4</artifactId> | ||
<version>${fdk.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.3</version> | ||
<configuration> | ||
<source>9</source> | ||
<target>9</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.example.fn; | ||
|
||
public class HelloFunction { | ||
|
||
public String handleRequest(String input) { | ||
String name = (input == null || input.isEmpty()) ? "world" : input; | ||
|
||
return "Hello, " + name + "!"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.example.fn; | ||
|
||
import com.fnproject.fn.testing.*; | ||
import org.junit.*; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class HelloFunctionTest { | ||
|
||
@Rule | ||
public final FnTestingRule testing = FnTestingRule.createDefault(); | ||
|
||
@Test | ||
public void shouldReturnGreeting() { | ||
testing.givenEvent().enqueue(); | ||
testing.thenRun(HelloFunction.class, "handleRequest"); | ||
|
||
FnResult result = testing.getOnlyResult(); | ||
assertEquals("Hello, world!", result.getBodyAsString()); | ||
} | ||
|
||
} |