use of com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_1_CHANGED_RESOURCE_PATH in project commercetools-sync-java by commercetools.
the class ProductSyncIT method sync_withChangedProductButConcurrentModificationException_shouldRetryAndUpdateProduct.
@Test
void sync_withChangedProductButConcurrentModificationException_shouldRetryAndUpdateProduct() {
// preparation
final SphereClient spyClient = buildClientWithConcurrentModificationUpdate();
final ProductSyncOptions spyOptions = ProductSyncOptionsBuilder.of(spyClient).errorCallback((exception, oldResource, newResource, updateActions) -> collectErrors(exception.getMessage(), exception.getCause())).warningCallback((exception, oldResource, newResource) -> warningCallBackMessages.add(exception.getMessage())).build();
final ProductSync spyProductSync = new ProductSync(spyOptions);
final ProductDraft productDraft = createProductDraft(PRODUCT_KEY_1_CHANGED_RESOURCE_PATH, ResourceIdentifier.ofKey(productType.getKey()), ResourceIdentifier.ofKey(targetTaxCategory.getKey()), ResourceIdentifier.ofKey(targetProductState.getKey()), categoryResourceIdentifiersWithKeys, categoryOrderHintsWithKeys);
final ProductSyncStatistics syncStatistics = executeBlocking(spyProductSync.sync(singletonList(productDraft)));
assertThat(syncStatistics).hasValues(1, 0, 1, 0, 0);
assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
assertThat(warningCallBackMessages).isEmpty();
}
Aggregations