Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1215

New MultipleExecutionStrategy for fixture scripts to use value semantics for determining whether to run a fixture script invoked more than once.

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.0
    • Fix Version/s: 1.10.0
    • Component/s: Core
    • Labels:
      None

      Description

      for fixture scripts, we can currently configure the MultipleExecutionStrategy as either IGNORE or EXECUTE, eg:

          @Override
          public FixtureScriptsSpecification getSpecification() {
              return FixtureScriptsSpecification
                      .builder(DomainAppFixtureScriptsSpecificationProvider.class)
                      .with(FixtureScripts.MultipleExecutionStrategy.EXECUTE)
                      .build();
          }
      

      The IGNORE is for using fixture scripts that combine both the "WHAT" and the "HOW" (a la Estatio):

      	ec.executeChild(this, new ImportEventsFromSpreadsheet());
      	ec.executeChild(this, new ImportPeopleFromSpreadsheet());
      

      where:

          static class ImportEventsFromSpreadsheet extends CreateUsingSpreadsheet<EventImport> {
              public ImportEventsFromSpreadsheet() {
                  super(EventImport.class, "EventImport.xls");
              }
          }
          static class ImportPeopleFromSpreadsheet extends CreateUsingSpreadsheet<PeopleImport> {
              public ImportPeopleFromSpreadsheet() {
                  super(PeopleImport.class, "PeopleImportB.xls");
              }
          }
      

      The alternative is EXECUTE, which basically switches this behaviour off. That is appropriate for general purpose fixture scripts which take care of the "HOW", but where the "WHAT" is parameterized,

      eg:

          ec.executeChild(this, new CreateUsingSpreadsheet<>(EventImport.class, "EventImport.xls"));
          ec.executeChild(this, new CreateUsingSpreadsheet<>(PeopleImport.class, "PeopleImportB.xls"));
      

      This ticket is to combine both approaches by using value-semantics rather than reference semantics, thus to ignore fixture scripts if invoked multiple times where "multiple times" is determine by invoking on equals(...) of the fixture script against all previously invoked fixture scripts.

      thus, we would skip a fixture script if

          ec.executeChild(this, new CreateUsingSpreadsheet<>(EventImport.class, "EventImport.xls"));    
      
        // would invoke this:
          ec.executeChild(this, new CreateUsingSpreadsheet<>(SomethingElseImport.class, "SomethingElseImport.xls"));    
      
         // but would skip this:
          ec.executeChild(this, new CreateUsingSpreadsheet<>(EventImport.class, "EventImport.xls"));    
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: