Package com.asakusafw.testtools

Examples of com.asakusafw.testtools.TestUtils


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

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

        // ExportBeanを生成
View Full Code Here


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

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        targetTable.put("EXP_TARGET1", table1);
View Full Code Here

            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET2_1");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_1_DF");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET2_1_DF");

            // テストデータを指定
            TestUtils util1 = new TestUtils(new File("src/test/data/exporter/ExportFileLoadTest/loadFileTest01_load"));
            // テストデータをセット
            util1.storeToDatabase(false);

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

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

            // DBの結果を検証
            TestUtils util2 = new TestUtils(new File("src/test/data/exporter/ExportFileLoadTest/loadFileTest01_assert"));
            util2.loadFromDatabase();
            if (!util2.inspect()) {
                for (Cause cause : util2.getCauses()) {
                    System.out.println(cause.getMessage());
                }
                fail(util2.getCauseMessage());
            }
            // 重複チェック件数を確認
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET1_1_DF", 2));
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET2_1_DF", 3));
        } finally {
View Full Code Here

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

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(false);
        table1.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET1_1.tsv").getAbsolutePath()));
        table1.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET1_2.tsv").getAbsolutePath()));
        table1.setExportTsvColumns(Arrays.asList(new String[]{"SID", "VERSION_NO", "TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        targetTable.put("IMPORT_TARGET1", table1);
        ExportTargetTableBean table2 = new ExportTargetTableBean();
        table2.setDuplicateCheck(false);
        table2.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET2_1.tsv").getAbsolutePath()));
        table2.setExportTsvColumns(Arrays.asList(new String[]{"TEXTDATA2", "INTDATA2", "DATEDATA2"}));
        targetTable.put("IMPORT_TARGET2", table2);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportFileLoad load = new ExportFileLoad() {
            @Override
            protected long getTempSeq(String jobflowSid, String tableName,
                    Connection conn) throws BulkLoaderSystemException {
                return 1;
            }
        };
        try {
            // テンポラリテーブルを削除
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_1");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET2_1");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_1_DF");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET2_1_DF");


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

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

            // DBの結果を検証
            TestUtils util2 = new TestUtils(new File("src/test/data/exporter/ExportFileLoadTest/loadFileTest02_assert"));
            util2.loadFromDatabase();
            if (!util2.inspect()) {
                for (Cause cause : util2.getCauses()) {
                    System.out.println(cause.getMessage());
                }
                fail(util2.getCauseMessage());
            }
            // 重複チェック件数を確認
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET1_1_DF", 0));
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET2_1_DF", 0));
        } finally {
View Full Code Here

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

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(false);
View Full Code Here

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

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
        table1.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET1_4.tsv").getAbsolutePath()));
        table1.setExportTsvColumns(Arrays.asList(new String[]{"SID", "VERSION_NO", "TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setExportTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        table1.setKeyColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1"}));
        table1.setErrorTableName("IMPORT_TARGET1_ERROR");
        table1.setErrorTableColumns(Arrays.asList(new String[]{"TEXTDATA1", "INTDATA1", "DATEDATA1"}));
        targetTable.put("IMPORT_TARGET1", table1);
        ExporterBean bean = new ExporterBean();
        bean.setExportTargetTable(targetTable);
        bean.setJobflowSid("11");
        bean.setJobflowId(jobflowId);
        bean.setExecutionId(executionId);

        // テスト対象クラスを生成
        ExportFileLoad load = new ExportFileLoad() {
            @Override
            protected long getTempSeq(String jobflowSid, String tableName,
                    Connection conn) throws BulkLoaderSystemException {
                return 1;
            }
        };
        try {
            // テンポラリテーブルを削除
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_1");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_1_DF");


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

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

            // DBの結果を検証
            TestUtils util2 = new TestUtils(new File("src/test/data/exporter/ExportFileLoadTest/loadFileTest04_assert"));
            util2.loadFromDatabase();
            if (!util2.inspect()) {
                for (Cause cause : util2.getCauses()) {
                    System.out.println(cause.getMessage());
                }
                fail(util2.getCauseMessage());
            }
            // 重複チェック件数を確認
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET1_1_DF", 0));
        } finally {
            // テンポラリテーブルを削除
View Full Code Here

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

        // ExportBeanを生成
        Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
        ExportTargetTableBean table1 = new ExportTargetTableBean();
        table1.setDuplicateCheck(true);
View Full Code Here

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

       // ExportBeanを生成
       Map<String, ExportTargetTableBean> targetTable = new LinkedHashMap<String, ExportTargetTableBean>();
       ExportTargetTableBean table1 = new ExportTargetTableBean();
       table1.setDuplicateCheck(true);
       table1.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET1_1.tsv").getAbsolutePath()));
       table1.addExportFile(new File(new File ("src/test/data/exporter/EXP_EXP_TARGET1_2.tsv").getAbsolutePath()));
       table1.setExportTsvColumns(Arrays.asList(new String[]{"SID", "VERSION_NO", "TEXTDATA1", "INTDATA2", "DATEDATA2"}));
       table1.setExportTableColumns(Arrays.asList(new String[] {"SID", "VERSION_NO", "TEXTDATA1"}));
       table1.setKeyColumns(Arrays.asList(new String[]{"TEXTDATA1"}));
       table1.setErrorTableName("IMPORT_TARGET2_ERROR");
       table1.setErrorTableColumns(Arrays.asList(new String[] {"SID", "VERSION_NO", "INTDATA2", "DATEDATA2"}));
       targetTable.put("IMPORT_TARGET1", table1);
       ExporterBean bean = new ExporterBean();
       bean.setExportTargetTable(targetTable);
       bean.setJobflowSid("11");
       bean.setJobflowId(jobflowId);
       bean.setExecutionId(executionId);

       // テスト対象クラスを生成
       ExportFileLoad load = new ExportFileLoad() {
           @Override
           protected long getTempSeq(String jobflowSid, String tableName,
                   Connection conn) throws BulkLoaderSystemException {
               return 9;
           }
       };
       try {
           // テンポラリテーブルを削除
           UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_9");
            UnitTestUtil.executeUpdate("DROP TABLE IF EXISTS EXPORT_TEMP_IMPORT_TARGET1_9_DF");


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

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

           // DBの結果を検証
           TestUtils util2 = new TestUtils(new File("src/test/data/exporter/ExportFileLoadTest/loadFileTest_DupCheckTableUnion_assert"));
           util2.loadFromDatabase();
           if (!util2.inspect()) {
               for (Cause cause : util2.getCauses()) {
                   System.out.println(cause.getMessage());
               }
               fail(util2.getCauseMessage());
           }
            // 重複チェック件数を確認
            assertTrue(UnitTestUtil.countAssert("EXPORT_TEMP_IMPORT_TARGET1_9_DF", 2));
       } finally {
           // テンポラリテーブルを削除
View Full Code Here

     */
    @Test
    public void createTempTableName01() 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 createImportFileTest01() throws Exception {
        // テストデータを指定
        File testDataDir = new File("src/test/data/importer/ImportFileCreateTest/createImportFileTest01");
        TestUtils util = new TestUtils(testDataDir);
        // テストデータをセット
        util.storeToDatabase(false);

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

        // ImportBeanを生成
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.