[PATCH] failed tests will be saved to disk

Wald Commits scm-commit at wald.intevation.org
Mon Nov 5 17:15:50 CET 2018


# HG changeset patch
# User gernotbelger
# Date 1541434530 -3600
# Node ID 531a60b7af95818602ad58fa5c61fba584be5641
# Parent  9f83ebf67c925aa344e5754d6192fa4cffefda3e
failed tests will be saved to disk

diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/AbstractBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/AbstractBerechnungsartenTester.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/AbstractBerechnungsartenTester.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,14 @@
  */
 package test;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
 /**
  * @author Domenico Nardi Tironi
  *
@@ -17,6 +25,8 @@
 
     // for common Settings
     //
+    protected static File testFolder;
+
     protected enum FileExportBehaviour {
         do_not_override, export_all, export_none;
         // do_not_override: file export is set individually (not overridden)
@@ -28,4 +38,33 @@
         Beispielfluss, Rhein, Elbe
     };
 
+    @BeforeClass
+    public static final void createTempFolder() {
+        // windows: C:\Users\USER_NAME\AppData\Local\Temp
+        if (testFolder == null) {
+            testFolder = new File(FileUtils.getTempDirectory(), "FlysTestFolder");
+            if (!testFolder.isDirectory())
+                testFolder.mkdir();
+        }
+    }
+
+    @AfterClass
+    public static void deleteTempFolder() {
+
+        testFolder = new File(FileUtils.getTempDirectory(), "FlysTestFolder");
+        if (testFolder.isDirectory() && testFolder.exists()) {
+
+            try {
+                final Iterator<File> test = FileUtils.iterateFiles(testFolder, null, true);
+                if (!test.hasNext()) {
+                    FileUtils.deleteDirectory(testFolder);
+
+                    testFolder = null;
+                }
+            }
+            catch (final IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/AbstractModuleRunner.java
--- a/gwt-client/src/test/java/test/AbstractModuleRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/AbstractModuleRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -1,5 +1,6 @@
 package test;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -66,14 +67,17 @@
     private final River river;
     private final List<ModuleRunnerOutput> outputList;
 
-    public AbstractModuleRunner(final Infotype infotype, final ICalcMode calcmode, final double from, final double to, final River beispielfluss)
-            throws ConnectionException, ServerException {
+    protected final File testFolder;
+
+    public AbstractModuleRunner(final File testFolder, final Infotype infotype, final ICalcMode calcmode, final double from, final double to,
+            final River beispielfluss) throws ConnectionException, ServerException {
         // common attributes (evtl. doch in subklassen, evtl. Zwischenhierarchiestufe einführen
         this.outputList = new ArrayList<ModuleRunnerOutput>();
         this.iCalcMode = calcmode;
         this.river = beispielfluss;
         this.from = from;
         this.to = to;
+        this.testFolder = testFolder;
 
         this.infotype = infotype;
 
@@ -261,7 +265,7 @@
             if (!stateHasRequiredOutputMode(name)) {
                 Assert.fail("Unbekannter outputmode " + name);
             }
-            output.assertAndWriteToFile(this.client, this.collection.identifier());
+            output.assertAndWriteToFile(this.client, this.collection.identifier(), this.testFolder);
         }
     }
 
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/FilenameSupplier.java
--- a/gwt-client/src/test/java/test/FilenameSupplier.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/FilenameSupplier.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,8 @@
  */
 package test;
 
+import java.io.File;
+
 /**
  * @author Domenico Nardi Tironi
  *
@@ -22,7 +24,7 @@
     }
 
     public final String getFilename() {
-        return this.filename;
+        return this.filename.replace("//", File.separator);
     }
 
 }
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/ModuleRunnerOutput.java
--- a/gwt-client/src/test/java/test/ModuleRunnerOutput.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/ModuleRunnerOutput.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,15 +9,11 @@
  */
 package test;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.net.URL;
-import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -42,8 +38,6 @@
 
     private static final String LINE_SEPARATOR = System.getProperty("line.separator");
 
-    private static final String EXPORT_FILE_DIR = "D:" + File.separator;
-
     final FilenameSupplier filename;
     final String outputModeName;
 
@@ -62,7 +56,7 @@
         this.params = getChartExportAttributeMap(currentKm, outputModeName);
     }
 
