view gwt-client/src/test/java/test/SinfoFloodDurationRunner.java @ 9418:9fe26f525ae3

sinfo floodduration jUnit test
author gernotbelger
date Thu, 16 Aug 2018 18:15:54 +0200
parents
children
line wrap: on
line source
/** 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;
import test.SinfoFloodDurationRiversideChoice.RiversideChoiceKey;

/**
 * @author Domenico Nardi Tironi
 *
 */
public class SinfoFloodDurationRunner extends AbstractModuleRunner {

    private final double[] wasserspiegellage;
    private final boolean showWspl;
    private final RiversideChoiceKey riverside;

    public SinfoFloodDurationRunner(final String username, final String password, final CalcMode calcmode, final FilenameMapper file, final double from,
            final double to, final River river, final double[] wasserspiegellage, final RiversideChoiceKey riverside, final boolean showWspl)
            throws ConnectionException, ServerException {
        super(username, password, AbstractModuleRunner.Infotype.sinfo, calcmode, file, from, to, river);
        this.wasserspiegellage = wasserspiegellage;
        this.showWspl = showWspl;
        this.riverside = riverside;
    }

    @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") }) }); //

        /* Select Range */
        super.selectRange();

        final Data riversideData = new StringOptionsData("riverside", "riverside",
                new DataItem[] { new DefaultDataItem("riverside", "riverside", this.riverside.toString()) });
        feedAndGo(new Data[] { riversideData }, 0);

        final Data showWsplData = new StringOptionsData("wspl", "wspl", new DataItem[] { new DefaultDataItem("wspl", "wspl", String.valueOf(this.showWspl)) });
        feedAndGo(new Data[] { showWsplData }, 0);

        final WQInputHelper helper = new WQInputHelper(this.wasserspiegellage);
        super.feedAndGo(helper.getDataforFeed(), //
                0);// reachable state index

        describeCollection();

        super.export(exportToFile);
    }
}

http://dive4elements.wald.intevation.org