Search in sources :

Example 1 with ProductTypeSyncOptions

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

the class ProductTypeSyncIT method sync_WithUpdates_ShouldReturnProperStatistics.

@Test
void sync_WithUpdates_ShouldReturnProperStatistics() {
    // preparation
    final List<ProductType> productTypes = CTP_SOURCE_CLIENT.execute(ProductTypeQuery.of()).toCompletableFuture().join().getResults();
    final List<ProductTypeDraft> productTypeDrafts = productTypes.stream().map(productType -> {
        final List<AttributeDefinitionDraft> attributeDefinitionDrafts = productType.getAttributes().stream().map(attribute -> AttributeDefinitionDraftBuilder.of(attribute).build()).collect(Collectors.toList());
        return ProductTypeDraftBuilder.of(productType.getKey(), "newName", productType.getDescription(), attributeDefinitionDrafts).build();
    }).collect(Collectors.toList());
    final List<String> errorMessages = new ArrayList<>();
    final List<Throwable> exceptions = new ArrayList<>();
    final ProductTypeSyncOptions productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).errorCallback((exception, oldResource, newResource, updateActions) -> {
        errorMessages.add(exception.getMessage());
        exceptions.add(exception.getCause());
    }).build();
    final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
    // test
    final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(productTypeDrafts).toCompletableFuture().join();
    // assertion
    assertThat(errorMessages).isEmpty();
    assertThat(exceptions).isEmpty();
    assertThat(productTypeSyncStatistics).hasValues(2, 1, 1, 0, 0);
    assertThat(productTypeSyncStatistics.getReportMessage()).isEqualTo("Summary: 2 product types were processed in total" + " (1 created, 1 updated, 0 failed to sync and 0 product types with at least one NestedType or a Set" + " of NestedType attribute definition(s) referencing a missing product type).");
}
Also used : AttributeDefinitionDraftBuilder(io.sphere.sdk.products.attributes.AttributeDefinitionDraftBuilder) BeforeEach(org.junit.jupiter.api.BeforeEach) ProductTypeQuery(io.sphere.sdk.producttypes.queries.ProductTypeQuery) ProductTypeDraftBuilder(io.sphere.sdk.producttypes.ProductTypeDraftBuilder) CTP_SOURCE_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_SOURCE_CLIENT) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductType(io.sphere.sdk.producttypes.ProductType) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Collectors(java.util.stream.Collectors) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) AfterAll(org.junit.jupiter.api.AfterAll) Test(org.junit.jupiter.api.Test) List(java.util.List) ProductTypeITUtils.populateSourceProject(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.populateSourceProject) ProductTypeITUtils.deleteProductTypesFromTargetAndSource(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypesFromTargetAndSource) 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) ProductTypeITUtils.populateTargetProject(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.populateTargetProject) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductTypeSync(com.commercetools.sync.producttypes.ProductTypeSync) ProductType(io.sphere.sdk.producttypes.ProductType) ArrayList(java.util.ArrayList) ProductTypeSyncStatistics(com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.jupiter.api.Test)

Example 2 with ProductTypeSyncOptions

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

the class ProductTypeWithNestedAttributeSyncIT method setup.

/**
 * Deletes product types from source and target CTP projects. Populates source and target CTP
 * projects with test data.
 */
