Search in sources :

Example 6 with ProductSync

use of com.commercetools.sync.products.ProductSync in project commercetools-sync-java by commercetools.

the class ProductSyncBenchmark method sync_ExistingProducts_ShouldUpdateProducts.

@Test
void sync_ExistingProducts_ShouldUpdateProducts() throws IOException {
    final List<ProductDraft> productDrafts = buildProductDrafts(NUMBER_OF_RESOURCE_UNDER_TEST);
    // Create drafts to target project with different descriptions
    CompletableFuture.allOf(productDrafts.stream().map(ProductDraftBuilder::of).map(builder -> builder.description(ofEnglish("oldDescription"))).map(builder -> builder.productType(productType.toReference())).map(ProductDraftBuilder::build).map(draft -> CTP_TARGET_CLIENT.execute(ProductCreateCommand.of(draft))).map(CompletionStage::toCompletableFuture).toArray(CompletableFuture[]::new)).join();
    // Sync new drafts
    final ProductSync productSync = new ProductSync(syncOptions);
    final long beforeSyncTime = System.currentTimeMillis();
    final ProductSyncStatistics syncStatistics = executeBlocking(productSync.sync(productDrafts));
    final long totalTime = System.currentTimeMillis() - beforeSyncTime;
    // assert on threshold (based on history of benchmarks; highest was ~19 seconds)
    // double of the highest benchmark
    final int threshold = 38000;
    assertThat(totalTime).withFailMessage(format(THRESHOLD_EXCEEDED_ERROR, totalTime, threshold)).isLessThan(threshold);
    // Assert actual state of CTP project (number of updated products)
    final CompletableFuture<Integer> totalNumberOfUpdatedProducts = CTP_TARGET_CLIENT.execute(ProductQuery.of().withPredicates(p -> p.masterData().staged().description().locale(ENGLISH).is("newDescription"))).thenApply(PagedQueryResult::getTotal).thenApply(Long::intValue).toCompletableFuture();
    executeBlocking(totalNumberOfUpdatedProducts);
    assertThat(totalNumberOfUpdatedProducts).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);
    // Assert actual state of CTP project (total number of existing products)
    final CompletableFuture<Integer> totalNumberOfProducts = CTP_TARGET_CLIENT.execute(ProductProjectionQuery.ofStaged()).thenApply(PagedQueryResult::getTotal).thenApply(Long::intValue).toCompletableFuture();
    executeBlocking(totalNumberOfProducts);
    assertThat(totalNumberOfProducts).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);
    // Assert statistics
    assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, 0, NUMBER_OF_RESOURCE_UNDER_TEST, 0);
    assertThat(errorCallBackExceptions).isEmpty();
    assertThat(errorCallBackMessages).isEmpty();
    assertThat(warningCallBackMessages).isEmpty();
    saveNewResult(PRODUCT_SYNC, UPDATES_ONLY, totalTime);
}
Also used : ProductProjectionQuery(io.sphere.sdk.products.queries.ProductProjectionQuery) BeforeEach(org.junit.jupiter.api.BeforeEach) 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) THRESHOLD_EXCEEDED_ERROR(com.commercetools.sync.benchmark.BenchmarkUtils.THRESHOLD_EXCEEDED_ERROR) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) ProductITUtils.deleteProductSyncTestData(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteProductSyncTestData) AfterAll(org.junit.jupiter.api.AfterAll) BeforeAll(org.junit.jupiter.api.BeforeAll) CREATES_ONLY(com.commercetools.sync.benchmark.BenchmarkUtils.CREATES_ONLY) OLD_CATEGORY_CUSTOM_TYPE_NAME(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_NAME) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ENGLISH(java.util.Locale.ENGLISH) OLD_CATEGORY_CUSTOM_TYPE_KEY(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_KEY) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) CompletionStageUtil.executeBlocking(com.commercetools.tests.utils.CompletionStageUtil.executeBlocking) Product(io.sphere.sdk.products.Product) String.format(java.lang.String.format) 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) CompletionStage(java.util.concurrent.CompletionStage) ProductSyncOptionsBuilder(com.commercetools.sync.products.ProductSyncOptionsBuilder) Optional(java.util.Optional) 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) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) 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) ProductQuery(io.sphere.sdk.products.queries.ProductQuery) CompletableFuture(java.util.concurrent.CompletableFuture) ArrayList(java.util.ArrayList) NUMBER_OF_RESOURCE_UNDER_TEST(com.commercetools.sync.benchmark.BenchmarkUtils.NUMBER_OF_RESOURCE_UNDER_TEST) CREATES_AND_UPDATES(com.commercetools.sync.benchmark.BenchmarkUtils.CREATES_AND_UPDATES) ProductSync(com.commercetools.sync.products.ProductSync) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) Nonnull(javax.annotation.Nonnull) CategoryITUtils.createCategoriesCustomType(com.commercetools.sync.integration.commons.utils.CategoryITUtils.createCategoriesCustomType) IOException(java.io.IOException) PRODUCT_SYNC(com.commercetools.sync.benchmark.BenchmarkUtils.PRODUCT_SYNC) UPDATES_ONLY(com.commercetools.sync.benchmark.BenchmarkUtils.UPDATES_ONLY) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) BenchmarkUtils.saveNewResult(com.commercetools.sync.benchmark.BenchmarkUtils.saveNewResult) ProductVariantDraftBuilder(io.sphere.sdk.products.ProductVariantDraftBuilder) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductSync(com.commercetools.sync.products.ProductSync) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) Test(org.junit.jupiter.api.Test)

