Skip to content
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
Expand Up @@ -16,8 +16,6 @@

package org.eclipse.dataplane;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.domain.DataAddress;
import org.eclipse.dataplane.domain.Result;
import org.eclipse.dataplane.domain.controlplane.ControlPlane;
Expand Down Expand Up @@ -52,6 +50,9 @@
import org.eclipse.dataplane.store.InMemoryControlPlaneStore;
import org.eclipse.dataplane.store.InMemoryDataFlowStore;
import org.eclipse.dataplane.store.Stores;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import java.net.URI;
import java.net.http.HttpClient;
Expand All @@ -64,14 +65,15 @@
import java.util.UUID;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static jakarta.ws.rs.core.HttpHeaders.AUTHORIZATION;

public class Dataplane {

private final ObjectMapper objectMapper = new ObjectMapper()
private final ObjectMapper objectMapper = JsonMapper.builder()
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
.setDefaultPropertyInclusion(NON_NULL);
.changeDefaultPropertyInclusion(incl -> incl.withValueInclusion(NON_NULL))
.build();
private DataFlowStore dataFlowStore = new InMemoryDataFlowStore(objectMapper);
private ControlPlaneStore controlPlaneStore = new InMemoryControlPlaneStore(objectMapper);
private String id;
Expand Down Expand Up @@ -391,7 +393,7 @@ private Result<Void> notifyControlPlane(String action, DataFlow dataFlow, Object
private Result<String> toJson(Object message) {
try {
return Result.success(objectMapper.writeValueAsString(message));
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
return Result.failure(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package org.eclipse.dataplane.domain.controlplane;

import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.eclipse.dataplane.domain.registration.AuthorizationProfile;
import tools.jackson.databind.annotation.JsonPOJOBuilder;

import java.net.URI;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.eclipse.dataplane.exception.IllegalAttributeTypeException;

import java.util.HashMap;
import java.util.Map;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;

@JsonAutoDetect(getterVisibility = NONE, isGetterVisibility = NONE)
public class AuthorizationProfile {

private final Map<String, Object> attributes;
Expand All @@ -35,7 +38,6 @@ public AuthorizationProfile(String type) {
attributes.put("type", type);
}

@JsonIgnore
public String getType() {
return attributes.get("type").toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

package org.eclipse.dataplane.domain.registration;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.nimbusds.jose.jwk.source.JWKSourceBuilder;
import com.nimbusds.jwt.proc.DefaultJWTProcessor;
import org.eclipse.dataplane.domain.Result;
import tools.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.URLEncoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package org.eclipse.dataplane.store;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.domain.Result;
import org.eclipse.dataplane.domain.controlplane.ControlPlane;
import org.eclipse.dataplane.exception.ResourceNotFoundException;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -37,7 +37,7 @@ public Result<Void> save(ControlPlane controlPlane) {
try {
store.put(controlPlane.getId(), objectMapper.writeValueAsString(controlPlane));
return Result.success();
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
return Result.failure(e);
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@ private Result<ControlPlane> deserialize(String json) {
try {
var deserialized = objectMapper.readValue(json, ControlPlane.class);
return Result.success(deserialized);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
return Result.failure(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package org.eclipse.dataplane.store;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.domain.Result;
import org.eclipse.dataplane.domain.dataflow.DataFlow;
import org.eclipse.dataplane.exception.ResourceNotFoundException;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -37,7 +37,7 @@ public Result<Void> save(DataFlow dataFlow) {
try {
store.put(dataFlow.getId(), objectMapper.writeValueAsString(dataFlow));
return Result.success();
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
return Result.failure(e);
}
}
Expand All @@ -52,7 +52,7 @@ public Result<DataFlow> findById(String flowId) {
try {
var deserialized = objectMapper.readValue(dataFlow, DataFlow.class);
return Result.success(deserialized);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
return Result.failure(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

package org.eclipse.dataplane.store;

import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;

class InMemoryControlPlaneStoreTest extends ControlPlaneStoreTestBase {

private InMemoryControlPlaneStore store = new InMemoryControlPlaneStore(new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false));
private InMemoryControlPlaneStore store = new InMemoryControlPlaneStore(JsonMapper.builder().configure(FAIL_ON_UNKNOWN_PROPERTIES, false).build());

@Override
protected ControlPlaneStore store() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

package org.eclipse.dataplane.store;

import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;

class InMemoryDataFlowStoreTest extends DataFlowStoreTestBase {

private InMemoryDataFlowStore store = new InMemoryDataFlowStore(new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false));
private InMemoryDataFlowStore store = new InMemoryDataFlowStore(JsonMapper.builder().configure(FAIL_ON_UNKNOWN_PROPERTIES, false).build());

@Override
protected DataFlowStore store() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

package org.eclipse.dataplane.store.postgresql;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.exception.PersistenceException;
import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.ObjectMapper;

import java.sql.Connection;
import javax.sql.DataSource;
Expand Down Expand Up @@ -61,7 +61,7 @@ protected String toJson(Object object) {

try {
return object instanceof String ? object.toString() : objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
throw new PersistenceException("Failed to convert object to JSON.", e);
}
}
Expand All @@ -81,7 +81,7 @@ protected <T> T fromJson(String json, JavaType type) {

try {
return objectMapper.readValue(json, type);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
throw new PersistenceException("Failed to convert JSON to object.", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

package org.eclipse.dataplane.store.postgresql;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.domain.Result;
import org.eclipse.dataplane.domain.controlplane.ControlPlane;
import org.eclipse.dataplane.domain.registration.AuthorizationProfile;
import org.eclipse.dataplane.exception.PersistenceException;
import org.eclipse.dataplane.exception.ResourceNotFoundException;
import org.eclipse.dataplane.store.ControlPlaneStore;
import tools.jackson.databind.ObjectMapper;

import java.net.URI;
import javax.sql.DataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

package org.eclipse.dataplane.store.postgresql;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.domain.DataAddress;
import org.eclipse.dataplane.domain.Result;
import org.eclipse.dataplane.domain.dataflow.DataFlow;
import org.eclipse.dataplane.exception.PersistenceException;
import org.eclipse.dataplane.exception.ResourceNotFoundException;
import org.eclipse.dataplane.store.DataFlowStore;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.ObjectMapper;

import java.net.URI;
import javax.sql.DataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package org.eclipse.dataplane.store.postgresql;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.store.ControlPlaneStore;
import org.eclipse.dataplane.store.ControlPlaneStoreTestBase;
import org.junit.jupiter.api.AfterAll;
Expand All @@ -24,8 +23,10 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.postgresql.PostgreSQLContainer;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;

@Testcontainers
class PostgresControlPlaneStoreTest extends ControlPlaneStoreTestBase {
Expand All @@ -35,7 +36,7 @@ class PostgresControlPlaneStoreTest extends ControlPlaneStoreTestBase {
private static final String USERNAME = "user";
private static final String PASSWORD = "password";

private final ObjectMapper mapper = new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
private final ObjectMapper mapper = JsonMapper.builder().configure(FAIL_ON_UNKNOWN_PROPERTIES, false).build();
private PostgresControlPlaneStore store;

@Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package org.eclipse.dataplane.store.postgresql;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.eclipse.dataplane.store.DataFlowStore;
import org.eclipse.dataplane.store.DataFlowStoreTestBase;
import org.junit.jupiter.api.AfterAll;
Expand All @@ -24,8 +23,10 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.postgresql.PostgreSQLContainer;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static tools.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;

@Testcontainers
class PostgresDataFlowStoreTest extends DataFlowStoreTestBase {
Expand All @@ -35,7 +36,7 @@ class PostgresDataFlowStoreTest extends DataFlowStoreTestBase {
private static final String USERNAME = "user";
private static final String PASSWORD = "password";

private final ObjectMapper mapper = new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
private final ObjectMapper mapper = JsonMapper.builder().configure(FAIL_ON_UNKNOWN_PROPERTIES, false).build();
private PostgresDataFlowStore store;

@Container
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ format.version = "1.1"
[versions]
assertJ = "3.27.7"
awaitility = "4.3.0"
jackson = "2.22.3"
jackson = "3.2.3"
jakarta = "4.0.0"
jersey = "4.0.2"
jersey = "4.0.3"
jetty = "12.1.13"
junit = "6.1.3"
mockito = "5.24.0"
Expand All @@ -19,12 +19,12 @@ testcontainers = "2.0.5"
wiremock = "3.13.2"

[libraries]
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
jackson-databind = { module = "tools.jackson.core:jackson-databind", version.ref = "jackson" }
nimbus-jwt = { module = "com.nimbusds:nimbus-jose-jwt", version.ref = "nimbusJoseJwt" }
jakarta-rsApi = { module = "jakarta.ws.rs:jakarta.ws.rs-api", version.ref = "jakarta" }
jersey-servlet = { module = "org.glassfish.jersey.containers:jersey-container-servlet", version.ref = "jersey" }
jersey-hk2 = { module = "org.glassfish.jersey.inject:jersey-hk2", version.ref = "jersey" }
jersey-jackson = { module = "org.glassfish.jersey.media:jersey-media-json-jackson", version.ref = "jersey" }
jersey-jackson = { module = "org.glassfish.jersey.media:jersey-media-json-jackson3", version.ref = "jersey" }

slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }

Expand Down
Loading