Search in sources :

Example 36 with ProductTypeSyncOptions

use of com.commercetools.sync.producttypes.ProductTypeSyncOptions in project commercetools-sync-java by commercetools.

the class ProductTypeSyncIT method sync_WithSetOfEnumsAndSetOfLenumsChanges_ShouldUpdateProductType.

@Test
void sync_WithSetOfEnumsAndSetOfLenumsChanges_ShouldUpdateProductType() {
    // preparation
    final AttributeDefinitionDraft withSetOfEnumsOld = AttributeDefinitionDraftBuilder.of(SetAttributeType.of(EnumAttributeType.of(asList(EnumValue.of("d", "d"), EnumValue.of("b", "newB"), EnumValue.of("a", "a"), EnumValue.of("c", "c")))), "foo", ofEnglish("foo"), false).build();
    final AttributeDefinitionDraft withSetOfSetOfLEnumsOld = AttributeDefinitionDraftBuilder.of(SetAttributeType.of(LocalizedEnumAttributeType.of(asList(LocalizedEnumValue.of("d", ofEnglish("d")), LocalizedEnumValue.of("b", ofEnglish("newB")), LocalizedEnumValue.of("a", ofEnglish("a")), LocalizedEnumValue.of("c", ofEnglish("c"))))), "bar", ofEnglish("bar"), false).build();
    final ProductTypeDraft oldDraft = ProductTypeDraft.ofAttributeDefinitionDrafts("withSetOfEnums", "withSetOfEnums", "withSetOfEnums", asList(withSetOfEnumsOld, withSetOfSetOfLEnumsOld));
    CTP_TARGET_CLIENT.execute(ProductTypeCreateCommand.of(oldDraft)).toCompletableFuture().join();
    final AttributeDefinitionDraft withSetOfEnumsNew = AttributeDefinitionDraftBuilder.of(SetAttributeType.of(EnumAttributeType.of(asList(EnumValue.of("a", "a"), EnumValue.of("b", "b"), EnumValue.of("c", "c")))), "foo", ofEnglish("foo"), false).build();
    final AttributeDefinitionDraft withSetOfSetOfLEnumsNew = AttributeDefinitionDraftBuilder.of(SetAttributeType.of(LocalizedEnumAttributeType.of(asList(LocalizedEnumValue.of("a", ofEnglish("a")), LocalizedEnumValue.of("b", ofEnglish("newB")), LocalizedEnumValue.of("c", ofEnglish("c"))))), "bar", ofEnglish("bar"), false).build();
    final ProductTypeDraft newProductTypeDraft = ProductTypeDraft.ofAttributeDefinitionDrafts("withSetOfEnums", "withSetOfEnums", "withSetOfEnums", asList(withSetOfEnumsNew, withSetOfSetOfLEnumsNew));
    final ProductTypeSyncOptions productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
    // tests
    final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(singletonList(newProductTypeDraft)).toCompletableFuture().join();
    // assertions
    assertThat(productTypeSyncStatistics).hasValues(1, 0, 1, 0, 0);
    final Optional<ProductType> oldProductTypeAfter = getProductTypeByKey(CTP_TARGET_CLIENT, "withSetOfEnums");
    assertThat(oldProductTypeAfter).hasValueSatisfying(productType -> assertAttributesAreEqual(productType.getAttributes(), asList(withSetOfEnumsNew, withSetOfSetOfLEnumsNew)));
}
Also used : ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductType(io.sphere.sdk.producttypes.ProductType) AttributeDefinitionDraft(io.sphere.sdk.products.attributes.AttributeDefinitionDraft) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Test(org.junit.jupiter.api.Test)

Example 37 with ProductTypeSyncOptions

use of com.commercetools.sync.producttypes.ProductTypeSyncOptions in project commercetools-sync-java by commercetools.

the class ProductTypeSyncIT method sync_WithUpdatedAttributeDefinition_ShouldUpdateProductTypeUpdatingAttribute.