Example 7 with ProductSync

use of com.commercetools.sync.products.ProductSync in project commercetools-sync-java by commercetools.

the class ProductSyncBenchmark method sync_WithSomeExistingProducts_ShouldSyncProducts.

@Test
void sync_WithSomeExistingProducts_ShouldSyncProducts() throws IOException {
    final List<ProductDraft> productDrafts = buildProductDrafts(NUMBER_OF_RESOURCE_UNDER_TEST);
    final int halfNumberOfDrafts = productDrafts.size() / 2;
    final List<ProductDraft> firstHalf = productDrafts.subList(0, halfNumberOfDrafts);
    // Create first half of drafts to target project with different description
    CompletableFuture.allOf(firstHalf.stream().map(ProductDraftBuilder::of).map(builder -> builder.description(ofEnglish("oldDescription"))).map(builder -> builder.productType(productType.toReference())).map(ProductDraftBuilder::build).map(draft -> CTP_TARGET_CLIENT.execute(ProductCreateCommand.of(draft))).map(CompletionStage::toCompletableFuture).toArray(CompletableFuture[]::new)).join();
    // Sync new drafts
    final ProductSync productSync = new ProductSync(syncOptions);
    final long beforeSyncTime = System.currentTimeMillis();
    final ProductSyncStatistics syncStatistics = executeBlocking(productSync.sync(productDrafts));
    final long totalTime = System.currentTimeMillis() - beforeSyncTime;
    // assert on threshold (based on history of benchmarks; highest was ~19 seconds)
    // double of the highest benchmark
    final int threshold = 38000;
    assertThat(totalTime).withFailMessage(format(THRESHOLD_EXCEEDED_ERROR, totalTime, threshold)).isLessThan(threshold);
    // Assert actual state of CTP project (number of updated products)
    final CompletableFuture<Integer> totalNumberOfUpdatedProducts = CTP_TARGET_CLIENT.execute(ProductQuery.of().withPredicates(p -> p.masterData().staged().description().locale(ENGLISH).is("oldDescription"))).thenApply(PagedQueryResult::getTotal).thenApply(Long::intValue).toCompletableFuture();
    executeBlocking(totalNumberOfUpdatedProducts);
    assertThat(totalNumberOfUpdatedProducts).isCompletedWithValue(0);
    // Assert actual state of CTP project (total number of existing products)
    final CompletableFuture<Integer> totalNumberOfProducts = CTP_TARGET_CLIENT.execute(ProductQuery.of()).thenApply(PagedQueryResult::getTotal).thenApply(Long::intValue).toCompletableFuture();
    executeBlocking(totalNumberOfProducts);
    assertThat(totalNumberOfProducts).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);
    // Assert statistics
    assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, halfNumberOfDrafts, halfNumberOfDrafts, 0);
    assertThat(errorCallBackExceptions).isEmpty();
    assertThat(errorCallBackMessages).isEmpty();
    assertThat(warningCallBackMessages).isEmpty();
    saveNewResult(PRODUCT_SYNC, CREATES_AND_UPDATES, totalTime);
}
Also used : ProductProjectionQuery(io.sphere.sdk.products.queries.ProductProjectionQuery) BeforeEach(org.junit.jupiter.api.BeforeEach) 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) THRESHOLD_EXCEEDED_ERROR(com.commercetools.sync.benchmark.BenchmarkUtils.THRESHOLD_EXCEEDED_ERROR) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) QuadConsumer(com.commercetools.sync.commons.utils.QuadConsumer) ProductITUtils.deleteProductSyncTestData(com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteProductSyncTestData) AfterAll(org.junit.jupiter.api.AfterAll) BeforeAll(org.junit.jupiter.api.BeforeAll) CREATES_ONLY(com.commercetools.sync.benchmark.BenchmarkUtils.CREATES_ONLY) OLD_CATEGORY_CUSTOM_TYPE_NAME(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_NAME) TriConsumer(com.commercetools.sync.commons.utils.TriConsumer) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ENGLISH(java.util.Locale.ENGLISH) OLD_CATEGORY_CUSTOM_TYPE_KEY(com.commercetools.sync.integration.commons.utils.CategoryITUtils.OLD_CATEGORY_CUSTOM_TYPE_KEY) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) CompletionStageUtil.executeBlocking(com.commercetools.tests.utils.CompletionStageUtil.executeBlocking) Product(io.sphere.sdk.products.Product) String.format(java.lang.String.format) 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) CompletionStage(java.util.concurrent.CompletionStage) ProductSyncOptionsBuilder(com.commercetools.sync.products.ProductSyncOptionsBuilder) Optional(java.util.Optional) 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) ResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier) 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) ProductQuery(io.sphere.sdk.products.queries.ProductQuery) CompletableFuture(java.util.concurrent.CompletableFuture) ArrayList(java.util.ArrayList) NUMBER_OF_RESOURCE_UNDER_TEST(com.commercetools.sync.benchmark.BenchmarkUtils.NUMBER_OF_RESOURCE_UNDER_TEST) CREATES_AND_UPDATES(com.commercetools.sync.benchmark.BenchmarkUtils.CREATES_AND_UPDATES) ProductSync(com.commercetools.sync.products.ProductSync) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) Nonnull(javax.annotation.Nonnull) CategoryITUtils.createCategoriesCustomType(com.commercetools.sync.integration.commons.utils.CategoryITUtils.createCategoriesCustomType) IOException(java.io.IOException) PRODUCT_SYNC(com.commercetools.sync.benchmark.BenchmarkUtils.PRODUCT_SYNC) UPDATES_ONLY(com.commercetools.sync.benchmark.BenchmarkUtils.UPDATES_ONLY) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) BenchmarkUtils.saveNewResult(com.commercetools.sync.benchmark.BenchmarkUtils.saveNewResult) ProductVariantDraftBuilder(io.sphere.sdk.products.ProductVariantDraftBuilder) ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductSync(com.commercetools.sync.products.ProductSync) ProductDraftBuilder(io.sphere.sdk.products.ProductDraftBuilder) Test(org.junit.jupiter.api.Test)

