Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
25f9a5f
#300: Remove empty space.
heshamMassoud Dec 5, 2018
76e4473
#300: Statically import assertion utils.
heshamMassoud Dec 5, 2018
ddf7e89
#300: Remove release notes for non exposed methods.
heshamMassoud Dec 5, 2018
291c5dc
#300: Reword release note entries.
heshamMassoud Dec 5, 2018
c87687b
#300: Fix bug in calculating diff of avg in benchmarks.
heshamMassoud Dec 5, 2018
1dd8d7e
#300: Delete types only from target.
heshamMassoud Dec 5, 2018
d29bfcd
#300: Making unneeded public fields private.
heshamMassoud Dec 5, 2018
c13e21a
#300: Adjust line spacing.
heshamMassoud Dec 5, 2018
903c0ca
#300: Use simpler name update.
heshamMassoud Dec 5, 2018
7efd69d
#300: Fix Javadoc.
heshamMassoud Dec 5, 2018
9fdb665
#300: Fix line spacing.
heshamMassoud Dec 5, 2018
f7f8cc1
#300: Fix Javadoc.
heshamMassoud Dec 5, 2018
9d66f49
#300: Remove braces for 1-liner.
heshamMassoud Dec 5, 2018
1154d69
#300: Use optional assertion.
heshamMassoud Dec 5, 2018
32d00af
#300: Remove unneeded variable reassignment.
heshamMassoud Dec 5, 2018
7fe0b60
#300: Move method and remove key check since it's required by CTP.
heshamMassoud Dec 5, 2018
28ed07a
#300: Remove unneeded variable and format method sig.
heshamMassoud Dec 5, 2018
94e9019
#300: Fix method names.
heshamMassoud Dec 5, 2018
f5895cd
#300: Statically import, improve indentation and remove unneeded asse…
heshamMassoud Dec 5, 2018
98c7b50
#300: Fix typos.
heshamMassoud Dec 5, 2018
f5da17e
#300: Remove redundant supressions.
heshamMassoud Dec 6, 2018
7d77067
#300: Add @nonnull annotation.
heshamMassoud Dec 6, 2018
694042f
#300: Statically import util.
heshamMassoud Dec 6, 2018
9057af9
#300: Remove excessive line spacing.
heshamMassoud Dec 6, 2018
a08da1f
#300: Refactor TypeSyncUtils.
heshamMassoud Dec 6, 2018
f9d086f
#300: Refactor util name.
heshamMassoud Dec 6, 2018
cfc1582
#300: Fix Javadoc.
heshamMassoud Dec 6, 2018
577a850
#300: Fix indentation.
heshamMassoud Dec 6, 2018
fd5cff6
#300: Fix Javadoc.
heshamMassoud Dec 6, 2018
85dab40
#300: Add note about FieldType and AttributeType changes.
heshamMassoud Dec 6, 2018
bd01fdb
#300: Add a test case for a new draft with different order.
heshamMassoud Dec 6, 2018
2128a66
#300: Remove unneeded asserts.
heshamMassoud Dec 6, 2018
658a005
#300: Add a unit test with a definition with a null name.
heshamMassoud Dec 6, 2018
d3f8dd8
#300: Fix unit test names.
heshamMassoud Dec 6, 2018
db1835e
#300: Add unit test for fieldDefinition with null FieldType.
heshamMassoud Dec 6, 2018
dcb95f4
#300: Unexpose enum differs.
heshamMassoud Dec 6, 2018
b5bfa67
#300: Fix Javadocs.
heshamMassoud Dec 6, 2018
bbaab01
#300: Add more readable line spacing.
heshamMassoud Dec 6, 2018
a87995d
#300: Move tests to accessible package.
heshamMassoud Dec 6, 2018
5bbf06d
#300: Unexpose generic enum differ.
heshamMassoud Dec 6, 2018
2459b38
#300: Remove redundant empty check.
heshamMassoud Dec 6, 2018
f6e34d2
#300: Replace singleton lists with optionals.
heshamMassoud Dec 6, 2018
4ab3f1d
#300: Change test names.
heshamMassoud Dec 6, 2018
f84764f
#300: Fix unit tests.
heshamMassoud Dec 6, 2018
a4ecf2d
#300: Use query builder.
heshamMassoud Dec 6, 2018
0c1e47f
#300: Fix Javadocs.
heshamMassoud Dec 6, 2018
24dca2c
#300: Change fixtures class name, package and contents.
heshamMassoud Dec 6, 2018
7f6912c
#300: Avoid star import for FieldDefinitionFixtures.
heshamMassoud Dec 6, 2018
9c96839
#300: Add unit tests for mixed cases.
heshamMassoud Dec 6, 2018
b7d4e54
#300: Move fixtures into fixtures class.
heshamMassoud Dec 6, 2018
767825f
#300: Remove unneeded field definitions from test.
heshamMassoud Dec 6, 2018
98abc39
#300: Reword notes.
heshamMassoud Dec 6, 2018
7d20528
#300 fix checksStyles
ahmetoz Dec 6, 2018
edf0981
#300: Fix Checkstyle issues.
heshamMassoud Dec 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
<property name="excludes" value="com.commercetools.sync.products.utils.productvariantupdateactionutils.prices.PriceDraftFixtures,
com.commercetools.sync.products.utils.productvariantupdateactionutils.prices.PriceFixtures,
com.commercetools.sync.commons.utils.LocalizedEnumValueFixtures,
com.commercetools.sync.commons.utils.PlainEnumValueFixtures"/>
com.commercetools.sync.commons.utils.PlainEnumValueFixtures,
com.commercetools.sync.types.utils.FieldDefinitionFixtures"/>
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="false"/>
</module>
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Currently this library supports synchronising the following entities in commerce
- [InventoryEntries](usage/INVENTORY_SYNC.md)
- [ProductTypes](usage/PRODUCT_TYPE_SYNC.md)
- [Types](usage/TYPE_SYNC.md)

