Search in sources :

Example 11 with TriConsumer

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

the class CategorySyncer method of.

@Nonnull
public static CategorySyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
    final QuadConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>, List<UpdateAction<Category>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "category", exception, oldResource, updateActions);
    final TriConsumer<SyncException, Optional<CategoryDraft>, Optional<Category>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "category", exception, oldResource);
    final CategorySyncOptions syncOptions = CategorySyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final CategorySync categorySync = new CategorySync(syncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new CategorySyncer(categorySync, sourceClient, targetClient, customObjectService, clock);
}
Also used : CategorySyncStatistics(com.commercetools.sync.categories.helpers.CategorySyncStatistics) SyncException(com.commercetools.sync.commons.exceptions.SyncException) LoggerFactory(org.slf4j.LoggerFactory) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) CategoryDraft(io.sphere.sdk.categories.CategoryDraft) CategoryQuery(io.sphere.sdk.categories.queries.CategoryQuery) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) SphereClient(io.sphere.sdk.client.SphereClient) CategorySync(com.commercetools.sync.categories.CategorySync) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) Nonnull(javax.annotation.Nonnull) SyncUtils.logErrorCallback(com.commercetools.project.sync.util.SyncUtils.logErrorCallback) Logger(org.slf4j.Logger) Category(io.sphere.sdk.categories.Category) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) CategorySyncOptionsBuilder(com.commercetools.sync.categories.CategorySyncOptionsBuilder) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Syncer(com.commercetools.project.sync.Syncer) CategoryTransformUtils.toCategoryDrafts(com.commercetools.sync.categories.utils.CategoryTransformUtils.toCategoryDrafts) Clock(java.time.Clock) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) Category(io.sphere.sdk.categories.Category) Optional(java.util.Optional) CategorySyncOptions(com.commercetools.sync.categories.CategorySyncOptions) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) List(java.util.List) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CategorySync(com.commercetools.sync.categories.CategorySync) Nonnull(javax.annotation.Nonnull)

Example 12 with TriConsumer

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

the class CustomerSyncer method of.

public static CustomerSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
    final QuadConsumer<SyncException, Optional<CustomerDraft>, Optional<Customer>, List<UpdateAction<Customer>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "customer", exception, oldResource, updateActions);
    final TriConsumer<SyncException, Optional<CustomerDraft>, Optional<Customer>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "customer", exception, oldResource);
    final CustomerSyncOptions customerSyncOptions = CustomerSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final CustomerSync customerSync = new CustomerSync(customerSyncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new CustomerSyncer(customerSync, sourceClient, targetClient, customObjectService, clock);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException) LoggerFactory(org.slf4j.LoggerFactory) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) CustomerSyncStatistics(com.commercetools.sync.customers.helpers.CustomerSyncStatistics) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) CustomerQuery(io.sphere.sdk.customers.queries.CustomerQuery) CustomerTransformUtils.toCustomerDrafts(com.commercetools.sync.customers.utils.CustomerTransformUtils.toCustomerDrafts) 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) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) CustomerSync(com.commercetools.sync.customers.CustomerSync) Customer(io.sphere.sdk.customers.Customer) CustomerSyncOptionsBuilder(com.commercetools.sync.customers.CustomerSyncOptionsBuilder) List(java.util.List) CustomerSyncOptions(com.commercetools.sync.customers.CustomerSyncOptions) 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) CustomerDraft(io.sphere.sdk.customers.CustomerDraft) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) Optional(java.util.Optional) CustomerSyncOptions(com.commercetools.sync.customers.CustomerSyncOptions) Customer(io.sphere.sdk.customers.Customer) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) List(java.util.List) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CustomerSync(com.commercetools.sync.customers.CustomerSync)

Example 13 with TriConsumer

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

the class CustomObjectSyncer method of.