Example 8 with ProductSync

use of com.commercetools.sync.products.ProductSync in project commercetools-sync-java by commercetools.

the class ProductSyncWithPricesIT method setupTest.

/**
 * Deletes Products from the target CTP project.
 */
@BeforeEach
void setupTest() {
    clearSyncTestCollections();
    deleteAllProducts(CTP_TARGET_CLIENT);
    productSync = new ProductSync(buildSyncOptions());
}
Also used : ProductSync(com.commercetools.sync.products.ProductSync) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with ProductSync

use of com.commercetools.sync.products.ProductSync in project commercetools-sync-java by commercetools.

the class ProductSyncFilterIT method sync_withChangedProductBlackListingCategories_shouldUpdateProductWithoutCategories.

@Test
void sync_withChangedProductBlackListingCategories_shouldUpdateProductWithoutCategories() {
    final ProductDraft productDraft = createProductDraft(PRODUCT_KEY_1_CHANGED_RESOURCE_PATH, referenceOfId(productType.getKey()), null, null, categoryResourceIdentifiersWithKeys, createRandomCategoryOrderHints(categoryResourceIdentifiersWithKeys));
    final ProductSyncOptions syncOptions = syncOptionsBuilder.syncFilter(ofBlackList(CATEGORIES)).build();
    final ProductSync productSync = new ProductSync(syncOptions);
    final ProductSyncStatistics syncStatistics = executeBlocking(productSync.sync(singletonList(productDraft)));
    assertThat(syncStatistics).hasValues(1, 0, 1, 0, 0);
    assertThat(updateActionsFromSync.stream().noneMatch(updateAction -> updateAction instanceof RemoveFromCategory)).isTrue();
    assertThat(updateActionsFromSync.stream().noneMatch(updateAction -> updateAction instanceof AddToCategory)).isTrue();
    assertThat(updateActionsFromSync.stream().noneMatch(updateAction -> updateAction instanceof SetCategoryOrderHint)).isTrue();
    assertThat(errorCallBackExceptions).isEmpty();
    assertThat(errorCallBackMessages).isEmpty();
    assertThat(warningCallBackMessages).isEmpty();
}
Also used : ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) RemoveFromCategory(io.sphere.sdk.products.commands.updateactions.RemoveFromCategory) SetCategoryOrderHint(io.sphere.sdk.products.commands.updateactions.SetCategoryOrderHint) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductSyncMockUtils.createProductDraft(com.commercetools.sync.products.ProductSyncMockUtils.createProductDraft) ProductSync(com.commercetools.sync.products.ProductSync) ProductSyncOptions(com.commercetools.sync.products.ProductSyncOptions) AddToCategory(io.sphere.sdk.products.commands.updateactions.AddToCategory) Test(org.junit.jupiter.api.Test)

