use of com.commercetools.sync.producttypes.ProductTypeSyncOptionsBuilder in project commercetools-sync-java by commercetools.
the class ProductTypeSyncIT method sync_WithSeveralBatches_ShouldReturnProperStatistics.
@Test
void sync_WithSeveralBatches_ShouldReturnProperStatistics() {
// Default batch size is 50 (check ProductTypeSyncOptionsBuilder) so we have 2 batches of 50
final List<ProductTypeDraft> productTypeDrafts = IntStream.range(0, 100).mapToObj(i -> ProductTypeDraft.ofAttributeDefinitionDrafts("product_type_key_" + Integer.toString(i), "product_type_name_" + Integer.toString(i), "product_type_description_" + Integer.toString(i), singletonList(ATTRIBUTE_DEFINITION_DRAFT_1))).collect(Collectors.toList());
final ProductTypeSyncOptions productTypeSyncOptions = ProductTypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).build();
final ProductTypeSync productTypeSync = new ProductTypeSync(productTypeSyncOptions);
final ProductTypeSyncStatistics productTypeSyncStatistics = productTypeSync.sync(productTypeDrafts).toCompletableFuture().join();
assertThat(productTypeSyncStatistics).hasValues(100, 100, 0, 0, 0);
}
Aggregations