view gwt-client/src/test/java/test/BerechnungsartenTester.java @ 9127:dbb26bc81843

Testing
author gernotbelger
date Wed, 06 Jun 2018 13:05:57 +0200
parents gwt-client/src/test/java/test/TestMain.java@95643dffd006
children af73fdd96920
line wrap: on
line source
package test;

/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

import java.io.IOException;

import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException;
import org.dive4elements.river.client.shared.exceptions.ServerException;
import org.junit.Ignore;
import org.junit.Test;

/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */

// 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 {
        sinfo_calc_flow_depth, sinfo_calc_flow_depth_development, sinfo_calc_flow_depth_minmax, sinfo_calc_collision, Transportkörperhöhen, sinfo_calc_flood_duration
    };

    public static enum River {
        Beispielfluss, Rhein
    };

    public static enum FilenameMapper {

        HELLO_WORLD_FILE("/sinfo/flowdepthminmax/sinfo_flowdepthminmax_export.csv"), //
        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");

        private final String filename;

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

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

    private final Boolean overrideFileExport() {
        return null;
    }

    @Test
    public void testHelloWorld() throws ServerException, IOException {

        /* Hello World Test */
        RunnerCreatorHelper.createSinfoFlowdepthMinMaxTest(FilenameMapper.HELLO_WORLD_FILE, 10, 100, River.Beispielfluss)
                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
    }

    @Test
    public void testRhein1() throws ConnectionException, ServerException, IOException {

        RunnerCreatorHelper
                .createSinfoFlowdepthTest(FilenameMapper.RHEIN_1_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_NHN", "longitudinal_section"))
                .runTest(overrideFileExport() != null ? overrideFileExport() : true);

    }

    @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,
                        new SimpleRecommendation("staticwqkms", "fixations-wstv-0-323", "longitudinal_section"),
                        new SimpleRecommendation("bedheight", "bedheight-soundings-92-2004-NIEDERRHEIN_QP-2004_Epoche_NHN", "longitudinal_section"))
                .runTest(overrideFileExport() != null ? overrideFileExport() : true);
    }

}

http://dive4elements.wald.intevation.org