[ 
https://issues.apache.org/jira/browse/ISIS-1215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood resolved ISIS-1215.
-------------------------------
    Resolution: Fixed

> 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: New Feature
>          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)

Reply via email to