![commercetools-java-sync-final 001](https://user-images.githubusercontent.com/9512131/31230702-0f2255a6-a9e5-11e7-9412-04ed52641dde.png)


Expand Down
9 changes: 2 additions & 7 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
- **Type Sync** - Support for syncing types. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300) For more info how to use it please refer to [Type usage doc](/docs/usage/TYPE_SYNC.md).
- **Type Sync** - Exposed `TypeSyncUtils#buildActions` which calculates all needed update actions after comparing a `Type` and a `TypeDraft`. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Exposed `TypeUpdateActionUtils` which contains utils for calculating needed update actions after comparing individual fields of a `Type` and a `TypeDraft`. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Exposed `LocalizedEnumValueUpdateActionUtils` which contains utils for calculating needed update actions after comparing two lists of `LocalizedEnumValue`s. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Exposed `PlainEnumValueUpdateActionUtils` which contains utils for calculating needed update actions after comparing two lists of `EnumValue`s. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Exposed `FieldDefinitionsUpdateActionUtils` which contains utils for calculating needed update actions after comparing a list of `FieldDefinition`s and a list of `FieldDefinition`s. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Exposed `FieldDefinitionUpdateActionUtils` which contains utils for calculating needed update actions after comparing a `FieldDefinition` and a `FieldDefinition`. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Commons** - Exposed `EnumValuesUpdateActionUtils` which contains generic utilities for calculating needed update actions after comparing two lists of `EnumValue`s or `LocalizedEnumValue`s. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)

