本文整理匯總了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));
}
示例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);
}
}
示例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 });
}
示例4: getSetUpOperation
protected DatabaseOperation getSetUpOperation()
throws Exception
{
if (!update) {
if (doCleanInsert())
{
return DatabaseOperation.CLEAN_INSERT;
}
return DatabaseOperation.REFRESH;
}
return DatabaseOperation.UPDATE;
}
示例5: cleanInsertStrategy
@Override
public DatabaseOperation cleanInsertStrategy() {
return DatabaseOperation.CLEAN_INSERT;
}
示例6: getSetUpOperation
@Override
protected DatabaseOperation getSetUpOperation() throws Exception {
return DatabaseOperation.CLEAN_INSERT;
}
示例7: getSetUpOperation
@Override
protected DatabaseOperation getSetUpOperation() throws Exception {
return DatabaseOperation.CLEAN_INSERT;
}