Mercurial > dive4elements > river
changeset 9417:46e3e23cca0b
sinfo.collision jUnit-Test
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 17:32:05 +0200 |
parents | 05405292a7ca |
children | 9fe26f525ae3 |
files | gwt-client/src/test/java/test/BerechnungsartenTester.java gwt-client/src/test/java/test/RunnerCreatorHelper.java gwt-client/src/test/java/test/SinfoCollisionRunner.java gwt-client/src/test/resources/sinfo/collision/sinfo_collision_epoch_export.csv gwt-client/src/test/resources/sinfo/collision/sinfo_collision_export.csv |
diffstat | 5 files changed, 304 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/test/java/test/BerechnungsartenTester.java Thu Aug 16 16:28:03 2018 +0200 +++ b/gwt-client/src/test/java/test/BerechnungsartenTester.java Thu Aug 16 17:32:05 2018 +0200 @@ -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; /** @@ -13,7 +12,7 @@ // REMARK: ignored, because maven will auto-test all tests, but this one needs a running river-artifacts // For running the JUunit test, the annotation @Ignore has to be disabled -@Ignore + public class BerechnungsartenTester { public static enum CalcMode { @@ -38,8 +37,10 @@ TKH_1_ELBE_FILE("/sinfo/flowdepthtkh/sinfo_tkh_01.csv"), // TKH_2_RHEIN_FILE("/sinfo/flowdepthtkh/sinfo_tkh_02.csv"), - TKH_TKH_RHEIN_FILE("/sinfo/tkh/sinfo_tkh_export.csv"); + TKH_TKH_RHEIN_FILE("/sinfo/tkh/sinfo_tkh_export.csv"), // + COLLISION_RHEIN_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_export.csv"), // + COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE("/sinfo/collision/sinfo_collision_epoch_export.csv"); private final String filename; FilenameMapper(final String filename) { @@ -157,4 +158,16 @@ .runTest(overrideFileExport() != null ? overrideFileExport() : true); } + @Test + public void testCollision() throws ConnectionException, ServerException, IOException { + RunnerCreatorHelper.createSinfoCollisionYearsTest(FilenameMapper.COLLISION_RHEIN_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, new int[] { 2006, 2008 }) + .runTest(overrideFileExport() != null ? overrideFileExport() : true); + } + + @Test + public void testCollisionEpochs() throws ConnectionException, ServerException, IOException { + RunnerCreatorHelper.createSinfoCollisionEpochsTest(FilenameMapper.COLLISION_RHEIN_EPOCH_HELLO_WORLD_FILE, 336.2, 866.3, River.Rhein, "2006,2008;") + .runTest(overrideFileExport() != null ? overrideFileExport() : true); + } + } \ No newline at end of file
--- a/gwt-client/src/test/java/test/RunnerCreatorHelper.java Thu Aug 16 16:28:03 2018 +0200 +++ b/gwt-client/src/test/java/test/RunnerCreatorHelper.java Thu Aug 16 17:32:05 2018 +0200 @@ -76,4 +76,17 @@ return proof; } + public final static AbstractModuleRunner createSinfoCollisionYearsTest(final FilenameMapper file, final double from, final double to, final River river, + final int[] years) throws ConnectionException, ServerException { + final SinfoCollisionRunner proof = new SinfoCollisionRunner(user, pw, file, from, to, river, years, null); + + return proof; + } + + public final static AbstractModuleRunner createSinfoCollisionEpochsTest(final FilenameMapper file, final double from, final double to, final River river, + final String epochs) throws ConnectionException, ServerException { + final SinfoCollisionRunner proof = new SinfoCollisionRunner(user, pw, file, from, to, river, null, epochs); + + return proof; + } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/test/java/test/SinfoCollisionRunner.java Thu Aug 16 17:32:05 2018 +0200 @@ -0,0 +1,79 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package test; + +import java.io.IOException; + +import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; +import org.dive4elements.river.client.shared.exceptions.ServerException; +import org.dive4elements.river.client.shared.model.Data; +import org.dive4elements.river.client.shared.model.DataItem; +import org.dive4elements.river.client.shared.model.DefaultDataItem; +import org.dive4elements.river.client.shared.model.StringOptionsData; + +import test.BerechnungsartenTester.CalcMode; +import test.BerechnungsartenTester.FilenameMapper; +import test.BerechnungsartenTester.River; + +/** + * @author Domenico Nardi Tironi + * + */ +public class SinfoCollisionRunner extends AbstractModuleRunner { + + private final int[] years; + private final String epochs; + private boolean isYears; // cannot be final because of the ternary expression + + public SinfoCollisionRunner(final String username, final String password, final FilenameMapper file, final double from, final double to, final River river, + final int[] years, final String epochs) throws ConnectionException, ServerException { + super(username, password, AbstractModuleRunner.Infotype.sinfo, CalcMode.sinfo_calc_collision, file, from, to, river); + this.years = years; + this.epochs = epochs; + this.isYears = (years != null) ? (this.isYears = true) : (this.isYears = false); + } + + @Override + public void runTest(final boolean exportToFile) throws ServerException, IOException { + /* Select River */ + super.selectRiver(); + + /* Select CalcMode */ + super.selectCalcMode(); + + super.feed(new Data[] { + new StringOptionsData("ld_mode", "ld_mode", new DataItem[] { new DefaultDataItem("distance_only", "distance_only", "distance_only") }) }); // ggf + + /* Select Range */ + super.selectRange(); + + /* Year or Epoch? eigentlich vermutlich überflüssig */ + final String yeSelectStr = this.isYears ? "state.sinfo.year" : "state.sinfo.epoch"; + final Data yearEpochSelect = new StringOptionsData("ye_select", "ye_select", + new DataItem[] { new DefaultDataItem(yeSelectStr, yeSelectStr, yeSelectStr) }); + feedAndGo(new Data[] { yearEpochSelect }, 0); + + if (this.years != null) { + final StringBuilder sb = new StringBuilder(); + for (final int value : this.years) { + sb.append(String.valueOf(value)); + sb.append(" "); + } + final Data yearsData = new StringOptionsData("years", "years", new DataItem[] { new DefaultDataItem("years", "years", sb.toString()) }); + feedAndGo(new Data[] { yearsData }, 0); + } else if (this.epochs != null) { + final Data data = new StringOptionsData("epochs", "epochs", new DataItem[] { new DefaultDataItem("epochs", "epochs", this.epochs) }); + feedAndGo(new Data[] { data }, 0); + } + describeCollection(); + + super.export(exportToFile); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/test/resources/sinfo/collision/sinfo_collision_epoch_export.csv Thu Aug 16 17:32:05 2018 +0200 @@ -0,0 +1,109 @@ +"##Ergebnisausgabe - Rhein - Grundberührungen" +"# FLYS-Version: 3.3.0" +"# Bearbeiter: belger" +"# Datum der Erstellung: 16.08.18" +"# Gewässer: Rhein" +"# Höhensystem des Flusses: Wasssers[NN " +"# Bereich (km): 336,200 - 866,300" +"# Jahr/Zeitraum: 2006-2008" +"" +"Titel: Häufigkeiten";; +"Fluss-km";"Jahr/Zeitraum";"Anzahl der Grundberührungen" +"" +"373,000";"2006-2008";"1" +"374,000";"2006-2008";"1" +"375,000";"2006-2008";"1" +"377,000";"2006-2008";"1" +"380,000";"2006-2008";"1" +"428,000";"2006-2008";"1" +"432,000";"2006-2008";"1" +"444,000";"2006-2008";"1" +"474,000";"2006-2008";"1" +"494,000";"2006-2008";"6" +"517,000";"2006-2008";"1" +"518,000";"2006-2008";"1" +"519,000";"2006-2008";"3" +"521,000";"2006-2008";"1" +"525,000";"2006-2008";"1" +"537,000";"2006-2008";"1" +"538,000";"2006-2008";"1" +"540,000";"2006-2008";"1" +"542,000";"2006-2008";"1" +"543,000";"2006-2008";"3" +"550,000";"2006-2008";"1" +"553,000";"2006-2008";"1" +"557,000";"2006-2008";"1" +"588,000";"2006-2008";"1" +"609,000";"2006-2008";"1" +"640,000";"2006-2008";"2" +"660,000";"2006-2008";"1" +"661,000";"2006-2008";"1" +"668,000";"2006-2008";"1" +"669,000";"2006-2008";"1" +"682,000";"2006-2008";"2" +"687,000";"2006-2008";"1" +"692,000";"2006-2008";"1" +"699,000";"2006-2008";"1" +"706,000";"2006-2008";"1" +"745,000";"2006-2008";"1" +"747,000";"2006-2008";"1" +"748,000";"2006-2008";"1" +"749,000";"2006-2008";"1" +"750,000";"2006-2008";"1" +"856,000";"2006-2008";"1" +"" +"Titel: Abfluss/Abflusszustand";;;;; +"Fluss-km";"Datum";"Pegelstand [cm]";"Bezugspegel [cm]";"Abfluss [m³/s]";"Abflusszustand" +"" +"372,800";"04.05.2006";"567";"Maxau";"1.540";"MQ-HQ1" +"373,600";"14.11.2007";"435";"Maxau";"869";"GlQ-MQ" +"374,900";"18.02.2008";"384";"Maxau";"661";"≈GlQ" +"376,600";"14.11.2007";"444";"Maxau";"910";"GlQ-MQ" +"380,200";"21.01.2006";"378";"Maxau";"640";"≈GlQ" +"428,500";"15.02.2006";"107";"Mannheim";"836";"MNQ-MQ" +"431,700";"27.07.2006";"197";"Mannheim";"1.290";"MNQ-MQ" +"444,400";"13.05.2007";"156";"Worms";"1.080";"MNQ-MQ" +"474,200";"13.02.2006";"36";"Worms";"546";"<GlQ" +"494,000";"30.04.2007";"230";"Mainz";"1.480";"≈MQ" +"494,400";"31.01.2006";"164";"Mainz";"1.120";"MNQ-MQ" +"494,400";"17.11.2008";"216";"Mainz";"1.400";"≈MQ" +"494,500";"17.01.2006";"163";"Mainz";"1.110";"MNQ-MQ" +"494,500";"18.09.2006";"232";"Mainz";"1.490";"≈MQ" +"494,500";"17.11.2008";"213";"Mainz";"1.380";"≈MQ" +"517,500";"24.02.2006";"185";"Östrich";"856";"≈MNQ" +"518,000";"13.10.2008";"127";"Östrich";"562";"<GlQ" +"518,600";"01.03.2006";"128";"Östrich";"567";"<GlQ" +"518,600";"16.01.2007";"199";"Östrich";"932";"MNQ-MQ" +"519,000";"17.01.2007";"190";"Östrich";"883";"MNQ-MQ" +"520,700";"26.11.2008";"163";"Östrich";"741";"≈GlQ" +"525,200";"03.08.2008";"183";"Östrich";"845";"≈MNQ" +"537,100";"06.05.2006";"262";"Kaub";"1.920";"MQ-HQ1" +"538,500";"19.09.2006";"161";"Kaub";"1.250";"MNQ-MQ" +"539,600";"07.05.2007";"141";"Kaub";"1.130";"MNQ-MQ" +"541,600";"28.10.2006";"163";"Kaub";"1.260";"MNQ-MQ" +"542,800";"28.07.2008";"212";"Kaub";"1.580";"≈MQ" +"543,000";"25.09.2006";"222";"Kaub";"1.640";"≈MQ" +"543,200";"28.10.2006";"163";"Kaub";"1.260";"MNQ-MQ" +"549,700";"20.02.2008";"134";"Kaub";"1.090";"MNQ-MQ" +"553,300";"12.07.2008";"192";"Kaub";"1.450";"MNQ-MQ" +"557,200";"26.08.2007";"262";"Kaub";"1.920";"MQ-HQ1" +"588,000";"10.06.2008";"258";"Koblenz";"1.900";"≈MQ" +"608,700";"19.11.2008";"157";"Andernach";"1.200";"MNQ-MQ" +"640,400";"03.05.2006";"333";"Oberwinter";"2.150";"≈MQ" +"640,500";"29.11.2006";"185";"Oberwinter";"1.150";"MNQ-MQ" +"660,400";"05.06.2008";"271";"Oberwinter";"1.710";"MNQ-MQ" +"660,600";"09.11.2007";"90";"Oberwinter";"725";"<GlQ" +"667,700";"16.01.2008";"338";"Köln";"2.180";"≈MQ" +"669,000";"22.12.2007";"323";"Köln";"2.070";"≈MQ" +"682,000";"01.12.2006";"231";"Köln";"1.450";"MNQ-MQ" +"682,000";"08.11.2007";"151";"Köln";"1.000";"≈MNQ" +"687,400";"05.08.2006";"179";"Köln";"1.150";"MNQ-MQ" +"692,500";"08.02.2006";"137";"Köln";"932";"≈GlQ" +"698,600";"22.07.2008";"347";"Köln";"2.250";"≈MQ" +"706,500";"20.04.2008";"488";"Köln";"3.770";"MQ-HQ1" +"745,000";"08.10.2007";"206";"Düsseldorf";"1.570";"MNQ-MQ" +"747,500";"30.01.2006";"131";"Düsseldorf";"1.140";"MNQ-MQ" +"748,000";"04.08.2007";"281";"Düsseldorf";"2.080";"≈MQ" +"748,700";"15.08.2008";"214";"Düsseldorf";"1.620";"MNQ-MQ" +"750,400";"25.02.2008";"302";"Düsseldorf";"2.230";"≈MQ" +"856,300";"18.10.2007";"2";"Emmerich";"731";"<GlQ"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/test/resources/sinfo/collision/sinfo_collision_export.csv Thu Aug 16 17:32:05 2018 +0200 @@ -0,0 +1,87 @@ +"##Ergebnisausgabe - Rhein - Grundberührungen" +"# FLYS-Version: 3.3.0" +"# Bearbeiter: belger" +"# Datum der Erstellung: 16.08.18" +"# Gewässer: Rhein" +"# Höhensystem des Flusses: Wasssers[NN " +"# Bereich (km): 336,200 - 866,300" +"# Jahr/Zeitraum: 2006, 2008" +"" +"Titel: Häufigkeiten";; +"Fluss-km";"Jahr/Zeitraum";"Anzahl der Grundberührungen" +"" +"373,000";"2006";"1" +"380,000";"2006";"1" +"428,000";"2006";"1" +"432,000";"2006";"1" +"474,000";"2006";"1" +"494,000";"2006";"3" +"517,000";"2006";"1" +"519,000";"2006";"1" +"537,000";"2006";"1" +"538,000";"2006";"1" +"542,000";"2006";"1" +"543,000";"2006";"2" +"640,000";"2006";"2" +"682,000";"2006";"1" +"687,000";"2006";"1" +"692,000";"2006";"1" +"747,000";"2006";"1" +"375,000";"2008";"1" +"494,000";"2008";"2" +"518,000";"2008";"1" +"521,000";"2008";"1" +"525,000";"2008";"1" +"543,000";"2008";"1" +"550,000";"2008";"1" +"553,000";"2008";"1" +"588,000";"2008";"1" +"609,000";"2008";"1" +"660,000";"2008";"1" +"668,000";"2008";"1" +"699,000";"2008";"1" +"706,000";"2008";"1" +"749,000";"2008";"1" +"750,000";"2008";"1" +"" +"Titel: Abfluss/Abflusszustand";;;;; +"Fluss-km";"Datum";"Pegelstand [cm]";"Bezugspegel [cm]";"Abfluss [m³/s]";"Abflusszustand" +"" +"372,800";"04.05.2006";"567";"Maxau";"1.540";"MQ-HQ1" +"380,200";"21.01.2006";"378";"Maxau";"640";"≈GlQ" +"428,500";"15.02.2006";"107";"Mannheim";"836";"MNQ-MQ" +"431,700";"27.07.2006";"197";"Mannheim";"1.290";"MNQ-MQ" +"474,200";"13.02.2006";"36";"Worms";"546";"<GlQ" +"494,400";"31.01.2006";"164";"Mainz";"1.120";"MNQ-MQ" +"494,500";"17.01.2006";"163";"Mainz";"1.110";"MNQ-MQ" +"494,500";"18.09.2006";"232";"Mainz";"1.490";"≈MQ" +"517,500";"24.02.2006";"185";"Östrich";"856";"≈MNQ" +"518,600";"01.03.2006";"128";"Östrich";"567";"<GlQ" +"537,100";"06.05.2006";"262";"Kaub";"1.920";"MQ-HQ1" +"538,500";"19.09.2006";"161";"Kaub";"1.250";"MNQ-MQ" +"541,600";"28.10.2006";"163";"Kaub";"1.260";"MNQ-MQ" +"543,000";"25.09.2006";"222";"Kaub";"1.640";"≈MQ" +"543,200";"28.10.2006";"163";"Kaub";"1.260";"MNQ-MQ" +"640,400";"03.05.2006";"333";"Oberwinter";"2.150";"≈MQ" +"640,500";"29.11.2006";"185";"Oberwinter";"1.150";"MNQ-MQ" +"682,000";"01.12.2006";"231";"Köln";"1.450";"MNQ-MQ" +"687,400";"05.08.2006";"179";"Köln";"1.150";"MNQ-MQ" +"692,500";"08.02.2006";"137";"Köln";"932";"≈GlQ" +"747,500";"30.01.2006";"131";"Düsseldorf";"1.140";"MNQ-MQ" +"374,900";"18.02.2008";"384";"Maxau";"661";"≈GlQ" +"494,400";"17.11.2008";"216";"Mainz";"1.400";"≈MQ" +"494,500";"17.11.2008";"213";"Mainz";"1.380";"≈MQ" +"518,000";"13.10.2008";"127";"Östrich";"562";"<GlQ" +"520,700";"26.11.2008";"163";"Östrich";"741";"≈GlQ" +"525,200";"03.08.2008";"183";"Östrich";"845";"≈MNQ" +"542,800";"28.07.2008";"212";"Kaub";"1.580";"≈MQ" +"549,700";"20.02.2008";"134";"Kaub";"1.090";"MNQ-MQ" +"553,300";"12.07.2008";"192";"Kaub";"1.450";"MNQ-MQ" +"588,000";"10.06.2008";"258";"Koblenz";"1.900";"≈MQ" +"608,700";"19.11.2008";"157";"Andernach";"1.200";"MNQ-MQ" +"660,400";"05.06.2008";"271";"Oberwinter";"1.710";"MNQ-MQ" +"667,700";"16.01.2008";"338";"Köln";"2.180";"≈MQ" +"698,600";"22.07.2008";"347";"Köln";"2.250";"≈MQ" +"706,500";"20.04.2008";"488";"Köln";"3.770";"MQ-HQ1" +"748,700";"15.08.2008";"214";"Düsseldorf";"1.620";"MNQ-MQ" +"750,400";"25.02.2008";"302";"Düsseldorf";"2.230";"≈MQ" \ No newline at end of file