-
Notifications
You must be signed in to change notification settings - Fork 37
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
438: Reference resolution of Product references (and set of) as an attribute of nested type #439
Conversation
…roduct references and set of them.
Codecov Report
@@ Coverage Diff @@
## master #439 +/- ##
===========================================
+ Coverage 98.67% 98.7% +0.02%
+ Complexity 1498 1493 -5
===========================================
Files 131 131
Lines 3787 3771 -16
Branches 203 202 -1
===========================================
- Hits 3737 3722 -15
Misses 32 32
+ Partials 18 17 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! We are covering most of the cases, did you consider adding integration tests for the project to project (aka ctpprojectsource)
src/main/java/com/commercetools/sync/products/helpers/VariantReferenceResolver.java
Outdated
Show resolved
Hide resolved
...tReferenceResolver/attributes/nested-attribute-with-set-of-product-reference-attributes.json
Outdated
Show resolved
Hide resolved
src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/commercetools/sync/products/helpers/VariantReferenceResolverTest.java
Outdated
Show resolved
Hide resolved
...mercetools/sync/integration/externalsource/products/ProductSyncWithReferencedProductsIT.java
Show resolved
Hide resolved
...mercetools/sync/integration/externalsource/products/ProductSyncWithReferencedProductsIT.java
Outdated
Show resolved
Hide resolved
...mercetools/sync/integration/externalsource/products/ProductSyncWithReferencedProductsIT.java
Show resolved
Hide resolved
@@ -184,19 +168,11 @@ static boolean isProductReference(@Nonnull final JsonNode referenceValue) { | |||
} | |||
|
|||
@Nonnull | |||
CompletionStage<Optional<String>> getResolvedIdFromKeyInReference(@Nonnull final JsonNode referenceValue) { | |||
CompletionStage<Optional<String>> getProductResolvedIdFromKeyInReference(@Nonnull final JsonNode referenceValue) { | |||
final JsonNode idField = referenceValue.get(REFERENCE_ID_FIELD); | |||
return idField != null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we handle the idField.isNull()
case here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good question. Even though, implementation wise, It would still work without this check. Because eventually, if it doesn't find "null" in the cache, will try to fetch it, and won't find it, so will still return empty optional.
However, having the check as you suggested is better as it avoids having to fetch at all. - Kind of short-circuiting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Addresses #438
Important to Note
The test
resolveAttributeReference_WithNullReferenceInSetAttribute_ShouldResolveReferences
is disabled due to a possible bug on FasterXML/jackson-databind#2442. If this PR is ready to be merged, we can create an issue for this and merge this. --> #441Todo