Skip to content

Fix the ProductSync's publish/unpublish build actions #533

Merged
ahmetoz merged 11 commits intomasterfrom
fix/530-product-publish
Aug 5, 2020
Merged

Fix the ProductSync's publish/unpublish build actions #533
ahmetoz merged 11 commits intomasterfrom
fix/530-product-publish

Conversation

@ahmetoz
Copy link
Copy Markdown
Contributor

@ahmetoz ahmetoz commented Aug 4, 2020

Summary

Check the task for the bug, #530

Todo

  • Tests
    • Unit
    • Integration
  • [-] Documentation
  • Add Release Notes entry.

Hints for Review

Check the fix first with following the cases in BuildPublishOrUnpublishUpdateActionTest
Some tests are adjusted, as some conditions before (state 13,14,15,16) was missing/bug.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 4, 2020

Codecov Report

Merging #533 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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           
Impacted Files Coverage Δ Complexity Δ
...rcetools/sync/products/utils/ProductSyncUtils.java 98.50% <100.00%> (+0.02%) 24.00 <0.00> (+1.00)
.../sync/products/utils/ProductUpdateActionUtils.java 95.62% <100.00%> (+0.04%) 79.00 <5.00> (+3.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 729a053...5a4794d. Read the comment docs.

@ahmetoz ahmetoz marked this pull request as ready for review August 4, 2020 14:45
@ahmetoz ahmetoz changed the title Fix the product sycn publish/unpublish build actions Fix the ProductSync's publish/unpublish build actions Aug 4, 2020
final boolean hasNewUpdateActions) {

final Boolean isNewProductPublished = toBoolean(newProduct.isPublish());
final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished());
final boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final Boolean isNewProductPublished = toBoolean(newProduct.isPublish());
final Boolean isOldProductPublished = toBoolean(oldProduct.getMasterData().isPublished());

if (Boolean.TRUE.equals(isNewProductPublished)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Boolean.TRUE.equals(isNewProductPublished)) {
if (isNewProductPublished) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// covers the state 14, state 15 and state 16.
return Optional.of(Publish.of());
}
return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of);
return buildUpdateAction(isOldProductPublished, true, Publish::of);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
return buildUpdateAction(isOldProductPublished, isNewProductPublished, Publish::of);
}
return buildUpdateAction(isOldProductPublished, isNewProductPublished, Unpublish::of);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return buildUpdateAction(isOldProductPublished, isNewProductPublished, Unpublish::of);
return buildUpdateAction(isOldProductPublished, false, Unpublish::of);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/main/java/com/commercetools/sync/products/utils/ProductUpdateActionUtils.java Outdated
@ahmetoz ahmetoz merged commit 81618aa into master Aug 5, 2020
@ahmetoz ahmetoz deleted the fix/530-product-publish branch August 5, 2020 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants