Search in sources :

Example 1 with ProductTransformService

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

the class ProductTransformServiceImplTest method transform_WithAttributeReferences_ShouldReplaceAttributeReferenceIdsWithKeys.

@Test
void transform_WithAttributeReferences_ShouldReplaceAttributeReferenceIdsWithKeys() {
    // preparation
    final SphereClient sourceClient = mock(SphereClient.class);
    final ProductTransformService productTransformService = new ProductTransformServiceImpl(sourceClient, referenceIdToKeyCache);
    final List<ProductProjection> productPage = asList(readObjectFromResource("product-key-4.json", Product.class).toProjection(STAGED));
    String jsonStringProducts = "{\"results\":[{\"id\":\"53c4a8b4-754f-4b95-b6f2-3e1e70e3d0d2\",\"key\":\"prod1\"}," + "{\"id\":\"53c4a8b4-754f-4b95-b6f2-3e1e70e3d0d6\",\"key\":\"prod2\"}]}";
    final ResourceKeyIdGraphQlResult productsResult = SphereJsonUtils.readObject(jsonStringProducts, ResourceKeyIdGraphQlResult.class);
    String jsonStringProductTypes = "{\"results\":[{\"id\":\"53c4a8b4-754f-4b95-b6f2-3e1e70e3d0d3\"," + "\"key\":\"prodType1\"}]}";
    final ResourceKeyIdGraphQlResult productTypesResult = SphereJsonUtils.readObject(jsonStringProductTypes, ResourceKeyIdGraphQlResult.class);
    String jsonStringCategories = "{\"results\":[{\"id\":\"53c4a8b4-754f-4b95-b6f2-3e1e70e3d0d4\",\"key\":\"cat1\"}," + "{\"id\":\"53c4a8b4-754f-4b95-b6f2-3e1e70e3d0d5\",\"key\":\"cat2\"}]}";
    final ResourceKeyIdGraphQlResult categoriesResult = SphereJsonUtils.readObject(jsonStringCategories, ResourceKeyIdGraphQlResult.class);
    when(sourceClient.execute(any(ResourceIdsGraphQlRequest.class))).thenReturn(CompletableFuture.completedFuture(productsResult)).thenReturn(CompletableFuture.completedFuture(productTypesResult)).thenReturn(CompletableFuture.completedFuture(categoriesResult));
    // test
    final List<ProductDraft> productsResolved = productTransformService.toProductDrafts(productPage).toCompletableFuture().join();
    // assertions
    final Optional<ProductDraft> productKey1 = productsResolved.stream().filter(productDraft -> "productKey4".equals(productDraft.getKey())).findFirst();
    assertThat(productKey1).hasValueSatisfying(product -> assertThat(product.getMasterVariant().getAttributes()).anySatisfy(attribute -> {
        assertThat(attribute.getName()).isEqualTo("productReference");
        final JsonNode referenceSet = attribute.getValue();
        assertThat(referenceSet).anySatisfy(reference -> assertThat(reference.get("id").asText()).isEqualTo("prod1"));
        assertThat(referenceSet).anySatisfy(reference -> assertThat(reference.get("id").asText()).isEqualTo("prod2"));
    }));
    assertThat(productKey1).hasValueSatisfying(product -> assertThat(product.getMasterVariant().getAttributes()).anySatisfy(attribute -> {
        assertThat(attribute.getName()).isEqualTo("categoryReference");
        final JsonNode referenceSet = attribute.getValue();
        assertThat(referenceSet).anySatisfy(reference -> assertThat(reference.get("id").asText()).isEqualTo("cat1"));
        assertThat(referenceSet).anySatisfy(reference -> assertThat(reference.get("id").asText()).isEqualTo("cat2"));
    }));
    assertThat(productKey1).hasValueSatisfying(product -> assertThat(product.getMasterVariant().getAttributes()).anySatisfy(attribute -> {
        assertThat(attribute.getName()).isEqualTo("productTypeReference");
        assertThat(attribute.getValue().get("id").asText()).isEqualTo("prodType1");
    }));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) STAGED(io.sphere.sdk.products.ProductProjectionType.STAGED) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CustomObject(io.sphere.sdk.customobjects.CustomObject) SphereJsonUtils(io.sphere.sdk.json.SphereJsonUtils) KEY_IS_NOT_SET_PLACE_HOLDER(com.commercetools.sync.services.impl.BaseTransformServiceImpl.KEY_IS_NOT_SET_PLACE_HOLDER) CompletableFuture(java.util.concurrent.CompletableFuture) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) Collections.singletonList(java.util.Collections.singletonList) ReferenceIdToKeyCache(com.commercetools.sync.commons.utils.ReferenceIdToKeyCache) Arrays.asList(java.util.Arrays.asList) SphereClient(io.sphere.sdk.client.SphereClient) JsonNode(com.fasterxml.jackson.databind.JsonNode) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) BadGatewayException(io.sphere.sdk.client.BadGatewayException) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Product(io.sphere.sdk.products.Product) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) ReferenceTransformException(com.commercetools.sync.commons.exceptions.ReferenceTransformException) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) JsonNode(com.fasterxml.jackson.databind.JsonNode) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) ProductProjection(io.sphere.sdk.products.ProductProjection) ProductDraft(io.sphere.sdk.products.ProductDraft) SphereClient(io.sphere.sdk.client.SphereClient) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) Test(org.junit.jupiter.api.Test)

