Search in sources :

Example 51 with SyncException

use of com.commercetools.sync.commons.exceptions.SyncException in project commercetools-sync-java by commercetools.

the class TaxCategorySync method fetchAndUpdate.

@Nonnull
private CompletionStage<Optional<TaxCategory>> fetchAndUpdate(@Nonnull final TaxCategory oldTaxCategory, @Nonnull final TaxCategoryDraft newTaxCategory) {
    final String key = oldTaxCategory.getKey();
    return taxCategoryService.fetchTaxCategory(key).handle(ImmutablePair::new).thenCompose(fetchResponse -> {
        final Optional<TaxCategory> fetchedTaxCategoryOptional = fetchResponse.getKey();
        final Throwable exception = fetchResponse.getValue();
        if (exception != null) {
            final String errorMessage = format(TAX_CATEGORY_UPDATE_FAILED, key, "Failed to fetch from CTP while retrying after concurrency modification.");
            handleError(new SyncException(errorMessage, exception), oldTaxCategory, newTaxCategory, null, 1);
            return completedFuture(null);
        }
        return fetchedTaxCategoryOptional.map(fetchedTaxCategory -> buildActionsAndUpdate(fetchedTaxCategory, newTaxCategory)).orElseGet(() -> {
            final String errorMessage = format(TAX_CATEGORY_UPDATE_FAILED, key, "Not found when attempting to fetch while retrying " + "after concurrency modification.");
            handleError(new SyncException(errorMessage), oldTaxCategory, newTaxCategory, null, 1);
            return completedFuture(null);
        });
    });
}
Also used : TaxCategorySyncStatistics(com.commercetools.sync.taxcategories.helpers.TaxCategorySyncStatistics) SyncException(com.commercetools.sync.commons.exceptions.SyncException) TaxCategoryDraft(io.sphere.sdk.taxcategories.TaxCategoryDraft) BaseSync(com.commercetools.sync.commons.BaseSync) CompletableFuture.completedFuture(java.util.concurrent.CompletableFuture.completedFuture) UpdateAction(io.sphere.sdk.commands.UpdateAction) CompletableFuture(java.util.concurrent.CompletableFuture) TaxCategoryBatchValidator(com.commercetools.sync.taxcategories.helpers.TaxCategoryBatchValidator) CompletableFuture.allOf(java.util.concurrent.CompletableFuture.allOf) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) TaxCategoryService(com.commercetools.sync.services.TaxCategoryService) SyncUtils.batchElements(com.commercetools.sync.commons.utils.SyncUtils.batchElements) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) Optional.ofNullable(java.util.Optional.ofNullable) TaxCategorySyncUtils.buildActions(com.commercetools.sync.taxcategories.utils.TaxCategorySyncUtils.buildActions) Set(java.util.Set) String.format(java.lang.String.format) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Function.identity(java.util.function.Function.identity) TaxCategoryServiceImpl(com.commercetools.sync.services.impl.TaxCategoryServiceImpl) Optional(java.util.Optional) TaxCategory(io.sphere.sdk.taxcategories.TaxCategory) TaxCategory(io.sphere.sdk.taxcategories.TaxCategory) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Nonnull(javax.annotation.Nonnull)

Example 52 with SyncException

use of com.commercetools.sync.commons.exceptions.SyncException in project commercetools-sync-java by commercetools.

the class CartDiscountSync method handleError.

/**
 * This method calls the optional error callback specified in the {@code syncOptions} and updates
 * the {@code statistics} instance by incrementing the total number of failed cart discounts to
 * sync.
 *
 * @param errorMessage The error message describing the reason(s) of failure.
 * @param exception The exception that called caused the failure, if any.
 * @param failedTimes The number of times that the failed cart discount statistic counter is
 *     incremented.
 */
private void handleError(@Nonnull final String errorMessage, @Nullable final Throwable exception, final int failedTimes) {
    syncOptions.applyErrorCallback(new SyncException(errorMessage, exception));
    statistics.incrementFailed(failedTimes);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException)

