Uploaded image for project: 'Magnolia Synchronization Module'
  1. Magnolia Synchronization Module
  2. MGNLSYNC-56

SynchronizationRequests can be created with non-unique ids

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Neutral
    • 2.0.1
    • 2.0
    • None
    • None

    Description

      In my use-case, I create a list of synchronization requests (for my 14 workspaces). These happen sequentially, but evidently too quickly, as the ID for each request is the same. This makes it impossible to get information about a particular request from the synchronization manager. 

      Steps to reproduce

      1. For loop over the below method, to create requests: 
        private SynchronizationRequest createSynchronizationRequest(String url, String workspace) {
          SynchronizationRequest req = new SynchronizationRequest();
          req.setUrl(url);
          req.setWorkspace(workspace);
          req.setFromPath("/");
          req.setToPath("/");
          return req;
        }
        
      1.  note that all the requests will have the same id: `req.getIdentifier()`

      Expected results

      Requests should have unique IDs, so that they can be queried by ID later. 

      Actual results

      Requests have the same identifier. 

      Workaround

      I manually appended the workspace to the identifier: 

       

      private SynchronizationRequest createSynchronizationRequest(String url, String workspace) {
        SynchronizationRequest req = new SynchronizationRequest();
      // THIS LINE  
        req.setIdentifier(generateNewSyncId(workspace));
      // ^^^^^^^
        req.setUrl(url);
        req.setWorkspace(workspace);
        req.setFromPath(ROOT_PATH);
        req.setToPath(ROOT_PATH);
        
        return req;
      }
      

      The generateNewSyncId() method just creates a string from the date + the workspace. 

      Development notes

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              rkovarik Roman Kovařík
              bmurdoch Brandon Murdoch
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD