From 9f86716ec31880c49b0f30777faecc9b5598b523 Mon Sep 17 00:00:00 2001 From: Fried Hoeben Date: Thu, 26 Feb 2015 22:03:25 +0100 Subject: [PATCH] Changes for new fitnesse release --- README.txt | 7 --- pom.xml | 4 +- .../fitnesse/HsacPluginFeatureFactory.java | 44 +++++++++++++++++++ .../fitnesse/slim/AutoArgScenarioTable.java | 7 --- .../slim/StoryboardAutoArgScenarioTable.java | 29 ------------ .../fitnesse.plugins.PluginFeatureFactory | 1 + 6 files changed, 47 insertions(+), 45 deletions(-) create mode 100644 src/main/java/nl/hsac/fitnesse/HsacPluginFeatureFactory.java delete mode 100644 src/main/java/nl/hsac/fitnesse/slim/StoryboardAutoArgScenarioTable.java create mode 100644 src/main/resources/META-INF/services/fitnesse.plugins.PluginFeatureFactory diff --git a/README.txt b/README.txt index d94e2de..bff1a06 100644 --- a/README.txt +++ b/README.txt @@ -7,7 +7,6 @@ Wiki symbols: Slim tables: - table template: scenario without need to define all parameters in first line - storyboard: script which takes a 'screenshot' after each row -- template storyboard: 'table template' scenario where a 'screenshot' is taken for each row This plugin is included in the FitNesse baseline installation of https://github.com/fhoeben/hsac-fitnesse-fixtures. @@ -20,9 +19,3 @@ After starting that installation Wiki pages demonstrating the use of this plugin To use this plugin in a 'plain vanilla' FitNesse installation: - copy .jar it to $FITNESSE_HOME/plugins -- if there already is a $FITNESSE_HOME/plugins.properties and it contains a line starting with SymbolTypes - - add ", nl.hsac.fitnesse.symbols.MonthsFromToday, nl.hsac.fitnesse.symbols.WeekDaysFromToday, nl.hsac.fitnesse.symbols.RandomBsn, nl.hsac.fitnesse.symbols.RandomInt, nl.hsac.fitnesse.symbols.RandomString" to that line -- otherwise (create that file and) add the line: "SymbolTypes = nl.hsac.fitnesse.symbols.MonthsFromToday, nl.hsac.fitnesse.symbols.WeekDaysFromToday, nl.hsac.fitnesse.symbols.RandomBsn, nl.hsac.fitnesse.symbols.RandomInt, nl.hsac.fitnesse.symbols.RandomString" -- if there already is a line starting with SlimTables - - add ", table template:nl.hsac.fitnesse.slim.AutoArgScenarioTable, storyboard:nl.hsac.fitnesse.slim.StoryboardTable, template storyboard:nl.hsac.fitnesse.slim.StoryboardAutoArgScenarioTable" -- otherwise add the line: "SlimTables = table template:nl.hsac.fitnesse.slim.AutoArgScenarioTable, storyboard:nl.hsac.fitnesse.slim.StoryboardTable, template storyboard:nl.hsac.fitnesse.slim.StoryboardAutoArgScenarioTable" diff --git a/pom.xml b/pom.xml index f235bba..0d3c76e 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ nl.hsac hsac-fitnesse-plugin - 1.8.2 + 1.9.0 jar https://github.com/fhoeben/hsac-fitnesse-plugin @@ -27,7 +27,7 @@ org.fitnesse fitnesse - 20150114 + 20150226 provided diff --git a/src/main/java/nl/hsac/fitnesse/HsacPluginFeatureFactory.java b/src/main/java/nl/hsac/fitnesse/HsacPluginFeatureFactory.java new file mode 100644 index 0000000..684f983 --- /dev/null +++ b/src/main/java/nl/hsac/fitnesse/HsacPluginFeatureFactory.java @@ -0,0 +1,44 @@ +package nl.hsac.fitnesse; + +import fitnesse.plugins.PluginException; +import fitnesse.plugins.PluginFeatureFactoryBase; +import fitnesse.testsystems.slim.tables.SlimTable; +import fitnesse.testsystems.slim.tables.SlimTableFactory; +import fitnesse.wikitext.parser.SymbolProvider; +import fitnesse.wikitext.parser.SymbolType; +import nl.hsac.fitnesse.slim.AutoArgScenarioTable; +import nl.hsac.fitnesse.slim.StoryboardTable; +import nl.hsac.fitnesse.symbols.MonthsFromToday; +import nl.hsac.fitnesse.symbols.RandomBsn; +import nl.hsac.fitnesse.symbols.RandomInt; +import nl.hsac.fitnesse.symbols.RandomString; +import nl.hsac.fitnesse.symbols.WeekDaysFromToday; + +public class HsacPluginFeatureFactory extends PluginFeatureFactoryBase { + @Override + public void registerSlimTables(SlimTableFactory slimTableFactory) throws PluginException { + super.registerSlimTables(slimTableFactory); + add(slimTableFactory, "table template", AutoArgScenarioTable.class); + add(slimTableFactory, "storyboard", StoryboardTable.class); + } + + private void add(SlimTableFactory factory, String prefix, Class tableType) { + factory.addTableType(prefix, tableType); + LOG.info("Added Slim table type: " + prefix + ": " + tableType.getName()); + } + + @Override + public void registerSymbolTypes(SymbolProvider symbolProvider) throws PluginException { + super.registerSymbolTypes(symbolProvider); + add(symbolProvider, new MonthsFromToday()); + add(symbolProvider, new WeekDaysFromToday()); + add(symbolProvider, new RandomInt()); + add(symbolProvider, new RandomString()); + add(symbolProvider, new RandomBsn()); + } + + private void add(SymbolProvider provider, SymbolType symbolType) { + provider.add(symbolType); + LOG.info("Added symbol " + symbolType.getClass()); + } +} diff --git a/src/main/java/nl/hsac/fitnesse/slim/AutoArgScenarioTable.java b/src/main/java/nl/hsac/fitnesse/slim/AutoArgScenarioTable.java index 9676730..a4b3631 100644 --- a/src/main/java/nl/hsac/fitnesse/slim/AutoArgScenarioTable.java +++ b/src/main/java/nl/hsac/fitnesse/slim/AutoArgScenarioTable.java @@ -49,13 +49,6 @@ protected void getScenarioArguments() { } } - private void addOutput(String argument) { - // if my pull request (https://github.com/unclebob/fitnesse/pull/592) gets - // merged output adding will have to be done that same as for input - // then this method can be deleted in this class - getOutputs().add(argument); - } - private Set findArguments(Pattern pattern) { Set found = new LinkedHashSet(); int rowCount = table.getRowCount(); diff --git a/src/main/java/nl/hsac/fitnesse/slim/StoryboardAutoArgScenarioTable.java b/src/main/java/nl/hsac/fitnesse/slim/StoryboardAutoArgScenarioTable.java deleted file mode 100644 index e42b658..0000000 --- a/src/main/java/nl/hsac/fitnesse/slim/StoryboardAutoArgScenarioTable.java +++ /dev/null @@ -1,29 +0,0 @@ -package nl.hsac.fitnesse.slim; - -import fitnesse.testsystems.slim.SlimTestContext; -import fitnesse.testsystems.slim.Table; -import fitnesse.testsystems.slim.tables.ScriptTable; -import fitnesse.testsystems.slim.tables.SlimTable; - -/** - * AutoArgScenarioTable that creates storyboard instances when invoked from - * decision table. - */ -public class StoryboardAutoArgScenarioTable extends AutoArgScenarioTable { - public StoryboardAutoArgScenarioTable(Table table, String tableId, SlimTestContext testContext) { - super(table, tableId, testContext); - } - - @Override - protected ScriptTable createChild(ScenarioTestContext testContext, SlimTable parentTable, Table newTable) { - ScriptTable scriptTable; - if (!(parentTable instanceof ScriptTable)) { - scriptTable = new StoryboardTable(newTable, id, testContext); - scriptTable.setCustomComparatorRegistry(customComparatorRegistry); - } else { - scriptTable = super.createChild(testContext, parentTable, newTable); - } - - return scriptTable; - } -} diff --git a/src/main/resources/META-INF/services/fitnesse.plugins.PluginFeatureFactory b/src/main/resources/META-INF/services/fitnesse.plugins.PluginFeatureFactory new file mode 100644 index 0000000..6458003 --- /dev/null +++ b/src/main/resources/META-INF/services/fitnesse.plugins.PluginFeatureFactory @@ -0,0 +1 @@ +nl.hsac.fitnesse.HsacPluginFeatureFactory \ No newline at end of file