@Nonnull
public static CustomObjectSyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock, @Nullable final String runnerName, final boolean isSyncProjectSyncCustomObjects) {
    final QuadConsumer<SyncException, Optional<CustomObjectDraft<JsonNode>>, Optional<CustomObject<JsonNode>>, List<UpdateAction<CustomObject<JsonNode>>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> {
        final String resourceIdentifier = getCustomObjectResourceIdentifier(oldResource);
        updateActions = updateActions == null ? Collections.emptyList() : updateActions;
        logErrorCallback(LOGGER, "customObject", exception, resourceIdentifier, updateActions);
    };
    final TriConsumer<SyncException, Optional<CustomObjectDraft<JsonNode>>, Optional<CustomObject<JsonNode>>> logWarningCallback = (exception, newResourceDraft, oldResource) -> {
        final String resourceIdentifier = getCustomObjectResourceIdentifier(oldResource);
        logWarningCallback(LOGGER, "customObject", exception, resourceIdentifier);
    };
    final CustomObjectSyncOptions syncOptions = CustomObjectSyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final CustomObjectSync customObjectSyncer = new CustomObjectSync(syncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new CustomObjectSyncer(customObjectSyncer, sourceClient, targetClient, customObjectService, clock, runnerName, isSyncProjectSyncCustomObjects);
}
Also used : CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CustomObjectSyncOptions(com.commercetools.sync.customobjects.CustomObjectSyncOptions) CustomObject(io.sphere.sdk.customobjects.CustomObject) LoggerFactory(org.slf4j.LoggerFactory) UpdateAction(io.sphere.sdk.commands.UpdateAction) CompletableFuture(java.util.concurrent.CompletableFuture) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) SphereClient(io.sphere.sdk.client.SphereClient) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) JsonNode(com.fasterxml.jackson.databind.JsonNode) CustomObjectCompositeIdentifier(com.commercetools.sync.customobjects.helpers.CustomObjectCompositeIdentifier) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) SyncUtils.logErrorCallback(com.commercetools.project.sync.util.SyncUtils.logErrorCallback) SyncModuleOption(com.commercetools.project.sync.SyncModuleOption) Logger(org.slf4j.Logger) CustomObjectDraft(io.sphere.sdk.customobjects.CustomObjectDraft) IDENTIFIER_NOT_PRESENT(com.commercetools.project.sync.util.SyncUtils.IDENTIFIER_NOT_PRESENT) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) CustomObjectSyncStatistics(com.commercetools.sync.customobjects.helpers.CustomObjectSyncStatistics) Collectors(java.util.stream.Collectors) CustomObjectSyncOptionsBuilder(com.commercetools.sync.customobjects.CustomObjectSyncOptionsBuilder) CustomObjectSync(com.commercetools.sync.customobjects.CustomObjectSync) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) Stream(java.util.stream.Stream) Syncer(com.commercetools.project.sync.Syncer) Clock(java.time.Clock) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) Collections(java.util.Collections) SyncUtils(com.commercetools.project.sync.util.SyncUtils) CustomObject(io.sphere.sdk.customobjects.CustomObject) Optional(java.util.Optional) JsonNode(com.fasterxml.jackson.databind.JsonNode) SyncException(com.commercetools.sync.commons.exceptions.SyncException) CustomObjectSync(com.commercetools.sync.customobjects.CustomObjectSync) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) CustomObjectSyncOptions(com.commercetools.sync.customobjects.CustomObjectSyncOptions) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) List(java.util.List) Nonnull(javax.annotation.Nonnull)

Example 14 with TriConsumer

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

the class InventoryEntrySyncer method of.

public static InventoryEntrySyncer of(@Nonnull final SphereClient sourceClient, @Nonnull final SphereClient targetClient, @Nonnull final Clock clock) {
    final QuadConsumer<SyncException, Optional<InventoryEntryDraft>, Optional<InventoryEntry>, List<UpdateAction<InventoryEntry>>> logErrorCallback = (exception, newResourceDraft, oldResource, updateActions) -> logErrorCallback(LOGGER, "inventory entry", exception, oldResource.map(InventoryEntry::getSku).orElse(IDENTIFIER_NOT_PRESENT), updateActions);
    final TriConsumer<SyncException, Optional<InventoryEntryDraft>, Optional<InventoryEntry>> logWarningCallback = (exception, newResourceDraft, oldResource) -> logWarningCallback(LOGGER, "inventory entry", exception, oldResource.map(InventoryEntry::getSku).orElse(IDENTIFIER_NOT_PRESENT));
    final InventorySyncOptions syncOptions = InventorySyncOptionsBuilder.of(targetClient).errorCallback(logErrorCallback).warningCallback(logWarningCallback).build();
    final InventorySync inventorySync = new InventorySync(syncOptions);
    final CustomObjectService customObjectService = new CustomObjectServiceImpl(targetClient);
    return new InventoryEntrySyncer(inventorySync, sourceClient, targetClient, customObjectService, clock);
}
Also used : SyncException(com.commercetools.sync.commons.exceptions.SyncException) InventoryEntryDraft(io.sphere.sdk.inventory.InventoryEntryDraft) LoggerFactory(org.slf4j.LoggerFactory) InventorySyncOptionsBuilder(com.commercetools.sync.inventories.InventorySyncOptionsBuilder) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) InventoryTransformUtils.toInventoryEntryDrafts(com.commercetools.sync.inventories.utils.InventoryTransformUtils.toInventoryEntryDrafts) SyncUtils.logWarningCallback(com.commercetools.project.sync.util.SyncUtils.logWarningCallback) SphereClient(io.sphere.sdk.client.SphereClient) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) InventoryEntryQuery(io.sphere.sdk.inventory.queries.InventoryEntryQuery) Nonnull(javax.annotation.Nonnull) SyncUtils.logErrorCallback(com.commercetools.project.sync.util.SyncUtils.logErrorCallback) Logger(org.slf4j.Logger) IDENTIFIER_NOT_PRESENT(com.commercetools.project.sync.util.SyncUtils.IDENTIFIER_NOT_PRESENT) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) InventoryEntry(io.sphere.sdk.inventory.InventoryEntry) InventorySync(com.commercetools.sync.inventories.InventorySync) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) InventorySyncOptions(com.commercetools.sync.inventories.InventorySyncOptions) Syncer(com.commercetools.project.sync.Syncer) Clock(java.time.Clock) Optional(java.util.Optional) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) InventorySyncStatistics(com.commercetools.sync.inventories.helpers.InventorySyncStatistics) CustomObjectService(com.commercetools.project.sync.service.CustomObjectService) Optional(java.util.Optional) InventorySync(com.commercetools.sync.inventories.InventorySync) CustomObjectServiceImpl(com.commercetools.project.sync.service.impl.CustomObjectServiceImpl) List(java.util.List) InventoryEntry(io.sphere.sdk.inventory.InventoryEntry) SyncException(com.commercetools.sync.commons.exceptions.SyncException) InventorySyncOptions(com.commercetools.sync.inventories.InventorySyncOptions)

Example 15 with TriConsumer

use of com.commercetools.sync.commons.utils.TriConsumer 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)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