Fix the ProductSync's publish/unpublish build actions #533
Merged
Conversation
…n, and add unit test before adding functionality.
Codecov Report
@@ Coverage Diff @@
## master #533 +/- ##
=========================================
Coverage 98.72% 98.72%
- Complexity 1788 1792 +4
=========================================
Files 153 153
Lines 4483 4486 +3
Branches 258 260 +2
=========================================
+ Hits 4426 4429 +3
Misses 37 37
Partials 20 20
Continue to review full report at Codecov.
|
lojzatran
suggested changes
Aug 4, 2020
| final boolean hasNewUpdateActions) { | ||
|
|
||
| final Boolean isNewProductPublished = toBoolean(newProduct.isPublish()); | ||
| final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished()); |
Contributor
There was a problem hiding this comment.
Suggested change
| final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished()); | |
| final boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished()); |
| final Boolean isNewProductPublished = toBoolean(newProduct.isPublish()); | ||
| final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished()); | ||
|
|
||
| if (Boolean.TRUE.equals(isNewProductPublished)) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if (Boolean.TRUE.equals(isNewProductPublished)) { | |
| if (isNewProductPublished) { |
| // covers the state 14, state 15 and state 16. | ||
| return Optional.of(Publish.of()); | ||
| } | ||
| return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of); |
Contributor
There was a problem hiding this comment.
Suggested change
| return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of); | |
| return buildUpdateAction(isOldProductPublished, true, Publish::of); |
| } | ||
| return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of); | ||
| } | ||
| return buildUpdateAction(isOldProductPublished, isNewProductPublished, Unpublish::of); |
Contributor
There was a problem hiding this comment.
Suggested change
| return buildUpdateAction(isOldProductPublished, isNewProductPublished, Unpublish::of); | |
| return buildUpdateAction(isOldProductPublished, false, Unpublish::of); |
ahalberkamp
approved these changes
Aug 5, 2020
lojzatran
approved these changes
Aug 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Check the task for the bug, #530
Todo
Hints for Review
Check the fix first with following the cases in
BuildPublishOrUnpublishUpdateActionTestSome tests are adjusted, as some conditions before (state 13,14,15,16) was missing/bug.