Example 2 with ProductTransformService

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

the class ProductTransformServiceImplTest method transform_WithNonCachedCustomObjectAttributeReference_ShouldFetchAndTransformProduct.

@Test
void transform_WithNonCachedCustomObjectAttributeReference_ShouldFetchAndTransformProduct() {
    // preparation
    final SphereClient sourceClient = mock(SphereClient.class);
    final ProductTransformService productTransformService = new ProductTransformServiceImpl(sourceClient, referenceIdToKeyCache);
    final List<ProductProjection> productPage = asList(readObjectFromResource("product-with-unresolved-references.json", Product.class).toProjection(STAGED));
    String jsonStringProductTypes = "{\"results\":[{\"id\":\"cda0dbf7-b42e-40bf-8453-241d5b587f93\"," + "\"key\":\"productTypeKey\"}]}";
    final ResourceKeyIdGraphQlResult productTypesResult = SphereJsonUtils.readObject(jsonStringProductTypes, ResourceKeyIdGraphQlResult.class);
    when(sourceClient.execute(any(ResourceIdsGraphQlRequest.class))).thenReturn(CompletableFuture.completedFuture(productTypesResult));
    mockAttributeCustomObjectReference(sourceClient);
    // test
    final List<ProductDraft> productsResolved = productTransformService.toProductDrafts(productPage).join();
    final Optional<ProductDraft> productKey1 = productsResolved.stream().filter(productDraft -> "productKeyResolved".equals(productDraft.getKey())).findFirst();
    assertThat(productKey1).hasValueSatisfying(product -> assertThat(product.getMasterVariant().getAttributes()).anySatisfy(attribute -> {
        assertThat(attribute.getName()).isEqualTo("customObjectReference");
    }));
    verify(sourceClient, times(1)).execute(any(CustomObjectQuery.class));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) STAGED(io.sphere.sdk.products.ProductProjectionType.STAGED) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CustomObject(io.sphere.sdk.customobjects.CustomObject) SphereJsonUtils(io.sphere.sdk.json.SphereJsonUtils) KEY_IS_NOT_SET_PLACE_HOLDER(com.commercetools.sync.services.impl.BaseTransformServiceImpl.KEY_IS_NOT_SET_PLACE_HOLDER) CompletableFuture(java.util.concurrent.CompletableFuture) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) Collections.singletonList(java.util.Collections.singletonList) ReferenceIdToKeyCache(com.commercetools.sync.commons.utils.ReferenceIdToKeyCache) Arrays.asList(java.util.Arrays.asList) SphereClient(io.sphere.sdk.client.SphereClient) JsonNode(com.fasterxml.jackson.databind.JsonNode) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) BadGatewayException(io.sphere.sdk.client.BadGatewayException) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Product(io.sphere.sdk.products.Product) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) ReferenceTransformException(com.commercetools.sync.commons.exceptions.ReferenceTransformException) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) ProductProjection(io.sphere.sdk.products.ProductProjection) ProductDraft(io.sphere.sdk.products.ProductDraft) SphereClient(io.sphere.sdk.client.SphereClient) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) Test(org.junit.jupiter.api.Test)

Example 3 with ProductTransformService

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

the class ProductTransformServiceImplTest method transform_WithErrorOnGraphQlRequest_ShouldThrowReferenceTransformException.