Example 53 with SyncException

use of com.commercetools.sync.commons.exceptions.SyncException in project commercetools-sync-java by commercetools.

the class CategorySync method handleError.

private void handleError(@Nonnull final String errorMessage, @Nullable final Throwable exception, @Nullable final Category oldCategory, @Nullable final CategoryDraft newCategory, @Nullable final List<UpdateAction<Category>> updateActions, final int failedTimes) {
    SyncException syncException = exception != null ? new SyncException(errorMessage, exception) : new SyncException(errorMessage);
    syncOptions.applyErrorCallback(syncException, oldCategory, newCategory, updateActions);
    statistics.incrementFailed(failedTimes);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException)

Example 54 with SyncException

use of com.commercetools.sync.commons.exceptions.SyncException in project commercetools-sync-java by commercetools.

the class ProductSyncWithReferencedProductsInAnyOrderIT method sync_withFailToFetchCustomObject_shouldSyncCorrectly.

@SuppressWarnings("unchecked")
@Test
void sync_withFailToFetchCustomObject_shouldSyncCorrectly() {
    // preparation
    final String productReferenceAttributeName = "product-reference";
    final String parentProductKey = "parent-product-key";
    final AttributeDraft productReferenceAttribute = AttributeDraft.of(productReferenceAttributeName, Reference.of(Product.referenceTypeId(), parentProductKey));
    final ProductDraft childDraft1 = ProductDraftBuilder.of(productType, ofEnglish("foo"), ofEnglish("foo-slug"), ProductVariantDraftBuilder.of().key("foo").sku("foo").attributes(productReferenceAttribute).build()).key(product.getKey()).build();
    final ProductDraft parentDraft = ProductDraftBuilder.of(productType, ofEnglish(parentProductKey), ofEnglish(parentProductKey), ProductVariantDraftBuilder.of().sku(parentProductKey).key(parentProductKey).build()).key(parentProductKey).build();
    final SphereClient ctpClient = spy(CTP_TARGET_CLIENT);
    final BadGatewayException gatewayException = new BadGatewayException("failed to respond.");
    when(ctpClient.execute(any(CustomObjectQuery.class))).thenReturn(CompletableFutureUtils.failed(gatewayException)).thenCallRealMethod();
    syncOptions = ProductSyncOptionsBuilder.of(ctpClient).errorCallback((syncException, draft, product, updateActions) -> collectErrors(syncException.getMessage(), syncException)).beforeUpdateCallback(this::collectActions).build();
    // test
    final ProductSync productSync = new ProductSync(syncOptions);
    final ProductSyncStatistics syncStatistics = productSync.sync(singletonList(childDraft1)).thenCompose(ignoredResult -> productSync.sync(singletonList(parentDraft))).toCompletableFuture().join();
    // assertion
    assertThat(syncStatistics).hasValues(2, 1, 0, 1, 0);
    assertThat(errorCallBackMessages).containsExactly("Failed to fetch ProductDrafts waiting to be resolved with keys '[foo]'.");
    assertThat(errorCallBackExceptions).singleElement(as(THROWABLE)).isExactlyInstanceOf(SyncException.class).hasCauseExactlyInstanceOf(CompletionException.class).hasRootCauseExactlyInstanceOf(BadGatewayException.class);
    assertThat(warningCallBackMessages).isEmpty();
    assertThat(actions).isEmpty();
    final UnresolvedReferencesService<WaitingToBeResolvedProducts> unresolvedReferencesService = new UnresolvedReferencesServiceImpl<>(syncOptions);
    final Set<WaitingToBeResolvedProducts> waitingDrafts = unresolvedReferencesService.fetch(asSet(childDraft1.getKey()), CUSTOM_OBJECT_PRODUCT_CONTAINER_KEY, WaitingToBeResolvedProducts.class).toCompletableFuture().join();
    assertThat(waitingDrafts).containsExactly(new WaitingToBeResolvedProducts(childDraft1, singleton(parentProductKey)));
}
Also used : CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) BeforeEach(org.junit.jupiter.api.BeforeEach) Reference(io.sphere.sdk.models.Reference) PRODUCT_TYPE_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_TYPE_RESOURCE_PATH) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) Collections.singletonList(java.util.Collections.singletonList) ProductITUtils.deleteProductSyncTestData(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteProductSyncTestData) AfterAll(org.junit.jupiter.api.AfterAll) Collections.singleton(java.util.Collections.singleton) BeforeAll(org.junit.jupiter.api.BeforeAll) Arrays.asList(java.util.Arrays.asList) THROWABLE(org.assertj.core.api.InstanceOfAssertFactories.THROWABLE) SphereClient(io.sphere.sdk.client.SphereClient) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) UnresolvedReferencesServiceImpl(com.commercetools.sync.services.impl.UnresolvedReferencesServiceImpl) BadGatewayException(io.sphere.sdk.client.BadGatewayException) CompletionStageUtil.executeBlocking(com.commercetools.tests.utils.CompletionStageUtil.executeBlocking) Collections.emptyList(java.util.Collections.emptyList) SetAttributeInAllVariants(io.sphere.sdk.products.commands.updateactions.SetAttributeInAllVariants) Set(java.util.Set) CompletionException(java.util.concurrent.CompletionException) Product(io.sphere.sdk.products.Product) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) Test(org.junit.jupiter.api.Test) List(java.util.List) LocalizedString.ofEnglish(io.sphere.sdk.models.LocalizedString.ofEnglish) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) ProductSyncOptionsBuilder(com.commercetools.sync.products.ProductSyncOptionsBuilder) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) SphereInternalUtils.asSet(io.sphere.sdk.utils.SphereInternalUtils.asSet) ProductSyncMockUtils.createReferenceObject(com.commercetools.sync.products.ProductSyncMockUtils.createReferenceObject) Optional(java.util.Optional) REFERENCE_TYPE_ID_FIELD(com.commercetools.sync.commons.utils.ResourceIdentifierUtils.REFERENCE_TYPE_ID_FIELD) ProductCreateCommand(io.sphere.sdk.products.commands.ProductCreateCommand) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) ProductSyncOptions(com.commercetools.sync.products.ProductSyncOptions) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CUSTOM_OBJECT_PRODUCT_CONTAINER_KEY(com.commercetools.sync.services.impl.UnresolvedReferencesServiceImpl.CUSTOM_OBJECT_PRODUCT_CONTAINER_KEY) WaitingToBeResolvedProducts(com.commercetools.sync.commons.models.WaitingToBeResolvedProducts) ProductByKeyGet(io.sphere.sdk.products.queries.ProductByKeyGet) ProductType(io.sphere.sdk.producttypes.ProductType) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) ProductITUtils.deleteAllProducts(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteAllProducts) CustomObject(io.sphere.sdk.customobjects.CustomObject) Mockito.spy(org.mockito.Mockito.spy) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) Attribute(io.sphere.sdk.products.attributes.Attribute) Assertions.as(org.assertj.core.api.Assertions.as) ProductSync(com.commercetools.sync.products.ProductSync) UnresolvedReferencesService(com.commercetools.sync.services.UnresolvedReferencesService) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) REFERENCE_ID_FIELD(com.commercetools.sync.commons.utils.ResourceIdentifierUtils.REFERENCE_ID_FIELD) Mockito.when(org.mockito.Mockito.when) AttributeDraft(io.sphere.sdk.products.attributes.AttributeDraft) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) CustomObjectITUtils.deleteWaitingToBeResolvedCustomObjects(com.commercetools.sync.integration.commons.utils.CustomObjectITUtils.deleteWaitingToBeResolvedCustomObjects) WaitingToBeResolved(com.commercetools.sync.commons.models.WaitingToBeResolved) ProductVariantDraftBuilder(io.sphere.sdk.products.ProductVariantDraftBuilder) AttributeDraft(io.sphere.sdk.products.attributes.AttributeDraft) ProductSync(com.commercetools.sync.products.ProductSync) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) UnresolvedReferencesServiceImpl(com.commercetools.sync.services.impl.UnresolvedReferencesServiceImpl) ProductDraft(io.sphere.sdk.products.ProductDraft) SphereClient(io.sphere.sdk.client.SphereClient) CompletionException(java.util.concurrent.CompletionException) WaitingToBeResolvedProducts(com.commercetools.sync.commons.models.WaitingToBeResolvedProducts) BadGatewayException(io.sphere.sdk.client.BadGatewayException) Test(org.junit.jupiter.api.Test)

