From 4256d26e8b497c3f4640dcbe575ddb009ff73e4c Mon Sep 17 00:00:00 2001 From: Hesham Massoud Date: Wed, 16 Oct 2019 15:35:26 +0200 Subject: [PATCH 1/3] #441: Bump JVM SDK. --- gradle-scripts/dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle-scripts/dependencies.gradle b/gradle-scripts/dependencies.gradle index 09b80c6d0a..3695951096 100644 --- a/gradle-scripts/dependencies.gradle +++ b/gradle-scripts/dependencies.gradle @@ -1,5 +1,5 @@ ext{ - commercetoolsJvmSdkVersion = '1.46.0' + commercetoolsJvmSdkVersion = '1.47.0' mockitoJunitJupiterVersion = '3.0.0' jupiterApiVersion = '5.5.2' assertjVersion = '3.13.2' From 1c0fad8199dc2e9f64b32ba1f4f4419c0928051d Mon Sep 17 00:00:00 2001 From: Hesham Massoud Date: Wed, 16 Oct 2019 15:35:40 +0200 Subject: [PATCH 2/3] #441: Enable disabled tests. --- .../sync/products/helpers/ProductBatchProcessorTest.java | 2 -- .../sync/products/helpers/VariantReferenceResolverTest.java | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/test/java/com/commercetools/sync/products/helpers/ProductBatchProcessorTest.java b/src/test/java/com/commercetools/sync/products/helpers/ProductBatchProcessorTest.java index 85ba0fa769..ac4b511193 100644 --- a/src/test/java/com/commercetools/sync/products/helpers/ProductBatchProcessorTest.java +++ b/src/test/java/com/commercetools/sync/products/helpers/ProductBatchProcessorTest.java @@ -12,7 +12,6 @@ import io.sphere.sdk.products.ProductVariantDraftBuilder; import io.sphere.sdk.products.attributes.AttributeDraft; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -325,7 +324,6 @@ void getProductKeyFromReference_WithoutAProductReference_ShouldReturnEmptyOpt() assertThat(result).isEmpty(); } - @Disabled("Fails due to bug on https://github.com/FasterXML/jackson-databind/issues/2442") @Test void getReferencedProductKeysFromSet_WithOnlyNullRefsInSet_ShouldReturnEmptySet() { final AttributeDraft productReferenceSetAttribute = diff --git a/src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java b/src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java index 1b2e12df11..175f5eaf0d 100644 --- a/src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java +++ b/src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java @@ -24,7 +24,6 @@ import io.sphere.sdk.types.CustomFieldsDraft; import io.sphere.sdk.utils.MoneyImpl; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -334,7 +333,6 @@ void resolveReferences_WithMixedReferences_ShouldResolveReferenceAttributes() { .isEqualTo(Customer.referenceTypeId()); } - @Disabled("Fails due to possible bug on https://github.com/FasterXML/jackson-databind/issues/2442") @Test void resolveReferences_WithNullReferenceInSetAttribute_ShouldResolveReferences() { // preparation @@ -370,7 +368,7 @@ void resolveReferences_WithNullReferenceInSetAttribute_ShouldResolveReferences() final ObjectNode resolvedReference = JsonNodeFactory.instance.objectNode(); resolvedReference.put(REFERENCE_TYPE_ID_FIELD, Product.referenceTypeId()); resolvedReference.put(REFERENCE_ID_FIELD, PRODUCT_ID); - assertThat(resolvedSet).containsExactly(resolvedReference); + assertThat(resolvedSet).containsExactlyInAnyOrder(resolvedReference, JsonNodeFactory.instance.nullNode()); } @Test From 3c3a748b43e00b0d56aab09f170eeaa269b2a769 Mon Sep 17 00:00:00 2001 From: Hesham Massoud Date: Wed, 16 Oct 2019 17:03:33 +0200 Subject: [PATCH 3/3] #441: Fix assertions. --- .../products/ProductSyncWithAssetsIT.java | 8 ++++---- .../externalsource/products/ProductSyncWithAssetsIT.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/products/ProductSyncWithAssetsIT.java b/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/products/ProductSyncWithAssetsIT.java index c3c5b46c62..0c881955a1 100644 --- a/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/products/ProductSyncWithAssetsIT.java +++ b/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/products/ProductSyncWithAssetsIT.java @@ -162,7 +162,7 @@ void sync_withNewProductWithAssets_shouldCreateProduct() { final List productDrafts = replaceProductsReferenceIdsWithKeys(products); - final ProductSyncStatistics syncStatistics = productSync.sync(productDrafts).toCompletableFuture().join(); + final ProductSyncStatistics syncStatistics = productSync.sync(productDrafts).toCompletableFuture().join(); // Assert results of sync assertThat(syncStatistics).hasValues(1, 1, 0, 0); @@ -216,7 +216,7 @@ void sync_withMatchingProductWithAssetChanges_shouldUpdateProduct() { final List productDrafts = replaceProductsReferenceIdsWithKeys(products); - final ProductSyncStatistics syncStatistics = productSync.sync(productDrafts).toCompletableFuture().join(); + final ProductSyncStatistics syncStatistics = productSync.sync(productDrafts).toCompletableFuture().join(); // Assert results of sync assertThat(syncStatistics).hasValues(1, 0, 1, 0); @@ -240,9 +240,9 @@ void sync_withMatchingProductWithAssetChanges_shouldUpdateProduct() { RemoveAsset.ofVariantIdWithKey(1, "1", true), ChangeAssetName.ofAssetKeyAndVariantId(1, "2", ofEnglish("newName"), true), SetAssetCustomType.ofVariantIdAndAssetKey(1, "2", null, true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, customFieldsJsonMap.get(BOOLEAN_CUSTOM_FIELD_NAME), true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, null, true), ChangeAssetOrder.ofVariantId(1, asList(assetsKeyToIdMap.get("3"), assetsKeyToIdMap.get("2")), true), AddAsset.ofVariantId(1, createAssetDraft("4", ofEnglish("4"), diff --git a/src/integration-test/java/com/commercetools/sync/integration/externalsource/products/ProductSyncWithAssetsIT.java b/src/integration-test/java/com/commercetools/sync/integration/externalsource/products/ProductSyncWithAssetsIT.java index 6653ca9253..6ad3acec0b 100644 --- a/src/integration-test/java/com/commercetools/sync/integration/externalsource/products/ProductSyncWithAssetsIT.java +++ b/src/integration-test/java/com/commercetools/sync/integration/externalsource/products/ProductSyncWithAssetsIT.java @@ -250,9 +250,9 @@ void sync_withMatchingProductWithAssetChanges_shouldUpdateProduct() { RemoveAsset.ofVariantIdWithKey(1, "1", true), ChangeAssetName.ofAssetKeyAndVariantId(1, "2", ofEnglish("new name"), true), SetAssetCustomType.ofVariantIdAndAssetKey(1, "2", null, true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, customFieldsJsonMap.get(BOOLEAN_CUSTOM_FIELD_NAME), true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, null, true), ChangeAssetOrder.ofVariantId(1, asList(assetsKeyToIdMap.get("3"), assetsKeyToIdMap.get("2")), true), AddAsset.ofVariantId(1, createAssetDraft("4", ofEnglish("4"), assetsCustomType.getId())) @@ -316,9 +316,9 @@ void sync_withMatchingProductWithNewVariantWithAssets_shouldUpdateAddAssetsToNew RemoveAsset.ofVariantIdWithKey(1, "1", true), ChangeAssetName.ofAssetKeyAndVariantId(1, "2", ofEnglish("new name"), true), SetAssetCustomType.ofVariantIdAndAssetKey(1, "2", null, true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", BOOLEAN_CUSTOM_FIELD_NAME, customFieldsJsonMap.get(BOOLEAN_CUSTOM_FIELD_NAME), true), - SetAssetCustomField.ofVariantIdAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, + SetAssetCustomField.ofVariantIdUsingJsonAndAssetKey(1, "3", LOCALISED_STRING_CUSTOM_FIELD_NAME, null, true), ChangeAssetOrder.ofVariantId(1, asList(assetsKeyToIdMap.get("3"), assetsKeyToIdMap.get("2")), true), AddAsset.ofVariantId(1, createAssetDraft("4", ofEnglish("4"), assetsCustomType.getId()))