* @throws Exception
*/
@Test
public void copyDataTest07() throws Exception {
// テストデータを指定
TestUtils util = new TestUtils(new File("src/test/data/exporter/ExportDataCopyTest/copyDataTest07"));
// テストデータをセット
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"}));
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_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);
assertFalse(copy.isUpdateEnd());
// DBの結果を検証
util.loadFromDatabase();
if (!util.inspect()) {
for (Cause cause : util.getCauses()) {
System.out.println(cause.getMessage());
}
fail(util.getCauseMessage());
}
}