当前位置: 首页>>代码示例>>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;未经允许,请勿转载。