view gwt-client/src/test/java/test/SinfoTkhRunner.java @ 9320:61e6d158a20f

Zusammenführen
author gernotbelger
date Fri, 27 Jul 2018 10:19:38 +0200
parents 83aee0942eae
children 9fe26f525ae3
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.DefaultData;
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 SinfoTkhRunner extends AbstractModuleRunner {

    private final double[] wasserspiegellage;

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

    @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") }) }); // leider
                                                                                                                                                           // wichtig
                                                                                                                                                           // :-(

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

        // from Panel: new DefaultDataItem("wq_single", "wq_single", sb.toString());
        final StringBuilder sb = new StringBuilder();
        for (final double value : this.wasserspiegellage) {
            sb.append(Double.toString(value));
            sb.append(" ");
        }

        final DataItem wsplItem = new DefaultDataItem("wq_single", "wq_single", sb.toString());

        super.feedAndGo(new Data[] {

                new DefaultData("wq_isq", null, null, new DataItem[] { new DefaultDataItem("wq_isq", "wq_isq", "true") }),
                new DefaultData("wq_isfree", null, null, new DataItem[] { new DefaultDataItem("wq_isfree", "wq_isfree", "false") }),
                new DefaultData("wq_isrange", null, null, new DataItem[] { new DefaultDataItem("wq_isrange", "wq_isrange", "false") }),
                new DefaultData("wq_from", null, null, new DataItem[] { new DefaultDataItem("wq_from", "wq_from", "") }),
                new DefaultData("wq_to", null, null, new DataItem[] { new DefaultDataItem("wq_to", "wq_to", "") }),
                new DefaultData("wq_step", null, null, new DataItem[] { new DefaultDataItem("wq_step", "wq_step", "") }),

                new DefaultData("wq_single", null, null, new DataItem[] { wsplItem }) }, //
                0);// reachable state index

        describeCollection();

        super.export(exportToFile);
    }
}

http://dive4elements.wald.intevation.org