SynchronizationRequests can be created with non-unique ids (MGNLSYNC-56)

[MGNLSYNC-63] Replicate the use case Created: 11/May/22  Updated: 11/May/22  Resolved: 11/May/22

Status: Completed
Project: Magnolia Synchronization Module
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Sub-task Priority: Neutral
Reporter: Roman Kovařík Assignee: Roman Kovařík
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Sprint: Nucleus 10
Team: Nucleus

 Description   

SynchronizationRequest req = new SynchronizationRequest();
SynchronizationRequest req2 = new SynchronizationRequest();

req.setUrl("http://localhost:8080/magnoliaPublic");
req.setWorkspace("website");
req.setFromPath("/travel");
req.setToPath("/travel");

req2.setUrl("http://localhost:8080/magnoliaPublic");
req2.setWorkspace("dam");
req2.setFromPath("/travel");
req2.setToPath("/travel");

SimpleSynchronizationManager synchronizationManager = (SimpleSynchronizationManager) Components.getComponent(SynchronizationManager.class);
synchronizationManager.setPolicy(SynchronizationPolicy.AllowAll);
synchronizationManager.synchronize(req);
synchronizationManager.synchronize(req2);

synchronizationManager.stopSynchronization(req.getIdentifier());
synchronizationManager.stopSynchronization(req2.getIdentifier());

synchronizationManager.getSynchronizationRequest(req2.getIdentifier()).get();

//req.getIdentifier().equals(req2.getIdentifier())


 Comments   
Comment by Roman Kovařík [ 11/May/22 ]

The code can return without the fix:


SynchronizationRequest(executionStart=Wed May 11 12:24:30 CEST 2022, executionEnd=null, cancelled=null, state=RUNNING, created=Wed May 11 12:24:30 CEST 2022, identifier=synchronization-20220511-122430247, workspace=dam, path=null, recursive=true, fromDate=null, template=null, url=http://localhost:8080/magnoliaPublic, fromPath=/travel, toPath=/travel)

which is the second request when the first one is requested.

 

With the fix, the correct request is returned:


SynchronizationRequest(executionStart=null, executionEnd=null, cancelled=Wed May 11 12:27:22 CEST 2022, state=CANCELLED, created=Wed May 11 12:27:22 CEST 2022, identifier=synchronization-20220511-122722861, workspace=dam, path=null, recursive=true, fromDate=null, template=null, url=http://localhost:8080/magnoliaPublic, fromPath=/travel, toPath=/travel)

Generated at Mon Feb 12 07:39:30 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.