Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static content for Graal native-image #962

Merged
merged 6 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
#
# 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.
#
Args=--enable-all-security-services
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<version.lib.el-impl>3.0.0</version.lib.el-impl>
<version.lib.etcd4j>2.16.0</version.lib.etcd4j>
<version.lib.google-api-client>1.23.0</version.lib.google-api-client>
<version.lib.graalvm>19.1.1</version.lib.graalvm>
<version.lib.graalvm>19.2.0</version.lib.graalvm>
<version.lib.groovy-all>2.4.14</version.lib.groovy-all>
<version.lib.grpc>1.22.1</version.lib.grpc>
<version.lib.guava>25.0-jre</version.lib.guava>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
#
# Graal native image supports additional configuration from this property file.
# Security Subject requires this to work
# The `all-security-services` is to support encryption algorithms, intermediate solution until we can figure out
# how to do a fine-grained algorithm support
#
Args=-H:IncludeResourceBundles=sun.security.util.Resources
Args=-H:IncludeResourceBundles=sun.security.util.Resources \
--enable-all-security-services
44 changes: 44 additions & 0 deletions tests/integration/native-image/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
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.
-->

<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>

<parent>
<groupId>io.helidon.tests.integration</groupId>
<artifactId>helidon-tests-integration</artifactId>
<version>1.2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<packaging>pom</packaging>

<artifactId>helidon-tests-integration-native-image</artifactId>
<name>Helidon Tests GraalVM Native image</name>

<description>
A set of tests that make sure various Helidon modules can compile with native-image.
</description>

<modules>
<module>se-1</module>
<module>static-content</module>
</modules>

</project>
40 changes: 40 additions & 0 deletions tests/integration/native-image/se-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#GraalVM native image integration test
_____

This is a manual (for the time being) test of integration with native-image.

To run this test:

```shell script
mvn clean package -Pnative-image
./target/helidon-tests-native-image-se-1
```

Once the native image builds and is started, run the following
curl requests:

```shell script
# Should return 200 code and "file-resource-text" as entity
curl -i http://localhost:7076/static/path/resource.txt

# Should return 200 code and "classpath-resource-text" as entity
curl -i http://localhost:7076/static/classpath/resource.txt

# Should return 200 code and "jar-resource-text" as entity
curl -i http://localhost:7076/static/jar/resource.txt

# Should return 200 code and "{"message":"SE Hallo World!"}" as entity
curl -i http://localhost:7076/greet

# Should return 401 code
curl -i http://localhost:7076/greet/john

# Should return 200 code and "{"message":"SE Hallo jack!"}" as entity
curl -i -u jack:password http://localhost:7076/greet/john

# Should return 200 code and JSON response with two health checks
curl -i http://localhost:7076/health

# Should return 200 code and JSON response with metrics
curl -i -H "Accept: application/json" http://localhost:7076/metrics
```
41 changes: 41 additions & 0 deletions tests/integration/native-image/se-1/conf/se.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
app:
greeting: "SE Hallo"

security:
provider-policy:
type: "COMPOSITE"
authentication:
- name: "http-signatures"
flag: "OPTIONAL"
- name: "http-basic-auth"
providers:
# enable the "ABAC" security provider (also handles RBAC)
- abac:
# enabled the HTTP Basic authentication provider
- http-basic-auth:
realm: "helidon"
users:
- login: "jack"
password: "password"
roles: ["admin"]
- login: "jill"
password: "password"
roles: ["user"]
- login: "joe"
password: "password"
- http-signatures:
optional: true
sign-headers:
- method: "get"
always: ["date", "(request-target)", "host"]
if-present: []
inbound.keys:
- key-id: "helidon-mp"
principal-name: "MP Service"
principal-type: "SERVICE"
hmac.secret: "badIdeaClearTextPassword!"
web-server:
paths:
- path: "/greet/{*}"
authenticate: true
roles-allowed: ["user", "admin"]
Loading