@Test
void sync_WithUpdatedAttributeDefinition_ShouldUpdateProductTypeUpdatingAttribute() {
    // Updating ATTRIBUTE_DEFINITION_1 (name = "attr_name_1") changing the label, attribute
    // constraint, input tip,
    // input hint, isSearchable fields.
    final AttributeDefinitionDraft attributeDefinitionDraftUpdated = AttributeDefinitionDraftBuilder.of(StringAttributeType.of(), "attr_name_1", ofEnglish("attr_label_updated"), true).attributeConstraint(AttributeConstraint.NONE).inputTip(ofEnglish("inputTip_updated")).inputHint(TextInputHint.MULTI_LINE).isSearchable(false).build();
    final ProductTypeDraft newProductTypeDraft = ProductTypeDraft.ofAttributeDefinitionDrafts(PRODUCT_TYPE_KEY_1, PRODUCT_TYPE_NAME_1, PRODUCT_TYPE_DESCRIPTION_1, singletonList(attributeDefinitionDraftUpdated));
    final ProductTypeSyncOptions productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
    final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(singletonList(newProductTypeDraft)).toCompletableFuture().join();
    assertThat(productTypeSyncStatistics).hasValues(1, 0, 1, 0, 0);
    final Optional<ProductType> oldProductTypeAfter = getProductTypeByKey(CTP_TARGET_CLIENT, PRODUCT_TYPE_KEY_1);
    assertThat(oldProductTypeAfter).hasValueSatisfying(productType -> assertAttributesAreEqual(productType.getAttributes(), singletonList(attributeDefinitionDraftUpdated)));
}
Also used : ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductType(io.sphere.sdk.producttypes.ProductType) AttributeDefinitionDraft(io.sphere.sdk.products.attributes.AttributeDefinitionDraft) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Test(org.junit.jupiter.api.Test)

Example 38 with ProductTypeSyncOptions

use of com.commercetools.sync.producttypes.ProductTypeSyncOptions in project commercetools-sync-java by commercetools.

the class ProductTypeSyncIT method syncDrafts_WithConcurrentModificationExceptionAndFailedFetch_ShouldFailToReFetchAndUpdate.

