Skip to content

Commit

Permalink
fix(deps): update commercetoolsjavasdkv2version to v17 (major) (#1093)
Browse files Browse the repository at this point in the history
* fix(deps): update commercetoolsjavasdkv2version to v17

* Fix compilation error

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: lojzatran <[email protected]>
  • Loading branch information
renovate[bot] and lojzatran authored Nov 1, 2023
1 parent 8030618 commit f7ff693
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

ext{
commercetoolsJavaSdkV2Version = '14.7.0'
commercetoolsJavaSdkV2Version = '17.1.0'
mockitoJunitJupiterVersion = '5.6.0'
jupiterApiVersion = '5.10.0'
assertjVersion = '3.24.2'
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/com/commercetools/sync/commons/utils/ChunkUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static com.commercetools.sync.commons.utils.CompletableFutureUtils.collectionOfFuturesToFutureOfCollection;
import static java.util.stream.Collectors.toList;

import com.commercetools.api.client.PagedQueryResourceRequest;
import com.commercetools.api.client.ProjectApiRoot;
import com.commercetools.api.models.PagedQueryResourceRequest;
import com.commercetools.api.models.graph_ql.GraphQLRequest;
import com.commercetools.api.models.graph_ql.GraphQLResponse;
import io.vrap.rmf.base.client.ApiHttpResponse;
Expand All @@ -24,16 +24,21 @@ public class ChunkUtils {
*
* @param requests A list of {@link PagedQueryResourceRequest} implementation to allow {@link
* ProjectApiRoot} to execute queries on CTP.
* @param <ResourceT> the type of the underlying model.
* @param <QueryT> the type of the request model.
* @param <ResourceT> the type of the request model.
* @param <ResultT> the type of the underlying model.
* @param <QueryBuilderDslT> the type of the query builder dsl class (e.g.
* CartDiscountQueryBuilderDsl, CustomerQueryBuilderDsl, ...).
* @return a list of lists where each list represents the results of passed {@link
* PagedQueryResourceRequest}.
*/
public static <QueryT extends PagedQueryResourceRequest<QueryT, ResourceT>, ResourceT>
CompletableFuture<List<ApiHttpResponse<ResourceT>>> executeChunks(
@Nonnull final List<QueryT> requests) {
public static <
ResourceT extends PagedQueryResourceRequest<ResourceT, ResultT, QueryBuilderDslT>,
ResultT,
QueryBuilderDslT>
CompletableFuture<List<ApiHttpResponse<ResultT>>> executeChunks(
@Nonnull final List<ResourceT> requests) {

final List<CompletableFuture<ApiHttpResponse<ResourceT>>> futures =
final List<CompletableFuture<ApiHttpResponse<ResultT>>> futures =
requests.stream().map(request -> request.execute()).collect(toList());

return collectionOfFuturesToFutureOfCollection(futures, toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang3.StringUtils.isBlank;

import com.commercetools.api.client.PagedQueryResourceRequest;
import com.commercetools.api.client.QueryUtils;
import com.commercetools.api.models.DomainResource;
import com.commercetools.api.models.PagedQueryResourceRequest;
import com.commercetools.api.models.ResourcePagedQueryResponse;
import com.commercetools.api.models.graph_ql.GraphQLRequest;
import com.commercetools.api.models.graph_ql.GraphQLRequestBuilder;
Expand Down Expand Up @@ -44,10 +44,12 @@ abstract class BaseService<
SyncOptionsT extends BaseSyncOptions,
ResourceT extends DomainResource<ResourceT>,
ResourceDraftT extends Draft<ResourceDraftT>,
PagedQueryRequestT extends PagedQueryResourceRequest<PagedQueryRequestT, PagedQueryResponseT>,
PagedQueryRequestT extends
PagedQueryResourceRequest<PagedQueryRequestT, PagedQueryResponseT, QueryBuilderDslT>,
PagedQueryResponseT extends ResourcePagedQueryResponse<ResourceT>,
GetOneResourceQueryT extends ApiMethod<GetOneResourceQueryT, ResourceT>,
QueryResultT,
QueryBuilderDslT,
PostRequestT extends BodyApiMethod<PostRequestT, QueryResultT, ResourceDraftT>> {

final SyncOptionsT syncOptions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.commercetools.sync.services.impl;

import com.commercetools.api.client.PagedQueryResourceRequest;
import com.commercetools.api.models.DomainResource;
import com.commercetools.api.models.PagedQueryResourceRequest;
import com.commercetools.api.models.ResourcePagedQueryResponse;
import com.commercetools.api.models.WithKey;
import com.commercetools.sync.commons.BaseSyncOptions;
Expand All @@ -19,10 +19,12 @@ abstract class BaseServiceWithKey<
SyncOptionsT extends BaseSyncOptions,
ResourceT extends DomainResource<ResourceT> & WithKey,
ResourceDraftT extends Draft<ResourceDraftT> & WithKey,
PagedQueryT extends PagedQueryResourceRequest<PagedQueryT, PagedQueryResponseT>,
PagedQueryT extends
PagedQueryResourceRequest<PagedQueryT, PagedQueryResponseT, QueryBuilderDslT>,
PagedQueryResponseT extends ResourcePagedQueryResponse<ResourceT>,
GetOneResourceQueryT extends ApiMethod<GetOneResourceQueryT, ResourceT>,
QueryResultT,
QueryBuilderDslT,
PostRequestT extends BodyApiMethod<PostRequestT, QueryResultT, ResourceDraftT>>
extends BaseService<
SyncOptionsT,
Expand All @@ -32,6 +34,7 @@ abstract class BaseServiceWithKey<
PagedQueryResponseT,
GetOneResourceQueryT,
QueryResultT,
QueryBuilderDslT,
PostRequestT> {

BaseServiceWithKey(@Nonnull final SyncOptionsT syncOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.cart_discount.CartDiscountPagedQueryResponse;
import com.commercetools.api.models.cart_discount.CartDiscountUpdateAction;
import com.commercetools.api.models.cart_discount.CartDiscountUpdateBuilder;
import com.commercetools.api.predicates.query.cart_discount.CartDiscountQueryBuilderDsl;
import com.commercetools.sync.cartdiscounts.CartDiscountSyncOptions;
import com.commercetools.sync.services.CartDiscountService;
import io.vrap.rmf.base.client.ApiHttpResponse;
Expand All @@ -31,6 +32,7 @@ public class CartDiscountServiceImpl
CartDiscountPagedQueryResponse,
ByProjectKeyCartDiscountsKeyByKeyGet,
CartDiscount,
CartDiscountQueryBuilderDsl,
ByProjectKeyCartDiscountsPost>
implements CartDiscountService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.category.CategoryPagedQueryResponse;
import com.commercetools.api.models.category.CategoryUpdateAction;
import com.commercetools.api.models.category.CategoryUpdateBuilder;
import com.commercetools.api.predicates.query.category.CategoryQueryBuilderDsl;
import com.commercetools.sync.categories.CategorySyncOptions;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.CategoryService;
Expand All @@ -35,6 +36,7 @@ public final class CategoryServiceImpl
CategoryPagedQueryResponse,
ByProjectKeyCategoriesKeyByKeyGet,
Category,
CategoryQueryBuilderDsl,
ByProjectKeyCategoriesPost>
implements CategoryService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.commercetools.api.models.channel.ChannelDraftBuilder;
import com.commercetools.api.models.channel.ChannelPagedQueryResponse;
import com.commercetools.api.models.channel.ChannelRoleEnum;
import com.commercetools.api.predicates.query.channel.ChannelQueryBuilderDsl;
import com.commercetools.sync.commons.BaseSyncOptions;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.ChannelService;
Expand All @@ -28,6 +29,7 @@ public final class ChannelServiceImpl
ChannelPagedQueryResponse,
ByProjectKeyChannelsByIDGet,
Channel,
ChannelQueryBuilderDsl,
ByProjectKeyChannelsPost>
implements ChannelService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.commercetools.api.models.custom_object.CustomObject;
import com.commercetools.api.models.custom_object.CustomObjectDraft;
import com.commercetools.api.models.custom_object.CustomObjectPagedQueryResponse;
import com.commercetools.api.predicates.query.custom_object.CustomObjectQueryBuilderDsl;
import com.commercetools.sync.customobjects.CustomObjectSync;
import com.commercetools.sync.customobjects.CustomObjectSyncOptions;
import com.commercetools.sync.customobjects.helpers.CustomObjectCompositeIdentifier;
Expand All @@ -17,7 +18,6 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

/** Implementation of CustomObjectService interface. */
public class CustomObjectServiceImpl
Expand All @@ -29,17 +29,18 @@ public class CustomObjectServiceImpl
CustomObjectPagedQueryResponse,
ByProjectKeyCustomObjectsByContainerByKeyGet,
CustomObject,
CustomObjectQueryBuilderDsl,
ByProjectKeyCustomObjectsPost>
implements CustomObjectService {

public CustomObjectServiceImpl(@Nonnull final CustomObjectSyncOptions syncOptions) {
super(syncOptions);
}

@NotNull
@Nonnull
@Override
public CompletionStage<Map<String, String>> cacheKeysToIds(
@NotNull final Set<CustomObjectCompositeIdentifier> identifiers) {
@Nonnull final Set<CustomObjectCompositeIdentifier> identifiers) {
/*
* one example representation of the cache:
*
Expand All @@ -57,26 +58,26 @@ public CompletionStage<Map<String, String>> cacheKeysToIds(
});
}

@NotNull
@Nonnull
@Override
public CompletionStage<Optional<String>> fetchCachedCustomObjectId(
@NotNull final CustomObjectCompositeIdentifier identifier) {
@Nonnull final CustomObjectCompositeIdentifier identifier) {
return super.fetchCachedResourceId(
identifier.toString(), this::keyMapper, queryOneIdentifier(identifier));
}

@NotNull
@Nonnull
@Override
public CompletionStage<Set<CustomObject>> fetchMatchingCustomObjects(
@NotNull final Set<CustomObjectCompositeIdentifier> identifiers) {
@Nonnull final Set<CustomObjectCompositeIdentifier> identifiers) {
return super.fetchMatchingResources(
getKeys(identifiers), this::keyMapper, (keysNotCached) -> createQuery(identifiers));
}

@NotNull
@Nonnull
@Override
public CompletionStage<Optional<CustomObject>> fetchCustomObject(
@NotNull final CustomObjectCompositeIdentifier identifier) {
@Nonnull final CustomObjectCompositeIdentifier identifier) {
final ByProjectKeyCustomObjectsByContainerByKeyGet query =
this.syncOptions
.getCtpClient()
Expand All @@ -87,10 +88,10 @@ public CompletionStage<Optional<CustomObject>> fetchCustomObject(
return super.fetchResource(identifier.toString(), query);
}

@NotNull
@Nonnull
@Override
public CompletionStage<Optional<CustomObject>> upsertCustomObject(
@NotNull final CustomObjectDraft customObjectDraft) {
@Nonnull final CustomObjectDraft customObjectDraft) {
return super.createResource(
customObjectDraft,
this::keyMapper,
Expand Down Expand Up @@ -121,11 +122,11 @@ public CompletionStage<Optional<CustomObject>> upsertCustomObject(
@Nonnull
@Override
CompletionStage<Optional<CustomObject>> executeCreateCommand(
@NotNull CustomObjectDraft draft,
@NotNull String key,
@NotNull Function<CustomObject, String> idMapper,
@NotNull Function<CustomObject, CustomObject> resourceMapper,
@NotNull ByProjectKeyCustomObjectsPost createCommand) {
@Nonnull CustomObjectDraft draft,
@Nonnull String key,
@Nonnull Function<CustomObject, String> idMapper,
@Nonnull Function<CustomObject, CustomObject> resourceMapper,
@Nonnull ByProjectKeyCustomObjectsPost createCommand) {
return createCommand
.execute()
.thenApply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.commercetools.api.models.customer_group.CustomerGroup;
import com.commercetools.api.models.customer_group.CustomerGroupDraft;
import com.commercetools.api.models.customer_group.CustomerGroupPagedQueryResponse;
import com.commercetools.api.predicates.query.customer_group.CustomerGroupQueryBuilderDsl;
import com.commercetools.sync.commons.BaseSyncOptions;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.CustomerGroupService;
Expand All @@ -27,6 +28,7 @@ public final class CustomerGroupServiceImpl
CustomerGroupPagedQueryResponse,
ByProjectKeyCustomerGroupsKeyByKeyGet,
CustomerGroup,
CustomerGroupQueryBuilderDsl,
ByProjectKeyCustomerGroupsPost>
implements CustomerGroupService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.commercetools.api.models.customer.CustomerSignInResult;
import com.commercetools.api.models.customer.CustomerUpdateAction;
import com.commercetools.api.models.customer.CustomerUpdateBuilder;
import com.commercetools.api.predicates.query.customer.CustomerQueryBuilderDsl;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.customers.CustomerSyncOptions;
import com.commercetools.sync.services.CustomerService;
Expand All @@ -34,6 +35,7 @@ public final class CustomerServiceImpl
CustomerPagedQueryResponse,
ByProjectKeyCustomersKeyByKeyGet,
CustomerSignInResult,
CustomerQueryBuilderDsl,
ByProjectKeyCustomersPost>
implements CustomerService {

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

import com.commercetools.api.client.*;
import com.commercetools.api.models.inventory.*;
import com.commercetools.api.predicates.query.inventory.InventoryEntryQueryBuilderDsl;
import com.commercetools.sync.commons.utils.ChunkUtils;
import com.commercetools.sync.inventories.InventorySyncOptions;
import com.commercetools.sync.inventories.helpers.InventoryEntryIdentifier;
Expand All @@ -28,6 +29,7 @@ public final class InventoryServiceImpl
InventoryPagedQueryResponse,
ByProjectKeyInventoryByIDGet,
InventoryEntry,
InventoryEntryQueryBuilderDsl,
ByProjectKeyInventoryPost>
implements InventoryService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.commercetools.api.models.product.ProductProjectionType;
import com.commercetools.api.models.product.ProductUpdateAction;
import com.commercetools.api.models.product.ProductUpdateBuilder;
import com.commercetools.api.predicates.query.product.ProductProjectionQueryBuilderDsl;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.products.ProductSyncOptions;
import com.commercetools.sync.services.ProductService;
Expand All @@ -35,6 +36,7 @@ public final class ProductServiceImpl
ProductProjectionPagedQueryResponse,
ByProjectKeyProductProjectionsKeyByKeyGet,
Product,
ProductProjectionQueryBuilderDsl,
ByProjectKeyProductsPost>
implements ProductService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.commercetools.api.models.product_type.ProductTypePagedQueryResponse;
import com.commercetools.api.models.product_type.ProductTypeUpdateAction;
import com.commercetools.api.models.product_type.ProductTypeUpdateBuilder;
import com.commercetools.api.predicates.query.product_type.ProductTypeQueryBuilderDsl;
import com.commercetools.sync.commons.BaseSyncOptions;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.products.AttributeMetaData;
Expand All @@ -35,6 +36,7 @@ public final class ProductTypeServiceImpl
ProductTypePagedQueryResponse,
ByProjectKeyProductTypesKeyByKeyGet,
ProductType,
ProductTypeQueryBuilderDsl,
ByProjectKeyProductTypesPost>
implements ProductTypeService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.shopping_list.ShoppingListPagedQueryResponse;
import com.commercetools.api.models.shopping_list.ShoppingListUpdateAction;
import com.commercetools.api.models.shopping_list.ShoppingListUpdateBuilder;
import com.commercetools.api.predicates.query.shopping_list.ShoppingListQueryBuilderDsl;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.ShoppingListService;
import com.commercetools.sync.shoppinglists.ShoppingListSyncOptions;
Expand All @@ -34,6 +35,7 @@ public final class ShoppingListServiceImpl
ShoppingListPagedQueryResponse,
ByProjectKeyShoppingListsKeyByKeyGet,
ShoppingList,
ShoppingListQueryBuilderDsl,
ByProjectKeyShoppingListsPost>
implements ShoppingListService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.state.StatePagedQueryResponse;
import com.commercetools.api.models.state.StateUpdateAction;
import com.commercetools.api.models.state.StateUpdateBuilder;
import com.commercetools.api.predicates.query.state.StateQueryBuilderDsl;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.StateService;
import com.commercetools.sync.states.StateSyncOptions;
Expand All @@ -34,6 +35,7 @@ public final class StateServiceImpl
StatePagedQueryResponse,
ByProjectKeyStatesKeyByKeyGet,
State,
StateQueryBuilderDsl,
ByProjectKeyStatesPost>
implements StateService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.tax_category.TaxCategoryPagedQueryResponse;
import com.commercetools.api.models.tax_category.TaxCategoryUpdateAction;
import com.commercetools.api.models.tax_category.TaxCategoryUpdateBuilder;
import com.commercetools.api.predicates.query.tax_category.TaxCategoryQueryBuilderDsl;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.TaxCategoryService;
import com.commercetools.sync.taxcategories.TaxCategorySyncOptions;
Expand All @@ -34,6 +35,7 @@ public final class TaxCategoryServiceImpl
TaxCategoryPagedQueryResponse,
ByProjectKeyTaxCategoriesKeyByKeyGet,
TaxCategory,
TaxCategoryQueryBuilderDsl,
ByProjectKeyTaxCategoriesPost>
implements TaxCategoryService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.commercetools.api.models.type.TypePagedQueryResponse;
import com.commercetools.api.models.type.TypeUpdateAction;
import com.commercetools.api.models.type.TypeUpdateBuilder;
import com.commercetools.api.predicates.query.type.TypeQueryBuilderDsl;
import com.commercetools.sync.commons.BaseSyncOptions;
import com.commercetools.sync.commons.models.GraphQlQueryResource;
import com.commercetools.sync.services.TypeService;
Expand All @@ -30,6 +31,7 @@ public final class TypeServiceImpl
TypePagedQueryResponse,
ByProjectKeyTypesKeyByKeyGet,
Type,
TypeQueryBuilderDsl,
ByProjectKeyTypesPost>
implements TypeService {

Expand Down

0 comments on commit f7ff693

Please sign in to comment.