-    protected final void assertAndWriteToFile(final HttpClient client, final String collectionId) throws IOException {
+    protected final void assertAndWriteToFile(final HttpClient client, final String collectionId, final File testFolder) throws IOException {
 
         final String type = "csv";
 
@@ -79,39 +73,23 @@
 
         final String expected = deleteErstelldatum(FileUtils.readFileToString(new File(expectedResource.getFile()), enc));
 
-        // if (!actual.equals(expected)) {
-        // if (this.writeToFile != null && this.writeToFile == true) {
-        doGetWriteToDisk(actual); // TODO: WENN der Test negativ ausfällt, Datei abspeichern -> Diskussion
-        // }
+        final File fileTmp = doGetWriteToDisk(actual, testFolder);
+        Assert.assertEquals(expected, actual);
 
-        try {
-            Assert.assertEquals(expected, actual);
-        }
-        catch (final AssertionError e) {
-            // TODO write (both?) files
+        fileTmp.delete(); // if assert fails, file won't be deleted
 
-            // doGetWriteToDisk(actual); // TODO: WENN der Test negativ ausfällt, Datei abspeichern -> Diskussion
-            throw e;
-        }
     }
 
-    public final void doGetWriteToDisk(final String actual_text) throws FileNotFoundException, IOException {
+    public final File doGetWriteToDisk(final String actual_text, final File testFolder) throws FileNotFoundException, IOException {
+
+        final File file = new File(testFolder, this.filename.getFilename());
+        new File(file.getParent()).mkdir();
 
         // final String name = mode;
-        final String type = "csv";
+        // final String type = "csv";
 
-        final String fn = this.outputModeName + System.currentTimeMillis() + "." + type;
-        final String enc = "windows-1252";
-
-        final String filepath = EXPORT_FILE_DIR + fn;
-        // BOM
-        final byte[] BOM = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF };
-        final String bomChar = new String(BOM, "UTF-8");
-        final String actualWithBom = new StringBuilder().append(BOM).append(actual_text).toString();
-
-        final InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(Charset.forName(enc).encode(actualWithBom).array()), enc);
-
-        IOUtils.copy(in, new FileOutputStream(filepath), enc);
+        FileUtils.write(file, actual_text, "UTF-8");
+        return file;
     }
 
     private final String deleteErstelldatum(final String input) {
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java	Mon Nov 05 17:15:30 2018 +0100
@@ -5,14 +5,13 @@
 import java.util.List;
 
 import org.dive4elements.river.client.shared.exceptions.ServerException;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import test.AbstractBerechnungsartenTester;
 import test.FilenameSupplier;
 import test.ICalcMode;
 
- at Ignore
+//@Ignore
 public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester {
 
     private static final String BUNDU_WST_DEFAULT_EXPORT_MODE = "bundu_wst_export";
@@ -92,8 +91,8 @@
         final boolean preprocessing = false;
         final boolean missingVolume = false;
 
-        new BunduBezugswstRunner(670.0, 710., 100., River.Rhein, 2014, fixChoice, function, abflussklasseFrom, abflussklasseTo, events, 40, segments,
-                calcChoice, preprocessing, missingVolume, null, null, sounding)//
+        new BunduBezugswstRunner(super.testFolder, 670.0, 710., 100., River.Rhein, 2014, fixChoice, function, abflussklasseFrom, abflussklasseTo, events, 40,
+                segments, calcChoice, preprocessing, missingVolume, null, null, sounding)//
                         .addOutputTest(this.BEZUGSWST_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null)//
                         .runTest();
     }
@@ -135,8 +134,8 @@
         final boolean preprocessing = true;
         final boolean missingVolume = true;
 
-        new BunduBezugswstRunner(336.2, 621., 100, River.Rhein, 2010, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 10, segments,
-                calcChoice, preprocessing, missingVolume, 400., 401., sounding)//
+        new BunduBezugswstRunner(super.testFolder, 336.2, 621., 100, River.Rhein, 2010, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 10,
+                segments, calcChoice, preprocessing, missingVolume, 400., 401., sounding)//
                         .addOutputTest(this.BEZUGSWST_02_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) //
                         .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no currentKM
                         .runTest();
@@ -168,8 +167,8 @@
         final boolean preprocessing = true;
         final boolean missingVolume = true;
 
-        new BunduBezugswstRunner(430., 500., 100, River.Rhein, 2014, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 40, segments,
-                calcChoice, preprocessing, missingVolume, 430., 480., sounding)//
+        new BunduBezugswstRunner(super.testFolder, 430., 500., 100, River.Rhein, 2014, fixChoice, "log-linear", abflussklasseFrom, abflussklasseTo, events, 40,
+                segments, calcChoice, preprocessing, missingVolume, 430., 480., sounding)//
                         .addOutputTest(this.BEZUGSWST_03_FILE, BUNDU_WST_DEFAULT_EXPORT_MODE, null) //
                         // .addOutputTest(this.BEZUGSWST_02_CHART_FILE, BUNDU_WSPL_LONGITUDINAL_SECTION_MODE, null) // longitudinal_section, no
                         // currentKM
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java
--- a/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/bundu/BunduBezugswstRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.bundu;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Calendar;
 import java.util.List;
@@ -50,11 +51,11 @@
     private final Double fehlVolTo;
     private final boolean preprocessing;
 
-    public BunduBezugswstRunner(final double from, final double to, final double step, final River river, final int bezugsjahr, final String fixationChoice,
-            final String function, final String abflussklasseFrom, final String abflussklasseTo, final int[] events, final int years_length,
-            final List<Segment> segments, final String calcChoice, final boolean preprocessing, final boolean fehlvolumina, final Double fehlVolFrom,
-            final Double fehlVolTo, final String sounding) throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, from, to, river);
+    public BunduBezugswstRunner(final File testFolder, final double from, final double to, final double step, final River river, final int bezugsjahr,
+            final String fixationChoice, final String function, final String abflussklasseFrom, final String abflussklasseTo, final int[] events,
+            final int years_length, final List<Segment> segments, final String calcChoice, final boolean preprocessing, final boolean fehlvolumina,
+            final Double fehlVolFrom, final Double fehlVolTo, final String sounding) throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.bundu, test.bundu.BunduBerechnungsartenTester.CalcMode.bundu_bezugswst, from, to, river);
         this.fixationChoice = fixationChoice;
         this.qSectorStart = abflussklasseFrom;
         this.qSectorEnd = abflussklasseTo;
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoBerechnungsartenTester.java	Mon Nov 05 17:15:30 2018 +0100
@@ -4,7 +4,6 @@
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
 import org.dive4elements.river.client.shared.exceptions.ServerException;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import test.AbstractBerechnungsartenTester;