- 📋 **Documentation** (4)
- **Commons** - Added the documentation github pages. https://commercetools.github.io/commercetools-sync-java
Expand All @@ -60,7 +55,7 @@
- **Product Sync** - Reference keys are not validated if they are in UUID format anymore. [#166](https://github.com/commercetools/commercetools-sync-java/issues/166)
- **Category Sync** - Reference keys are not validated if they are in UUID format anymore. [#166](https://github.com/commercetools/commercetools-sync-java/issues/166)
- **Inventory Sync** - Reference keys are not validated if they are in UUID format anymore. [#166](https://github.com/commercetools/commercetools-sync-java/issues/166)
- **ProductType Sync** - Added `ProductTypeSyncBenchmark` to benchmark the product type sync, to be able to compare the performance of the sync with the future releases. [#301](https://github.com/commercetools/commercetools-sync-java/issues/301)
- **ProductType Sync** - Added benchmarks for the `productType` sync to be able to compare the performance of the sync with the future releases. [#301](https://github.com/commercetools/commercetools-sync-java/issues/301)
- **Commons** - Bumped commercetools-jvm-sdk to version [1.37.0](http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/meta/ReleaseNotes.html#v1_37_0).
- **Commons** - Bumped `mockito` to 2.23.4.
- **Commons** - Bumped `com.adarshr.test-logger` to 1.6.0.
Expand All @@ -71,7 +66,7 @@
- **Commons** - Bumped `com.adarshr.test-logger` to 1.6.0.
- **Commons** - Bumped `org.ajoberstar.grgit` to 3.0.0.
- **Commons** - Bumped gradle to version [gradle-5.0](https://docs.gradle.org/5.0/release-notes.html)
- **Type Sync** - Added `TypeSyncBenchmark` to benchmark the type sync, to be able to compare the performance of the sync with the future releases. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)
- **Type Sync** - Added benchmarks for the `type` sync to be able to compare the performance of the sync with the future releases. [#300](https://github.com/commercetools/commercetools-sync-java/issues/300)

- 🚧 **Breaking Changes** (11)
- **Product Sync** - `allowUuid` option is now removed. [#166](https://github.com/commercetools/commercetools-sync-java/issues/166)
Expand Down
11 changes: 10 additions & 1 deletion docs/usage/PRODUCT_TYPE_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ against a [ProductTypeDraft](https://docs.commercetools.com/http-api-projects-pr
- [Sync list of product type drafts](#sync-list-of-product-type-drafts)
- [Prerequisites](#prerequisites)
- [Running the sync](#running-the-sync)
- [Important to Note](#important-to-note)
- [More examples of how to use the sync](#more-examples-of-how-to-use-the-sync)
- [Build all update actions](#build-all-update-actions)
- [Build particular update action(s)](#build-particular-update-actions)
- [Caveats](#caveats)
Expand Down Expand Up @@ -64,8 +66,15 @@ __Note__ The statistics object contains the processing time of the last batch on

1. The sync processing time should not take into account the time between supplying batches to the sync.
2. It is not known by the sync which batch is going to be the last one supplied.

#### Important to Note

1. If two matching `attributeDefinition`s (old and new) on the matching `productType`s (old and new) have a different `AttributeType`, the sync will
**remove** the existing `attributeDefinition` and then **add** a new `attributeDefinition` with the new `AttributeType`.

2. The `attributeDefinition` for which the `AttributeType` is not defined (`null`) will not be synced.

##### More examples of how to use the sync
#### More examples of how to use the sync

1. [Sync from another CTP project as a source](https://github.com/commercetools/commercetools-sync-java/tree/master/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/producttypes/ProductTypeSyncIT.java).
2. [Sync from an external source](https://github.com/commercetools/commercetools-sync-java/tree/master/src/integration-test/java/com/commercetools/sync/integration/externalsource/producttypes/ProductTypeSyncIT.java).
Expand Down
10 changes: 9 additions & 1 deletion docs/usage/TYPE_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ against a [TypeDraft](https://docs.commercetools.com/http-api-projects-types.htm
- [Sync list of type drafts](#sync-list-of-type-drafts)
- [Prerequisites](#prerequisites)
- [Running the sync](#running-the-sync)
- [Important to Note](#important-to-note)
- [More examples of how to use the sync](#more-examples-of-how-to-use-the-sync)
- [Build all update actions](#build-all-update-actions)
- [Build particular update action(s)](#build-particular-update-actions)
- [Caveats](#caveats)
Expand Down Expand Up @@ -62,7 +64,13 @@ __Note__ The statistics object contains the processing time of the last batch on
1. The sync processing time should not take into account the time between supplying batches to the sync.
2. It is not known by the sync which batch is going to be the last one supplied.

##### More examples of how to use the sync
#### Important to Note
1. If two matching `fieldDefinition`s (old and new) on the matching `type`s (old and new) have a different `FieldType`, the sync will
**remove** the existing `fieldDefinition` and then **add** a new `fieldDefinition` with the new `FieldType`.

2. The `fieldDefinition` for which the `fieldType` is not defined (`null`) will not be synced.

#### More examples of how to use the sync

1. [Sync from another CTP project as a source](https://github.com/commercetools/commercetools-sync-java/tree/master/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/types/TypeSyncIT.java).
2. [Sync from an external source](https://github.com/commercetools/commercetools-sync-java/tree/master/src/integration-test/java/com/commercetools/sync/integration/externalsource/types/TypeSyncIT.java).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void sync_ExistingProducts_ShouldUpdateProducts() throws IOException {


// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_SYNC, CREATES_ONLY, totalTime);
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_SYNC, UPDATES_ONLY, totalTime);
assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.", diff,
THRESHOLD))
Expand Down Expand Up @@ -222,7 +222,7 @@ public void sync_WithSomeExistingProducts_ShouldSyncProducts() throws IOExceptio


// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_SYNC, CREATES_ONLY, totalTime);
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_SYNC, CREATES_AND_UPDATES, totalTime);
assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.", diff,
THRESHOLD))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.commercetools.sync.benchmark;

import com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics;
import com.commercetools.sync.commons.utils.SyncSolutionInfo;
import com.commercetools.sync.producttypes.ProductTypeSync;
import com.commercetools.sync.producttypes.ProductTypeSyncOptions;
Expand Down Expand Up @@ -36,6 +35,7 @@
import static com.commercetools.sync.benchmark.BenchmarkUtils.UPDATES_ONLY;
import static com.commercetools.sync.benchmark.BenchmarkUtils.calculateDiff;
import static com.commercetools.sync.benchmark.BenchmarkUtils.saveNewResult;
import static com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat;
import static com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.ATTRIBUTE_DEFINITION_DRAFT_1;
import static com.commercetools.sync.integration.commons.utils.ProductTypeITUtils.deleteProductTypes;
import static com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT;
Expand Down Expand Up @@ -111,9 +111,7 @@ public void sync_NewProductTypes_ShouldCreateProductTypes() throws IOException {
assertThat(totalNumberOfProductTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);


AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, NUMBER_OF_RESOURCE_UNDER_TEST, 0, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, NUMBER_OF_RESOURCE_UNDER_TEST, 0, 0);
assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
assertThat(warningCallBackMessages).isEmpty();
Expand Down Expand Up @@ -144,7 +142,7 @@ public void sync_ExistingProductTypes_ShouldUpdateProductTypes() throws IOExcept
final long totalTime = System.currentTimeMillis() - beforeSyncTime;

// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_TYPE_SYNC, CREATES_ONLY, totalTime);
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_TYPE_SYNC, UPDATES_ONLY, totalTime);
assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.",
diff, THRESHOLD))
Expand Down Expand Up @@ -172,9 +170,7 @@ public void sync_ExistingProductTypes_ShouldUpdateProductTypes() throws IOExcept
assertThat(totalNumberOfProductTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);

// Assert statistics
AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, 0, NUMBER_OF_RESOURCE_UNDER_TEST, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, 0, NUMBER_OF_RESOURCE_UNDER_TEST, 0);

assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
Expand Down Expand Up @@ -207,7 +203,9 @@ public void sync_WithSomeExistingProductTypes_ShouldSyncProductTypes() throws IO
final long totalTime = System.currentTimeMillis() - beforeSyncTime;

// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_TYPE_SYNC, CREATES_ONLY, totalTime);
final double diff =
calculateDiff(SyncSolutionInfo.LIB_VERSION, PRODUCT_TYPE_SYNC, CREATES_AND_UPDATES, totalTime);

assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.",
diff, THRESHOLD))
Expand Down Expand Up @@ -235,9 +233,7 @@ public void sync_WithSomeExistingProductTypes_ShouldSyncProductTypes() throws IO
assertThat(totalNumberOfProductTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);

// Assert statistics
AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, halfNumberOfDrafts, halfNumberOfDrafts, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, halfNumberOfDrafts, halfNumberOfDrafts, 0);

assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.commercetools.sync.benchmark;

import com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics;
import com.commercetools.sync.commons.utils.SyncSolutionInfo;
import com.commercetools.sync.types.TypeSync;
import com.commercetools.sync.types.TypeSyncOptions;
Expand Down Expand Up @@ -38,7 +37,7 @@
import static com.commercetools.sync.benchmark.BenchmarkUtils.UPDATES_ONLY;
import static com.commercetools.sync.benchmark.BenchmarkUtils.calculateDiff;
import static com.commercetools.sync.benchmark.BenchmarkUtils.saveNewResult;
import static com.commercetools.sync.integration.commons.utils.ITUtils.deleteTypesFromTargetAndSource;
import static com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat;
import static com.commercetools.sync.integration.commons.utils.SphereClientUtils.CTP_TARGET_CLIENT;
import static com.commercetools.sync.integration.commons.utils.TypeITUtils.FIELD_DEFINITION_1;
import static com.commercetools.sync.integration.commons.utils.TypeITUtils.FIELD_DEFINITION_NAME_1;
Expand All @@ -57,7 +56,7 @@ public class TypeSyncBenchmark {

@BeforeClass
public static void setup() {
deleteTypesFromTargetAndSource();
deleteTypes(CTP_TARGET_CLIENT);
}

@AfterClass
Expand Down Expand Up @@ -120,9 +119,7 @@ public void sync_NewTypes_ShouldCreateTypes() throws IOException {
assertThat(totalNumberOfTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);


AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, NUMBER_OF_RESOURCE_UNDER_TEST, 0, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, NUMBER_OF_RESOURCE_UNDER_TEST, 0, 0);
assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
assertThat(warningCallBackMessages).isEmpty();
Expand Down Expand Up @@ -152,7 +149,7 @@ public void sync_ExistingTypes_ShouldUpdateTypes() throws IOException {
final long totalTime = System.currentTimeMillis() - beforeSyncTime;

// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, TYPE_SYNC, CREATES_ONLY, totalTime);
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, TYPE_SYNC, UPDATES_ONLY, totalTime);
assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.",
diff, THRESHOLD))
Expand Down Expand Up @@ -180,9 +177,7 @@ public void sync_ExistingTypes_ShouldUpdateTypes() throws IOException {
assertThat(totalNumberOfTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);

// Assert statistics
AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, 0, NUMBER_OF_RESOURCE_UNDER_TEST, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, 0, NUMBER_OF_RESOURCE_UNDER_TEST, 0);

assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
Expand Down Expand Up @@ -215,23 +210,23 @@ public void sync_WithSomeExistingTypes_ShouldSyncTypes() throws IOException {
final long totalTime = System.currentTimeMillis() - beforeSyncTime;

// Calculate time taken for benchmark and assert it lies within threshold
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, TYPE_SYNC, CREATES_ONLY, totalTime);
final double diff = calculateDiff(SyncSolutionInfo.LIB_VERSION, TYPE_SYNC, CREATES_AND_UPDATES, totalTime);
assertThat(diff)
.withFailMessage(format("Diff of benchmark '%e' is longer than expected threshold of '%d'.",
diff, THRESHOLD))
.isLessThanOrEqualTo(THRESHOLD);

// Assert actual state of CTP project (number of updated types)
final CompletableFuture<Integer> totalNumberOfUpdatedTypesWithOldFielDefinitionName =
final CompletableFuture<Integer> totalNumberOfUpdatedTypesWithOldFieldDefinitionName =
CTP_TARGET_CLIENT.execute(TypeQuery.of()
.withPredicates(p -> p.fieldDefinitions().name().is(
FIELD_DEFINITION_NAME_1 + "_old")))
.thenApply(PagedQueryResult::getTotal)
.thenApply(Long::intValue)
.toCompletableFuture();

executeBlocking(totalNumberOfUpdatedTypesWithOldFielDefinitionName);
assertThat(totalNumberOfUpdatedTypesWithOldFielDefinitionName).isCompletedWithValue(0);
executeBlocking(totalNumberOfUpdatedTypesWithOldFieldDefinitionName);
assertThat(totalNumberOfUpdatedTypesWithOldFieldDefinitionName).isCompletedWithValue(0);

// Assert actual state of CTP project (total number of existing types)
final CompletableFuture<Integer> totalNumberOfTypes =
Expand All @@ -243,9 +238,7 @@ public void sync_WithSomeExistingTypes_ShouldSyncTypes() throws IOException {
assertThat(totalNumberOfTypes).isCompletedWithValue(NUMBER_OF_RESOURCE_UNDER_TEST);

// Assert statistics
AssertionsForStatistics
.assertThat(syncStatistics)
.hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, halfNumberOfDrafts, halfNumberOfDrafts, 0);
assertThat(syncStatistics).hasValues(NUMBER_OF_RESOURCE_UNDER_TEST, halfNumberOfDrafts, halfNumberOfDrafts, 0);

assertThat(errorCallBackExceptions).isEmpty();
assertThat(errorCallBackMessages).isEmpty();
Expand Down
Loading