當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseOperation.CLEAN_INSERT屬性代碼示例

本文整理匯總了Java中org.dbunit.operation.DatabaseOperation.CLEAN_INSERT屬性的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseOperation.CLEAN_INSERT屬性的具體用法?Java DatabaseOperation.CLEAN_INSERT怎麽用?Java DatabaseOperation.CLEAN_INSERT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.dbunit.operation.DatabaseOperation的用法示例。


在下文中一共展示了DatabaseOperation.CLEAN_INSERT屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

@Before
public void setUp() throws Exception {
    initialDataSet = new FlatXmlDataSetBuilder().build(new File("src/test/resources/test-data.xml"));
    connection = new DatabaseConnection(DriverManager.getConnection(CONNECTION_URL, USER_NAME, PASSWORD));

    final DatabaseOperation operation = DatabaseOperation.CLEAN_INSERT;
    operation.execute(connection, initialDataSet);

    connection.getConnection().createStatement().execute(
            "insert into XML_TABLE_1(id, version, value_1, value_2, value_3, value_4, value_5) values(10, 'Record 10 version', 'Record 10 Value 1', 'Record 10 Value 2', 'Record 10 Value 3', 'Record 10 Value 4', 'Record 10 Value 5');");
    connection.getConnection().commit();

    connection.getConnection().createStatement().execute(
            "merge into XML_TABLE_3(id, version, value_8, value_9) values(11, 'Record 11 version', 'Record 11 Value 8', 'Record 11 Value 9');");
    connection.getConnection().commit();

    assertThat(getRecordCountFromTable(connection, "XML_TABLE_1"), equalTo(4));
    assertThat(getRecordCountFromTable(connection, "XML_TABLE_2"), equalTo(1));
    assertThat(getRecordCountFromTable(connection, "XML_TABLE_3"), equalTo(1));
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:20,代碼來源:CleanupStrategyProviderTest.java

示例2: getDBOperation

/**
 * Gets the Database operation
 *
 * @param operation
 * @return
 * @throws Exception
 */
private static DatabaseOperation getDBOperation(@NonNull String operation)
        throws Exception {

    switch (operation) {
        case "INSERT":
            return DatabaseOperation.INSERT;
        case "CLEAN_INSERT":
            return DatabaseOperation.CLEAN_INSERT;
        case "UPDATE":
            return DatabaseOperation.UPDATE;
        case "REFRESH":
            return DatabaseOperation.REFRESH;
        case "DELETE":
            return DatabaseOperation.DELETE;
        case "DELETE_ALL":
            return DatabaseOperation.DELETE_ALL;
        case "TRUNCATE_TABLE":
            return DatabaseOperation.TRUNCATE_TABLE;
        case "NONE":
            return DatabaseOperation.NONE;
        default:
            log.error("Unknown DB operation : " + operation);
            throw new Exception("Unknown DB operation : " + operation);
    }
}
 
開發者ID:awltech,項目名稱:easycukes,代碼行數:32,代碼來源:DBUnitManager.java

示例3: getSetUpOperation

protected DatabaseOperation getSetUpOperation() throws Exception {
	parseCreateTableScriptFile();

	initSpringContext();

	return new CompositeOperation(new DatabaseOperation[] { new DatabaseOperation() {

		@Override
		public void execute(IDatabaseConnection connection, IDataSet dataSet)
				throws DatabaseUnitException, SQLException {

			DatabaseConfig databaseConfig = connection.getConfig();
			IStatementFactory statementFactory = (IStatementFactory) databaseConfig
					.getProperty(DatabaseConfig.PROPERTY_STATEMENT_FACTORY);
			IBatchStatement statement = statementFactory.createBatchStatement(connection);
			try {
				int count = 0;
				for (SingleCreateTableScriptEntry entry : createdTableList) {
					statement.addBatch(entry.getCreateTableScript());
					count++;
				}

				if (count > 0) {
					statement.executeBatch();
					statement.clearBatch();
				}
			} finally {
				statement.close();
			}
		}
	}, DatabaseOperation.CLEAN_INSERT });
}
 
開發者ID:dianping,項目名稱:zebra,代碼行數:32,代碼來源:SingleDBBaseTestCase.java

示例4: getSetUpOperation

protected DatabaseOperation getSetUpOperation()
        throws Exception
{
	if (!update) {
		if (doCleanInsert())
        {
            return DatabaseOperation.CLEAN_INSERT;
        }

        return DatabaseOperation.REFRESH;
	}
    return DatabaseOperation.UPDATE;
}
 
開發者ID:NCIP,項目名稱:cadsr-semantic-tools,代碼行數:13,代碼來源:MainTestCase.java

示例5: cleanInsertStrategy

@Override
public DatabaseOperation cleanInsertStrategy() {
    return DatabaseOperation.CLEAN_INSERT;
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:4,代碼來源:DataSeedStrategyProvider.java

示例6: getSetUpOperation

@Override
protected DatabaseOperation getSetUpOperation() throws Exception {
    return DatabaseOperation.CLEAN_INSERT;
}
 
開發者ID:Fosstrak,項目名稱:fosstrak-epcis,代碼行數:4,代碼來源:TestSetupTest.java

示例7: getSetUpOperation

@Override
protected DatabaseOperation getSetUpOperation() throws Exception {
	return DatabaseOperation.CLEAN_INSERT;
}
 
開發者ID:Fosstrak,項目名稱:fosstrak-epcis,代碼行數:4,代碼來源:EventQueryTest.java


注:本文中的org.dbunit.operation.DatabaseOperation.CLEAN_INSERT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。