forked from rashtao/arango-micronaut-native-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from arangodb-helper/driver_v7.7
[DE-818] Update dependencies versions
- Loading branch information
Showing
20 changed files
with
1,346 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Native CI | ||
|
||
on: push | ||
|
||
jobs: | ||
|
||
verify: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shaded: | ||
- 'true' | ||
- 'false' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '21.0.2' | ||
distribution: 'graalvm-community' | ||
cache: 'maven' | ||
native-image-job-reports: 'true' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Info | ||
run: mvn -version | ||
- name: Deps tree | ||
run: mvn dependency:tree -Dshaded=${{matrix.shaded}} | ||
- name: Start Database | ||
run: ./docker/start_db.sh | ||
env: | ||
SSL: true | ||
- name: test | ||
run: mvn test | ||
- name: package-native | ||
run: mvn -Dpackaging=native-image -Dshaded=${{matrix.shaded}} package | ||
- name: start-native | ||
run: ./target/demo & | ||
- name: wait | ||
run: sleep 1 | ||
- name: test-version | ||
run: curl -v --fail http://localhost:8080/version | ||
- name: test-serde | ||
run: curl -v --fail http://localhost:8080/order |
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
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
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,44 @@ | ||
package com.example | ||
|
||
import com.arangodb.ArangoDB | ||
import com.arangodb.serde.ArangoSerde | ||
import io.micronaut.context.annotation.Factory | ||
import io.micronaut.serde.ObjectMapper | ||
import jakarta.inject.Singleton | ||
import java.security.KeyStore | ||
import javax.net.ssl.SSLContext | ||
import javax.net.ssl.TrustManagerFactory | ||
|
||
@Factory | ||
class ArangoProvider { | ||
@Singleton | ||
fun arangoDB(config: ArangoConfig, mapper: ObjectMapper): ArangoDB = ArangoDB.Builder() | ||
.loadProperties(ArangoConfigAdapter(config)) | ||
.sslContext(createSslContext(config)) | ||
|
||
// ArangoSerde implementation based on Micronaut serialization | ||
.serde(object : ArangoSerde { | ||
override fun serialize(value: Any?): ByteArray { | ||
return mapper.writeValueAsBytes(value) | ||
} | ||
|
||
override fun <T : Any?> deserialize(content: ByteArray, clazz: Class<T>): T? { | ||
return mapper.readValue(content, clazz) | ||
} | ||
}) | ||
.build() | ||
|
||
|
||
private fun createSslContext(config: ArangoConfig): SSLContext { | ||
val ks = KeyStore.getInstance(config.ssl.trustStoreType) | ||
ks.load( | ||
Thread.currentThread().contextClassLoader.getResourceAsStream(config.ssl.trustStoreFile), | ||
config.ssl.trustStorePassword.toCharArray() | ||
) | ||
val tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()) | ||
tmf.init(ks) | ||
val sc = SSLContext.getInstance("TLS") | ||
sc.init(null, tmf.trustManagers, null) | ||
return sc | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
src/main/resources/META-INF/native-image/com/example/demo/native-image.properties
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,43 @@ | ||
Args=\ | ||
-Dio.netty.noUnsafe=true \ | ||
-Dio.netty.leakDetection.level=DISABLED \ | ||
--initialize-at-build-time=\ | ||
com.example,\ | ||
ch.qos.logback,\ | ||
org.slf4j,\ | ||
io.netty \ | ||
--initialize-at-run-time=\ | ||
io.netty.buffer.PooledByteBufAllocator,\ | ||
io.netty.buffer.ByteBufAllocator,\ | ||
io.netty.buffer.ByteBufUtil,\ | ||
io.netty.buffer.AbstractReferenceCountedByteBuf,\ | ||
io.netty.handler.ssl.JdkSslServerContext,\ | ||
io.netty.handler.codec.compression.BrotliDecoder,\ | ||
io.netty.handler.codec.compression.ZstdConstants,\ | ||
io.netty.handler.codec.http2.Http2CodecUtil,\ | ||
io.netty.handler.codec.http2.Http2ClientUpgradeCodec,\ | ||
io.netty.handler.codec.http2.Http2ConnectionHandler,\ | ||
io.netty.handler.codec.http2.DefaultHttp2FrameWriter,\ | ||
io.netty.handler.codec.http.HttpObjectEncoder,\ | ||
io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder,\ | ||
io.netty.handler.codec.http.websocketx.extensions.compression.DeflateDecoder,\ | ||
io.netty.handler.codec.http2.CleartextHttp2ServerUpgradeHandler,\ | ||
io.netty.handler.codec.http2.Http2ServerUpgradeCodec,\ | ||
io.netty.handler.pcap.PcapWriteHandler$WildcardAddressHolder,\ | ||
io.netty.util.AbstractReferenceCounted,\ | ||
io.netty.util.concurrent.GlobalEventExecutor,\ | ||
io.netty.util.concurrent.ImmediateEventExecutor,\ | ||
io.netty.util.concurrent.ScheduledFutureTask,\ | ||
io.netty.util.internal.ThreadLocalRandom,\ | ||
io.netty.util.NetUtilSubstitutions$NetUtilLocalhost4LazyHolder,\ | ||
io.netty.util.NetUtilSubstitutions$NetUtilLocalhost6LazyHolder,\ | ||
io.netty.util.NetUtilSubstitutions$NetUtilLocalhostLazyHolder,\ | ||
io.netty.util.NetUtilSubstitutions$NetUtilNetworkInterfacesLazyHolder,\ | ||
io.netty.handler.ssl.util.ThreadLocalInsecureRandom,\ | ||
io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider,\ | ||
io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder,\ | ||
io.netty.resolver.dns.DnsNameResolver,\ | ||
io.netty.resolver.HostsFileEntriesResolver,\ | ||
io.netty.resolver.dns.ResolvConf$ResolvConfLazy,\ | ||
io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider,\ | ||
io.vertx.core.buffer.impl.VertxByteBufAllocator |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
micronaut.application.name=demo | ||
|
||
adb.hosts=127.0.0.1:8529 | ||
adb.hosts=localhost:8529 | ||
adb.password=test | ||
adb.useSsl=true | ||
adb.ssl.trustStoreFile=META-INF/resources/adb.truststore | ||
adb.ssl.trustStorePassword=12345678 | ||
adb.ssl.trustStoreType=pkcs12 |
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,20 @@ | ||
package graal; | ||
|
||
import com.oracle.svm.core.annotate.Substitute; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
|
||
public class BrotliSubstitutions { | ||
|
||
@TargetClass(className = "io.netty.handler.codec.compression.Brotli") | ||
static final class Target_io_netty_handler_codec_compression_Brotli { | ||
@Substitute | ||
public static boolean isAvailable() { | ||
return false; | ||
} | ||
|
||
@Substitute | ||
public static void ensureAvailability() throws Throwable { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} | ||
} |
Oops, something went wrong.