Example 10 with ProductSync

use of com.commercetools.sync.products.ProductSync in project commercetools-sync-java by commercetools.

the class ProductSyncIT method sync_withSameSlugInSingleBatch_ShouldNotSyncIt.

@Test
void sync_withSameSlugInSingleBatch_ShouldNotSyncIt() {
    // Prepare batches from external source
    final ProductDraft productDraft = createProductDraft(PRODUCT_KEY_1_CHANGED_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey()), ResourceIdentifier.ofKey(targetTaxCategory.getKey()), ResourceIdentifier.ofKey(targetProductState.getKey()), categoryResourceIdentifiersWithKeys, categoryOrderHintsWithKeys);
    final ProductDraft key3Draft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey())).taxCategory(null).state(null).categories(new ArrayList<>()).categoryOrderHints(CategoryOrderHints.of(new HashMap<>())).key("productKey3").masterVariant(ProductVariantDraftBuilder.of().key("k3").sku("s3").build()).build();
    final ProductDraft key4Draft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey())).taxCategory(null).state(null).categories(new ArrayList<>()).categoryOrderHints(CategoryOrderHints.of(new HashMap<>())).key("productKey4").masterVariant(ProductVariantDraftBuilder.of().key("k4").sku("s4").build()).build();
    final ProductDraft key5Draft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey())).taxCategory(null).state(null).categories(new ArrayList<>()).categoryOrderHints(CategoryOrderHints.of(new HashMap<>())).key("productKey5").masterVariant(ProductVariantDraftBuilder.of().key("k5").sku("s5").build()).build();
    final ProductDraft key6Draft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey())).taxCategory(null).state(null).categories(new ArrayList<>()).categoryOrderHints(CategoryOrderHints.of(new HashMap<>())).key("productKey6").masterVariant(ProductVariantDraftBuilder.of().key("k6").sku("s6").build()).build();
    final List<ProductDraft> batch = new ArrayList<>();
    batch.add(productDraft);
    batch.add(key3Draft);
    batch.add(key4Draft);
    batch.add(key5Draft);
    batch.add(key6Draft);
    final ProductSync productSync = new ProductSync(syncOptions);
    final ProductSyncStatistics syncStatistics = executeBlocking(productSync.sync(batch));
    assertThat(syncStatistics).hasValues(5, 1, 1, 3, 0);
    final String duplicatedSlug = key3Draft.getSlug().get(Locale.ENGLISH);
    assertThat(errorCallBackExceptions).hasSize(3);
    assertThat(errorCallBackExceptions).allSatisfy(exception -> {
        assertThat(exception).isExactlyInstanceOf(ErrorResponseException.class);
        final ErrorResponseException errorResponse = ((ErrorResponseException) exception);
        final List<DuplicateFieldError> fieldErrors = errorResponse.getErrors().stream().map(sphereError -> {
            assertThat(sphereError.getCode()).isEqualTo(DuplicateFieldError.CODE);
            return sphereError.as(DuplicateFieldError.class);
        }).collect(toList());
        assertThat(fieldErrors).hasSize(1);
        assertThat(fieldErrors).allSatisfy(error -> {
            assertThat(error.getField()).isEqualTo("slug.en");
            assertThat(error.getDuplicateValue()).isEqualTo(duplicatedSlug);
        });
    });
    assertThat(errorCallBackMessages).hasSize(3).allSatisfy(errorMessage -> {
        assertThat(errorMessage).contains("\"code\" : \"DuplicateField\"");
        assertThat(errorMessage).contains("\"field\" : \"slug.en\"");
        assertThat(errorMessage).contains(format("\"duplicateValue\" : \"%s\"", duplicatedSlug));
    });
    assertThat(warningCallBackMessages).isEmpty();
}
Also used : ProductSyncStatistics(com.commercetools.sync.products.helpers.ProductSyncStatistics) 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) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductSyncMockUtils.createProductDraft(com.commercetools.sync.products.ProductSyncMockUtils.createProductDraft) ArrayList(java.util.ArrayList) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) ProductSync(com.commercetools.sync.products.ProductSync) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) LocalizedString(io.sphere.sdk.models.LocalizedString) Test(org.junit.jupiter.api.Test)