@Test
void syncDrafts_WithConcurrentModificationExceptionAndFailedFetch_ShouldFailToReFetchAndUpdate() {
    // Preparation
    final SphereClient spyClient = buildClientWithConcurrentModificationUpdateAndFailedFetchOnRetry();
    final ProductTypeDraft productTypeDraft = ProductTypeDraftBuilder.of("key", "foo", "description", emptyList()).build();
    CTP_TARGET_CLIENT.execute(ProductTypeCreateCommand.of(productTypeDraft)).toCompletableFuture().join();
    final String newProductTypeName = "bar";
    final ProductTypeDraft updatedDraft = ProductTypeDraftBuilder.of(productTypeDraft).name(newProductTypeName).build();
    final List<String> errorMessages = new ArrayList<>();
    final List<Throwable> errors = new ArrayList<>();
    final ProductTypeSyncOptions syncOptions = ProductTypeSyncOptionsBuilder.of(spyClient).errorCallback((exception, oldResource, newResource, updateActions) -> {
        errorMessages.add(exception.getMessage());
        errors.add(exception.getCause());
    }).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(syncOptions);
    // Test
    final ProductTypeSyncStatistics statistics = productTypeSync.sync(singletonList(updatedDraft)).toCompletableFuture().join();
    // Assertion
    assertThat(statistics).hasValues(1, 0, 0, 1, 0);
    assertThat(errorMessages).hasSize(1);
    assertThat(errors).hasSize(1);
    assertThat(errors.get(0).getCause()).isExactlyInstanceOf(BadGatewayException.class);
    assertThat(errorMessages.get(0)).contains(format("Failed to update product type with key: '%s'. Reason: Failed to fetch from CTP while retrying " + "after concurrency modification.", productTypeDraft.getKey()));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) SyncException(com.commercetools.sync.commons.exceptions.SyncException) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) LocalizedEnumAttributeType(io.sphere.sdk.products.attributes.LocalizedEnumAttributeType) ProductTypeCreateCommand(io.sphere.sdk.producttypes.commands.ProductTypeCreateCommand) Collections.singletonList(java.util.Collections.singletonList) AfterAll(org.junit.jupiter.api.AfterAll) StringAttributeType(io.sphere.sdk.products.attributes.StringAttributeType) Arrays.asList(java.util.Arrays.asList) SphereClient(io.sphere.sdk.client.SphereClient) CompletableFutureUtils.exceptionallyCompletedFuture(io.sphere.sdk.utils.CompletableFutureUtils.exceptionallyCompletedFuture) EnumValue(io.sphere.sdk.models.EnumValue) MoneyAttributeType(io.sphere.sdk.products.attributes.MoneyAttributeType) ProductTypeITUtils.getProductTypeByKey(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.getProductTypeByKey) ProductTypeITUtils.assertAttributesAreEqual(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.assertAttributesAreEqual) BadGatewayException(io.sphere.sdk.client.BadGatewayException) ProductTypeQuery(io.sphere.sdk.producttypes.queries.ProductTypeQuery) ProductTypeUpdateCommand(io.sphere.sdk.producttypes.commands.ProductTypeUpdateCommand) PRODUCT_TYPE_NAME_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_NAME_1) ProductTypeDraftBuilder(io.sphere.sdk.producttypes.ProductTypeDraftBuilder) PRODUCT_TYPE_NAME_2(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_NAME_2) Collections.emptyList(java.util.Collections.emptyList) CompletionException(java.util.concurrent.CompletionException) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Test(org.junit.jupiter.api.Test) List(java.util.List) LocalizedString.ofEnglish(io.sphere.sdk.models.LocalizedString.ofEnglish) TextInputHint(io.sphere.sdk.models.TextInputHint) AttributeConstraint(io.sphere.sdk.products.attributes.AttributeConstraint) Optional(java.util.Optional) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) AttributeDefinitionDraftDsl(io.sphere.sdk.products.attributes.AttributeDefinitionDraftDsl) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) AttributeDefinitionDraft(io.sphere.sdk.products.attributes.AttributeDefinitionDraft) ProductTypeITUtils.populateTargetProject(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.populateTargetProject) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) IntStream(java.util.stream.IntStream) ProductType(io.sphere.sdk.producttypes.ProductType) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) CompletableFuture(java.util.concurrent.CompletableFuture) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) Assertions.as(org.assertj.core.api.Assertions.as) PRODUCT_TYPE_KEY_2(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_2) PRODUCT_TYPE_KEY_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_1) Nonnull(javax.annotation.Nonnull) SetAttributeType(io.sphere.sdk.products.attributes.SetAttributeType) AttributeDefinitionDraftBuilder(io.sphere.sdk.products.attributes.AttributeDefinitionDraftBuilder) ChangeAttributeOrderByName(io.sphere.sdk.producttypes.commands.updateactions.ChangeAttributeOrderByName) EnumAttributeType(io.sphere.sdk.products.attributes.EnumAttributeType) LocalizedEnumValue(io.sphere.sdk.models.LocalizedEnumValue) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Mockito.when(org.mockito.Mockito.when) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ATTRIBUTE_DEFINITION_DRAFT_3(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_3) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) ProductTypeITUtils.deleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypes) ConcurrentModificationException(io.sphere.sdk.client.ConcurrentModificationException) PRODUCT_TYPE_DESCRIPTION_2(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_2) PRODUCT_TYPE_DESCRIPTION_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_1) STRING(org.assertj.core.api.InstanceOfAssertFactories.STRING) ATTRIBUTE_DEFINITION_DRAFT_2(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_2) ATTRIBUTE_DEFINITION_DRAFT_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) SphereClient(io.sphere.sdk.client.SphereClient) ArrayList(java.util.ArrayList) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Test(org.junit.jupiter.api.Test)