@BeforeEach
void setup() {
    removeAttributeReferencesAndDeleteProductTypes(CTP_SOURCE_CLIENT);
    removeAttributeReferencesAndDeleteProductTypes(CTP_TARGET_CLIENT);
    populateProjectWithNestedAttributes(CTP_SOURCE_CLIENT);
    builtUpdateActions = new ArrayList<>();
    errorMessages = new ArrayList<>();
    exceptions = new ArrayList<>();
    productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).beforeUpdateCallback((actions, draft, oldProductType) -> {
        builtUpdateActions.addAll(actions);
        return actions;
    }).errorCallback((exception, oldResource, newResource, actions) -> {
        errorMessages.add(exception.getMessage());
        exceptions.add(exception);
    }).build();
    referenceIdToKeyCache = new CaffeineReferenceIdToKeyCacheImpl();
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) CTP_SOURCE_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_SOURCE_CLIENT) ProductTypeITUtils.removeAttributeReferencesAndDeleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.removeAttributeReferencesAndDeleteProductTypes) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductType(io.sphere.sdk.producttypes.ProductType) AssertionsForStatistics.assertThat(com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat) UpdateAction(io.sphere.sdk.commands.UpdateAction) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) AfterAll(org.junit.jupiter.api.AfterAll) ReferenceIdToKeyCache(com.commercetools.sync.commons.utils.ReferenceIdToKeyCache) ChangeAttributeDefinitionLabel(io.sphere.sdk.producttypes.commands.updateactions.ChangeAttributeDefinitionLabel) ProductTypeTransformUtils(com.commercetools.sync.producttypes.utils.ProductTypeTransformUtils) AttributeDefinitionDraftBuilder(io.sphere.sdk.products.attributes.AttributeDefinitionDraftBuilder) ProductTypeQuery(io.sphere.sdk.producttypes.queries.ProductTypeQuery) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) ProductTypeITUtils.populateProjectWithNestedAttributes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.populateProjectWithNestedAttributes) ProductTypeDraftBuilder(io.sphere.sdk.producttypes.ProductTypeDraftBuilder) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Collectors(java.util.stream.Collectors) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) Test(org.junit.jupiter.api.Test) NestedAttributeType(io.sphere.sdk.products.attributes.NestedAttributeType) List(java.util.List) LocalizedString.ofEnglish(io.sphere.sdk.models.LocalizedString.ofEnglish) 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) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with ProductTypeSyncOptions

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

the class ProductTypeServiceImplIT method createProductType_WithDuplicateKey_ShouldHaveEmptyOptionalAsAResult.

@Test
void createProductType_WithDuplicateKey_ShouldHaveEmptyOptionalAsAResult() {
    // preparation
    final ProductTypeDraft newProductTypeDraft = ProductTypeDraft.ofAttributeDefinitionDrafts(OLD_PRODUCT_TYPE_KEY, PRODUCT_TYPE_NAME_1, PRODUCT_TYPE_DESCRIPTION_1, singletonList(ATTRIBUTE_DEFINITION_DRAFT_1));
    final ProductTypeSyncOptions options = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).errorCallback((exception, oldResource, newResource, updateActions) -> {
        errorCallBackMessages.add(exception.getMessage());
        errorCallBackExceptions.add(exception.getCause());
    }).build();
    final ProductTypeService service = new ProductTypeServiceImpl(options);
    // test
    final Optional<ProductType> result = service.createProductType(newProductTypeDraft).toCompletableFuture().join();
    // assertion
    assertThat(result).isEmpty();
    assertThat(errorCallBackMessages).hasSize(1).singleElement(as(STRING)).contains("A duplicate value");
    assertThat(errorCallBackExceptions).hasSize(1).singleElement().matches(exception -> {
        assertThat(exception).isExactlyInstanceOf(ErrorResponseException.class);
        final ErrorResponseException errorResponseException = (ErrorResponseException) exception;
        final List<DuplicateFieldError> fieldErrors = errorResponseException.getErrors().stream().map(sphereError -> {
            assertThat(sphereError.getCode()).isEqualTo(DuplicateFieldError.CODE);
            return sphereError.as(DuplicateFieldError.class);
        }).collect(toList());
        return fieldErrors.size() == 1;
    });
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductType(io.sphere.sdk.producttypes.ProductType) Mockito.spy(org.mockito.Mockito.spy) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) HashSet(java.util.HashSet) AfterAll(org.junit.jupiter.api.AfterAll) Collections.singleton(java.util.Collections.singleton) Assertions.as(org.assertj.core.api.Assertions.as) Locale(java.util.Locale) ProductTypeService(com.commercetools.sync.services.ProductTypeService) Map(java.util.Map) SphereClient(io.sphere.sdk.client.SphereClient) PRODUCT_TYPE_KEY_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_1) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) 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) Set(java.util.Set) Mockito.times(org.mockito.Mockito.times) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) SetKey(io.sphere.sdk.producttypes.commands.updateactions.SetKey) Mockito.when(org.mockito.Mockito.when) AttributeMetaData(com.commercetools.sync.products.AttributeMetaData) ChangeName(io.sphere.sdk.producttypes.commands.updateactions.ChangeName) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) ProductTypeITUtils.deleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypes) Optional(java.util.Optional) PRODUCT_TYPE_DESCRIPTION_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_1) STRING(org.assertj.core.api.InstanceOfAssertFactories.STRING) Collections(java.util.Collections) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) ATTRIBUTE_DEFINITION_DRAFT_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1) ProductTypeService(com.commercetools.sync.services.ProductTypeService) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductType(io.sphere.sdk.producttypes.ProductType) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) Test(org.junit.jupiter.api.Test)

