Mercurial > dive4elements > river
changeset 9133:af73fdd96920
Title current/historical diff pair; limit on entries in diff'pair twin_panel
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/LoadSingleYearSelectState.java Wed Jun 06 14:24:51 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/LoadSingleYearSelectState.java Thu Jun 07 11:41:10 2018 +0200 @@ -60,7 +60,7 @@ for (final Collision coll : collisions) { final Integer year = coll.getYear(); final Map<String, String> row = new HashMap<>(); - row.put("year", year.toString()); // Nullpointer? + row.put("year", year.toString()); // Nullpointer-Check? helper.addRow(row); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableState.java Wed Jun 06 14:24:51 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableState.java Thu Jun 07 11:41:10 2018 +0200 @@ -9,7 +9,13 @@ */ package org.dive4elements.river.artifacts.uinfo.vegetationzones; +import org.dive4elements.artifactdatabase.ProtocolUtils; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; +import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.states.DefaultState; +import org.w3c.dom.Element; /** * @author Domenico Nardi Tironi @@ -22,4 +28,24 @@ protected String getUIProvider() { return "uinfo.vegetationzones.table"; } + + // TODO GET REAL DATA + @Override + protected Element[] createItems(final ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { + final String datakey = "vegzones"; + if (name.equals(datakey)) { + final Element item = ProtocolUtils.createArtNode(cr, "item", null, null); + final Element label = ProtocolUtils.createArtNode(cr, "label", null, null); + final Element value = ProtocolUtils.createArtNode(cr, "value", null, null); + final D4EArtifact flys = (D4EArtifact) artifact; + final String s = flys.getDataAsString(datakey) == null ? VegetationZone.parseListToDataString(VegetationZone.getStandardList()) + : flys.getDataAsString(datakey); + + value.setTextContent(s); + item.appendChild(label); + item.appendChild(value); + return new Element[] { item }; + } + return new Element[] {}; + } } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Thu Jun 07 11:41:10 2018 +0200 @@ -1532,4 +1532,6 @@ String uinfo_vegetation_zones_invalid_integer(); String chart_settings_export_metadata(); + + String sinfo_flow_depth_development_twin_panel_max_count_msg(); } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Thu Jun 07 11:41:10 2018 +0200 @@ -769,6 +769,7 @@ sinfo_flow_depth_developments = Flie\u00dftiefenentwicklung sinfo_flow_depth_development = Flie\u00dftiefenentwicklung sinfo_flow_depth_development_peryear = Flie\u00dftiefenentwicklung pro Jahr +sinfo_flow_depth_development_twin_panel_max_count_msg = Es kann nur ein Differenzenpaar ausgew\u00e4hlt werden. sinfo_waterlevel_differences = Differenzen sinfo_waterlevel_difference = Differenzen sinfo_bedheight_differences = Sohlh\u00f6hendifferenzen
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Thu Jun 07 11:41:10 2018 +0200 @@ -769,6 +769,7 @@ sinfo_flow_depth_developments = Flie\u00dftiefenentwicklung sinfo_flow_depth_development = Flie\u00dftiefenentwicklung sinfo_flow_depth_development_peryear = Flie\u00dftiefenentwicklung pro Jahr +sinfo_flow_depth_development_twin_panel_max_count_msg = Es kann nur ein Differenzenpaar ausgew\u00e4hlt werden. sinfo_waterlevel_differences = Differenzen sinfo_waterlevel_difference = Differenzen sinfo_bedheight_differences = Sohlh\u00f6hendifferenzen
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacagePairWidget.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacagePairWidget.java Thu Jun 07 11:41:10 2018 +0200 @@ -8,8 +8,12 @@ package org.dive4elements.river.client.client.ui; +import org.dive4elements.river.client.client.FLYSConstants; +import org.dive4elements.river.client.shared.model.Artifact; +import org.dive4elements.river.client.shared.model.ToLoad; +import org.dive4elements.river.client.shared.model.User; + import com.google.gwt.core.client.GWT; - import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.events.ClickEvent; @@ -18,22 +22,13 @@ import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import org.dive4elements.river.client.client.FLYSConstants; -import org.dive4elements.river.client.shared.model.Artifact; -import org.dive4elements.river.client.shared.model.ToLoad; -import org.dive4elements.river.client.shared.model.User; - - /** * Widget showing two Datacages and a add-this-button. * Insert a record into a listgrid when add-this-button clicked. */ -public class DatacagePairWidget -extends VLayout -{ +public class DatacagePairWidget extends VLayout { /** i18n resource. */ - protected FLYSConstants MSG = - GWT.create(FLYSConstants.class); + protected FLYSConstants MSG = GWT.create(FLYSConstants.class); /** The "remote" ListGrid to insert data to when add-button is clicked. */ protected ListGrid grid; @@ -44,47 +39,46 @@ /** Second (lower) DataCage Grid. */ protected DatacageWidget secondDatacageWidget; + /** Max number of recommendation pairs to be added */ + private final int maxCount; + /** errorMsg maxCount */ + private final String msgMaxCount; /** * - * @param artifact Artifact to query datacage with. - * @param user User to query datacage with. - * @param leftOuts outs to query the left datacage with. - * @param rightOuts outs to query the right datacage with. - * @param grid Grid into which to insert selection of pairs. + * @param artifact + * Artifact to query datacage with. + * @param user + * User to query datacage with. + * @param leftOuts + * outs to query the left datacage with. + * @param rightOuts + * outs to query the right datacage with. + * @param grid + * Grid into which to insert selection of pairs. + * @param max */ - public DatacagePairWidget(Artifact artifact, - User user, - String leftOuts, - String rightOuts, - ListGrid grid) { + public DatacagePairWidget(final Artifact artifact, final User user, final String leftOuts, final String rightOuts, final ListGrid grid, final int maxCount, + final String msgMaxCount) { + this.msgMaxCount = msgMaxCount; + this.maxCount = maxCount; this.grid = grid; - HLayout hLayout = new HLayout(); - firstDatacageWidget = new DatacageWidget( - artifact, - user, - leftOuts, - "load-system:true", - false); - secondDatacageWidget = new DatacageWidget( - artifact, - user, - rightOuts, - "load-system:true", - false); - firstDatacageWidget.setIsMutliSelectable(false); - secondDatacageWidget.setIsMutliSelectable(false); + final HLayout hLayout = new HLayout(); + this.firstDatacageWidget = new DatacageWidget(artifact, user, leftOuts, "load-system:true", false); + this.secondDatacageWidget = new DatacageWidget(artifact, user, rightOuts, "load-system:true", false); + this.firstDatacageWidget.setIsMutliSelectable(false); + this.secondDatacageWidget.setIsMutliSelectable(false); - hLayout.addMember(firstDatacageWidget); - hLayout.addMember(secondDatacageWidget); + hLayout.addMember(this.firstDatacageWidget); + hLayout.addMember(this.secondDatacageWidget); // TODO: icon - Button plusBtn = new Button(MSG.datacage_add_pair()); + final Button plusBtn = new Button(this.MSG.datacage_add_pair()); plusBtn.setAutoFit(true); plusBtn.addClickHandler(new ClickHandler() { @Override - public void onClick(ClickEvent event) { + public void onClick(final ClickEvent event) { plusClicked(); } }); @@ -93,25 +87,24 @@ addMember(plusBtn); } - /** * Callback for add-button. * Fires to load for every selected element and handler. */ public void plusClicked() { - ToLoad toLoad1 = firstDatacageWidget.getSelection(); - ToLoad toLoad2 = secondDatacageWidget.getSelection(); + final ToLoad toLoad1 = this.firstDatacageWidget.getSelection(); + final ToLoad toLoad2 = this.secondDatacageWidget.getSelection(); - if (toLoad1 == null || toLoad2 == null || - toLoad1.toRecommendations().isEmpty() || - toLoad2.toRecommendations().isEmpty()) { - SC.say(MSG.warning_select_two_values()); + if (toLoad1 == null || toLoad2 == null || toLoad1.toRecommendations().isEmpty() || toLoad2.toRecommendations().isEmpty()) { + SC.say(this.MSG.warning_select_two_values()); + return; + } + if (this.grid.getTotalRows() >= this.maxCount) { + SC.say(this.msgMaxCount); return; } - grid.addData(new RecommendationPairRecord( - toLoad1.toRecommendations().get(0), - toLoad2.toRecommendations().get(0))); + this.grid.addData(new RecommendationPairRecord(toLoad1.toRecommendations().get(0), toLoad2.toRecommendations().get(0))); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageTwinPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -13,6 +13,7 @@ import com.google.gwt.core.client.GWT; import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; @@ -21,37 +22,47 @@ * A {@link AbstractPairRecommendationPanel} that uses a 'TwinDatacage' in the help-input area. * DatacagePairWidget which is put in the input-helper area. */ -public abstract class DatacageTwinPanel -extends AbstractPairRecommendationPanel { - - private IDatacageTwinPanelInfo leftInfo; - private IDatacageTwinPanelInfo rightInfo; +public abstract class DatacageTwinPanel extends AbstractPairRecommendationPanel { - public static interface IDatacageTwinPanelInfo extends IRecommendationInfo - { - String getOuts(); - } - - public DatacageTwinPanel(final User user, IValidator validator, final IDatacageTwinPanelInfo leftInfo, final IDatacageTwinPanelInfo rightInfo ) { - super(user, validator, leftInfo, rightInfo); + private final IDatacageTwinPanelInfo leftInfo; + private final IDatacageTwinPanelInfo rightInfo; - this.leftInfo = leftInfo; - this.rightInfo = rightInfo; - } - + private final int maxCount; + private final String msgMaxCount; + + public static interface IDatacageTwinPanelInfo extends IRecommendationInfo { + String getOuts(); + } + + public DatacageTwinPanel(final User user, final IValidator validator, final IDatacageTwinPanelInfo leftInfo, final IDatacageTwinPanelInfo rightInfo, + final int maxCount, final String msgMaxCount) { + super(user, validator, leftInfo, rightInfo); + + this.maxCount = maxCount; + this.msgMaxCount = msgMaxCount; + this.leftInfo = leftInfo; + this.rightInfo = rightInfo; + } + @Override protected final Canvas createChooserWidgets(final Canvas widget, final DataList dataList, final User user, final ListGrid differencesList) { GWT.log("createData()"); - Canvas submit = getNextButton(); + final Canvas submit = getNextButton(); - VLayout layout = new VLayout(); - HLayout helperLayout = new HLayout(); - - final String leftOuts = leftInfo.getOuts(); - final String rightOuts = rightInfo.getOuts(); - - helperLayout.addMember(new DatacagePairWidget(this.artifact, user, leftOuts, rightOuts, differencesList)); + final VLayout layout = new VLayout(); + final HLayout helperLayout = new HLayout(); + + final String leftOuts = this.leftInfo.getOuts(); + final String rightOuts = this.rightInfo.getOuts(); + + helperLayout.addMember(new DatacagePairWidget(this.artifact, user, leftOuts, rightOuts, differencesList, this.maxCount, this.msgMaxCount)); + + if (dataList != null && dataList.get(0) != null && dataList.get(0).getDescription() != null) { + final Label title = new Label(dataList.get(0).getDescription()); + title.setHeight("25px"); + layout.addMember(title); + } layout.addMember(widget); layout.addMember(submit); @@ -60,4 +71,5 @@ return layout; } + } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Thu Jun 07 11:41:10 2018 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.client.client.ui; +import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.client.ui.fixation.FixEventSelect; import org.dive4elements.river.client.client.ui.fixation.FixFunctionSelect; import org.dive4elements.river.client.client.ui.fixation.FixGaugeSelectPanel; @@ -34,6 +35,8 @@ import org.dive4elements.river.client.client.ui.uinfo.VegetationzonesTablePanel; import org.dive4elements.river.client.shared.model.User; +import com.google.gwt.core.client.GWT; + /** * Depending on the provider the state declared, return a UIProvider. * @@ -41,6 +44,7 @@ * artifacts state. */ public class UIProviderFactory { + private static FLYSConstants MSG; private UIProviderFactory() { } @@ -175,7 +179,7 @@ } if ("sinfo_flowdepth_twin_panel".equals(uiProvider)) - return new FlowDepthTwinPanel(user); + return new FlowDepthTwinPanel(user, 1, getMSG().sinfo_flow_depth_development_twin_panel_max_count_msg()); if ("sinfo_flowdepthminmax_twin_panel".equals(uiProvider)) return new FlowDepthMinMaxTwinPanel(user); @@ -183,5 +187,13 @@ // GWT.log("Picked default provider."); return new SelectProvider(); } + + private static FLYSConstants getMSG() { + if (MSG == null) { + MSG = GWT.create(FLYSConstants.class); + } + return MSG; + } + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelTwinPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WaterlevelTwinPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -1,6 +1,6 @@ /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH + * 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) @@ -13,13 +13,13 @@ /** * A DatacageTwinPanel implementation for W-INFO Differences: choose two waterlevels - * + * * @author Gernot Belger */ -public class WaterlevelTwinPanel -extends DatacageTwinPanel { +public class WaterlevelTwinPanel extends DatacageTwinPanel { - public WaterlevelTwinPanel(final User user) { - super(user, new WaterlevelTwinPanelValidator(), new WaterlevelRecommendationInfo("winfo_diff_twin_panel"), new WaterlevelRecommendationInfo("winfo_diff_twin_panel") ); - } + public WaterlevelTwinPanel(final User user) { + super(user, new WaterlevelTwinPanelValidator(), new WaterlevelRecommendationInfo("winfo_diff_twin_panel"), + new WaterlevelRecommendationInfo("winfo_diff_twin_panel"), 9999, ""); + } } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthMinMaxTwinPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthMinMaxTwinPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -20,6 +20,6 @@ public final class FlowDepthMinMaxTwinPanel extends DatacageTwinPanel { public FlowDepthMinMaxTwinPanel(final User user) { super(user, new FlowDepthTwinPanelValidator(), new NilDatacageTwinPanelInfo("sinfo_flowdepth_waterlevels"), - new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepthminmax_heights")); + new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepthminmax_heights"), 9999, ""); } } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthTwinPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/FlowDepthTwinPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -18,8 +18,8 @@ * @author Gernot Belger */ public final class FlowDepthTwinPanel extends DatacageTwinPanel { - public FlowDepthTwinPanel(final User user) { + public FlowDepthTwinPanel(final User user, final int maxCount, final String msgMaxCount) { super(user, new FlowDepthTwinPanelValidator(), new NilDatacageTwinPanelInfo("sinfo_flowdepth_waterlevels"), - new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepth_minfo_heights")); + new DefaultDatacageTwinPanelInfo("bedheight", "sinfo_flowdepth_minfo_heights"), maxCount, msgMaxCount); } } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -52,10 +52,10 @@ protected final ListGrid createTable(final Layout root, final DataList data, final String width, final boolean editable) { final Label title = new Label(data.get(0).getDescription()); - title.setHeight("35px"); // orig:25 + title.setHeight("35px"); - this.elements.setWidth(width); // 185 - this.elements.setHeight(300); // + this.elements.setWidth(width); + this.elements.setHeight(300); this.elements.setShowHeaderContextMenu(false); this.elements.setCanReorderFields(false); this.elements.setCanSort(true); @@ -71,7 +71,6 @@ vegzoneField.setCanDragResize(true); final ListGridField fromField = createIntTableField("from", this.MSG.uinfo_vegetation_zones_from(), true); - final ListGridField toField = createIntTableField("to", this.MSG.uinfo_vegetation_zones_to(), false);// nicht sortierbar nach "ÜFDauer bis" if (editable) { @@ -104,7 +103,6 @@ @Override public Object normalize(final ListGridRecord record, final String fieldName) { final String number = record.getAttribute(fieldName); - // String.format("%03d", number); funktioniert hier leider nicht final String numberFormat = "000" + number; return numberFormat.substring(numberFormat.length() - 3); } @@ -178,6 +176,7 @@ public final Canvas create(final DataList data) { final VLayout layout = new VLayout(); + // TODO: Helper zur Vegetationszonen-Auswahl // final Canvas helper = createHelper(); // this.helperContainer.addMember(helper); @@ -222,22 +221,13 @@ return layout; } - // protected static final Data[] getDataToAdd(final List<VegetationZone> list) { - // final List<Data> data = new ArrayList<Data>(); - // final String d = VegetationZone.parseListToDataString(list); - // - // final DataItem item = new DefaultDataItem(datakey, "entryDescription", d); - // data.add(new DefaultData(datakey, null, null, new DataItem[] { item })); - // return data.toArray(new Data[data.size()]); - // } - @Override protected final Data[] getData() { final List<Data> data = new ArrayList<Data>(); final ListGridRecord[] lgr = this.elements.getRecords(); if (lgr.length == 0) { - return null; // getDataToAdd(VegetationZone.getStandardList());// new Data[0]; //SHOULD NOT HAPPEN + return new Data[0]; // TODO: Klären, ob Vegetationszonen-Auswahl Pflicht ist, ob es ein Fallback geben soll usw. } final List<VegetationZone> zoneList = new ArrayList<VegetationZone>(); for (final ListGridRecord element : lgr) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -43,8 +43,10 @@ title.setHeight("25px"); final DynamicForm form = new DynamicForm(); + form.setNumCols(4); - final TextItem inputItem = createInputItem(""); + final TextItem inputItem = createInputItem("waterlevelDifference_Name_to_prevent_errorMsg"); + inputItem.setShowTitle(false); final StaticTextItem textItem = new StaticTextItem("IRRELEVANT_NAME"); textItem.setValue("cm");
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java Thu Jun 07 11:41:10 2018 +0200 @@ -43,7 +43,8 @@ final DynamicForm form = new DynamicForm(); form.setNumCols(4); - final TextItem inputItem = createInputItem(""); + final TextItem inputItem = createInputItem("YEAR_INPUT"); + inputItem.setShowTitle(false); form.setFields(inputItem); layout.addMember(title);
--- a/gwt-client/src/test/java/test/BerechnungsartenTester.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/test/java/test/BerechnungsartenTester.java Thu Jun 07 11:41:10 2018 +0200 @@ -12,7 +12,6 @@ import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; import org.dive4elements.river.client.shared.exceptions.ServerException; -import org.junit.Ignore; import org.junit.Test; /** @@ -21,7 +20,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 +// @Ignore public class BerechnungsartenTester { public static enum CalcMode { @@ -35,9 +34,10 @@ public static enum FilenameMapper { HELLO_WORLD_FILE("/sinfo/flowdepthminmax/sinfo_flowdepthminmax_export.csv"), // + + // Schäfer-Tests: RHEIN_1_FILE("/sinfo/flowdepth/sinfo_ft_01.csv"), // - RHEIN_2_FILE("/sinfo/flowdepth/sinfo_ft_02.csv"), // - RHEIN_3_FILE("/sinfo/flowdepth/sinfo_ft_03.csv"); + RHEIN_3_FILE("/sinfo/flowdepth/sinfo_ft_03.csv"); // private final String filename; @@ -74,17 +74,6 @@ } @Test - public void testRhein2() throws ConnectionException, ServerException, IOException { - // 2004 :: DGM-2004_Epoche FEHLT - RunnerCreatorHelper.createSinfoFlowdepthTest(FilenameMapper.RHEIN_2_FILE, 350, 380, River.Rhein, false, - new SimpleRecommendation("staticwqkms", "additionals-wstv-0-415", "longitudinal_section"), - new SimpleRecommendation("bedheight", "bedheight-soundings-79-2004-DGM-2004_Epoche", // FEHLT: 2004 :: DGM-2004_Epoche - - "longitudinal_section")) - .runTest(overrideFileExport() != null ? overrideFileExport() : true); - } - - @Test public void testRhein3() throws ConnectionException, ServerException, IOException { RunnerCreatorHelper .createSinfoFlowdepthTest(FilenameMapper.RHEIN_3_FILE, 655, 675, River.Rhein, true,
--- a/gwt-client/src/test/java/test/ModuleRunner.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/test/java/test/ModuleRunner.java Thu Jun 07 11:41:10 2018 +0200 @@ -93,7 +93,7 @@ private final double to; private final River river; - private final List<String> pairIds = new ArrayList<String>(); + private final List<String> pairIds = new ArrayList<String>(); // TODO in Subklassen public ModuleRunner(final String username, final String password, final Infotype infotype, final CalcMode sinfoCalcFlowDepth, final FilenameMapper helloWorldFile, final double from, final double to, final River beispielfluss) throws ConnectionException, ServerException { @@ -294,8 +294,8 @@ if (exportToFile) { doGetWriteToDisk(mode); // TODO: WENN der Test negativ ausfällt, Datei abspeichern -> Diskussion } - Assert.assertEquals(actual, expected); + Assert.assertEquals(expected, actual); } private final String deleteErstelldatum(final String input) {
--- a/gwt-client/src/test/java/test/RunnerCreatorHelper.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/test/java/test/RunnerCreatorHelper.java Thu Jun 07 11:41:10 2018 +0200 @@ -20,13 +20,14 @@ * @author Domenico Nardi Tironi * */ -public class RunnerCreatorHelper { +public final class RunnerCreatorHelper { private final static String user = "belger"; + private final static String pw = "belger"; - public RunnerCreatorHelper() { - + private RunnerCreatorHelper() { + throw new UnsupportedOperationException(); } // HELPER-Methods: @@ -43,10 +44,9 @@ public final static ModuleRunner createSinfoFlowdepthTest(final FilenameMapper file, final double from, final double to, final River river, final boolean useTkh, final SimpleRecommendation rec0, final SimpleRecommendation rec1) throws ConnectionException, ServerException { - final ModuleRunner proof = new SinfoFlowdepthTest(user, pw, CalcMode.sinfo_calc_flow_depth, file, from, to, river, useTkh); + final ModuleRunner proof = new SinfoFlowdepthRunner(user, pw, CalcMode.sinfo_calc_flow_depth, file, from, to, river, useTkh); proof.addRecommendationPair(rec0, rec1); return proof; } - -} +} \ No newline at end of file
--- a/gwt-client/src/test/java/test/SinfoFlowdepthMinMaxRunner.java Wed Jun 06 14:24:51 2018 +0200 +++ b/gwt-client/src/test/java/test/SinfoFlowdepthMinMaxRunner.java Thu Jun 07 11:41:10 2018 +0200 @@ -27,7 +27,6 @@ public SinfoFlowdepthMinMaxRunner(final String username, final String password, final CalcMode sinfoCalcFlowDepthMinmax, final FilenameMapper helloWorldFile, final double from, final double to, final River beispielfluss) throws ConnectionException, ServerException { super(username, password, ModuleRunner.Infotype.sinfo, sinfoCalcFlowDepthMinmax, helloWorldFile, from, to, beispielfluss); - } @Override
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/test/java/test/SinfoFlowdepthRunner.java Thu Jun 07 11:41:10 2018 +0200 @@ -0,0 +1,62 @@ +/** 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 SinfoFlowdepthRunner extends ModuleRunner { + + private final boolean useTkh; + + public SinfoFlowdepthRunner(final String username, final String password, final CalcMode sinfoCalcFlowDepth, final FilenameMapper file, final double from, + final double to, final River river, final boolean useTkh) throws ConnectionException, ServerException { + super(username, password, ModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, file, from, to, river); + this.useTkh = useTkh; + } + + @Override + public void runTest(final boolean exportToFile) throws ServerException, IOException { + /* Select River */ + super.selectRiver(); + + /* Select CalcMode */ + super.selectCalcMode(); + + /* Select Range */ + super.selectRange(); + + /* Select Fixpunkte */ + feedAndGo(super.getPairData(), 0); + + /* Select TRANSPORTKÖRPERHÖHHEN - einziger Unterschied zu FlowdepthMinMax */ + final String useTkhStr = String.valueOf(this.useTkh); + feedAndGo(new Data[] { new StringOptionsData("use_transport_bodies", "use_transport_bodies", + new DataItem[] { new DefaultDataItem(useTkhStr, useTkhStr, useTkhStr) }) }, 0); + + describeCollection(); + + super.export(exportToFile); + } +}
--- a/gwt-client/src/test/java/test/SinfoFlowdepthTest.java Wed Jun 06 14:24:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/** 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 SinfoFlowdepthTest extends ModuleRunner { - - private final boolean useTkh; - - public SinfoFlowdepthTest(final String username, final String password, final CalcMode sinfoCalcFlowDepth, final FilenameMapper file, final double from, - final double to, final River river, final boolean useTkh) throws ConnectionException, ServerException { - super(username, password, ModuleRunner.Infotype.sinfo, sinfoCalcFlowDepth, file, from, to, river); - this.useTkh = useTkh; - } - - @Override - public void runTest(final boolean exportToFile) throws ServerException, IOException { - /* Select River */ - super.selectRiver(); - - /* Select CalcMode */ - super.selectCalcMode(); - - /* Select Range */ - super.selectRange(); - - /* Select Fixpunkte */ - feedAndGo(super.getPairData(), 0); - - /* Select TRANSPORTKÖRPERHÖHHEN - einziger Unterschied zu FlowdepthMinMax */ - final String useTkhStr = String.valueOf(this.useTkh); - feedAndGo(new Data[] { new StringOptionsData("use_transport_bodies", "use_transport_bodies", - new DataItem[] { new DefaultDataItem(useTkhStr, useTkhStr, useTkhStr) }) }, 0); - - describeCollection(); // wichtig, damit die Facets erzeugt werden - - super.export(exportToFile); - } -}