@@ -13,7 +12,7 @@
 import test.SimpleRecommendation;
 import test.sinfo.SinfoFloodDurationRiversideChoice.RiversideChoiceKey;
 
- at Ignore // ein- oder auskommentieren, je nach Bedarf!
+//@Ignore // ein- oder auskommentieren, je nach Bedarf!
 public final class SinfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
     // has to be public for jUnit-Test
     public static enum CalcMode implements ICalcMode {
@@ -56,7 +55,7 @@
     public void testFTMINMAX1() throws ServerException, IOException {
 
         SinfoRunnerCreatorHelper
-                .createSinfoFlowdepthMinMaxTest(430, 450, River.Rhein,
+                .createSinfoFlowdepthMinMaxTest(super.testFolder, 433, 450, River.Rhein,
                         new SimpleRecommendation("bedheight", "bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
                         new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section", "Amtl.Festlegung_GlQ(2002)"))//
                 .addOutputTest(this.FT_MINMAX_RHEIN_1_FILE, "sinfo_flowdepthminmax_export", null)//
@@ -65,7 +64,7 @@
 
     @Test
     public void testFTMINMAX2() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(0, 90, River.Elbe,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(this.testFolder, 0, 90, River.Elbe,
                 // first
                 // bedheight-single-58-2015-FP-2015_0-502
 
@@ -84,7 +83,7 @@
     @Test
     public void testRhein1FT() throws ConnectionException, ServerException, IOException {
 
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(350, 380, River.Rhein, false,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthTest(this.testFolder, 350, 380, River.Rhein, false,
                 // [b34f91bd-17b3-435e-b609-8026980ed301;bedheight;0;DGM-2004_Epoche_NHN]#[e1bedb5e-edee-427d-b74e-7566652ebfda;staticwqkms;0;Amtl.Festlegung_GlQ(2002)]]]
                 // debug at org.dive4elements.river.client.shared.model.DefaultData.Recommendation line 142
                 new SimpleRecommendation("bedheight", " bedheight-single-103-2004-DGM-2004_Epoche_NHN", "longitudinal_section"),
@@ -97,7 +96,7 @@
     @Test
     public void testRhein2FT() throws ConnectionException, ServerException, IOException {
         SinfoRunnerCreatorHelper
-                .createSinfoFlowdepthTest(655, 675, River.Rhein, true,
+                .createSinfoFlowdepthTest(this.testFolder, 655, 675, River.Rhein, true,
                         new SimpleRecommendation("bedheight", "bedheight-soundings-92-2004-NIEDERRHEIN_QP-2004_Epoche_NHN", "longitudinal_section"),
                         new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section"))//
 
@@ -109,7 +108,7 @@
 
     @Test
     public void testElbeFTE() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(210, 230, River.Elbe,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(this.testFolder, 210, 230, River.Elbe,
                 // current
                 new SimpleRecommendation("bedheight", "bedheight-soundings-66-2008-FP-QP-2008",
                         // "bedheight-single-66-2008-MW-FP-QP-2008",
@@ -129,7 +128,7 @@
 
     @Test
     public void testRheinFTE() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(655, 665, River.Rhein,
+        SinfoRunnerCreatorHelper.createSinfoFlowdepthDevelopmentTest(this.testFolder, 655, 665, River.Rhein,
                 // current
                 new SimpleRecommendation("bedheight", "bedheight-single-94-2008-MW-NIEDERRHEIN_QP-2008_Epoche_NHN",
                         // "bedheight-single....",
@@ -151,7 +150,7 @@
 
     @Test
     public void testElbeTKH_1() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoTkhTest(150, 160, River.Elbe, new double[] { 1520.0 })//
+        SinfoRunnerCreatorHelper.createSinfoTkhTest(this.testFolder, 150, 160, River.Elbe, new double[] { 1520.0 })//
                 .addOutputTest(this.TKH_1_ELBE_FILE, "sinfo_tkh_export", null)//
                 .addOutputTest(this.TKH_1_ELBE_CHART_FILE, "sinfo_tkk", null)//
 
@@ -160,14 +159,14 @@
 
     @Test
     public void testRheinTKH_2() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoTkhTest(600, 610, River.Rhein, new double[] { 6125, 6526 })//
+        SinfoRunnerCreatorHelper.createSinfoTkhTest(this.testFolder, 600, 610, River.Rhein, new double[] { 6125, 6526 })//
                 .addOutputTest(this.TKH_2_RHEIN_FILE, "sinfo_tkh_export", null)//
                 .runTest();
     }
 
     @Test
     public void testCollision_01() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoCollisionYearsTest(336.2, 866.3, River.Rhein, new int[] { 2003, 2006, 2007 })//
+        SinfoRunnerCreatorHelper.createSinfoCollisionYearsTest(this.testFolder, 336.2, 866.3, River.Rhein, new int[] { 2003, 2006, 2007 })//
 
                 .addOutputTest(this.COLLISION_RHEIN_01, "sinfo_collision_export", null)//
                 .runTest();
@@ -175,7 +174,7 @@
 
     @Test
     public void testCollision_02() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoCollisionEpochsTest(336.2, 866.3, River.Rhein, "2002,2007;2005,2009;")//
+        SinfoRunnerCreatorHelper.createSinfoCollisionEpochsTest(this.testFolder, 336.2, 866.3, River.Rhein, "2002,2007;2005,2009;")//
 
                 .addOutputTest(this.COLLISION_RHEIN_02, "sinfo_collision_export", null)//
                 .runTest();
@@ -183,7 +182,7 @@
 
     @Test
     public void testFloodDurationDurCurves() throws ConnectionException, ServerException, IOException {
-        SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(336.2, 865.5, River.Rhein, null, false, RiversideChoiceKey.BOTH)//
+        SinfoRunnerCreatorHelper.createSinfoFloodDurationTest(this.testFolder, 336.2, 865.5, River.Rhein, null, false, RiversideChoiceKey.BOTH)//
                 .addOutputTest(this.FLOOD_DURATION_CS_384_6, "sinfo_floodduration_curve", "384.6")//
                 .addOutputTest(this.FLOOD_DURATION_CS_384_7, "sinfo_floodduration_curve", "384.7")//
                 .addOutputTest(this.FLOOD_DURATION_CS_384_9, "sinfo_floodduration_curve", "384.9")//
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoCollisionRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoCollisionRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoCollisionRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
@@ -32,9 +33,9 @@
     private final String epochs;
     private boolean isYears; // cannot be final because of the ternary expression
 
-    public SinfoCollisionRunner(final double from, final double to, final River river, final int[] years, final String epochs)
+    public SinfoCollisionRunner(final File testFolder, final double from, final double to, final River river, final int[] years, final String epochs)
             throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, CalcMode.sinfo_calc_collision, from, to, river);
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, CalcMode.sinfo_calc_collision, from, to, river);
         this.years = years;
         this.epochs = epochs;
         this.isYears = (years != null) ? (this.isYears = true) : (this.isYears = false);
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoFloodDurationRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoFloodDurationRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoFloodDurationRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
@@ -34,9 +35,9 @@
     private final boolean showWspl;
     private final RiversideChoiceKey riverside;
 
-    public SinfoFloodDurationRunner(final ICalcMode calcmode, final double from, final double to, final River river, final double[] wasserspiegellage,
-            final RiversideChoiceKey riverside, final boolean showWspl) throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, calcmode, from, to, river);
+    public SinfoFloodDurationRunner(final File testFolder, final ICalcMode calcmode, final double from, final double to, final River river,
+            final double[] wasserspiegellage, final RiversideChoiceKey riverside, final boolean showWspl) throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, calcmode, from, to, river);
         this.wasserspiegellage = wasserspiegellage;
         this.showWspl = showWspl;
         this.riverside = riverside;
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoFlowdepthDevelopmentRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthDevelopmentRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthDevelopmentRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -30,9 +31,9 @@
     private final List<String> pairIdsCurrent = new ArrayList<String>();
     private final List<String> pairIdsHistorical = new ArrayList<String>();
 
-    public SinfoFlowdepthDevelopmentRunner(final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river)
+    public SinfoFlowdepthDevelopmentRunner(final File testFolder, final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river)
             throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
 
     }
 
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoFlowdepthMinMaxRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthMinMaxRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthMinMaxRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -29,9 +30,9 @@
 
     private final List<String> pairIds = new ArrayList<String>();
 
-    public SinfoFlowdepthMinMaxRunner(final ICalcMode sinfoCalcFlowDepthMinmax, final double from, final double to, final River beispielfluss)
-            throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepthMinmax, from, to, beispielfluss);
+    public SinfoFlowdepthMinMaxRunner(final File testFolder, final ICalcMode sinfoCalcFlowDepthMinmax, final double from, final double to,
+            final River beispielfluss) throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepthMinmax, from, to, beispielfluss);
     }
 
     public void addRecommendationPair(final SimpleRecommendation rec1, final SimpleRecommendation rec2) throws ConnectionException, ServerException {
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoFlowdepthRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoFlowdepthRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 
@@ -33,9 +34,9 @@
     private final boolean useTkh;
     private final ArrayList<String> pairIds = new ArrayList<String>();
 
-    public SinfoFlowdepthRunner(final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river, final boolean useTkh)
-            throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
+    public SinfoFlowdepthRunner(final File testFolder, final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river,
+            final boolean useTkh) throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
         this.useTkh = useTkh;
     }
 
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoRunnerCreatorHelper.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoRunnerCreatorHelper.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoRunnerCreatorHelper.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,8 @@
  */
 package test.sinfo;
 
+import java.io.File;
+
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
 import org.dive4elements.river.client.shared.exceptions.ServerException;
 
@@ -30,52 +32,53 @@
 
     // HELPER-Methods:
 
-    public final static AbstractModuleRunner createSinfoFlowdepthMinMaxTest(final double from, final double to, final River river,
+    public final static AbstractModuleRunner createSinfoFlowdepthMinMaxTest(final File testFolder, final double from, final double to, final River river,
             final SimpleRecommendation rec0, final SimpleRecommendation rec1) throws ConnectionException, ServerException {
         // TODO: make recommendationPair to method parameter if needed
-        final SinfoFlowdepthMinMaxRunner proof = new SinfoFlowdepthMinMaxRunner(CalcMode.sinfo_calc_flow_depth_minmax, from, to, river);
+        final SinfoFlowdepthMinMaxRunner proof = new SinfoFlowdepthMinMaxRunner(testFolder, CalcMode.sinfo_calc_flow_depth_minmax, from, to, river);
         proof.addRecommendationPair(rec0, rec1);
 
         return proof;
     }
 
-    public static AbstractModuleRunner createSinfoFlowdepthMinMaxTest(final int from, final int to, final River river,
+    public static AbstractModuleRunner createSinfoFlowdepthMinMaxTest(final File testFolder, final int from, final int to, final River river,
             final SimpleRecommendation simpleRecommendation0, final SimpleRecommendation simpleRecommendation1,
             final SimpleRecommendation simpleRecommendation2, final SimpleRecommendation simpleRecommendation3) throws ConnectionException, ServerException {
-        final SinfoFlowdepthMinMaxRunner proof = (SinfoFlowdepthMinMaxRunner) createSinfoFlowdepthMinMaxTest(from, to, river, simpleRecommendation0,
+        final SinfoFlowdepthMinMaxRunner proof = (SinfoFlowdepthMinMaxRunner) createSinfoFlowdepthMinMaxTest(testFolder, from, to, river, simpleRecommendation0,
                 simpleRecommendation1);
         proof.addRecommendationPair(simpleRecommendation2, simpleRecommendation3);
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoFlowdepthTest(final double from, final double to, final River river, final boolean useTkh,
-            final SimpleRecommendation rec0, final SimpleRecommendation rec1) throws ConnectionException, ServerException {
-        final SinfoFlowdepthRunner proof = new SinfoFlowdepthRunner(CalcMode.sinfo_calc_flow_depth, from, to, river, useTkh);
+    public final static AbstractModuleRunner createSinfoFlowdepthTest(final File testFolder, final double from, final double to, final River river,
+            final boolean useTkh, final SimpleRecommendation rec0, final SimpleRecommendation rec1) throws ConnectionException, ServerException {
+        final SinfoFlowdepthRunner proof = new SinfoFlowdepthRunner(testFolder, CalcMode.sinfo_calc_flow_depth, from, to, river, useTkh);
         proof.addRecommendationPair(rec0, rec1);
 
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoFlowdepthDevelopmentTest(final double from, final double to, final River river,
+    public final static AbstractModuleRunner createSinfoFlowdepthDevelopmentTest(final File testFolder, final double from, final double to, final River river,
             final SimpleRecommendation rec0_curr, final SimpleRecommendation rec1_curr, final SimpleRecommendation rec0_hist,
             final SimpleRecommendation rec1_hist) throws ConnectionException, ServerException {
-        final SinfoFlowdepthDevelopmentRunner proof = new SinfoFlowdepthDevelopmentRunner(CalcMode.sinfo_calc_flow_depth_development, from, to, river);
+        final SinfoFlowdepthDevelopmentRunner proof = new SinfoFlowdepthDevelopmentRunner(testFolder, CalcMode.sinfo_calc_flow_depth_development, from, to,
+                river);
         proof.addCurrentRecommendationPair(rec0_curr, rec1_curr);
         proof.addHistoricalRecommendationPair(rec0_hist, rec1_hist);
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoTkhTest(final double from, final double to, final River river,
+    public final static AbstractModuleRunner createSinfoTkhTest(final File testFolder, final double from, final double to, final River river,
             // final boolean useTkh,
             final double[] wasserspiegellage) throws ConnectionException, ServerException {
-        final SinfoTkhRunner proof = new SinfoTkhRunner(CalcMode.sinfo_calc_transport_bodies_heights, from, to, river, wasserspiegellage);
+        final SinfoTkhRunner proof = new SinfoTkhRunner(testFolder, CalcMode.sinfo_calc_transport_bodies_heights, from, to, river, wasserspiegellage);
 
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoCollisionYearsTest(final double from, final double to, final River river, final int[] years)
-            throws ConnectionException, ServerException {
-        final SinfoCollisionRunner proof = new SinfoCollisionRunner(from, to, river, years, null)
+    public final static AbstractModuleRunner createSinfoCollisionYearsTest(final File testFolder, final double from, final double to, final River river,
+            final int[] years) throws ConnectionException, ServerException {
+        final SinfoCollisionRunner proof = new SinfoCollisionRunner(testFolder, from, to, river, years, null)
         // .addOutputTest(file, outputModeName, overideWriteToDisk,
         // params)
         ;
@@ -83,17 +86,17 @@
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoCollisionEpochsTest(final double from, final double to, final River river, final String epochs)
-            throws ConnectionException, ServerException {
-        final SinfoCollisionRunner proof = new SinfoCollisionRunner(from, to, river, null, epochs);
+    public final static AbstractModuleRunner createSinfoCollisionEpochsTest(final File testFolder, final double from, final double to, final River river,
+            final String epochs) throws ConnectionException, ServerException {
+        final SinfoCollisionRunner proof = new SinfoCollisionRunner(testFolder, from, to, river, null, epochs);
 
         return proof;
     }
 
-    public final static AbstractModuleRunner createSinfoFloodDurationTest(final double from, final double to, final River river,
+    public final static AbstractModuleRunner createSinfoFloodDurationTest(final File testFolder, final double from, final double to, final River river,
             final double[] wasserspiegellage, final boolean showWspl, final RiversideChoiceKey riverside) throws ConnectionException, ServerException {
-        final SinfoFloodDurationRunner proof = new SinfoFloodDurationRunner(CalcMode.sinfo_calc_flood_duration, from, to, river, wasserspiegellage, riverside,
-                showWspl);
+        final SinfoFloodDurationRunner proof = new SinfoFloodDurationRunner(testFolder, CalcMode.sinfo_calc_flood_duration, from, to, river, wasserspiegellage,
+                riverside, showWspl);
 
         return proof;
     }
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/sinfo/SinfoTkhRunner.java
--- a/gwt-client/src/test/java/test/sinfo/SinfoTkhRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/sinfo/SinfoTkhRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.sinfo;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
@@ -31,9 +32,9 @@
 
     private final double[] wasserspiegellage;
 
-    public SinfoTkhRunner(final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river, final double[] wasserspiegellage)
-            throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
+    public SinfoTkhRunner(final File testFolder, final ICalcMode sinfoCalcFlowDepth, final double from, final double to, final River river,
+            final double[] wasserspiegellage) throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, from, to, river);
         this.wasserspiegellage = wasserspiegellage;
     }
 
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java
--- a/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UInfoBerechnungsartenTester.java	Mon Nov 05 17:15:30 2018 +0100
@@ -6,14 +6,12 @@
 
 import org.dive4elements.river.client.shared.exceptions.ServerException;
 import org.dive4elements.river.client.shared.model.SalixZone;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import test.AbstractBerechnungsartenTester;
 import test.FilenameSupplier;
 import test.ICalcMode;
 
- at Ignore
 public class UInfoBerechnungsartenTester extends AbstractBerechnungsartenTester {
 
     private final String UINFO_SALIX_MAIN_EXPORT_MODE_NAME = "uinfo_salix_line_export";
@@ -46,7 +44,7 @@
 
     @Test
     public void test01() throws ServerException, IOException {
-        new UinfoSalixRunner(336.2, 866.3, River.Rhein, null) //
+        new UinfoSalixRunner(super.testFolder, 336.2, 866.3, River.Rhein, null) //
                 .addOutputTest(this.SALIX_01, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
                 .runTest();
         // this.SALIX_NO_SCENARIO
@@ -54,7 +52,7 @@
 
     @Test
     public void test02() throws ServerException, IOException {
-        new UinfoSalixRegionalRunner(336.2, 866.3, River.Rhein, "scenarioType.option1", 336.2, 866.3, "-50 50")//
+        new UinfoSalixRegionalRunner(super.testFolder, 336.2, 866.3, River.Rhein, "scenarioType.option1", 336.2, 866.3, "-50 50")//
                 .addOutputTest(this.SALIX_02, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
                 .addOutputTest(this.SALIX_02_CHART, this.UINFO_SALIX_LAENGS_CHART_NAME, null) //
                 .runTest();
@@ -70,7 +68,7 @@
         zones.add(SalixZone.createFromTableEntry("30", "300", "450"));
         zones.add(SalixZone.createFromTableEntry("0", "450", "550"));
 
-        new UinfoSalixSupraregionalRunner(0., 550.0, River.Elbe, "scenarioType.option2", zones)
+        new UinfoSalixSupraregionalRunner(super.testFolder, 0., 550.0, River.Elbe, "scenarioType.option2", zones)
                 .addOutputTest(this.SALIX_03, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
                 .addOutputTest(this.SALIX_03_CHART, this.UINFO_SALIX_LAENGS_CHART_NAME, null) //
                 .runTest();
@@ -80,7 +78,7 @@
     @Test
     public void test04() throws ServerException, IOException {
         // name of sounding can be found in ParameterMatrixPanel.getData
-        new UinfoSalixHistoricalRunner(0., 598.3, River.Elbe, "scenarioType.option3", "single-68", 0.1, 585.3)
+        new UinfoSalixHistoricalRunner(super.testFolder, 0., 598.3, River.Elbe, "scenarioType.option3", "single-68", 0.1, 585.3)
                 .addOutputTest(this.SALIX_04, this.UINFO_SALIX_MAIN_EXPORT_MODE_NAME, null) //
                 .runTest();
         // this.SALIX_HISTORICAL_SCENARIO,
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/uinfo/UinfoSalixHistoricalRunner.java
--- a/gwt-client/src/test/java/test/uinfo/UinfoSalixHistoricalRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UinfoSalixHistoricalRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,8 @@
  */
 package test.uinfo;
 
+import java.io.File;
+
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
 import org.dive4elements.river.client.shared.exceptions.ServerException;
 
@@ -24,9 +26,9 @@
     private final double toPart;
     private final String soundingName;
 
-    public UinfoSalixHistoricalRunner(final double from, final double to, final River river, final String scenarioChoice, final String soundingName,
-            final double fromPart, final double toPart) throws ConnectionException, ServerException {
-        super(from, to, river, scenarioChoice);
+    public UinfoSalixHistoricalRunner(final File testFolder, final double from, final double to, final River river, final String scenarioChoice,
+            final String soundingName, final double fromPart, final double toPart) throws ConnectionException, ServerException {
+        super(testFolder, from, to, river, scenarioChoice);
         this.fromPart = fromPart;
         this.toPart = toPart;
         this.soundingName = soundingName;
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/uinfo/UinfoSalixRegionalRunner.java
--- a/gwt-client/src/test/java/test/uinfo/UinfoSalixRegionalRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UinfoSalixRegionalRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,8 @@
  */
 package test.uinfo;
 
+import java.io.File;
+
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
 import org.dive4elements.river.client.shared.exceptions.ServerException;
 
@@ -24,9 +26,9 @@
     private final double toPart;
     private final String dwspl;
 
-    public UinfoSalixRegionalRunner(final double from, final double to, final River river, final String scenarioChoice, final double fromPart,
-            final double toPart, final String dwspl) throws ConnectionException, ServerException {
-        super(from, to, river, scenarioChoice);
+    public UinfoSalixRegionalRunner(final File testFolder, final double from, final double to, final River river, final String scenarioChoice,
+            final double fromPart, final double toPart, final String dwspl) throws ConnectionException, ServerException {
+        super(testFolder, from, to, river, scenarioChoice);
         this.fromPart = fromPart;
         this.toPart = toPart;
         this.dwspl = dwspl;
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/uinfo/UinfoSalixRunner.java
--- a/gwt-client/src/test/java/test/uinfo/UinfoSalixRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UinfoSalixRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.uinfo;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
@@ -30,8 +31,9 @@
     private final String scenarioChoice;
     private boolean isUseScenario;
 
-    public UinfoSalixRunner(final double from, final double to, final River river, final String scenarioChoice) throws ConnectionException, ServerException {
-        super(AbstractModuleRunner.Infotype.uinfo, CalcMode.uinfo_salix_line, from, to, river);
+    public UinfoSalixRunner(final File testFolder, final double from, final double to, final River river, final String scenarioChoice)
+            throws ConnectionException, ServerException {
+        super(testFolder, AbstractModuleRunner.Infotype.uinfo, CalcMode.uinfo_salix_line, from, to, river);
         this.scenarioChoice = scenarioChoice;
         this.isUseScenario = (scenarioChoice != null) ? (this.isUseScenario = true) : (this.isUseScenario = false);
     }
diff -r 9f83ebf67c92 -r 531a60b7af95 gwt-client/src/test/java/test/uinfo/UinfoSalixSupraregionalRunner.java
--- a/gwt-client/src/test/java/test/uinfo/UinfoSalixSupraregionalRunner.java	Mon Nov 05 13:51:47 2018 +0100
+++ b/gwt-client/src/test/java/test/uinfo/UinfoSalixSupraregionalRunner.java	Mon Nov 05 17:15:30 2018 +0100
@@ -9,6 +9,7 @@
  */
 package test.uinfo;
 
+import java.io.File;
 import java.util.List;
 
 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
@@ -25,9 +26,9 @@
 
     private final List<SalixZone> supraregionalTable;
 
-    public UinfoSalixSupraregionalRunner(final double from, final double to, final River river, final String scenarioChoice,
+    public UinfoSalixSupraregionalRunner(final File testFolder, final double from, final double to, final River river, final String scenarioChoice,
             final List<SalixZone> supraRegionalTable) throws ConnectionException, ServerException {
-        super(from, to, river, scenarioChoice);
+        super(testFolder, from, to, river, scenarioChoice);
         this.supraregionalTable = supraRegionalTable;
     }
 


More information about the Dive4Elements-commits mailing list