@Test
void transform_WithErrorOnGraphQlRequest_ShouldThrowReferenceTransformException() {
    // preparation
    final SphereClient sourceClient = mock(SphereClient.class);
    final ProductTransformService productTransformService = new ProductTransformServiceImpl(sourceClient, referenceIdToKeyCache);
    final List<ProductProjection> productPage = asList(readObjectFromResource("product-key-5.json", Product.class).toProjection(STAGED), readObjectFromResource("product-key-6.json", Product.class).toProjection(STAGED));
    final BadGatewayException badGatewayException = new BadGatewayException("Failed Graphql request");
    when(sourceClient.execute(any(ResourceIdsGraphQlRequest.class))).thenReturn(CompletableFutureUtils.failed(badGatewayException));
    // test
    final CompletionStage<List<ProductDraft>> productDraftsFromPageStage = productTransformService.toProductDrafts(productPage);
    // assertions
    assertThat(productDraftsFromPageStage).failsWithin(1, TimeUnit.SECONDS).withThrowableOfType(ExecutionException.class).withCauseExactlyInstanceOf(ReferenceTransformException.class).withRootCauseExactlyInstanceOf(BadGatewayException.class);
    ;
}
Also used : ProductProjection(io.sphere.sdk.products.ProductProjection) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ReferenceTransformException(com.commercetools.sync.commons.exceptions.ReferenceTransformException) SphereClient(io.sphere.sdk.client.SphereClient) Collections.singletonList(java.util.Collections.singletonList) Arrays.asList(java.util.Arrays.asList) List(java.util.List) BadGatewayException(io.sphere.sdk.client.BadGatewayException) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) Test(org.junit.jupiter.api.Test)

Example 4 with ProductTransformService

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

the class ProductTransformServiceImplTest method transform_ProductWithProductTypeReferencesWithNullKey_ShouldReplaceReferencesKeyValueWithPlaceHolder.

@Test
void transform_ProductWithProductTypeReferencesWithNullKey_ShouldReplaceReferencesKeyValueWithPlaceHolder() {
    // preparation
    final SphereClient sourceClient = mock(SphereClient.class);
    final ProductTransformService productTransformService = new ProductTransformServiceImpl(sourceClient, referenceIdToKeyCache);
    final List<ProductProjection> productPage = asList(readObjectFromResource("product-with-unresolved-references.json", Product.class).toProjection(STAGED));
    String jsonStringProductTypes = "{\"results\":[{\"id\":\"cda0dbf7-b42e-40bf-8453-241d5b587f93\"," + "\"key\":" + null + "}]}";
    final ResourceKeyIdGraphQlResult productTypesResult = SphereJsonUtils.readObject(jsonStringProductTypes, ResourceKeyIdGraphQlResult.class);
    when(sourceClient.execute(any(ResourceIdsGraphQlRequest.class))).thenReturn(CompletableFuture.completedFuture(productTypesResult));
    mockAttributeCustomObjectReference(sourceClient);
    // test
    final List<ProductDraft> productsResolved = productTransformService.toProductDrafts(productPage).toCompletableFuture().join();
    // assertions
    final Optional<ProductDraft> productKey1 = productsResolved.stream().filter(productDraft -> "productKeyResolved".equals(productDraft.getKey())).findFirst();
    assertThat(productKey1).hasValueSatisfying(productDraft -> assertThat(productDraft.getProductType().getKey()).isEqualTo(KEY_IS_NOT_SET_PLACE_HOLDER));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) STAGED(io.sphere.sdk.products.ProductProjectionType.STAGED) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CustomObject(io.sphere.sdk.customobjects.CustomObject) SphereJsonUtils(io.sphere.sdk.json.SphereJsonUtils) KEY_IS_NOT_SET_PLACE_HOLDER(com.commercetools.sync.services.impl.BaseTransformServiceImpl.KEY_IS_NOT_SET_PLACE_HOLDER) CompletableFuture(java.util.concurrent.CompletableFuture) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) Collections.singletonList(java.util.Collections.singletonList) ReferenceIdToKeyCache(com.commercetools.sync.commons.utils.ReferenceIdToKeyCache) Arrays.asList(java.util.Arrays.asList) SphereClient(io.sphere.sdk.client.SphereClient) JsonNode(com.fasterxml.jackson.databind.JsonNode) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) BadGatewayException(io.sphere.sdk.client.BadGatewayException) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Product(io.sphere.sdk.products.Product) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) ReferenceTransformException(com.commercetools.sync.commons.exceptions.ReferenceTransformException) ProductProjection(io.sphere.sdk.products.ProductProjection) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) SphereClient(io.sphere.sdk.client.SphereClient) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) Test(org.junit.jupiter.api.Test)

