view gwt-client/src/test/java/test/bundu/BunduBerechnungsartenTester.java @ 9442:173f188569c6

little improvements
author gernotbelger
date Mon, 20 Aug 2018 18:20:15 +0200
parents ce0a48b93f4b
children 86e522bc7f36
line wrap: on
line source
package test.bundu;

import java.io.IOException;
import java.util.ArrayList;
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.ICalcMode;
import test.IFilenameMapper;

@Ignore
public class BunduBerechnungsartenTester extends AbstractBerechnungsartenTester {

    public static enum CalcMode implements ICalcMode {
        bundu_bezugswst, //
        // der Vollständigkeit halber
        bundu_analysis, bundu_vollmer
    };

    public static enum FilenameMapper implements IFilenameMapper {
        BEZUGSWST_FILE("/bundu/bezugswst/bezugswst.csv"); //
        private final String filename;

        FilenameMapper(final String filename) {
            this.filename = filename;
        }

        @Override
        public String getFilename() {
            return this.filename;
        }
    }

    // public static final LinkedHashMap<String, String> getMapValues(final FLYSConstants MSG) {
    // final LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
    // mapValues.put("0", MSG.gauge_mnq());
    // mapValues.put("1", MSG.gauge_mq());
    // mapValues.put("2", MSG.gauge_mhq());
    // mapValues.put("3", MSG.gauge_hq5());
    // return mapValues;
    // }

    @Test
    public void testBezugswstAuto() throws ServerException, IOException {
        /* WQ-Input */
        final List<Segment> segments = new ArrayList<Segment>();
        // gauge, fromKm, toKm, Q-Input
        segments.add(new Segment("Köln", 670., 703.3, 1090.));
        segments.add(new Segment("Düsseldorf", 703.3, 710., 1060.));

        /* Abflussklassen */
        // MSG won't work here!
        // final LinkedHashMap<String, String> map = FixGaugeSelectPanel.getMapValues(MSG);
        // final String mnq = MSG.gauge_mnq();
        // final String hq5 = MSG.gauge_hq5();

        final String abflussklasseFrom = "0"; // map.get(mnq);
        final String abflussklasseTo = "3";// map.get(hq5);

        /* Function */
        // from FixFunctionSelect:
        // funcDesc.put("log", "W(Q) = m*ln(Q + b)");
        // funcDesc.put("linear", "W(Q) = m * Q + b");
        // funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)");
        // funcDesc.put("exp", "W(Q) = m * a^Q + b");
        // funcDesc.put("quad", "W(Q) = n*Q^2+m*Q+b");
        // funcDesc.put("pow", "W(Q) = a * Q^c + d");
        // funcDesc.put("sq-pow", "S(Q) = a * Q^b");

        final String function = "log";

        /* calc-choice (has to be set due to state-transition-conditions) */
        // state.bundu.wst.calc.manual
        // state.bundu.wst.calc.auto
        final String calcChoice = "state.bundu.wst.calc.auto";

        /* fixation-choice (has to be set due to state-transition-conditions) */
        // "state.bundu.wst.fix.auto"
        // state.bundu.wst.fix.manual;
        final String fixChoice = "state.bundu.wst.fix.auto";

        /* Soundings */
        // --> Debug at ParameterMatrixPanel.getData
        final String sounding = "single-95"; // Todo: make multiple if needed

        /* events - have to be set also when auto is selected */
        // --> get ids by debugging FixCalculation line 73 (constructor)
        final int[] events = new int[] { 1465, 1466, 1452, 1453, 1472, 1473, 1478, 1479, 1604, 1605, 1317, 1318, 1353, 1354, 1596, 1597, 1323, 1324, 1345, 1346,
                1330, 1331, 1458, 1459 };

        new BunduBezugswstRunner(FilenameMapper.BEZUGSWST_FILE, 670., 710., 100, River.Rhein, 2015, fixChoice, function, abflussklasseFrom, abflussklasseTo,
                events, 10, segments, calcChoice, false, sounding).runTest(overrideFileExport() != null ? overrideFileExport() : true);
    }
}

http://dive4elements.wald.intevation.org