Aggregations

ProductSync (com.commercetools.sync.products.ProductSync)89 ProductDraft (io.sphere.sdk.products.ProductDraft)85 ProductSyncStatistics (com.commercetools.sync.products.helpers.ProductSyncStatistics)84 Test (org.junit.jupiter.api.Test)83 AttributeDraft (io.sphere.sdk.products.attributes.AttributeDraft)66 ProductVariantDraft (io.sphere.sdk.products.ProductVariantDraft)64 Product (io.sphere.sdk.products.Product)56 Attribute (io.sphere.sdk.products.attributes.Attribute)41 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)35 ProductSyncOptions (com.commercetools.sync.products.ProductSyncOptions)33 SetAttribute (io.sphere.sdk.products.commands.updateactions.SetAttribute)33 BeforeEach (org.junit.jupiter.api.BeforeEach)33 ArrayList (java.util.ArrayList)32 ProductProjection (io.sphere.sdk.products.ProductProjection)30 ProductSyncOptionsBuilder (com.commercetools.sync.products.ProductSyncOptionsBuilder)29 List (java.util.List)29 ProductITUtils.deleteProductSyncTestData (com.commercetools.sync.integration.commons.utils.ProductITUtils.deleteProductSyncTestData)28 CTP_TARGET_CLIENT (com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT)28 ProductDraftBuilder (io.sphere.sdk.products.ProductDraftBuilder)28 ProductVariantDraftBuilder (io.sphere.sdk.products.ProductVariantDraftBuilder)28