Package com.asakusafw.testtools

Examples of com.asakusafw.testtools.TestUtils


     */
    @Test
    public void createTempTableName02() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/exporter/ExportFileLoadTest/createTempTableName01");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // テスト対象クラス実行
        Connection conn = null;
        String result = null;
        try {
View Full Code Here


     */
    @Test
    public void createImportFileTest02() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/importer/ImportFileCreateTest/createImportFileTest02");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // ImportBeanを生成
        Map<String, ImportTargetTableBean> targetTable = new LinkedHashMap<String, ImportTargetTableBean>();
        ImportTargetTableBean tableBean = new ImportTargetTableBean();
        tableBean.setImportTargetColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
View Full Code Here

     */
    @Test
    public void createTempTableName03() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/exporter/ExportFileLoadTest/createTempTableName01");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // テスト対象クラス実行
        Connection conn = null;
        try {
            conn = DBConnection.getConnection();
View Full Code Here

     */
    @Test
    public void createImportFileTest03() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/importer/ImportFileCreateTest/createImportFileTest03");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

//        // テストデータの指定
//        String pattern = "patternC02";

        // ImportBeanを生成
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyDataTest03() throws Exception {
        // テストデータを指定
        TestUtils util = new TestUtils(new File("src/test/data/exporter/ExportDataCopyTest/copyDataTest03"));
        // テストデータをセット
        util.storeToDatabase(false);

        // プロパティを書き換え
        Properties prop = ConfigurationLoader.getProperty();
        prop.setProperty(Constants.PROP_KEY_EXP_COPY_MAX_RECORD, "1");
        ConfigurationLoader.setProperty(prop);

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
        table1.setExportTempTableName("TEMP_IMPORT_TARGET1");
        table1.setDuplicateFlagTableName("TEMP_IMPORT_TARGET1_DF");
        table1.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorTableName("IMPORT_TARGET1_ERROR");
        table1.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorCodeColumn("ERROR_CODE");
        table1.setErrorCode("ERR01");
        targetTable.put("IMPORT_TARGET1", table1);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportDataCopy copy = new ExportDataCopy();

        // テスト対象クラス実行
        boolean result = copy.copyData(bean);

        // 実行結果の検証
        assertTrue(result);
        assertTrue(copy.isUpdateEnd());

        // DBの結果を検証
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }
        // IMPORT_TARGET1_RLの内容を検証
        assertTrue(UnitTestUtil.countAssert("IMPORT_TARGET1_RL", 0));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyDataTest04() throws Exception {
        // テストデータを指定
        TestUtils util = new TestUtils(new File("src/test/data/exporter/ExportDataCopyTest/copyDataTest04"));
        // テストデータをセット
        util.storeToDatabase(false);

        // プロパティを書き換え
        Properties prop = ConfigurationLoader.getProperty();
        prop.setProperty(Constants.PROP_KEY_EXP_COPY_MAX_RECORD, "1");
        ConfigurationLoader.setProperty(prop);

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
        table1.setExportTempTableName("TEMP_IMPORT_TARGET1");
        table1.setDuplicateFlagTableName("TEMP_IMPORT_TARGET1_DF");
        table1.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorTableName("IMPORT_TARGET1_ERROR");
        table1.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorCodeColumn("ERROR_CODE");
        table1.setErrorCode("ERR01");
        targetTable.put("IMPORT_TARGET1", table1);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportDataCopy copy = new ExportDataCopy();

        // テスト対象クラス実行
        boolean result = copy.copyData(bean);

        // 実行結果の検証
        assertTrue(result);
        assertTrue(copy.isUpdateEnd());

        // DBの結果を検証
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }
        // IMPORT_TARGET1_RLの内容を検証
        assertTrue(UnitTestUtil.countAssert("IMPORT_TARGET1_RL", 0));
    }
View Full Code Here

     */
    @Test
    public void executeTest26() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/recoverer/executeTest26");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // 処理の実行
        String[] args = new String[]{targetName};
        Recoverer recoverer = new StubRecoverer();
        int result = recoverer.execute(args);

        // 実行結果の検証
        assertEquals(0, result);

        // DBの結果を検証
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyDataTest05() throws Exception {
        // テストデータを指定
        TestUtils util = new TestUtils(new File("src/test/data/exporter/ExportDataCopyTest/copyDataTest05"));
        // テストデータをセット
        util.storeToDatabase(false);

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
        table1.setExportTempTableName("TEMP_IMPORT_TARGET1");
        table1.setDuplicateFlagTableName("TEMP_IMPORT_TARGET1_DF");
        table1.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1"}));
        table1.setErrorTableName("IMPORT_TARGET1_ERROR");
        table1.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorCodeColumn("ERROR_CODE");
        table1.setErrorCode("ERR01");
        targetTable.put("IMPORT_TARGET1", table1);
        ExportTargetTableBean table2 = new ExportTargetTableBean();
        table2.setDuplicateCheck(true);
        table2.setExportTempTableName("TEMP_IMPORT_TARGET2");
        table2.setDuplicateFlagTableName("TEMP_IMPORT_TARGET2_DF");
        table2.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA2", "INTDATA2", "DATEDATA2"}));
        table2.setErrorTableName("IMPORT_TARGET2_ERROR");
        table2.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA2", "INTDATA2", "DATEDATA2"}));
        table2.setErrorCodeColumn("ERROR_CODE");
        table2.setErrorCode("ERR02");
        targetTable.put("IMPORT_TARGET3", table2);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportDataCopy copy = new ExportDataCopy();

        // テスト対象クラス実行
        boolean result = copy.copyData(bean);

        // 実行結果の検証
        assertFalse(result);

        // DBの結果を検証
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }
        assertTrue(UnitTestUtil.countAssert("IMPORT_TARGET1_RL", 1));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyDataTest06() throws Exception {
        // テストデータを指定
        TestUtils util = new TestUtils(new File("src/test/data/exporter/ExportDataCopyTest/copyDataTest06"));
        // テストデータをセット
        util.storeToDatabase(false);

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
        table1.setExportTempTableName("TEMP_IMPORT_TARGET1_1");
        table1.setDuplicateFlagTableName("TEMP_IMPORT_TARGET1_1_DF");
        table1.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1"}));
        table1.setErrorTableName("IMPORT_TARGET1_ERROR");
        table1.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setErrorCodeColumn("ERROR_CODE");
        table1.setErrorCode("ERR01");
        targetTable.put("IMPORT_TARGET1", table1);
        ExportTargetTableBean table2 = new ExportTargetTableBean();
        table2.setDuplicateCheck(true);
        table2.setExportTempTableName("TEMP_IMPORT_TARGET2_1");
        table2.setDuplicateFlagTableName("TEMP_IMPORT_TARGET2_1_DF");
        table2.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA2", "INTDATA2", "DATEDATA2"}));
        table2.setErrorTableName("IMPORT_TARGET2_ERROR");
        table2.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA2", "INTDATA2", "DATEDATA2"}));
        table2.setErrorCodeColumn("ERROR_CODE");
        table2.setErrorCode("ERR02");
        targetTable.put("IMPORT_TARGET2", table2);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportDataCopy copy = new ExportDataCopy();

        // テスト対象クラス実行
        boolean result = copy.copyData(bean);

        // 実行結果の検証
        assertTrue(result);
        assertTrue(copy.isUpdateEnd());

        // DBの結果を検証
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }
    }
View Full Code Here

        UnitTestUtil.executeUpdate(createSql1);
        UnitTestUtil.executeUpdate(dropSql2);
        UnitTestUtil.executeUpdate(createSql2);
        // テストデータを指定
        File testDataDir = new File("src/test/data/recoverer/executeTest27");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // 処理の実行
        String[] args = new String[]{targetName};
        Recoverer recoverer = new StubRecoverer();
        int result = recoverer.execute(args);

        // 実行結果の検証
        assertEquals(1, result);

        // DBの結果を検証
        util = new TestUtils(new File("src/test/data/recoverer/executeTest27_assert"));
        util.loadFromDatabase();
        if (!util.inspect()) {
            for (Cause cause : util.getCauses()) {
                System.out.println(cause.getMessage());
            }
            fail(util.getCauseMessage());
        }

        // テンポラリテーブルが存在しない事を確認
        assertFalse(UnitTestUtil.isExistTable(tempTable1));
        assertFalse(UnitTestUtil.isExistTable(tempTable2));
View Full Code Here

TOP

Related Classes of com.asakusafw.testtools.TestUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.