use of com.commercetools.sync.types.TypeSyncOptionsBuilder in project commercetools-sync-java by commercetools.
the class TypeSyncIT method sync_WithSeveralBatches_ShouldReturnProperStatistics.
@Test
void sync_WithSeveralBatches_ShouldReturnProperStatistics() {
// preparation
// Default batch size is 50 (check TypeSyncOptionsBuilder) so we have 2 batches of 50
final List<TypeDraft> typeDrafts = IntStream.range(0, 100).mapToObj(i -> TypeDraftBuilder.of("key__" + Integer.toString(i), LocalizedString.ofEnglish("name__" + Integer.toString(i)), ResourceTypeIdsSetBuilder.of().addCategories().build()).description(LocalizedString.ofEnglish("description__" + Integer.toString(i))).fieldDefinitions(singletonList(FIELD_DEFINITION_1)).build()).collect(Collectors.toList());
final TypeSyncOptions typeSyncOptions = TypeSyncOptionsBuilder.of(CTP_TARGET_CLIENT).build();
final TypeSync typeSync = new TypeSync(typeSyncOptions);
// test
final TypeSyncStatistics typeSyncStatistics = typeSync.sync(typeDrafts).toCompletableFuture().join();
// assertion
assertThat(typeSyncStatistics).hasValues(100, 100, 0, 0);
}
Aggregations