adobe / commerce-cif-connector

AEM Commerce connector for Magento and GraphQL
Apache License 2.0
43 stars 27 forks source link

CIF-1325 - Automatically create a product binding after creating a configuration #121

Closed dplaton closed 4 years ago

dplaton commented 4 years ago

Description

The product binding creation is handled by a ResourceChangeListener that kicks off when a new node is added under /conf. The product binding name follows this pattern: <configuration name>-<store view>.

The operations are performed using a new service user which has jcr:read access on /conf and rep:write access on /var/commerce/products.

Notes:

Related Issue

CIF-1325

Motivation and Context

Automate configuration of new stores.

How Has This Been Tested?

Functional tests, unit tests

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 4 years ago

Codecov Report

Merging #121 into master will decrease coverage by 0.60%. The diff coverage is 80.24%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #121      +/-   ##
============================================
- Coverage     88.05%   87.44%   -0.61%     
- Complexity      450      465      +15     
============================================
  Files            34       35       +1     
  Lines          1783     1864      +81     
  Branches        274      282       +8     
============================================
+ Hits           1570     1630      +60     
- Misses           88      103      +15     
- Partials        125      131       +6     
Flag Coverage Δ Complexity Δ
#integration 50.08% <12.34%> (-1.88%) 253.00 <4.00> (+4.00) :arrow_down:
#karma 92.71% <ø> (-3.32%) 0.00 <ø> (ø)
#unittests 83.77% <80.24%> (-0.18%) 449.00 <14.00> (+15.00) :arrow_down:
Impacted Files Coverage Δ Complexity Δ
...rtual/catalog/data/impl/ProductBindingCreator.java 79.48% <79.48%> (ø) 14.00 <14.00> (?)
...a/impl/CatalogDataResourceProviderManagerImpl.java 82.07% <100.00%> (+0.25%) 44.00 <0.00> (+1.00)
...omponents/common/cifpicker/clientlibs/cifpicker.js 80.00% <0.00%> (-11.12%) 0.00% <0.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 a7314b7...7f3349f. Read the comment docs.

herzog31 commented 4 years ago

lgtm. Regarding the deletion. If a config is deleted and we only get the path, we could determine the config root path from it (without the commerce bucket name) and query for all bindings that point to that config and delete them, right?

dplaton commented 4 years ago

@herzog31 @cjelger the path of the config contains the name of the configuration but doesn't contain the store view. For a configuration /conf/venia/en with store view default the corresponding binding name is /var/commerce/products/en-default. The deletion event will only contain the /conf/venia/en path.

herzog31 commented 4 years ago

@dplaton Here https://github.com/adobe/commerce-cif-connector/pull/121/files#diff-eff6c4447dee114924edf543d12fb303R111 you store the config path in the binding. Can't you query all bindings with the path to the config that was deleted?

dplaton commented 4 years ago

@dplaton Here https://github.com/adobe/commerce-cif-connector/pull/121/files#diff-eff6c4447dee114924edf543d12fb303R111 you store the config path in the binding. Can't you query all bindings with the path to the config that was deleted?

Oh, I now understand what you said :). Yes, I can do this.

cjelger commented 4 years ago

@dplaton You can also simply delete all bindings with names like /var/commerce/products/en- ... no?