Example 4 with ProductTypeSyncOptions

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

the class ProductTypeServiceImplIT method fetchMatchingProductTypesByKeys_WithBadGateWayExceptionAlways_ShouldFail.

@Test
void fetchMatchingProductTypesByKeys_WithBadGateWayExceptionAlways_ShouldFail() {
    // Mock sphere client to return BadGatewayException on any request.
    final SphereClient spyClient = spy(CTP_TARGET_CLIENT);
    when(spyClient.execute(any(ProductTypeQuery.class))).thenReturn(CompletableFutureUtils.exceptionallyCompletedFuture(new BadGatewayException())).thenCallRealMethod();
    final ProductTypeSyncOptions spyOptions = ProductTypeSyncOptionsBuilder.of(spyClient).errorCallback((exception, oldResource, newResource, updateActions) -> {
        errorCallBackMessages.add(exception.getMessage());
        errorCallBackExceptions.add(exception.getCause());
    }).build();
    final ProductTypeService spyProductTypeService = new ProductTypeServiceImpl(spyOptions);
    final Set<String> keys = new HashSet<>();
    keys.add(OLD_PRODUCT_TYPE_KEY);
    // test and assert
    assertThat(errorCallBackExceptions).isEmpty();
    assertThat(errorCallBackMessages).isEmpty();
    assertThat(spyProductTypeService.fetchMatchingProductTypesByKeys(keys)).failsWithin(10, TimeUnit.SECONDS).withThrowableOfType(ExecutionException.class).withCauseExactlyInstanceOf(BadGatewayException.class);
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductType(io.sphere.sdk.producttypes.ProductType) Mockito.spy(org.mockito.Mockito.spy) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) HashSet(java.util.HashSet) AfterAll(org.junit.jupiter.api.AfterAll) Collections.singleton(java.util.Collections.singleton) Assertions.as(org.assertj.core.api.Assertions.as) Locale(java.util.Locale) ProductTypeService(com.commercetools.sync.services.ProductTypeService) Map(java.util.Map) SphereClient(io.sphere.sdk.client.SphereClient) PRODUCT_TYPE_KEY_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_1) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) 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) Set(java.util.Set) Mockito.times(org.mockito.Mockito.times) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) SetKey(io.sphere.sdk.producttypes.commands.updateactions.SetKey) Mockito.when(org.mockito.Mockito.when) AttributeMetaData(com.commercetools.sync.products.AttributeMetaData) ChangeName(io.sphere.sdk.producttypes.commands.updateactions.ChangeName) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) ProductTypeITUtils.deleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypes) Optional(java.util.Optional) PRODUCT_TYPE_DESCRIPTION_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_1) STRING(org.assertj.core.api.InstanceOfAssertFactories.STRING) Collections(java.util.Collections) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) ATTRIBUTE_DEFINITION_DRAFT_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1) ProductTypeService(com.commercetools.sync.services.ProductTypeService) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) SphereClient(io.sphere.sdk.client.SphereClient) BadGatewayException(io.sphere.sdk.client.BadGatewayException) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ExecutionException(java.util.concurrent.ExecutionException) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 5 with ProductTypeSyncOptions

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

the class ProductTypeServiceImplIT method createProductType_WithValidProductType_ShouldCreateProductTypeAndCacheId.

