Skip to content

Commit

Permalink
Bump library version to the v2.2.0 (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetoz authored Sep 25, 2020
1 parent 5a1f8d2 commit 9059dab
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 41 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# commercetools sync
[![Build Status](https://travis-ci.org/commercetools/commercetools-sync-java.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-sync-java)
[![codecov](https://codecov.io/gh/commercetools/commercetools-sync-java/branch/master/graph/badge.svg)](https://codecov.io/gh/commercetools/commercetools-sync-java)
[![Benchmarks 2.1.0](https://img.shields.io/badge/Benchmarks-2.1.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
[![Benchmarks 2.2.0](https://img.shields.io/badge/Benchmarks-2.2.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
[![Download](https://api.bintray.com/packages/commercetools/maven/commercetools-sync-java/images/download.svg) ](https://bintray.com/commercetools/maven/commercetools-sync-java/_latestVersion)
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/)
[![Known Vulnerabilities](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646/badge.svg)](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646)

More at https://commercetools.github.io/commercetools-sync-java
Expand Down Expand Up @@ -37,7 +37,7 @@ The library supports synchronising the following entities in commercetools
- [Ivy](#ivy)
- [Roadmap](#roadmap)
- [Release Notes](/docs/RELEASE_NOTES.md)
- [Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
- [Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/)
- [Benchmarks](https://commercetools.github.io/commercetools-sync-java/benchmarks/)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand All @@ -64,7 +64,7 @@ commercetools sync is a Java library that imports commercetools platform data in

- Make sure you have `JDK 8` installed.
- [commercetools-jvm-sdk](https://github.com/commercetools/commercetools-jvm-sdk) as a dependency in your JVM-based
application. (Make sure to use a version `>= 1.47.0`).
application. (Make sure to use a version `>= 1.53.0`).
- a target commercetools project for syncing your source data to.


Expand All @@ -79,26 +79,26 @@ Here are the most popular ones:
<dependency>
<groupId>com.commercetools</groupId>
<artifactId>commercetools-sync-java</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
````

#### Gradle

````groovy
implementation 'com.commercetools:commercetools-sync-java:2.1.0'
implementation 'com.commercetools:commercetools-sync-java:2.2.0'
````

#### SBT

````
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.1.0"
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.2.0"
````

#### Ivy

````xml
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.1.0"/>
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.2.0"/>
````


Expand Down
12 changes: 6 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# commercetools sync
[![Build Status](https://travis-ci.org/commercetools/commercetools-sync-java.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-sync-java)
[![codecov](https://codecov.io/gh/commercetools/commercetools-sync-java/branch/master/graph/badge.svg)](https://codecov.io/gh/commercetools/commercetools-sync-java)
[![Benchmarks 2.1.0](https://img.shields.io/badge/Benchmarks-2.1.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
[![Benchmarks 2.2.0](https://img.shields.io/badge/Benchmarks-2.2.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
[![Download](https://api.bintray.com/packages/commercetools/maven/commercetools-sync-java/images/download.svg) ](https://bintray.com/commercetools/maven/commercetools-sync-java/_latestVersion)
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/)
[![Known Vulnerabilities](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646/badge.svg)](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646)


Expand Down Expand Up @@ -56,18 +56,18 @@ Here are the most popular ones:
<dependency>
<groupId>com.commercetools</groupId>
<artifactId>commercetools-sync-java</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
````
#### Gradle
````groovy
implementation 'com.commercetools:commercetools-sync-java:2.1.0'
implementation 'com.commercetools:commercetools-sync-java:2.2.0'
````
#### SBT
````
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.1.0"
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.2.0"
````
#### Ivy
````xml
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.1.0"/>
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.2.0"/>
````
9 changes: 5 additions & 4 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
-->

<!--
### 2.2.0 - MM xx,, 2020
### 2.2.0 - Sep 25, 2020
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/2.1.0...2.2.0) |
[Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/) |
[Jar](https://bintray.com/commercetools/maven/commercetools-sync-java/2.2.0)
Expand All @@ -45,7 +43,10 @@
[#235](https://github.com/commercetools/commercetools-sync-java/issues/235)
- Populated `keyToId` caches in services before reference resolution to improve the performance of the library
with collecting referenced keys in batches of drafts. [#235](https://github.com/commercetools/commercetools-sync-java/issues/235)
-->

- 🛠️ **Dependency Updates** (1)
- `mockito-junit-jupiter` `3.5.11` -> [`3.5.13`](https://github.com/mockito/mockito/releases/tag/v3.5.13)


### 2.1.0 - Sep 21, 2020
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/2.0.0...2.1.0) |
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/CART_DISCOUNT_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fields set, otherwise they won't be matched.
Types are matched by their `key`s. Therefore, in order for the sync to resolve the
actual ids of the type reference, the `key` of the `Type` has to be supplied.

- When syncing from a source commercetools project, you can use [`mapToCartDiscountDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/cartdiscounts/utils/CartDiscountReferenceResolutionUtils.html#mapToCartDiscountDrafts-java.util.List-)
- When syncing from a source commercetools project, you can use [`mapToCartDiscountDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/cartdiscounts/utils/CartDiscountReferenceResolutionUtils.html#mapToCartDiscountDrafts-java.util.List-)
method that maps from a `CartDiscount` to `CartDiscountDraft` in order to make them ready for reference resolution by the sync:

````java
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/CATEGORY_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ otherwise they won't be matched.
These references are matched by their `key`s. Therefore, in order for the sync to resolve the
actual ids of the references, their `key`s has to be supplied.

- When syncing from a source commercetools project, you can use [`mapToCategoryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/categories/utils/CategoryReferenceResolutionUtils.html#mapToCategoryDrafts-java.util.List-)
- When syncing from a source commercetools project, you can use [`mapToCategoryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/categories/utils/CategoryReferenceResolutionUtils.html#mapToCategoryDrafts-java.util.List-)
method that maps from a `Category` to `CategoryDraft` in order to make them ready for reference resolution by the sync:
````java
final List<CategoryDraft> categoryDrafts = CategoryReferenceResolutionUtils.mapToCategoryDrafts(categories);
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/IMPORTANT_USAGE_TIPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ productSync.sync(batch1)
By design, scaling the sync process should **not** be done by executing the batches themselves in parallel. However, it can be done either by:

- Changing the number of [max parallel requests](https://github.com/commercetools/commercetools-sync-java/tree/master/src/main/java/com/commercetools/sync/commons/utils/ClientConfigurationUtils.java#L116) within the `sphereClient` configuration. It defines how many requests the client can execute in parallel.
- or changing the draft [batch size](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/commons/BaseSyncOptionsBuilder.html#batchSize-int-). It defines how many drafts can one batch contain.
- or changing the draft [batch size](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/commons/BaseSyncOptionsBuilder.html#batchSize-int-). It defines how many drafts can one batch contain.

The current overridable default [configuration](https://github.com/commercetools/commercetools-sync-java/tree/master/src/main/java/com/commercetools/sync/commons/utils/ClientConfigurationUtils.java#L45) of the `sphereClient`
is the recommended good balance for stability and performance for the sync process.
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/INVENTORY_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ against a [InventoryEntryDraft](https://docs.commercetools.com/http-api-projects
references are matched by their `key`s. Therefore, in order for the sync to resolve the actual ids of those references,
their `key`s has to be supplied.

- When syncing from a source commercetools project, you can use [`mapToInventoryEntryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/inventories/utils/InventoryReferenceResolutionUtils.html#mapToInventoryEntryDrafts-java.util.List-)
- When syncing from a source commercetools project, you can use [`mapToInventoryEntryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/inventories/utils/InventoryReferenceResolutionUtils.html#mapToInventoryEntryDrafts-java.util.List-)
method that that maps from a `InventoryEntry` to `InventoryEntryDraft` in order to make them ready for reference resolution by the sync:
````java
final List<InventoryEntryDraft> inventoryEntryDrafts = InventoryReferenceResolutionUtils.mapToInventoryEntryDrafts(inventoryEntries);
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/PRODUCT_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ all the variants in the target project are expected to have the `sku` fields set
of the product also have prices, where each price also has some references including a reference to the `Type` of its
custom fields and a reference to a `channel`. All these referenced resources are matched by their `key`s. Therefore, in
order for the sync to resolve the actual ids of those references, those `key`s have to be supplied in the following way:
- When syncing from a source commercetools project, you can use [`mapToProductDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/products/utils/ProductReferenceResolutionUtils.html#mapToProductDrafts-java.util.List-)
- When syncing from a source commercetools project, you can use [`mapToProductDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/products/utils/ProductReferenceResolutionUtils.html#mapToProductDrafts-java.util.List-)
method that maps from a `Product` to `ProductDraft` in order to make them ready for reference resolution by the sync:
````java
final List<ProductDraft> productDrafts = ProductReferenceResolutionUtils.mapToProductDrafts(products);
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/PRODUCT_TYPE_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ references, those `key`s have to be supplied in the following way:
- Provide the `key` value on the `id` field of the reference. This means that calling `getId()` on the
reference would return its `key`.

**Note**: When syncing from a source commercetools project, you can use [`mapToProductTypeDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/producttypes/utils/ProductTypeReferenceResolutionUtils.html#mapToProductTypeDrafts-java.util.List-)
**Note**: When syncing from a source commercetools project, you can use [`mapToProductTypeDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.2.0/com/commercetools/sync/producttypes/utils/ProductTypeReferenceResolutionUtils.html#mapToProductTypeDrafts-java.util.List-)

that replaces the references id fields with keys, in order to make them ready for reference resolution by the sync:
````java
Expand Down
7 changes: 4 additions & 3 deletions docs/usage/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.commercetools</groupId>
<artifactId>commercetools-sync-java</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
</dependency>
````
- For Gradle users:
Expand All @@ -48,7 +48,7 @@ implementation 'com.commercetools.sdk.jvm.core:commercetools-java-client:1.53.0'
implementation 'com.commercetools.sdk.jvm.core:commercetools-convenience:1.53.0'
// Add commercetools-sync-java dependency.
implementation 'com.commercetools:commercetools-sync-java:2.1.0'
implementation 'com.commercetools:commercetools-sync-java:2.2.0'
````

### 2. Setup Syncing Options
Expand Down Expand Up @@ -88,4 +88,5 @@ implementation 'com.commercetools:commercetools-sync-java:2.1.0'
*[Product Sync](PRODUCT_SYNC.md), [ProductType Sync](PRODUCT_TYPE_SYNC.md),
[Category Sync](CATEGORY_SYNC.md), [Inventory Sync](INVENTORY_SYNC.md),
[Type Sync](TYPE_SYNC.md), [CartDiscount Sync](CART_DISCOUNT_SYNC.md),
[TaxCategory Sync](/docs/usage/TAX_CATEGORY_SYNC.md), [State Sync](/docs/usage/STATE_SYNC.md)*
[TaxCategory Sync](/docs/usage/TAX_CATEGORY_SYNC.md), [State Sync](/docs/usage/STATE_SYNC.md),
[CustomObject Sync](/docs/usage/CUSTOM_OBJECT_SYNC.md)*
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nav:
- Advanced:
- Sync Options: usage/SYNC_OPTIONS.md
- Usage Tips: usage/IMPORTANT_USAGE_TIPS.md
- Javadoc: https://commercetools.github.io/commercetools-sync-java/v/2.1.0/
- Javadoc: https://commercetools.github.io/commercetools-sync-java/v/2.2.0/
- Release notes: RELEASE_NOTES.md
- Roadmap: https://github.com/commercetools/commercetools-sync-java/milestones
- Issues: https://github.com/commercetools/commercetools-sync-java/issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class InventoryReferenceResolver
+ "InventoryEntryDraft with SKU:'%s'.";
private static final String FAILED_TO_RESOLVE_SUPPLY_CHANNEL = "Failed to resolve supply channel "
+ "resource identifier on InventoryEntryDraft with SKU:'%s'. Reason: %s";
private static final String FAILED_TO_CREATE_SUPPLY_CHANNEL = "Failed to create supply channel with key: '%s'";
private final ChannelService channelService;
private final TypeService typeService;

Expand Down Expand Up @@ -206,7 +207,7 @@ private CompletionStage<InventoryEntryDraftBuilder> createChannelAndSetReference
return setChannelReference(createdChannelOptional.get().getId(), draftBuilder);
} else {
final ReferenceResolutionException referenceResolutionException =
new ReferenceResolutionException(format(CHANNEL_DOES_NOT_EXIST, channelKey));
new ReferenceResolutionException(format(FAILED_TO_CREATE_SUPPLY_CHANNEL, channelKey));
return CompletableFutureUtils.exceptionallyCompletedFuture(referenceResolutionException);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ private void collectReferencedKeysInAttributes(
@Nonnull
private List<String> getVariantDraftErrorsInAllVariants(@Nonnull final ProductDraft productDraft) {
final List<String> errorMessages = new ArrayList<>();
final List<ProductVariantDraft> allVariants = getAllVariants(productDraft);

// don't filter the nulls
final List<ProductVariantDraft> allVariants = new ArrayList<>();
allVariants.add(productDraft.getMasterVariant());
allVariants.addAll(productDraft.getVariants());

for (int i = 0; i < allVariants.size(); i++) {
errorMessages.addAll(getVariantDraftErrorsInAllVariants(allVariants.get(i),
i, requireNonNull(productDraft.getKey())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,9 @@ public CompletionStage<ProductDraft> resolveReferences(@Nonnull final ProductDra
private CompletionStage<ProductDraftBuilder> resolveAllVariantsReferences(
@Nonnull final ProductDraftBuilder draftBuilder) {
final ProductVariantDraft masterVariantDraft = draftBuilder.getMasterVariant();
if (masterVariantDraft != null) {
return variantReferenceResolver.resolveReferences(masterVariantDraft)
.thenApply(draftBuilder::masterVariant)
.thenCompose(this::resolveVariantsReferences);
}
return resolveVariantsReferences(draftBuilder);
return variantReferenceResolver.resolveReferences(masterVariantDraft)
.thenApply(draftBuilder::masterVariant)
.thenCompose(this::resolveVariantsReferences);
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import static com.commercetools.sync.inventories.InventorySyncMockUtils.getMockInventoryEntry;
import static com.commercetools.sync.inventories.InventorySyncMockUtils.getMockInventoryService;
import static com.commercetools.sync.inventories.InventorySyncMockUtils.getMockSupplyChannel;
import static io.sphere.sdk.utils.CompletableFutureUtils.failed;
import static io.sphere.sdk.utils.SphereInternalUtils.asSet;
import static java.lang.String.format;
import static java.util.Arrays.asList;
Expand Down Expand Up @@ -395,7 +394,8 @@ void sync_WithExceptionWhenCreatingNewSupplyChannel_ShouldTriggerErrorCallbackAn
final ChannelService channelService = getMockChannelService(getMockSupplyChannel(REF_3, KEY_3));
when(channelService.fetchCachedChannelId(anyString()))
.thenReturn(CompletableFuture.completedFuture(Optional.empty()));
when(channelService.createAndCacheChannel(anyString())).thenReturn(failed(new SphereException()));
when(channelService.createAndCacheChannel(anyString()))
.thenReturn(CompletableFuture.completedFuture(Optional.empty()));

final InventoryEntryDraft newInventoryDraft = InventoryEntryDraftBuilder
.of(SKU_1, QUANTITY_1, DATE_1, RESTOCKABLE_1, ResourceIdentifier.ofKey(KEY_3))
Expand All @@ -410,13 +410,12 @@ void sync_WithExceptionWhenCreatingNewSupplyChannel_ShouldTriggerErrorCallbackAn
assertThat(stats).hasValues(1, 0, 0, 1);
assertThat(errorCallBackMessages).isNotEmpty();
assertThat(errorCallBackMessages.get(0)).contains(format("Failed to resolve supply channel resource identifier"
+ " on InventoryEntryDraft with SKU:'%s'.", SKU_1));
+ " on InventoryEntryDraft with SKU:'%s'. Reason: Failed to create supply channel with key: '%s'", SKU_1,
"channel-key_3"));
assertThat(errorCallBackExceptions).isNotEmpty();
assertThat(errorCallBackExceptions.get(0)).isExactlyInstanceOf(CompletionException.class);
assertThat(errorCallBackExceptions.get(0).getCause()).isExactlyInstanceOf(ReferenceResolutionException.class);
assertThat(errorCallBackExceptions.get(0).getCause().getCause()).isExactlyInstanceOf(CompletionException.class);
assertThat(errorCallBackExceptions.get(0).getCause()
.getCause().getCause()).isExactlyInstanceOf(SphereException.class);
}

@Test
Expand Down

0 comments on commit 9059dab

Please sign in to comment.