Example 39 with ProductTypeSyncOptions

use of com.commercetools.sync.producttypes.ProductTypeSyncOptions in project commercetools-sync-java by commercetools.

the class ProductTypeSyncIT method sync_WithUpdatedProductType_ShouldUpdateProductType.

@Test
void sync_WithUpdatedProductType_ShouldUpdateProductType() {
    // preparation
    final ProductTypeDraft newProductTypeDraft = ProductTypeDraft.ofAttributeDefinitionDrafts(PRODUCT_TYPE_KEY_1, PRODUCT_TYPE_NAME_2, PRODUCT_TYPE_DESCRIPTION_2, singletonList(ATTRIBUTE_DEFINITION_DRAFT_1));
    final ProductTypeSyncOptions productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
    // test
    final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(singletonList(newProductTypeDraft)).toCompletableFuture().join();
    // assertion
    assertThat(productTypeSyncStatistics).hasValues(1, 0, 1, 0, 0);
    final Optional<ProductType> oldProductTypeAfter = getProductTypeByKey(CTP_TARGET_CLIENT, PRODUCT_TYPE_KEY_1);
    assertThat(oldProductTypeAfter).hasValueSatisfying(productType -> {
        assertThat(productType.getName()).isEqualTo(PRODUCT_TYPE_NAME_2);
        assertThat(productType.getDescription()).isEqualTo(PRODUCT_TYPE_DESCRIPTION_2);
        assertAttributesAreEqual(productType.getAttributes(), singletonList(ATTRIBUTE_DEFINITION_DRAFT_1));
    });
}
Also used : ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductType(io.sphere.sdk.producttypes.ProductType) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Test(org.junit.jupiter.api.Test)

Example 40 with ProductTypeSyncOptions

use of com.commercetools.sync.producttypes.ProductTypeSyncOptions in project commercetools-sync-java by commercetools.

the class ProductTypeWithNestedAttributeSyncIT method sync_WithNewProductTypeWithFailedFetchOnReferenceResolution_ShouldFail.

