Skip to content
Draft
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
56 changes: 56 additions & 0 deletions jackson3-serde-vpack/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?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>

<parent>
<groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver-parent</artifactId>
<version>7.26.0</version>
</parent>

<name>jackson3-serde-vpack</name>
<artifactId>jackson3-serde-vpack</artifactId>
<description>Jackson 3 Serde JSON module for ArangoDB Java Driver</description>

<properties>
<moduleName>com.arangodb.serde.jackson3.vpack</moduleName>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>tools.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>3.1.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson3-serde-json</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-velocypack</artifactId>
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.arangodb.serde.jackson3.vpack;

import com.arangodb.ContentType;
import com.arangodb.serde.ArangoSerde;
import com.arangodb.serde.ArangoSerdeProvider;
import com.arangodb.serde.jackson3.JacksonSerde;
import tools.jackson.dataformat.velocypack.VPackMapper;

public class JacksonVPackSerdeProvider implements ArangoSerdeProvider {
@Override
public ArangoSerde create() {
return JacksonSerde.create(new VPackMapper());
}

@Override
public ContentType getContentType() {
return ContentType.VPACK;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Args=\
-H:ResourceConfigurationResources=${.}/resource-config-spi.json \
-H:ReflectionConfigurationResources=${.}/reflect-config-spi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name": "com.arangodb.serde.jackson3.vpack.JacksonVPackSerdeProvider",
"methods": [
{
"name": "<init>",
"parameterTypes": []
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"resources": {
"includes": [
{
"pattern": "META-INF/services/com.arangodb.serde.ArangoSerdeProvider"
}
]
},
"bundles": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.arangodb.serde.jackson3.vpack.JacksonVPackSerdeProvider
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<module>shaded</module>
<module>jackson-serde-json</module>
<module>jackson3-serde-json</module>
<module>jackson3-serde-vpack</module>
<module>jackson-serde-vpack</module>
<module>jsonb-serde</module>
<module>http-protocol</module>
Expand Down Expand Up @@ -304,6 +305,11 @@
<artifactId>jackson3-serde-json</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson3-serde-vpack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson-serde-vpack</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions test-non-functional/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<artifactId>jackson3-serde-json</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson3-serde-vpack</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jsonb-serde</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package serde;

import com.arangodb.ArangoDB;
import com.arangodb.ContentType;
import com.arangodb.Protocol;
import com.arangodb.config.ArangoConfigProperties;
import com.arangodb.serde.jackson3.json.JacksonJsonSerdeProvider;
import com.arangodb.serde.jackson3.vpack.JacksonVPackSerdeProvider;
import com.arangodb.util.RawJson;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
Expand All @@ -19,9 +22,11 @@
class Jackson3SerdeTest {

static Stream<Arguments> adbByContentType() {
return Stream.of(new ArangoDB.Builder()
return Stream.of(ContentType.values())
.map(ct -> new ArangoDB.Builder()
.loadProperties(ArangoConfigProperties.fromFile())
.serdeProviderClass(JacksonJsonSerdeProvider.class)
.protocol(ContentType.VPACK.equals(ct) ? Protocol.HTTP2_VPACK : Protocol.HTTP2_JSON)
.serdeProviderClass(ContentType.VPACK.equals(ct) ? JacksonVPackSerdeProvider.class : JacksonJsonSerdeProvider.class)
.build())
.map(Arguments::of);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,15 @@ void jackson3SerdeProvider() {
assertThat(serde).isInstanceOf(com.arangodb.serde.jackson3.internal.JacksonSerdeImpl.class);
}

@Test
void jackson3VPackSerdeProvider() {
ArangoDB adb = new ArangoDB.Builder()
.host("foo", 1111)
.serdeProviderClass(com.arangodb.serde.jackson3.vpack.JacksonVPackSerdeProvider.class)
.build();

ArangoSerde serde = adb.getSerde().getUserSerde();
assertThat(serde).isInstanceOf(com.arangodb.serde.jackson3.internal.JacksonSerdeImpl.class);
}

}