hanicz opened a new pull request, #1469:
URL: https://github.com/apache/knox/pull/1469

   …es without an identity-assertion provider are marked UPDATED on every reload
   
   [KNOX-3528](https://issues.apache.org/jira/browse/KNOX-3528) - 
DeploymentFactory mutates the cached Topology, so topologies without an 
identity-assertion provider are marked UPDATED on every reload
   
   ## What changes were proposed in this pull request?
   
   When any file in the topologies directory changed, every topology without an 
identity-assertion provider got an UPDATED event and was reactivated, even if 
its own file hadn't changed.
   
   `DeploymentFactory.addMissingDefaultProviders()` added a `Default` 
identity-assertion provider directly to the `Topology` it was given. That is 
the same object `DefaultTopologyService` caches for change detection. On the 
next reload the cached topology had one more provider than the re-parsed file, 
so `Topology.equals()` failed.
   
   - Add `Topology.shallowCopy()`. It copies metadata and rebuilds the 
provider, service and application collections through `addProvider`, 
`addService` and `addApplication`. The element objects are shared, not cloned.
   - `DeploymentFactory.createDeployment()` deploys from a shallow copy, so the 
default provider only ends up in the deployment artifacts. The generated 
`gateway.xml` and `topology.xml` are unchanged.
   
   ## How was this patch tested?
   
   - `TopologyTest#testShallowCopyIsEqualAndIndependent`: the copy equals the 
original, shares its elements, and adding to its collections doesn't affect the 
original.
   - `DeploymentFactoryFuncTest#testGenericProviderDeploymentContributor`: the 
deployment still contains the `Default` identity-assertion provider, and the 
input `Topology` is left unchanged. This failed before the fix with 
`expected:<1> but was:<2>`.
   
   Verified manually
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to