Search in sources :

Example 1 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer in project commercetools-project-sync by commercetools.

the class ShoppingListSyncer method of.

public static ShoppingListSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
    final QuadConsumer<SyncException, Optional<ShoppingListDraft>, Optional<ShoppingList>, List<UpdateAction<ShoppingList>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "shoppingList", exception, oldResource.map(ShoppingList::getKey).orElse(IDENTIFIER_NOT_PRESENT), updateActions);
    final TriConsumer<SyncException, Optional<ShoppingListDraft>, Optional<ShoppingList>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "shoppingList", exception, oldResource.map(ShoppingList::getKey).orElse(IDENTIFIER_NOT_PRESENT));
    final ShoppingListSyncOptions shoppingListSyncOptions = ShoppingListSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final ShoppingListSync shoppingListSync = new ShoppingListSync(shoppingListSyncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new ShoppingListSyncer(shoppingListSync, sourceClient, targetClient, customObjectService, clock);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException) ShoppingListSyncOptions(com.commercetools.sync.shoppinglists.ShoppingListSyncOptions) LoggerFactory(org.slf4j.LoggerFactory) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) ShoppingList(io.sphere.sdk.shoppinglists.ShoppingList) ShoppingListQuery(io.sphere.sdk.shoppinglists.queries.ShoppingListQuery) ShoppingListSyncOptionsBuilder(com.commercetools.sync.shoppinglists.ShoppingListSyncOptionsBuilder) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) SphereClient(io.sphere.sdk.client.SphereClient) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) Nonnull(javax.annotation.Nonnull) SyncUtils.logErrorCallback(com.commercetools.project.sync.util.SyncUtils.logErrorCallback) Logger(org.slf4j.Logger) ShoppingListSync(com.commercetools.sync.shoppinglists.ShoppingListSync) ShoppingListSyncStatistics(com.commercetools.sync.shoppinglists.helpers.ShoppingListSyncStatistics) IDENTIFIER_NOT_PRESENT(com.commercetools.project.sync.util.SyncUtils.IDENTIFIER_NOT_PRESENT) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) ShoppingListTransformUtils.toShoppingListDrafts(com.commercetools.sync.shoppinglists.utils.ShoppingListTransformUtils.toShoppingListDrafts) ShoppingListReferenceResolutionUtils.buildShoppingListQuery(com.commercetools.sync.shoppinglists.utils.ShoppingListReferenceResolutionUtils.buildShoppingListQuery) ShoppingListDraft(io.sphere.sdk.shoppinglists.ShoppingListDraft) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Syncer(com.commercetools.project.sync.Syncer) Clock(java.time.Clock) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) Optional(java.util.Optional) ShoppingList(io.sphere.sdk.shoppinglists.ShoppingList) ShoppingListSync(com.commercetools.sync.shoppinglists.ShoppingListSync) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) ShoppingListSyncOptions(com.commercetools.sync.shoppinglists.ShoppingListSyncOptions) ShoppingList(io.sphere.sdk.shoppinglists.ShoppingList) List(java.util.List) SyncException(com.commercetools.sync.commons.exceptions.SyncException)

Example 2 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer in project commercetools-project-sync by commercetools.

the class CartDiscountSyncer method of.