@Test
void createProductType_WithValidProductType_ShouldCreateProductTypeAndCacheId() {
    // preparation
    final ProductTypeDraft newProductTypeDraft = ProductTypeDraft.ofAttributeDefinitionDrafts(PRODUCT_TYPE_KEY_1, PRODUCT_TYPE_NAME_1, PRODUCT_TYPE_DESCRIPTION_1, singletonList(ATTRIBUTE_DEFINITION_DRAFT_1));
    final SphereClient spyClient = spy(CTP_TARGET_CLIENT);
    final ProductTypeSyncOptions spyOptions = ProductTypeSyncOptionsBuilder.of(spyClient).errorCallback((exception, oldResource, newResource, updateActions) -> {
        errorCallBackMessages.add(exception.getMessage());
        errorCallBackExceptions.add(exception.getCause());
    }).build();
    final ProductTypeService spyProductTypeService = new ProductTypeServiceImpl(spyOptions);
    // test
    final Optional<ProductType> createdOptional = spyProductTypeService.createProductType(newProductTypeDraft).toCompletableFuture().join();
    // assertion
    final Optional<ProductType> queriedOptional = CTP_TARGET_CLIENT.execute(ProductTypeQuery.of().withPredicates(productTypeQueryModel -> productTypeQueryModel.key().is(PRODUCT_TYPE_KEY_1))).toCompletableFuture().join().head();
    assertThat(queriedOptional).hasValueSatisfying(queried -> assertThat(createdOptional).hasValueSatisfying(created -> {
        assertThat(created.getKey()).isEqualTo(queried.getKey());
        assertThat(created.getDescription()).isEqualTo(queried.getDescription());
        assertThat(created.getName()).isEqualTo(queried.getName());
        assertThat(created.getAttributes()).isEqualTo(queried.getAttributes());
    }));
    // Assert that the created product type is cached
    final Optional<String> productTypeId = spyProductTypeService.fetchCachedProductTypeId(PRODUCT_TYPE_KEY_1).toCompletableFuture().join();
    assertThat(productTypeId).isPresent();
    verify(spyClient, times(0)).execute(any(ProductTypeQuery.class));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ProductType(io.sphere.sdk.producttypes.ProductType) Mockito.spy(org.mockito.Mockito.spy) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) DuplicateFieldError(io.sphere.sdk.models.errors.DuplicateFieldError) Collections.singletonList(java.util.Collections.singletonList) ArrayList(java.util.ArrayList) ProductTypeSyncOptionsBuilder(com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder) HashSet(java.util.HashSet) AfterAll(org.junit.jupiter.api.AfterAll) Collections.singleton(java.util.Collections.singleton) Assertions.as(org.assertj.core.api.Assertions.as) Locale(java.util.Locale) ProductTypeService(com.commercetools.sync.services.ProductTypeService) Map(java.util.Map) SphereClient(io.sphere.sdk.client.SphereClient) PRODUCT_TYPE_KEY_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_KEY_1) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) 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) Set(java.util.Set) Mockito.times(org.mockito.Mockito.times) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) SetKey(io.sphere.sdk.producttypes.commands.updateactions.SetKey) Mockito.when(org.mockito.Mockito.when) AttributeMetaData(com.commercetools.sync.products.AttributeMetaData) ChangeName(io.sphere.sdk.producttypes.commands.updateactions.ChangeName) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ErrorResponseException(io.sphere.sdk.client.ErrorResponseException) ProductTypeITUtils.deleteProductTypes(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypes) Optional(java.util.Optional) PRODUCT_TYPE_DESCRIPTION_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.PRODUCT_TYPE_DESCRIPTION_1) STRING(org.assertj.core.api.InstanceOfAssertFactories.STRING) Collections(java.util.Collections) CTP_TARGET_CLIENT(com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT) ATTRIBUTE_DEFINITION_DRAFT_1(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1) ProductTypeService(com.commercetools.sync.services.ProductTypeService) ProductTypeSyncOptions(com.commercetools.sync.producttypes.ProductTypeSyncOptions) ProductTypeQuery(io.sphere.sdk.producttypes.queries.ProductTypeQuery) SphereClient(io.sphere.sdk.client.SphereClient) ProductType(io.sphere.sdk.producttypes.ProductType) ProductTypeITUtils.createProductType(com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.createProductType) ProductTypeServiceImpl(com.commercetools.sync.services.impl.ProductTypeServiceImpl) ProductTypeDraft(io.sphere.sdk.producttypes.ProductTypeDraft) 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