Package com.asakusafw.testtools

Examples of com.asakusafw.testtools.TestUtils


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

        // 処理の実行
        String[] args = new String[]{targetName};
        Recoverer recoverer = new StubRecoverer(){
            /* (非 Javadoc)
View Full Code Here


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

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

        // ImportBeanを生成
        Map<String, ImportTargetTableBean> targetTable = new LinkedHashMap<String, ImportTargetTableBean>();
        ImportTargetTableBean tableBean = new ImportTargetTableBean();
        tableBean.setImportTargetColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        tableBean.setSearchCondition(null);
        tableBean.setUseCache(false);
        tableBean.setLockType(ImportTableLockType.TABLE);
        tableBean.setLockedOperation(ImportTableLockedOperation.ERROR);
        tableBean.setImportTargetType(null);
        tableBean.setDfsFilePath(null);
        targetTable.put("IMPORT_TARGET1", tableBean);
        ImportBean bean = createBean(new String[]{jobflowId, executionId, "20101021221015", "3", "5"}, targetTable);

        // テスト対象クラス実行
        TargetDataLock lock = new TargetDataLock();
        boolean result = lock.lock(bean);

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

        // 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/executeTest10");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

        // 処理の実行
        String[] args = new String[]{targetName};
        Recoverer recoverer = new StubRecoverer(){
View Full Code Here

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

        // 処理の実行
        String[] args = new String[]{targetName, executionId};
        Recoverer recoverer = new Recoverer(){
            /**
             * @see com.asakusafw.bulkloader.recoverer.Recoverer#createJobFlowParamLoader()
             */
            @Override
            protected JobFlowParamLoader createJobFlowParamLoader() {
                JobFlowParamLoader loder = new JobFlowParamLoader(){
                    @Override
                    protected Properties getImportProp(File dslFile, String targetName) throws IOException {
                        Properties prop = new Properties();
                        prop.setProperty("import.target-table", "IMPORT_TARGET1,IMPORT_TARGET2");
                        return prop;
                    }
                    @Override
                    protected Properties getExportProp(File dslFile, String targetName) throws IOException {
                        Properties prop = new Properties();
                        prop.setProperty("export.target-table", "IMPORT_TARGET1,IMPORT_TARGET2");
                        prop.setProperty("IMPORT_TARGET1.export-table-column", "TEXTDATA1,INTDATA1,DATEDATA1");
                        prop.setProperty("IMPORT_TARGET2.export-table-column", "SID,VERSION_NO,TEXTDATA2,INTDATA2,DATEDATA2,RGST_DATE,UPDT_DATE");
                        prop.setProperty("IMPORT_TARGET1.tsv-column", "SID,VERSION_NO,TEXTDATA1,INTDATA1,DATEDATA1,RGST_DATE,UPDT_DATE");
                        prop.setProperty("IMPORT_TARGET2.tsv-column", "SID,VERSION_NO,TEXTDATA2,INTDATA2,DATEDATA2,RGST_DATE,UPDT_DATE");
                        prop.setProperty("IMPORT_TARGET1.error-table", "IMPORT_TARGET1_ERROR");
                        prop.setProperty("IMPORT_TARGET2.error-table", "IMPORT_TARGET2_ERROR");
                        prop.setProperty("IMPORT_TARGET1.error-table-column", "SID,VERSION_NO,TEXTDATA1,INTDATA1,DATEDATA1,RGST_DATE,UPDT_DATE");
                        prop.setProperty("IMPORT_TARGET2.error-table-column", "TEXTDATA2,INTDATA2,DATEDATA2");
                        prop.setProperty("IMPORT_TARGET1.error-column", "ERROR_CODE");
                        prop.setProperty("IMPORT_TARGET2.error-column", "ERROR_CODE");
                        prop.setProperty("IMPORT_TARGET1.error-code", "ERR99");
                        prop.setProperty("IMPORT_TARGET2.error-code", "99");

                        return prop;
                    }
                };
                return loder;
            }
        };
        int result = recoverer.execute(args);

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

        // DBの結果を検証
        util = new TestUtils(new File("src/test/data/recoverer/executeTest10_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

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

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

        // ImportBeanを生成
        Map<String, ImportTargetTableBean> targetTable = new LinkedHashMap<String, ImportTargetTableBean>();
        ImportTargetTableBean tableBean = new ImportTargetTableBean();
        tableBean.setImportTargetColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        tableBean.setSearchCondition(null);
        tableBean.setUseCache(false);
        tableBean.setLockType(ImportTableLockType.NONE);
        tableBean.setLockedOperation(ImportTableLockedOperation.FORCE);
        tableBean.setImportTargetType(null);
        tableBean.setDfsFilePath(null);
        targetTable.put("IMPORT_TARGET1", tableBean);
        ImportBean bean = createBean(new String[]{jobflowId, executionId, "20101021221015", "3", "5"}, targetTable);

        // テスト対象クラス実行
        TargetDataLock lock = new TargetDataLock();
        boolean result = lock.lock(bean);

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

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

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

        // 処理の実行
        TempTableDelete delete = new TempTableDelete();
        Connection conn =DBConnection.getConnection();
        try {
            delete.deleteTempInfoRecord("1", "Table2", true, conn);
            DBConnection.commit(conn);
        } catch (Exception e) {
            DBConnection.rollback(conn);
            e.printStackTrace();
            fail();
        } finally {
            DBConnection.closeConn(conn);
        }

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

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

        // 処理の実行
        ExporterBean bean = new ExporterBean();
        bean.setExecutionId("JOB_FLOW01-001");
        bean.setJobflowId("JOBFLOW-01");
View Full Code Here

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

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

        // ImportBeanを生成
        Map<String, ImportTargetTableBean> targetTable = new LinkedHashMap<String, ImportTargetTableBean>();
        ImportTargetTableBean tableBean = new ImportTargetTableBean();
        tableBean.setImportTargetColumns(Arrays.asList(new String[]{"TEXTDATA2"}));
        tableBean.setSearchCondition(null);
        tableBean.setUseCache(false);
        tableBean.setLockType(ImportTableLockType.RECORD);
        tableBean.setLockedOperation(ImportTableLockedOperation.OFF);
        tableBean.setImportTargetType(null);
        tableBean.setDfsFilePath(null);
        targetTable.put("IMPORT_TARGET2", tableBean);
        ImportBean bean = createBean(new String[]{jobflowId, executionId, "20101021221015", "3", "5"}, targetTable);

        // テスト対象クラス実行
        TargetDataLock lock = new TargetDataLock();
        boolean result = lock.lock(bean);

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

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

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

        // 処理の実行
        TempTableDelete delete = new TempTableDelete();
        Connection conn =DBConnection.getConnection();
        try {
            delete.deleteTempInfoRecord("11", "Table2", true, conn);
            DBConnection.commit(conn);
        } catch (Exception e) {
            DBConnection.rollback(conn);
            e.printStackTrace();
            fail();
        } finally {
            DBConnection.closeConn(conn);
        }

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

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

        // 処理の実行
        ExporterBean bean = new ExporterBean();
        bean.setExecutionId("JOB_FLOW01-002");
        bean.setJobflowId("JOBFLOW-02");
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.