@Nonnull
public static CartDiscountSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
    final QuadConsumer<SyncException, Optional<CartDiscountDraft>, Optional<CartDiscount>, List<UpdateAction<CartDiscount>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "cart discount", exception, oldResource, updateActions);
    final TriConsumer<SyncException, Optional<CartDiscountDraft>, Optional<CartDiscount>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "cart discount", exception, oldResource);
    final CartDiscountSyncOptions syncOptions = CartDiscountSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final CartDiscountSync cartDiscountSync = new CartDiscountSync(syncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new CartDiscountSyncer(cartDiscountSync, sourceClient, targetClient, customObjectService, clock);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException) CartDiscount(io.sphere.sdk.cartdiscounts.CartDiscount) LoggerFactory(org.slf4j.LoggerFactory) UpdateAction(io.sphere.sdk.commands.UpdateAction) CartDiscountSyncOptionsBuilder(com.commercetools.sync.cartdiscounts.CartDiscountSyncOptionsBuilder) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) CartDiscountQuery(io.sphere.sdk.cartdiscounts.queries.CartDiscountQuery) CartDiscountTransformUtils.toCartDiscountDrafts(com.commercetools.sync.cartdiscounts.utils.CartDiscountTransformUtils.toCartDiscountDrafts) CartDiscountSyncOptions(com.commercetools.sync.cartdiscounts.CartDiscountSyncOptions) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) CartDiscountSyncStatistics(com.commercetools.sync.cartdiscounts.helpers.CartDiscountSyncStatistics) SphereClient(io.sphere.sdk.client.SphereClient) CartDiscountSync(com.commercetools.sync.cartdiscounts.CartDiscountSync) CartDiscountDraft(io.sphere.sdk.cartdiscounts.CartDiscountDraft) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) Nonnull(javax.annotation.Nonnull) SyncUtils.logErrorCallback(com.commercetools.project.sync.util.SyncUtils.logErrorCallback) Logger(org.slf4j.Logger) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Syncer(com.commercetools.project.sync.Syncer) Clock(java.time.Clock) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) CartDiscountSync(com.commercetools.sync.cartdiscounts.CartDiscountSync) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) List(java.util.List) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CartDiscount(io.sphere.sdk.cartdiscounts.CartDiscount) CartDiscountSyncOptions(com.commercetools.sync.cartdiscounts.CartDiscountSyncOptions) Nonnull(javax.annotation.Nonnull)

Example 3 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer in project commercetools-sync-java by commercetools.

the class CategoryUpdateActionUtilsTest method buildChangeOrderHintUpdateAction_WithNullValues_ShouldNotBuildUpdateActionAndCallCallback.

@Test
void buildChangeOrderHintUpdateAction_WithNullValues_ShouldNotBuildUpdateActionAndCallCallback() {
    when(MOCK_OLD_CATEGORY.getId()).thenReturn("oldCatId");
    final CategoryDraft newCategory = mock(CategoryDraft.class);
    when(newCategory.getOrderHint()).thenReturn(null);
    final ArrayList<Object> callBackResponse = new ArrayList<>();
    final TriConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>> updateActionWarningCallBack = (exception, newResource, oldResource) -> callBackResponse.add(exception.getMessage());
    final CategorySyncOptions categorySyncOptions = CategorySyncOptionsBuilder.of(CTP_CLIENT).warningCallback(updateActionWarningCallBack).build();
    final Optional<UpdateAction<Category>> changeOrderHintUpdateAction = buildChangeOrderHintUpdateAction(MOCK_OLD_CATEGORY, newCategory, categorySyncOptions);
    assertThat(changeOrderHintUpdateAction).isNotNull();
    assertThat(changeOrderHintUpdateAction).isNotPresent();
    assertThat(callBackResponse).hasSize(1);
    assertThat(callBackResponse.get(0)).isEqualTo("Cannot unset 'orderHint' field of category with id 'oldCatId'.");
}
Also used : CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) SetExternalId(io.sphere.sdk.categories.commands.updateactions.SetExternalId) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SetDescription(io.sphere.sdk.categories.commands.updateactions.SetDescription) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategorySyncMockUtils.getMockCategory(com.commercetools.sync.categories.CategorySyncMockUtils.getMockCategory) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ChangeName(io.sphere.sdk.categories.commands.updateactions.ChangeName) SetMetaDescription(io.sphere.sdk.categories.commands.updateactions.SetMetaDescription) SetMetaKeywords(io.sphere.sdk.categories.commands.updateactions.SetMetaKeywords) ArrayList(java.util.ArrayList) SetMetaTitle(io.sphere.sdk.categories.commands.updateactions.SetMetaTitle) Locale(java.util.Locale) SphereClient(io.sphere.sdk.client.SphereClient) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) Category(io.sphere.sdk.categories.Category) ChangeOrderHint(io.sphere.sdk.categories.commands.updateactions.ChangeOrderHint) Mockito.when(org.mockito.Mockito.when) CategorySyncOptionsBuilder(com.commercetools.sync.categories.CategorySyncOptionsBuilder) ChangeSlug(io.sphere.sdk.categories.commands.updateactions.ChangeSlug) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) Test(org.junit.jupiter.api.Test) LocalizedString(io.sphere.sdk.models.LocalizedString) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CATEGORY_KEY_1_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.CATEGORY_KEY_1_RESOURCE_PATH) Optional(java.util.Optional) ChangeParent(io.sphere.sdk.categories.commands.updateactions.ChangeParent) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) Mockito.mock(org.mockito.Mockito.mock) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) Optional(java.util.Optional) CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ArrayList(java.util.ArrayList) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Test(org.junit.jupiter.api.Test)

