You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2015/10/16 01:32:05 UTC

[jira] [Created] (ISIS-1215) New MultipleExecutionStrategy for fixture scripts to use value semantics for determining whether to run a fixture script invoked more than once.

Dan Haywood created ISIS-1215:
---------------------------------

             Summary: New MultipleExecutionStrategy for fixture scripts to use value semantics for determining whether to run a fixture script invoked more than once.
                 Key: ISIS-1215
                 URL: https://issues.apache.org/jira/browse/ISIS-1215
             Project: Isis
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.9.0
            Reporter: Dan Haywood
            Assignee: Dan Haywood
            Priority: Minor
             Fix For: 1.10.0


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

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

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

{code:java}
	ec.executeChild(this, new ImportEventsFromSpreadsheet());
	ec.executeChild(this, new ImportPeopleFromSpreadsheet());
{code}

where:

{code:java}
    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");
        }
    }
{code}

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:
{code:java}
    ec.executeChild(this, new CreateUsingSpreadsheet<>(EventImport.class, "EventImport.xls"));
    ec.executeChild(this, new CreateUsingSpreadsheet<>(PeopleImport.class, "PeopleImportB.xls"));
{code}

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
{code:java}
    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"));    
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)