@Test
void sync_WithNewProductTypeWithFailedFetchOnReferenceResolution_ShouldFail() {
    // preparation
    final AttributeDefinitionDraft nestedTypeAttr = AttributeDefinitionDraftBuilder.of(AttributeDefinitionBuilder.of("nestedattr", ofEnglish("nestedattr"), NestedAttributeType.of(ProductType.referenceOfId(PRODUCT_TYPE_KEY_5))).build()).searchable(false).build();
    final ProductTypeDraft withMissingNestedTypeRef = ProductTypeDraft.ofAttributeDefinitionDrafts(PRODUCT_TYPE_KEY_1, PRODUCT_TYPE_NAME_1, PRODUCT_TYPE_DESCRIPTION_1, asList(ATTRIBUTE_DEFINITION_DRAFT_1, ATTRIBUTE_DEFINITION_DRAFT_2, nestedTypeAttr));
    final ProductTypeDraft productTypeDraft5 = ProductTypeDraft.ofAttributeDefinitionDrafts(PRODUCT_TYPE_KEY_5, PRODUCT_TYPE_NAME_5, PRODUCT_TYPE_DESCRIPTION_5, singletonList(ATTRIBUTE_DEFINITION_DRAFT_3));
    final SphereClient ctpClient = spy(CTP_TARGET_CLIENT);
    final BadGatewayException badGatewayException = new BadGatewayException();
    when(ctpClient.execute(any(ResourceKeyIdGraphQlRequest.class))).thenCallRealMethod();
    when(ctpClient.execute(any(ProductTypeQuery.class))).thenCallRealMethod().thenCallRealMethod().thenReturn(// fail on fetching during resolution
    exceptionallyCompletedFuture(badGatewayException)).thenCallRealMethod();
    productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(ctpClient).batchSize(// this ensures the drafts are in separate batches.
    1).beforeUpdateCallback((actions, draft, oldProductType) -> {
        builtUpdateActions.addAll(actions);
        return actions;
    }).errorCallback((exception, oldResource, newResource, actions) -> {
        errorMessages.add(exception.getMessage());
        exceptions.add(exception);
    }).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
    // tests
    final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(asList(withMissingNestedTypeRef, productTypeDraft5)).toCompletableFuture().join();
    // assertions
    final Optional<ProductType> productType1 = getProductTypeByKey(CTP_TARGET_CLIENT, PRODUCT_TYPE_KEY_1);
    assert productType1.isPresent();
    assertThat(errorMessages).containsExactly("Failed to fetch existing product types with keys: '[key_1]'.");
    assertThat(exceptions).hasSize(1).singleElement(as(THROWABLE)).isExactlyInstanceOf(SyncException.class).hasCauseExactlyInstanceOf(CompletionException.class).hasRootCauseExactlyInstanceOf(BadGatewayException.class);
    assertThat(builtUpdateActions).isEmpty();
    assertThat(productTypeSyncStatistics).hasValues(2, 1, 0, 0, 1);
    assertThat(productTypeSyncStatistics.getReportMessage()).isEqualTo("Summary: 2 product types were processed in total" + " (1 created, 0 updated, 0 failed to sync and 1 product types with at least one NestedType or a Set" + " of NestedType attribute definition(s) referencing a missing product type).");
    assertThat(productTypeSyncStatistics.getProductTypeKeysWithMissingParents()).hasSize(1);
    final ConcurrentHashMap<String, ConcurrentHashMap.KeySetView<AttributeDefinitionDraft, Boolean>> children = productTypeSyncStatistics.getProductTypeKeysWithMissingParents().get(PRODUCT_TYPE_KEY_5);
    assertThat(children).hasSize(1);
    assertThat(children.get(PRODUCT_TYPE_KEY_1)).containsExactly(nestedTypeAttr);
    final Optional<ProductType> productType5 = getProductTypeByKey(CTP_TARGET_CLIENT, PRODUCT_TYPE_KEY_5);
    assertThat(productType5).hasValueSatisfying(productType -> {
        assertThat(productType.getName()).isEqualTo(PRODUCT_TYPE_NAME_5);
        assertThat(productType.getDescription()).isEqualTo(PRODUCT_TYPE_DESCRIPTION_5);
        assertThat(productType.getAttributes()).hasSize(1);
    });
    assertThat(productType1).hasValueSatisfying(productType -> assertThat(productType.getAttributes()).hasSize(2));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) SyncException(com.commercetools.sync.commons.exceptions.SyncException) ProductTypeITUtils.removeAttributeReferencesAndDeleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.removeAttributeReferencesAndDeleteProductTypes) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) AddAttributeDefinition(io.sphere.sdk.producttypes.commands.updateactions.AddAttributeDefinition) Collections.singletonList(java.util.Collections.singletonList) AfterAll(org.junit.jupiter.api.AfterAll) Arrays.asList(java.util.Arrays.asList) THROWABLE(org.assertj.core.api.InstanceOfAssertFactories.THROWABLE) SphereClient(io.sphere.sdk.client.SphereClient) CompletableFutureUtils.exceptionallyCompletedFuture(io.sphere.sdk.utils.CompletableFutureUtils.exceptionallyCompletedFuture) AttributeDefinition(io.sphere.sdk.products.attributes.AttributeDefinition) ProductTypeITUtils.getProductTypeByKey(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.getProductTypeByKey) ProductTypeITUtils.assertAttributesAreEqual(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.assertAttributesAreEqual) BadGatewayException(io.sphere.sdk.client.BadGatewayException) ProductTypeQuery(io.sphere.sdk.producttypes.queries.ProductTypeQuery) PRODUCT_TYPE_NAME_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_NAME_1) ResourceKeyIdGraphQlRequest(com.commercetools.sync.commons.helpers.ResourceKeyIdGraphQlRequest) Collections.emptyList(java.util.Collections.emptyList) PRODUCT_TYPE_NAME_5(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_NAME_5) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) PRODUCT_TYPE_NAME_3(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_NAME_3) CompletionException(java.util.concurrent.CompletionException) Test(org.junit.jupiter.api.Test) List(java.util.List) LocalizedString.ofEnglish(io.sphere.sdk.models.LocalizedString.ofEnglish) Optional(java.util.Optional) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) AttributeDefinitionDraft(io.sphere.sdk.products.attributes.AttributeDefinitionDraft) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ProductType(io.sphere.sdk.producttypes.ProductType) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) Assertions.as(org.assertj.core.api.Assertions.as) PRODUCT_TYPE_KEY_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_1) PRODUCT_TYPE_KEY_3(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_3) PRODUCT_TYPE_KEY_5(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_5) AttributeDefinitionBuilder(io.sphere.sdk.products.attributes.AttributeDefinitionBuilder) SetAttributeType(io.sphere.sdk.products.attributes.SetAttributeType) AttributeDefinitionDraftBuilder(io.sphere.sdk.products.attributes.AttributeDefinitionDraftBuilder) ProductTypeITUtils.populateProjectWithNestedAttributes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.populateProjectWithNestedAttributes) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Mockito.when(org.mockito.Mockito.when) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) Resource(io.sphere.sdk.models.Resource) ATTRIBUTE_DEFINITION_DRAFT_3(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_3) NestedAttributeType(io.sphere.sdk.products.attributes.NestedAttributeType) RemoveAttributeDefinition(io.sphere.sdk.producttypes.commands.updateactions.RemoveAttributeDefinition) PRODUCT_TYPE_DESCRIPTION_5(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_5) PRODUCT_TYPE_DESCRIPTION_3(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_3) PRODUCT_TYPE_DESCRIPTION_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_1) ATTRIBUTE_DEFINITION_DRAFT_2(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_2) ATTRIBUTE_DEFINITION_DRAFT_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductType(io.sphere.sdk.producttypes.ProductType) ResourceKeyIdGraphQlRequest(com.commercetools.sync.commons.helpers.ResourceKeyIdGraphQlRequest) AttributeDefinitionDraft(io.sphere.sdk.products.attributes.AttributeDefinitionDraft) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) SphereClient(io.sphere.sdk.client.SphereClient) CompletionException(java.util.concurrent.CompletionException) BadGatewayException(io.sphere.sdk.client.BadGatewayException) Test(org.junit.jupiter.api.Test)