Example 5 with ProductTransformService

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

the class ProductTransformServiceImplTest method transform_ProductReferences_ShouldReplaceReferencesIdsWithKeysAndMapToProductDraft.

@Test
void transform_ProductReferences_ShouldReplaceReferencesIdsWithKeysAndMapToProductDraft() {
    // preparation
    final SphereClient sourceClient = mock(SphereClient.class);
    final ProductTransformService productTransformService = new ProductTransformServiceImpl(sourceClient, referenceIdToKeyCache);
    final List<ProductProjection> productPage = asList(readObjectFromResource("product-with-unresolved-references.json", Product.class).toProjection(STAGED));
    String jsonStringProductTypes = "{\"results\":[{\"id\":\"cda0dbf7-b42e-40bf-8453-241d5b587f93\"," + "\"key\":\"productTypeKey\"}]}";
    final ResourceKeyIdGraphQlResult productTypesResult = SphereJsonUtils.readObject(jsonStringProductTypes, ResourceKeyIdGraphQlResult.class);
    String jsonStringState = "{\"results\":[{\"id\":\"ste95fb-2282-4f9a-8747-fbe440e02dcs0\"," + "\"key\":\"stateKey\"}]}";
    final ResourceKeyIdGraphQlResult statesResult = SphereJsonUtils.readObject(jsonStringState, ResourceKeyIdGraphQlResult.class);
    String jsonStringTaxCategory = "{\"results\":[{\"id\":\"ebbe95fb-2282-4f9a-8747-fbe440e02dc0\"," + "\"key\":\"taxCategoryKey\"}]}";
    final ResourceKeyIdGraphQlResult taxCategoryResult = SphereJsonUtils.readObject(jsonStringTaxCategory, ResourceKeyIdGraphQlResult.class);
    String jsonStringCustomerGroup = "{\"results\":[{\"id\":\"d1229e6f-2b79-441e-b419-180311e52754\"," + "\"key\":\"customerGroupKey\"}]}";
    final ResourceKeyIdGraphQlResult customerGroupResult = SphereJsonUtils.readObject(jsonStringCustomerGroup, ResourceKeyIdGraphQlResult.class);
    String jsonStringChannel = "{\"results\":[{\"id\":\"cdcf8bea-48f2-54bc-b3c2-cdc94bf94f2c\"," + "\"key\":\"channelKey\"}]}";
    final ResourceKeyIdGraphQlResult channelResult = SphereJsonUtils.readObject(jsonStringChannel, ResourceKeyIdGraphQlResult.class);
    String jsonStringCategories = "{\"results\":[{\"id\":\"1dfc8bea-84f2-45bc-b3c2-cdc94bf96f1f\",\"key\":\"categoryKey1\"}," + "{\"id\":\"2dfc8bea-84f2-45bc-b3c2-cdc94bf96f1f\",\"key\":\"categoryKey2\"}]}";
    final ResourceKeyIdGraphQlResult categoriesResult = SphereJsonUtils.readObject(jsonStringCategories, ResourceKeyIdGraphQlResult.class);
    String jsonStringCustomTypes = "{\"results\":[{\"id\":\"custom_type_id\"," + "\"key\":\"customTypeId\"}]}";
    final ResourceKeyIdGraphQlResult customTypesResult = SphereJsonUtils.readObject(jsonStringCustomTypes, ResourceKeyIdGraphQlResult.class);
    when(sourceClient.execute(any(ResourceIdsGraphQlRequest.class))).thenReturn(CompletableFuture.completedFuture(productTypesResult)).thenReturn(CompletableFuture.completedFuture(categoriesResult)).thenReturn(CompletableFuture.completedFuture(statesResult)).thenReturn(CompletableFuture.completedFuture(channelResult)).thenReturn(CompletableFuture.completedFuture(taxCategoryResult)).thenReturn(CompletableFuture.completedFuture(customerGroupResult)).thenReturn(CompletableFuture.completedFuture(customTypesResult));
    mockAttributeCustomObjectReference(sourceClient);
    // test
    final List<ProductDraft> productsResolved = productTransformService.toProductDrafts(productPage).toCompletableFuture().join();
    // assertions
    final Optional<ProductDraft> productKey1 = productsResolved.stream().filter(productDraft -> "productKeyResolved".equals(productDraft.getKey())).findFirst();
    assertThat(productKey1).hasValueSatisfying(productDraft -> assertThat(productDraft.getMasterVariant().getPrices()).anySatisfy(priceDraft -> {
        assertThat(priceDraft.getChannel().getKey()).isEqualTo("channelKey");
        assertThat(priceDraft.getCustomerGroup().getKey()).isEqualTo("customerGroupKey");
    }));
    assertThat(productKey1).hasValueSatisfying(productDraft -> {
        assertThat(productDraft.getProductType().getKey()).isEqualTo("productTypeKey");
        assertThat(productDraft.getState().getKey()).isEqualTo("stateKey");
        assertThat(productDraft.getTaxCategory().getKey()).isEqualTo("taxCategoryKey");
        assertThat(productDraft.getCategories()).anySatisfy(categoryDraft -> {
            assertThat(categoryDraft.getKey()).isEqualTo("categoryKey1");
        });
    });
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) CustomObjectQuery(io.sphere.sdk.customobjects.queries.CustomObjectQuery) SphereJsonUtils.readObjectFromResource(io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource) STAGED(io.sphere.sdk.products.ProductProjectionType.STAGED) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CustomObject(io.sphere.sdk.customobjects.CustomObject) SphereJsonUtils(io.sphere.sdk.json.SphereJsonUtils) KEY_IS_NOT_SET_PLACE_HOLDER(com.commercetools.sync.services.impl.BaseTransformServiceImpl.KEY_IS_NOT_SET_PLACE_HOLDER) CompletableFuture(java.util.concurrent.CompletableFuture) CompletableFutureUtils(io.sphere.sdk.utils.CompletableFutureUtils) Collections.singletonList(java.util.Collections.singletonList) ReferenceIdToKeyCache(com.commercetools.sync.commons.utils.ReferenceIdToKeyCache) Arrays.asList(java.util.Arrays.asList) SphereClient(io.sphere.sdk.client.SphereClient) JsonNode(com.fasterxml.jackson.databind.JsonNode) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) ProductProjection(io.sphere.sdk.products.ProductProjection) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) BadGatewayException(io.sphere.sdk.client.BadGatewayException) CaffeineReferenceIdToKeyCacheImpl(com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Product(io.sphere.sdk.products.Product) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) PagedQueryResult(io.sphere.sdk.queries.PagedQueryResult) Optional(java.util.Optional) Mockito.mock(org.mockito.Mockito.mock) ReferenceTransformException(com.commercetools.sync.commons.exceptions.ReferenceTransformException) ProductProjection(io.sphere.sdk.products.ProductProjection) ProductTransformService(com.commercetools.sync.products.service.ProductTransformService) ProductDraft(io.sphere.sdk.products.ProductDraft) SphereClient(io.sphere.sdk.client.SphereClient) ResourceKeyIdGraphQlResult(com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult) ResourceIdsGraphQlRequest(com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest) Test(org.junit.jupiter.api.Test)