Example 4 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer in project commercetools-sync-java by commercetools.

the class CategoryUpdateActionUtilsTest method buildChangeParentUpdateAction_WithBothNullValues_ShouldNotBuildUpdateActionAndNotCallCallback.

@Test
void buildChangeParentUpdateAction_WithBothNullValues_ShouldNotBuildUpdateActionAndNotCallCallback() {
    when(MOCK_OLD_CATEGORY.getId()).thenReturn("oldCatId");
    when(MOCK_OLD_CATEGORY.getParent()).thenReturn(null);
    final CategoryDraft newCategory = mock(CategoryDraft.class);
    when(newCategory.getParent()).thenReturn(null);
    final ArrayList<Object> callBackResponse = new ArrayList<>();
    final TriConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>> updateActionWarningCallBack = (exception, newResource, oldResource) -> callBackResponse.add(exception.getMessage());
    final CategorySyncOptions categorySyncOptions = CategorySyncOptionsBuilder.of(CTP_CLIENT).warningCallback(updateActionWarningCallBack).build();
    final Optional<UpdateAction<Category>> changeParentUpdateAction = buildChangeParentUpdateAction(MOCK_OLD_CATEGORY, newCategory, categorySyncOptions);
    assertThat(changeParentUpdateAction).isNotNull();
    assertThat(changeParentUpdateAction).isNotPresent();
    assertThat(callBackResponse).isEmpty();
}
Also used : CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) SetExternalId(io.sphere.sdk.categories.commands.updateactions.SetExternalId) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SetDescription(io.sphere.sdk.categories.commands.updateactions.SetDescription) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategorySyncMockUtils.getMockCategory(com.commercetools.sync.categories.CategorySyncMockUtils.getMockCategory) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ChangeName(io.sphere.sdk.categories.commands.updateactions.ChangeName) SetMetaDescription(io.sphere.sdk.categories.commands.updateactions.SetMetaDescription) SetMetaKeywords(io.sphere.sdk.categories.commands.updateactions.SetMetaKeywords) ArrayList(java.util.ArrayList) SetMetaTitle(io.sphere.sdk.categories.commands.updateactions.SetMetaTitle) Locale(java.util.Locale) SphereClient(io.sphere.sdk.client.SphereClient) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) Category(io.sphere.sdk.categories.Category) ChangeOrderHint(io.sphere.sdk.categories.commands.updateactions.ChangeOrderHint) Mockito.when(org.mockito.Mockito.when) CategorySyncOptionsBuilder(com.commercetools.sync.categories.CategorySyncOptionsBuilder) ChangeSlug(io.sphere.sdk.categories.commands.updateactions.ChangeSlug) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) Test(org.junit.jupiter.api.Test) LocalizedString(io.sphere.sdk.models.LocalizedString) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CATEGORY_KEY_1_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.CATEGORY_KEY_1_RESOURCE_PATH) Optional(java.util.Optional) ChangeParent(io.sphere.sdk.categories.commands.updateactions.ChangeParent) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) Mockito.mock(org.mockito.Mockito.mock) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) Optional(java.util.Optional) CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ArrayList(java.util.ArrayList) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Test(org.junit.jupiter.api.Test)

Example 5 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer in project commercetools-sync-java by commercetools.

the class CategoryUpdateActionUtilsTest method buildChangeOrderHintUpdateAction_WithBothNullValues_ShouldNotBuildUpdateActionAndNotCallCallback.

