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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ c4e2bf407aa0b7a3d34605134791013ba8a2d376
f00f4fe6ed5e22cdd2e3f68370c2da96e6bbc8e7
899ed51a7b6607161fcda5c1000115a076cc4fe7
53b9d9cc4fc4091b89f84effb6e526371d3bae68
383b1b8dee10fbed5dab6566ea0fe49caf9e15b4
f6aab9d10212756b1d71a0568c706a9df51c322d
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ subprojects { project ->

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile).configureEach {
Expand Down Expand Up @@ -136,6 +136,7 @@ subprojects { project ->
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
jvmArgs '-Djdk.tracePinnedThreads=full'
}
}

Expand Down Expand Up @@ -173,7 +174,8 @@ generateLicenseReport {
}

def excludeProjects = [
'internal-docs'
'internal-docs',
'commercetools-sdk-compat-v1'
]
subprojects { project ->
if (project.file("build.gradle").exists() && !excludeProjects.contains(project.name)) {
Expand Down Expand Up @@ -223,7 +225,7 @@ def documentationProjects= [
":commercetools:commercetools-okhttp-client3",
":commercetools:commercetools-okhttp-client4",
":commercetools:commercetools-reactornetty-client",
":commercetools:commercetools-sdk-compat-v1",
//":commercetools:commercetools-sdk-compat-v1",
":commercetools:commercetools-sdk-java-api",
":commercetools:commercetools-sdk-java-history",
":commercetools:commercetools-sdk-java-importapi",
Expand Down
4 changes: 2 additions & 2 deletions commercetools/commercetools-graphql-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
api graphql.java
api jackson_core.databind
api jackson_core.core
api jackson_core.datatype
// api jackson_core.datatype
api 'com.netflix.graphql.dgs.codegen:graphql-dgs-codegen-shared-core:8.1.0'

}
Expand All @@ -55,7 +55,7 @@ generateJava {
"Country": "String",
"Locale": "String",
"Long": "Long",
"Json": "com.fasterxml.jackson.databind.JsonNode",
"Json": "tools.jackson.databind.JsonNode",
"KeyReferenceInput": "String",
"Set": "Object",
"Time": "String",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import com.commercetools.api.models.graph_ql.GraphQLError;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import jakarta.validation.Valid;
import tools.jackson.databind.annotation.JsonDeserialize;

/**
* GraphQLResponse
Expand Down Expand Up @@ -141,8 +141,8 @@ default <T> T withGraphQLDataResponse(Function<GraphQLDataResponse, T> helper) {
* gives a TypeReference for usage with Jackson DataBind
* @return TypeReference
*/
public static com.fasterxml.jackson.core.type.TypeReference<GraphQLDataResponse> typeReference() {
return new com.fasterxml.jackson.core.type.TypeReference<GraphQLDataResponse>() {
public static tools.jackson.core.type.TypeReference<GraphQLDataResponse> typeReference() {
return new tools.jackson.core.type.TypeReference<GraphQLDataResponse>() {
@Override
public String toString() {
return "TypeReference<GraphQLDataResponse>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
package com.commercetools.graphql.api;

import com.commercetools.api.models.graph_ql.GraphQLResponse;
import com.fasterxml.jackson.databind.module.SimpleModule;

import tools.jackson.databind.module.SimpleModule;

public class GraphQLModule extends SimpleModule {
private static final long serialVersionUID = 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
package com.commercetools.graphql.api;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import tools.jackson.databind.annotation.JsonDeserialize;

public interface GraphQLResponseMixin {
@JsonProperty("data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.stream.Collectors;

import com.commercetools.api.models.cart.CartReferenceImpl;
import com.commercetools.api.models.category.CategoryReference;
import com.commercetools.api.models.category.CategoryReferenceImpl;
import com.commercetools.api.models.common.LocalizedString;
import com.commercetools.api.models.common.Money;
Expand Down Expand Up @@ -61,6 +62,39 @@ public ProductDraftImport toProductDraftImport(ProductProjection product) {
product.getAttributes().stream().map(ProductUtil::mapAttribute).collect(Collectors.toList()));
return draft.build();
}
/*
public CategoryImportImpl toCategoryImportImpl(CategoryImpl categoryReference) {
var catImport = new CategoryImportImpl();
catImport.setKey(categoryReference.getKey());
catImport.setName(getLocalizedStringBuilder(categoryReference.getName()).build());
catImport.setSlug(getLocalizedStringBuilder(categoryReference.getSlug()).build());
catImport.setDescription(getLocalizedStringBuilder(categoryReference.getDescription()).build());
catImport.setParent(extractCategoryKeyReference(categoryReference.getParent()));
catImport.setOrderHint(categoryReference.getOrderHint());
catImport.setMetaTitle(getLocalizedStringBuilder(categoryReference.getMetaTitle()).build());
catImport.setMetaDescription(getLocalizedStringBuilder(categoryReference.getMetaDescription()).build());
catImport.setMetaKeywords(getLocalizedStringBuilder(categoryReference.getMetaKeywords()).build());
catImport.setAssets(categoryReference.getAssets().stream().map(this::toImportApiAssert).collect(
Collectors.toList()));
catImport.setCustom(categoryReference.getCustom());
return catImport;
}
public com.commercetools.importapi.models.common.Asset toImportApiAssert(com.commercetools.api.models.common.Asset asset) {
Asset.builder().key(asset.getKey()).name(getLocalizedStringBuilder(asset.getName()).build())
.sources(toImportApiSources(asset.getSources())).description(getLocalizedStringBuilder(asset.getDescription()).build())
.tags(asset.getTags()).custom(toImportApiCustom(asset.getCustom()));
}

public List<AssetSource> toImportApiSources(
List<com.commercetools.api.models.common.AssetSource> assetSources) {
return assetSources.stream().map(source -> AssetSource.builder().uri(source.getUri()).key(source.getKey()).build()).collect(
Collectors.toList());
}

public Custom toImportApiCustom(CustomFields custom) {
return Custom.builder().type(TypeKeyReference.builder().key(keyResolverService.resolveKey(custom.getType())).build())
.fields(custom.getFields());
}*/

private static LocalizedStringBuilder getLocalizedStringBuilder(LocalizedString s) {
return com.commercetools.importapi.models.common.LocalizedString.builder().values(s.values());
Expand Down Expand Up @@ -164,6 +198,10 @@ private List<CategoryKeyReference> extractCategoryKeyReference(ProductProjection
.collect(Collectors.toList());
}

private CategoryKeyReference extractCategoryKeyReference(CategoryReference ref) {
return CategoryKeyReference.builder().key(keyResolverService.resolveKey(ref)).build();
}

private static Attribute mapAttribute(com.commercetools.api.models.product.Attribute attribute) {
Object value = attribute.getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
import com.commercetools.api.models.product.ProductProjection;
import com.commercetools.api.models.product.ProductProjectionImpl;
import com.commercetools.importapi.models.productvariants.*;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.vrap.rmf.base.client.utils.json.JsonUtils;

import org.junit.jupiter.api.Test;

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

public class ProductUtilTest {
String productProjectionExample = "src/test/resources/product-projection.example.json";
private final ObjectMapper objectMapper = new ObjectMapper();
private final ObjectMapper objectMapper = new JsonMapper();
ProductUtil util = new ProductUtil();

@Test
Expand Down
2 changes: 1 addition & 1 deletion commercetools/commercetools-javanet-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ dependencies {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
languageVersion = JavaLanguageVersion.of(17)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.v2.api.MetricsApi;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;

import io.vrap.rmf.base.client.ApiHttpResponse;
import io.vrap.rmf.base.client.ResponseSerializer;

import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;

/**
* This serializer uses API to submit metrics to datadog.
* If you are using dogstatsd, use {@link com.commercetools.monitoring.datadog.statsd.DatadogResponseSerializer} to submit metrics to datadog with statsd.
Expand Down Expand Up @@ -83,7 +84,7 @@ public <O> ApiHttpResponse<O> convertResponse(ApiHttpResponse<byte[]> response,
}

@Override
public byte[] toJsonByteArray(Object value) throws JsonProcessingException {
public byte[] toJsonByteArray(Object value) throws JacksonException {
Instant start = Instant.now();
byte[] result = serializer.toJsonByteArray(value);
double durationInMillis = Duration.between(start, Instant.now()).toNanos() / 1_000_000.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
import java.util.*;
import java.util.stream.Collectors;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.timgroup.statsd.StatsDClient;

import io.vrap.rmf.base.client.ApiHttpResponse;
import io.vrap.rmf.base.client.ResponseSerializer;

import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;

/**
* This serializer uses dogstatsd library to submit metrics to datadog.
* If you are not using statsd, use {@link com.commercetools.monitoring.datadog.DatadogResponseSerializer} to submit metrics to datadog with API.
Expand Down Expand Up @@ -82,7 +83,7 @@ public <O> ApiHttpResponse<O> convertResponse(ApiHttpResponse<byte[]> response,
}

@Override
public byte[] toJsonByteArray(Object value) throws JsonProcessingException {
public byte[] toJsonByteArray(Object value) throws JacksonException {
Instant start = Instant.now();
byte[] result = serializer.toJsonByteArray(value);
double durationInMillis = Duration.between(start, Instant.now()).toNanos() / 1_000_000.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.commercetools.monitoring.datadog.DatadogResponseSerializer;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.MetricsApi;
import com.fasterxml.jackson.core.JsonProcessingException;

import io.vrap.rmf.base.client.ApiHttpHeaders;
import io.vrap.rmf.base.client.ApiHttpResponse;
Expand All @@ -19,10 +18,12 @@
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import tools.jackson.core.JacksonException;

public class ResponseSerializerTest {

@Test
public void testSerialize() throws ApiException, JsonProcessingException {
public void testSerialize() throws ApiException, JacksonException {
MetricsApi metricsApi = Mockito.mock(MetricsApi.class);
Mockito.when(metricsApi.submitMetrics(Mockito.any())).thenReturn(null);
DatadogResponseSerializer serializer = new DatadogResponseSerializer(ResponseSerializer.of(), metricsApi);
Expand All @@ -40,7 +41,7 @@ public void testSerialize() throws ApiException, JsonProcessingException {
}

@Test
public void testSerializeWithAttributes() throws ApiException, JsonProcessingException {
public void testSerializeWithAttributes() throws ApiException, JacksonException {
MetricsApi metricsApi = Mockito.mock(MetricsApi.class);
Mockito.when(metricsApi.submitMetrics(Mockito.any())).thenReturn(null);
Map<String, String> tags = new HashMap<>();
Expand All @@ -66,7 +67,7 @@ public void testSerializeWithAttributes() throws ApiException, JsonProcessingExc
}

@Test
public void testDeserialize() throws ApiException, JsonProcessingException {
public void testDeserialize() throws ApiException, JacksonException {
MetricsApi metricsApi = Mockito.mock(MetricsApi.class);
Mockito.when(metricsApi.submitMetrics(Mockito.any())).thenReturn(null);
DatadogResponseSerializer serializer = new DatadogResponseSerializer(ResponseSerializer.of(), metricsApi);
Expand All @@ -86,7 +87,7 @@ public void testDeserialize() throws ApiException, JsonProcessingException {
}

@Test
public void testDeserializeWithAttributes() throws ApiException, JsonProcessingException {
public void testDeserializeWithAttributes() throws ApiException, JacksonException {
MetricsApi metricsApi = Mockito.mock(MetricsApi.class);
Mockito.when(metricsApi.submitMetrics(Mockito.any())).thenReturn(null);
Map<String, String> tags = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import java.util.Collections;
import java.util.Map;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.newrelic.api.agent.NewRelic;

import io.vrap.rmf.base.client.ApiHttpResponse;
import io.vrap.rmf.base.client.ResponseSerializer;

import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;

/**
* This serializer uses API to submit metrics to newrelic.
*/
Expand Down Expand Up @@ -64,7 +65,7 @@ public <O> ApiHttpResponse<O> convertResponse(ApiHttpResponse<byte[]> response,
}

@Override
public byte[] toJsonByteArray(Object value) throws JsonProcessingException {
public byte[] toJsonByteArray(Object value) throws JacksonException {
Instant start = Instant.now();
byte[] result = serializer.toJsonByteArray(value);
double durationInMillis = Duration.between(start, Instant.now()).toNanos() / 1_000_000.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import java.util.Collections;
import java.util.Map;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
Expand All @@ -18,6 +14,10 @@
import io.vrap.rmf.base.client.ApiHttpResponse;
import io.vrap.rmf.base.client.ResponseSerializer;

import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;

/**
* <p>The OpenTelemetry ResponseSerializer can be used to report metrics about the De-/Serialization performance.
* It can be registered as a {@link ResponseSerializer} to the {@link io.vrap.rmf.base.client.ClientBuilder#withSerializer(ResponseSerializer)} ClientBuilder
Expand Down Expand Up @@ -99,7 +99,7 @@ public <O> ApiHttpResponse<O> convertResponse(ApiHttpResponse<byte[]> response,
}

@Override
public byte[] toJsonByteArray(Object value) throws JsonProcessingException {
public byte[] toJsonByteArray(Object value) throws JacksonException {
Instant start = Instant.now();
byte[] result = serializer.toJsonByteArray(value);
Attributes attributes = this.attributes.toBuilder()
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

import com.commercetools.api.models.custom_object.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import commercetools.utils.CommercetoolsTestUtils;
import commercetools.utils.ValueObject;

Expand All @@ -20,6 +17,10 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

public class CustomObjectIntegrationTests {

@Test
Expand Down Expand Up @@ -117,7 +118,7 @@ public void updateWithClass() {
Assertions.assertEquals(typeRefCustomObject.getValue().getBars().get(1).getName(), "Winchester");
Assertions.assertEquals(typeRefCustomObject.getValue().getBars().get(1).getNumber(), 2);

JavaType javaType = TypeFactory.defaultInstance()
JavaType javaType = TypeFactory.createDefaultInstance()
.constructParametricType(GenericCustomObject.class, Foo.class);
GenericCustomObject<Foo> javaTypeCustomObject = (GenericCustomObject<Foo>) CommercetoolsTestUtils
.getProjectApiRoot()
Expand Down
Loading
Loading