Aggregations

ReferenceTransformException (com.commercetools.sync.commons.exceptions.ReferenceTransformException)6 ResourceIdsGraphQlRequest (com.commercetools.sync.commons.models.ResourceIdsGraphQlRequest)6 ProductTransformService (com.commercetools.sync.products.service.ProductTransformService)6 BadGatewayException (io.sphere.sdk.client.BadGatewayException)6 SphereClient (io.sphere.sdk.client.SphereClient)6 ProductProjection (io.sphere.sdk.products.ProductProjection)6 Arrays.asList (java.util.Arrays.asList)6 Collections.singletonList (java.util.Collections.singletonList)6 List (java.util.List)6 Test (org.junit.jupiter.api.Test)6 ResourceKeyIdGraphQlResult (com.commercetools.sync.commons.models.ResourceKeyIdGraphQlResult)5 CaffeineReferenceIdToKeyCacheImpl (com.commercetools.sync.commons.utils.CaffeineReferenceIdToKeyCacheImpl)5 ReferenceIdToKeyCache (com.commercetools.sync.commons.utils.ReferenceIdToKeyCache)5 KEY_IS_NOT_SET_PLACE_HOLDER (com.commercetools.sync.services.impl.BaseTransformServiceImpl.KEY_IS_NOT_SET_PLACE_HOLDER)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 CustomObject (io.sphere.sdk.customobjects.CustomObject)5 CustomObjectQuery (io.sphere.sdk.customobjects.queries.CustomObjectQuery)5 SphereJsonUtils (io.sphere.sdk.json.SphereJsonUtils)5 SphereJsonUtils.readObjectFromResource (io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource)5 Product (io.sphere.sdk.products.Product)5