@Test
void buildChangeOrderHintUpdateAction_WithBothNullValues_ShouldNotBuildUpdateActionAndNotCallCallback() {
    when(MOCK_OLD_CATEGORY.getId()).thenReturn("oldCatId");
    when(MOCK_OLD_CATEGORY.getOrderHint()).thenReturn(null);
    final CategoryDraft newCategory = mock(CategoryDraft.class);
    when(newCategory.getOrderHint()).thenReturn(null);
    final ArrayList<Object> callBackResponse = new ArrayList<>();
    final TriConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>> updateActionWarningCallBack = (exception, newResource, oldResource) -> callBackResponse.add(exception.getMessage());
    final CategorySyncOptions categorySyncOptions = CategorySyncOptionsBuilder.of(CTP_CLIENT).warningCallback(updateActionWarningCallBack).build();
    final Optional<UpdateAction<Category>> changeOrderHintUpdateAction = buildChangeOrderHintUpdateAction(MOCK_OLD_CATEGORY, newCategory, categorySyncOptions);
    assertThat(changeOrderHintUpdateAction).isNotNull();
    assertThat(changeOrderHintUpdateAction).isNotPresent();
    assertThat(callBackResponse).isEmpty();
}
Also used : CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) SetExternalId(io.sphere.sdk.categories.commands.updateactions.SetExternalId) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SetDescription(io.sphere.sdk.categories.commands.updateactions.SetDescription) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategorySyncMockUtils.getMockCategory(com.commercetools.sync.categories.CategorySyncMockUtils.getMockCategory) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ChangeName(io.sphere.sdk.categories.commands.updateactions.ChangeName) SetMetaDescription(io.sphere.sdk.categories.commands.updateactions.SetMetaDescription) SetMetaKeywords(io.sphere.sdk.categories.commands.updateactions.SetMetaKeywords) ArrayList(java.util.ArrayList) SetMetaTitle(io.sphere.sdk.categories.commands.updateactions.SetMetaTitle) Locale(java.util.Locale) SphereClient(io.sphere.sdk.client.SphereClient) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) Category(io.sphere.sdk.categories.Category) ChangeOrderHint(io.sphere.sdk.categories.commands.updateactions.ChangeOrderHint) Mockito.when(org.mockito.Mockito.when) CategorySyncOptionsBuilder(com.commercetools.sync.categories.CategorySyncOptionsBuilder) ChangeSlug(io.sphere.sdk.categories.commands.updateactions.ChangeSlug) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) Test(org.junit.jupiter.api.Test) LocalizedString(io.sphere.sdk.models.LocalizedString) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CATEGORY_KEY_1_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.CATEGORY_KEY_1_RESOURCE_PATH) Optional(java.util.Optional) ChangeParent(io.sphere.sdk.categories.commands.updateactions.ChangeParent) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) Mockito.mock(org.mockito.Mockito.mock) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) Optional(java.util.Optional) CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaDescriptionUpdateAction) CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaTitleUpdateAction) CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetMetaKeywordsUpdateAction) CategoryUpdateActionUtils.buildChangeNameUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeNameUpdateAction) UpdateAction(io.sphere.sdk.commands.UpdateAction) CategoryUpdateActionUtils.buildChangeParentUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeParentUpdateAction) CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeOrderHintUpdateAction) CategoryUpdateActionUtils.buildSetExternalIdUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetExternalIdUpdateAction) CategoryUpdateActionUtils.buildSetDescriptionUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildSetDescriptionUpdateAction) CategoryUpdateActionUtils.buildChangeSlugUpdateAction(com.commercetools.sync.categories.utils.CategoryUpdateActionUtils.buildChangeSlugUpdateAction) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) ArrayList(java.util.ArrayList) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Test(org.junit.jupiter.api.Test)

Aggregations

SyncException (com.commercetools.sync.commons.exceptions.SyncException)17 TriConsumer (com.commercetools.sync.commons.utils.TriConsumer)17 SphereClient (io.sphere.sdk.client.SphereClient)17 UpdateAction (io.sphere.sdk.commands.UpdateAction)17 Optional (java.util.Optional)17 Syncer (com.commercetools.project.sync.Syncer)11 CustomObjectService (com.commercetools.project.sync.service.CustomObjectService)11 List (java.util.List)11 Nonnull (javax.annotation.Nonnull)11 CustomObjectServiceImpl (com.commercetools.project.sync.service.impl.CustomObjectServiceImpl)9 SyncUtils.logErrorCallback (com.commercetools.project.sync.util.SyncUtils.logErrorCallback)9 SyncUtils.logWarningCallback (com.commercetools.project.sync.util.SyncUtils.logWarningCallback)9 QuadConsumer (com.commercetools.sync.commons.utils.QuadConsumer)9 Clock (java.time.Clock)9 CompletionStage (java.util.concurrent.CompletionStage)9 Logger (org.slf4j.Logger)9 LoggerFactory (org.slf4j.LoggerFactory)9 Category (io.sphere.sdk.categories.Category)7 CategoryDraft (io.sphere.sdk.categories.CategoryDraft)7 LocalizedString (io.sphere.sdk.models.LocalizedString)6