Example 55 with SyncException

use of com.commercetools.sync.commons.exceptions.SyncException in project commercetools-sync-java by commercetools.

the class ProductSyncIT method sync_withMissingPriceChannel_shouldCreateProductDistributionPriceChannel.

@Test
void sync_withMissingPriceChannel_shouldCreateProductDistributionPriceChannel() {
    PriceDraftDsl priceDraftWithMissingChannelRef = PriceDraftBuilder.of(MoneyImpl.of("20", "EUR")).channel(ResourceIdentifier.ofKey("missingKey")).build();
    ProductVariantDraftDsl masterVariantDraft = ProductVariantDraftBuilder.of(ProductVariantDraftDsl.of().withKey("v2").withSku("1065833").withPrices(Collections.singletonList(priceDraftWithMissingChannelRef))).build();
    final ProductDraft productDraft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey())).masterVariant(masterVariantDraft).taxCategory(null).state(null).build();
    final TriConsumer<SyncException, Optional<ProductDraft>, Optional<ProductProjection>> warningCallBack = (exception, newResource, oldResource) -> warningCallBackMessages.add(exception.getMessage());
    ProductSyncOptions syncOptions = ProductSyncOptionsBuilder.of(CTP_TARGET_CLIENT).errorCallback((exception, oldResource, newResource, actions) -> collectErrors(exception.getMessage(), exception.getCause())).warningCallback(warningCallBack).ensurePriceChannels(true).build();
    final ProductSync productSync = new ProductSync(syncOptions);
    final ProductSyncStatistics syncStatistics = executeBlocking(productSync.sync(singletonList(productDraft)));
    assertThat(syncStatistics).hasValues(1, 1, 0, 0, 0);
    assertThat(errorCallBackExceptions).isEmpty();
    assertThat(errorCallBackMessages).isEmpty();
    assertThat(warningCallBackMessages).isEmpty();
    Product productFromTargetProject = executeBlocking(CTP_TARGET_CLIENT.execute(ProductByKeyGet.of(productDraft.getKey())));
    List<Price> prices = productFromTargetProject.getMasterData().getStaged().getMasterVariant().getPrices();
    assertThat(prices.size()).isEqualTo(1);
    Channel channel = executeBlocking(CTP_TARGET_CLIENT.execute(ChannelByIdGet.of(Objects.requireNonNull(Objects.requireNonNull(prices.get(0).getChannel()).getId()))));
    assertThat(channel.getRoles()).containsOnly(ChannelRole.PRODUCT_DISTRIBUTION);
}
Also used : ProductProjectionQuery(io.sphere.sdk.products.queries.ProductProjectionQuery) BeforeEach(org.junit.jupiter.api.BeforeEach) Reference(io.sphere.sdk.models.Reference) ProductVariantDraft(io.sphere.sdk.products.ProductVariantDraft) PRODUCT_TYPE_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_TYPE_RESOURCE_PATH) SyncException(com.commercetools.sync.commons.exceptions.SyncException) MoneyImpl(io.sphere.sdk.utils.MoneyImpl) StateITUtils.createState(com.commercetools.sync.integration.commons.utils.StateITUtils.createState) CategoryITUtils.getCategoryDrafts(com.commercetools.sync.integration.commons.utils.CategoryITUtils.getCategoryDrafts) TaxCategoryITUtils.createTaxCategory(com.commercetools.sync.integration.commons.utils.TaxCategoryITUtils.createTaxCategory) Channel(io.sphere.sdk.channels.Channel) Collections.singletonList(java.util.Collections.singletonList) AfterAll(org.junit.jupiter.api.AfterAll) BeforeAll(org.junit.jupiter.api.BeforeAll) Arrays.asList(java.util.Arrays.asList) OLD_CATEGORY_CUSTOM_TYPE_NAME(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_NAME) SphereClient(io.sphere.sdk.client.SphereClient) StateType(io.sphere.sdk.states.StateType) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) ProductProjection(io.sphere.sdk.products.ProductProjection) PRODUCT_KEY_1_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_1_RESOURCE_PATH) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) BadGatewayException(io.sphere.sdk.client.BadGatewayException) SetAttributeInAllVariants(io.sphere.sdk.products.commands.updateactions.SetAttributeInAllVariants) Price(io.sphere.sdk.products.Price) Set(java.util.Set) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) ProductSyncOptionsBuilder(com.commercetools.sync.products.ProductSyncOptionsBuilder) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) ProductUpdateCommand(io.sphere.sdk.products.commands.ProductUpdateCommand) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) TaxCategory(io.sphere.sdk.taxcategories.TaxCategory) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) ProductITUtils.deleteAllProducts(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteAllProducts) Mockito.spy(org.mockito.Mockito.spy) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) ArrayList(java.util.ArrayList) PriceDraftBuilder(io.sphere.sdk.products.PriceDraftBuilder) CategoryITUtils.replaceCategoryOrderHintCategoryIdsWithKeys(com.commercetools.sync.integration.commons.utils.CategoryITUtils.replaceCategoryOrderHintCategoryIdsWithKeys) ProductSync(com.commercetools.sync.products.ProductSync) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) ChannelByIdGet(io.sphere.sdk.channels.queries.ChannelByIdGet) PRODUCT_KEY_1_CHANGED_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_1_CHANGED_RESOURCE_PATH) CategoryITUtils.geResourceIdentifiersWithKeys(com.commercetools.sync.integration.commons.utils.CategoryITUtils.geResourceIdentifiersWithKeys) FAILED_TO_BUILD_ATTRIBUTE_UPDATE_ACTION(com.commercetools.sync.products.utils.ProductVariantUpdateActionUtils.FAILED_TO_BUILD_ATTRIBUTE_UPDATE_ACTION) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) ConcurrentModificationException(io.sphere.sdk.client.ConcurrentModificationException) RemoveFromCategory(io.sphere.sdk.products.commands.updateactions.RemoveFromCategory) ProductVariantDraftBuilder(io.sphere.sdk.products.ProductVariantDraftBuilder) PRODUCT_KEY_2_RESOURCE_PATH(com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_2_RESOURCE_PATH) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductSyncMockUtils.createProductDraftBuilder(com.commercetools.sync.products.ProductSyncMockUtils.createProductDraftBuilder) UpdateAction(io.sphere.sdk.commands.UpdateAction) ProductITUtils.deleteProductSyncTestData(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteProductSyncTestData) SetTaxCategory(io.sphere.sdk.products.commands.updateactions.SetTaxCategory) Locale(java.util.Locale) ProductDraft(io.sphere.sdk.products.ProductDraft) OLD_CATEGORY_CUSTOM_TYPE_KEY(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_KEY) CompletionStageUtil.executeBlocking(com.commercetools.tests.utils.CompletionStageUtil.executeBlocking) Collections.emptyList(java.util.Collections.emptyList) Category(io.sphere.sdk.categories.Category) Product(io.sphere.sdk.products.Product) CategoryITUtils.getReferencesWithIds(com.commercetools.sync.integration.commons.utils.CategoryITUtils.getReferencesWithIds) State(io.sphere.sdk.states.State) String.format(java.lang.String.format) Objects(java.util.Objects) Test(org.junit.jupiter.api.Test) LocalizedString(io.sphere.sdk.models.LocalizedString) List(java.util.List) Publish(io.sphere.sdk.products.commands.updateactions.Publish) ProductSyncMockUtils.createProductDraft(com.commercetools.sync.products.ProductSyncMockUtils.createProductDraft) Optional(java.util.Optional) ProductVariantDraftDsl(io.sphere.sdk.products.ProductVariantDraftDsl) ProductCreateCommand(io.sphere.sdk.products.commands.ProductCreateCommand) ProductSyncOptions(com.commercetools.sync.products.ProductSyncOptions) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CategoryITUtils.createCategories(com.commercetools.sync.integration.commons.utils.CategoryITUtils.createCategories) ProductByKeyGet(io.sphere.sdk.products.queries.ProductByKeyGet) CategoryOrderHints(io.sphere.sdk.products.CategoryOrderHints) ProductType(io.sphere.sdk.producttypes.ProductType) ProductQuery(io.sphere.sdk.products.queries.ProductQuery) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) SetAttribute(io.sphere.sdk.products.commands.updateactions.SetAttribute) Nonnull(javax.annotation.Nonnull) ChannelRole(io.sphere.sdk.channels.ChannelRole) PriceDraftDsl(io.sphere.sdk.products.PriceDraftDsl) QueryPredicate(io.sphere.sdk.queries.QueryPredicate) ATTRIBUTE_NOT_IN_ATTRIBUTE_METADATA(com.commercetools.sync.products.utils.ProductVariantAttributeUpdateActionUtils.ATTRIBUTE_NOT_IN_ATTRIBUTE_METADATA) CategoryITUtils.createCategoriesCustomType(com.commercetools.sync.integration.commons.utils.CategoryITUtils.createCategoriesCustomType) Mockito.when(org.mockito.Mockito.when) Collectors.toList(java.util.stream.Collectors.toList) AttributeDraft(io.sphere.sdk.products.attributes.AttributeDraft) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) ProductSyncMockUtils.createRandomCategoryOrderHints(com.commercetools.sync.products.ProductSyncMockUtils.createRandomCategoryOrderHints) Collections(java.util.Collections) Optional(java.util.Optional) ProductVariantDraftDsl(io.sphere.sdk.products.ProductVariantDraftDsl) Channel(io.sphere.sdk.channels.Channel) Product(io.sphere.sdk.products.Product) ProductSync(com.commercetools.sync.products.ProductSync) SyncException(com.commercetools.sync.commons.exceptions.SyncException) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) PriceDraftDsl(io.sphere.sdk.products.PriceDraftDsl) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductSyncMockUtils.createProductDraft(com.commercetools.sync.products.ProductSyncMockUtils.createProductDraft) Price(io.sphere.sdk.products.Price) ProductSyncOptions(com.commercetools.sync.products.ProductSyncOptions) Test(org.junit.jupiter.api.Test)

Aggregations

SyncException (com.commercetools.sync.commons.exceptions.SyncException)74 Nonnull (javax.annotation.Nonnull)47 UpdateAction (io.sphere.sdk.commands.UpdateAction)45 Optional (java.util.Optional)39 List (java.util.List)37 CompletionStage (java.util.concurrent.CompletionStage)25 SphereClient (io.sphere.sdk.client.SphereClient)24 String.format (java.lang.String.format)23 ArrayList (java.util.ArrayList)21 Map (java.util.Map)20 Test (org.junit.jupiter.api.Test)20 TriConsumer (com.commercetools.sync.commons.utils.TriConsumer)18 Set (java.util.Set)17 CompletableFuture (java.util.concurrent.CompletableFuture)17 Nullable (javax.annotation.Nullable)16 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)14 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)14 Category (io.sphere.sdk.categories.Category)13 BaseSync (com.commercetools.sync.commons.BaseSync)12 QuadConsumer (com.commercetools.sync.commons.utils.QuadConsumer)12