Skip to content

Commit 29f11d3

Browse files
authored
Merge branch 'master' into native-image-afux
2 parents 327ca84 + 050c2cc commit 29f11d3

19 files changed

Lines changed: 173 additions & 31 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- run:
1818
name: Install fn binary (as it is needed for the integration tests)
1919
command: ./.circleci/install-fn.sh
20+
- run:
21+
name: Workaround for https://issues.apache.org/jira/browse/SUREFIRE-1588
22+
command: ./.circleci/fix-java-for-surefire.sh
2023
- run:
2124
name: Install junit-merge
2225
command: npm install -g junit-merge

.circleci/fix-java-for-surefire.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
cat << 'EOF' > $HOME/.m2/settings.xml
6+
<settings>
7+
<profiles>
8+
<profile>
9+
<id>SUREFIRE-1588</id>
10+
<activation>
11+
<activeByDefault>true</activeByDefault>
12+
</activation>
13+
<properties>
14+
<argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
15+
</properties>
16+
</profile>
17+
</profiles>
18+
</settings>
19+
EOF

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ logs/
1212
*.versionsBackup
1313
.gradle
1414
examples/gradle-build/build
15+
**/*.classpath
16+
**/*.project
17+
**/*.settings
18+

api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<configuration>
5151
<sigfile>src/main/api/snapshot.sigfile</sigfile>
5252
<action>strictcheck</action>
53-
<packages>com.fnproject.fn.api,com.fnproject.fn.api.exception,com.fnproject.fn.api.flow</packages>
53+
<packages>com.fnproject.fn.api,com.fnproject.fn.api.exception</packages>
5454
</configuration>
5555
</plugin>
5656
</plugins>

api/src/main/api/snapshot.sigfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ supr java.lang.Enum<com.fnproject.fn.api.FunctionInvoker$Phase>
3333

3434
CLSS public final com.fnproject.fn.api.Headers
3535
intf java.io.Serializable
36+
meth public java.util.Map getAll()
3637
meth public !varargs com.fnproject.fn.api.Headers addHeader(java.lang.String,java.lang.String,java.lang.String[])
3738
meth public !varargs com.fnproject.fn.api.Headers setHeader(java.lang.String,java.lang.String,java.lang.String[])
3839
meth public boolean equals(java.lang.Object)
@@ -170,6 +171,17 @@ cons public init(java.lang.String)
170171
cons public init(java.lang.String,java.lang.Exception)
171172
supr java.lang.RuntimeException
172173

174+
175+
CLSS public abstract interface com.fnproject.fn.api.httpgateway.HTTPGatewayContext
176+
meth public abstract InvocationContext getInvocationContext()
177+
meth public abstract Headers getHeaders()
178+
meth public abstract String getRequestURL()
179+
meth public abstract String getMethod()
180+
meth public abstract QueryParameters getQueryParameters()
181+
meth public abstract void addResponseHeader(String key, String value)
182+
meth public abstract void setResponseHeader(String key, String v1, String... vs)
183+
meth public abstract void setStatusCode(int code)
184+
173185
CLSS public abstract interface java.io.Closeable
174186
intf java.lang.AutoCloseable
175187
meth public abstract void close() throws java.io.IOException

api/src/main/java/com/fnproject/fn/api/Headers.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ private Headers(Map<String, List<String>> headersIn) {
3232

3333
private static Pattern headerName = Pattern.compile("[A-Za-z0-9!#%&'*+-.^_`|~]+");
3434

35+
public Map getAll() {
36+
return headers;
37+
}
3538

3639
/**
3740
* Calculates the canonical key (cf RFC 7230) for a header

flow-runtime/src/main/java/com/fnproject/fn/runtime/flow/RemoteFlowApiClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ public CompletionId invokeFunction(FlowId flowId, String functionId, byte[] data
121121
httpReq.headers = new ArrayList<>();
122122

123123
headers.asMap().forEach((k, vs) -> vs.forEach(v -> httpReq.headers.add(APIModel.HTTPHeader.create(k, v))));
124+
125+
Map<String, List<String>> headersMap = headers.asMap();
126+
headersMap.forEach((key, values) -> values.forEach(value -> httpReq.headers.add(APIModel.HTTPHeader.create(key, value))));
124127
}
125128

126129
httpReq.method = APIModel.HTTPMethod.fromFlow(method);

flow-runtime/src/test/java/com/fnproject/fn/runtime/flow/RemoteFlowApiClientTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.ObjectOutputStream;
2323
import java.util.Collections;
2424
import java.util.List;
25+
import java.util.Map;
2526

2627
import static org.junit.Assert.assertEquals;
2728
import static org.junit.Assert.assertNotNull;
@@ -130,7 +131,9 @@ public void invokeFunctionWithInvalidFunctionId() throws Exception {
130131
thrown.expectMessage("Failed to add stage");
131132

132133
// When
133-
completerClient.invokeFunction(new FlowId(testFlowId), testFunctionId, invokeBody, HttpMethod.POST, Headers.fromMap(Collections.singletonMap("Content-type", contentType)), locationFn());
134+
Map headersMap = Collections.singletonMap("Content-type", contentType);
135+
Headers headers = Headers.fromMap(headersMap);
136+
completerClient.invokeFunction(new FlowId(testFlowId), testFunctionId, invokeBody, HttpMethod.POST, headers, locationFn());
134137
}
135138

136139
@Test

images/build/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
<target>1.8</target>
5656
</configuration>
5757
</plugin>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-surefire-plugin</artifactId>
61+
<version>2.22.1</version>
62+
<configuration>
63+
<useSystemClassLoader>false</useSystemClassLoader>
64+
</configuration>
65+
</plugin>
5866
<plugin>
5967
<groupId>org.apache.maven.plugins</groupId>
6068
<artifactId>maven-deploy-plugin</artifactId>

images/init-native/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<properties>
77
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8-
<fdk.version>1.0.0-SNAPSHOT</fdk.version>
8+
<fdk.version>1.0.76</fdk.version>
99
</properties>
1010
<groupId>com.example.fn</groupId>
1111
<artifactId>hello</artifactId>

0 commit comments

Comments
 (0)