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

CIF-2060 - fix NPEs related to special handling for Launches #568

Merged
merged 4 commits into from
May 17, 2021

Conversation

buuhuu
Copy link
Contributor

@buuhuu buuhuu commented May 12, 2021

Description

Launches do not support context aware configurations in all supported product version right now. Because of that a fallback logic has been introduced to fallback to the production content of a Launch when accessing context aware configurations. This logic fails when the content was newly created in the Launch and so production content does not (yet) exists, causing NPEs in various places.

Related Issue

CIF-2060
CIF-2061

How Has This Been Tested?

  • Create a Launch from an existing site (e.g. Venia sample storefront)
  • In the Launch, create a new content page as child of a homepage
  • Open the content page for editing => fails with a NPE
  • Open the Homepage => navigation not rendered correctly, NPE

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

…for newly created Resources

Launches do not fully support context aware configurations in all of the supported product versions. A workaround was introduced before to handle this special case in StoreConfigExporterImpl and MagentoGraphqlClient. In order to make those consumers agnostic to the implementation details of the workaround, the logic was moved to the ComponentsConfigurationAdapterFactory.
@@ -51,8 +54,7 @@
import io.wcm.testing.mock.aem.junit.AemContext;
import io.wcm.testing.mock.aem.junit.AemContextCallback;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor, but lets avoid wildcard imports, especially if we only import low number of classes/methods.

@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #568 (56ad60f) into master (15778f7) will decrease coverage by 0.05%.
The diff coverage is 78.26%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #568      +/-   ##
============================================
- Coverage     87.41%   87.36%   -0.06%     
- Complexity     1291     1292       +1     
============================================
  Files           235      235              
  Lines          6031     6038       +7     
  Branches        888      890       +2     
============================================
+ Hits           5272     5275       +3     
- Misses          587      589       +2     
- Partials        172      174       +2     
Flag Coverage Δ Complexity Δ
integration 63.54% <52.17%> (+0.01%) 883.00 <5.00> (+2.00)
jest 83.33% <ø> (ø) 0.00 <ø> (ø)
karma 94.54% <ø> (ø) 0.00 <ø> (ø)
unittests 87.41% <78.26%> (-0.10%) 1260.00 <8.00> (+1.00) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...e/core/components/client/MagentoGraphqlClient.java 89.65% <ø> (-0.12%) 25.00 <0.00> (ø)
...ervices/ComponentsConfigurationAdapterFactory.java 62.50% <66.66%> (-1.14%) 5.00 <1.00> (+2.00) ⬇️
...1/storeconfigexporter/StoreConfigExporterImpl.java 90.90% <100.00%> (-1.10%) 8.00 <2.00> (-1.00)
...commerce/core/components/utils/SiteNavigation.java 85.50% <100.00%> (+1.00%) 33.00 <5.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 15778f7...56ad60f. Read the comment docs.

@dplaton dplaton merged commit 373ac0d into master May 17, 2021
@dplaton dplaton deleted the issues/CIF-2060 branch May 17, 2021 12:32
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.

3 participants