Aggregations

ProductTypeSyncOptions (com.commercetools.sync.producttypes.ProductTypeSyncOptions)56 Test (org.junit.jupiter.api.Test)54 ProductTypeDraft (io.sphere.sdk.producttypes.ProductTypeDraft)45 AttributeDefinitionDraft (io.sphere.sdk.products.attributes.AttributeDefinitionDraft)41 ProductType (io.sphere.sdk.producttypes.ProductType)38 ProductTypeSyncOptionsBuilder (com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder)31 List (java.util.List)31 ArrayList (java.util.ArrayList)30 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)30 SphereClient (io.sphere.sdk.client.SphereClient)29 UpdateAction (io.sphere.sdk.commands.UpdateAction)26 AttributeDefinitionDraftBuilder (io.sphere.sdk.products.attributes.AttributeDefinitionDraftBuilder)26 SetAttributeType (io.sphere.sdk.products.attributes.SetAttributeType)26 ProductTypeSync (com.commercetools.sync.producttypes.ProductTypeSync)25 ProductTypeSyncStatistics (com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics)25 Collections.singletonList (java.util.Collections.singletonList)25 Mockito.when (org.mockito.Mockito.when)25 LocalizedString.ofEnglish (io.sphere.sdk.models.LocalizedString.ofEnglish)24 ProductTypeDraftBuilder (io.sphere.sdk.producttypes.ProductTypeDraftBuilder)24 ProductTypeQuery (io.sphere.sdk.producttypes.queries.ProductTypeQuery)24