★ wanayoo — archive 1999 https://github.com/commercetools/commercetools-sync-java/pull/561Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement utility class and helper classes for CustomObjectSync #561

Open
wants to merge 13 commits into
base: master
from

Conversation

@leungkinghin
Copy link
Contributor

leungkinghin commented Sep 10, 2020 •

Summary

Add SyncUtils, SyncOptions, SyncOptionsBuilder, SyncStatistic for CustomObject sync process.

Description

Implement utility class to check the json value differences between old and new custom objects.
Implement sync options class for CTP project interaction.
Implement sync statistic class for sync process result.

Relevant Issues

#565

Todo

  • Tests
    • Unit
    • Integration
  • Documentation
  • Add Release Notes entry.

Hints for Review

UpdateActionUtils is not implemented because UpdateAction is not applicable in CustomObjects.
JSON value comparison is carried out in SyncUtils

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2020 •

Codecov Report

Merging #561 into master will decrease coverage by 0.02%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #561      +/-   ##
============================================
- Coverage     99.19%   99.17%   -0.03%     
- Complexity     1851     1854       +3     
============================================
  Files           157      159       +2     
  Lines          4584     4592       +8     
  Branches        268      268              
============================================
+ Hits           4547     4554       +7     
- Misses           19       20       +1     
  Partials         18       18              
Impacted Files Coverage Δ Complexity Δ
...ls/sync/customobjects/CustomObjectSyncOptions.java 100.00% <ø> (ø) 1.00 <0.00> (ø)
.../customobjects/CustomObjectSyncOptionsBuilder.java 100.00% <ø> (ø) 4.00 <0.00> (ø)
...ync/customobjects/utils/CustomObjectSyncUtils.java 75.00% <75.00%> (ø) 1.00 <1.00> (?)
...tomobjects/helpers/CustomObjectSyncStatistics.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 829bd55...9f33ed9. Read the comment docs.

@lojzatran lojzatran self-requested a review Sep 10, 2020
@@ -37,4 +44,6 @@
beforeCreateCallback);
}


This comment has been minimized.

@ahmetoz

ahmetoz Sep 10, 2020 Member

extra spaces

This comment has been minimized.

JsonNode oldValue = oldCustomObject.getValue();
JsonNode newValue = newCustomObject.getValue();

return oldValue.equals(newValue);

This comment has been minimized.

@ahmetoz

ahmetoz Sep 10, 2020 Member

this could be a one-liner, also it looks like you added a utility to be able to test without the Sync method.

JsonNode actualObj = new ObjectMapper().readTree("true");
JsonNode mockedObj = new ObjectMapper().readTree("true");

newCustomObjectdraft = CustomObjectDraft.ofUnversionedUpsert(container, key, actualObj);

This comment has been minimized.

@ahmetoz

ahmetoz Sep 10, 2020 Member

you could refactor the mocking CustomObject into a private method, also checks like isBoolean, isNumber is not necessary just test the hasIdenticalValue method, but I am also thinking we are doing extra tests which should be part of the Sync class, here it looks like to me just testing the JsonNode which is not necessary to test separately.

This comment has been minimized.

@lojzatran

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor Author

leungkinghin replied Sep 10, 2020

@leungkinghin leungkinghin requested a review from ahmetoz Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.