当前位置: 首页>>代码示例>>Java>>正文


Java FlatXmlDataSetBuilder.setColumnSensing方法代码示例

本文整理汇总了Java中org.dbunit.dataset.xml.FlatXmlDataSetBuilder.setColumnSensing方法的典型用法代码示例。如果您正苦于以下问题:Java FlatXmlDataSetBuilder.setColumnSensing方法的具体用法?Java FlatXmlDataSetBuilder.setColumnSensing怎么用?Java FlatXmlDataSetBuilder.setColumnSensing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dbunit.dataset.xml.FlatXmlDataSetBuilder的用法示例。


在下文中一共展示了FlatXmlDataSetBuilder.setColumnSensing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initEntityManager

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Set up memory database and insert data from test-dataset.xml
 * 
 * @throws DatabaseUnitException
 * @throws HibernateException
 * @throws SQLException
 */
@BeforeClass
public static void initEntityManager() throws HibernateException, DatabaseUnitException, SQLException {
    entityManagerFactory = Persistence.createEntityManagerFactory("listing-test-db");
    entityManager = entityManagerFactory.createEntityManager();
    connection = new DatabaseConnection(((SessionImpl) (entityManager.getDelegate())).connection());
    connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

    InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(datasetXml);
    if (inputStream != null) {
        FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
        flatXmlDataSetBuilder.setColumnSensing(true);
        dataset = flatXmlDataSetBuilder.build(inputStream);
        DatabaseOperation.CLEAN_INSERT.execute(connection, dataset);
    }
}
 
开发者ID:coodoo-io,项目名称:coodoo-listing,代码行数:23,代码来源:AbstractDbUnitTest.java

示例2: from

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * @author Wasiq B
 * @since 24-Nov-2015 8:10:47 pm
 * @param file
 * @return {@link DataSetBuilder}
 * @throws FrameworkException
 */
public DataSetBuilder from (final String file) throws FrameworkException {
	log.entry ();
	try {
		final FlatXmlDataSetBuilder build = new FlatXmlDataSetBuilder ();
		build.setColumnSensing (true);
		final IDataSet dataSet = build
				.build (new File (FileUtils.getResource (file).getPath ()));
		setDataSet (dataSet);
		return this;
	}
	catch (final Exception e) {
		log.catching (e);
		throw new FrameworkException ("from", e);
	}
	finally {
		log.exit ();
	}
}
 
开发者ID:WasiqB,项目名称:xtesy-framework,代码行数:26,代码来源:DataSetBuilder.java

示例3: setupDB

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@BeforeClass
public static void setupDB() throws Exception {
  ds = UnitTestDSProvider.getDataSource();
  //clean any existing records and load some records into the database.
  FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
  builder.setColumnSensing(true);
  Connection setup = ds.getConnection();
  IDatabaseConnection con = new DatabaseConnection(setup);
  {
    InputStream xmlInput = DeviceDAOImplTest.class.getResourceAsStream("/data/app-data-1.xml");
    IDataSet dataSet = builder.build(xmlInput);
    DatabaseOperation.CLEAN_INSERT.execute(con, dataSet);
  }
  // load test encryptor class
  Class.forName(EncryptorForTest.class.getName());
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:17,代码来源:AppTest.java

示例4: loadDatasource

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
private void loadDatasource(DBUnitDataSet annotation, TestContext testContext) throws Exception{
	DataSource dataSource = testContext.getApplicationContext().getBean(DataSource.class);
	IDatabaseTester databaseTester = new DataSourceDatabaseTester(dataSource, "PUBLIC");	
	
	//Ignore referential integrity so DBUnit can correctly delete rows related to the data set
	dataSource.getConnection().createStatement().execute("SET DATABASE REFERENTIAL INTEGRITY FALSE;");

	for(String sourceFile : annotation.value()){
		InputStream input = this.getClass().getResourceAsStream(sourceFile);
		FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
		builder.setColumnSensing(true);
		IDataSet ds = builder.build(input);
		databaseTester.setDataSet(ds);
		databaseTester.onSetup();			
	}
	
	//Add Referential constraints back in, now that the dbunit setup is complete
	dataSource.getConnection().createStatement().execute("SET DATABASE REFERENTIAL INTEGRITY TRUE;");
}
 
开发者ID:jacobhyphenated,项目名称:TaskList,代码行数:20,代码来源:DBUnitTestExecutionListener.java

示例5: initializeGlobalDataFile

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Initialize.
 *
 * @param context
 *            the context
 * @param dataSource
 *            the data source
 * @throws DatabaseUnitException
 *             the database unit exception
 * @throws SQLException
 *             the SQL exception
 * @throws MalformedURLException
 *             the malformed url exception
 */
public void initializeGlobalDataFile(ApplicationContext context)
		throws DatabaseUnitException, SQLException, MalformedURLException {
	DataSource datas = GlobalUtils.findDataSourceBean(context);
	IDatabaseConnection con = new DatabaseConnection(datas.getConnection()); // Create
																				// DBUnit
																				// Database
																				// connection
	FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
	builder.setColumnSensing(true);

	datasets = new IDataSet[] { builder.build(singleInitXmlFile) };
	DatabaseOperation.REFRESH.execute(con, new CompositeDataSet(datasets)); // Import
																			// your
																			// data

	// TODO handle the empty data file case.
	con.close();

}
 
开发者ID:bigtester,项目名称:automation-test-engine,代码行数:34,代码来源:TestDatabaseInitializer.java

示例6: getDataSet

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Charge le jeu de données à partir d'un fichier XML d'import
 * @return 
 * @throws java.lang.Exception 
 */
@Override
protected IDataSet getDataSet() throws Exception {
    if (dataset != null) {
        return dataset;
    }
    if (!getInputDataFileName().isEmpty()) {
        FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
        builder.setColumnSensing(true);
        dataset = builder.build(new File(
                getInputDataFileName()));
        return dataset;
    } else {
        return null;
    }
}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:21,代码来源:AbstractRuleImplementationTestCase.java

示例7: getBuilder

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Permet de créer un dataSet pouvant parser un fichier xml.
 * @return {@link IDataSet}
 * @throws SaladiumException
 */
private IDataSet getBuilder(File file) throws SaladiumException {
    FlatXmlDataSetBuilder dataSetBuilder = new FlatXmlDataSetBuilder();
    dataSetBuilder.setColumnSensing(true);
    dataSetBuilder.setCaseSensitiveTableNames(true);
    dataSetBuilder.setDtdMetadata(false);
    try {
        // FileInputStream xmlInputFile = new FileInputStream(file);
        FlatXmlDataSet dataSet = dataSetBuilder.build(file);
        // xmlInputFile.close();
        return dataSet;
    } catch (Exception e) {
        throw new SaladiumException(e);
    }
}
 
开发者ID:Nonorc,项目名称:saladium,代码行数:20,代码来源:AbstractWorker.java

示例8: loadDataSet

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
protected IDataSet loadDataSet(URL source) throws Exception {
    final FlatXmlDataSetBuilder xmlData = new FlatXmlDataSetBuilder();
    xmlData.setColumnSensing(true);
    final ReplacementDataSet set = new ReplacementDataSet(
            xmlData.build(source));
    set.addReplacementObject("[NULL]", null);
    return set;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:9,代码来源:SchemaUpgradeTestBase.java

示例9: xmlLoader

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@Override
public DataSetLoader<IDataSet> xmlLoader() {
    return (final File path) -> {
        try (InputStream in = new FileInputStream(path)) {
            final FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
            flatXmlDataSetBuilder.setColumnSensing(true);
            return defineReplaceableExpressions(flatXmlDataSetBuilder.build(in));
        } catch (final DataSetException e) {
            throw new IOException(e);
        }
    };
}
 
开发者ID:dadrus,项目名称:jpa-unit,代码行数:13,代码来源:DataSetLoaderProvider.java

示例10: initEntityManager

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@BeforeClass
public static void initEntityManager() throws HibernateException, DatabaseUnitException {
	entityManagerFactory = Persistence.createEntityManagerFactory("com.infinities.keystone4j.jpa.test");
	entityManager = entityManagerFactory.createEntityManager();
	connection = new DatabaseConnection(((SessionImpl) (entityManager.getDelegate())).connection());
	connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

	FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
	flatXmlDataSetBuilder.setColumnSensing(true);
	InputStream dataSet = Thread.currentThread().getContextClassLoader().getResourceAsStream("test-data.xml");
	dataset = flatXmlDataSetBuilder.build(dataSet);
	EntityManagerListener.setEntityManagerFactory(entityManagerFactory);
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:14,代码来源:AbstractIntegratedTest.java

示例11: createDataSet

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@Override
protected IDataSet createDataSet(Resource resource) throws Exception {
    FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
    builder.setColumnSensing(true);
    try (InputStream inputStream = resource.getInputStream()) {
        return builder.build(inputStream);
    }
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:9,代码来源:ColumnSensingFlatXMLDataSetLoader.java

示例12: getDataSet

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Load in a set of data from a (fixed for now) XML file
 *
 * @return data set to be provided to database tester (or used for
 *         comparison)
 */
public IDataSet getDataSet() throws DataSetException, IOException {
	URL url = LoginDatabaseHandler.class.getClassLoader().getResource("LoginDatabaseHandlerTest.xml");
	FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
	builder.setColumnSensing(true);
	return builder.build(url);
}
 
开发者ID:UQdeco2800,项目名称:minesim,代码行数:13,代码来源:LoginDatabaseHandlerTests.java

示例13: getDataSet

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
/**
 * Load in a set of data from a (fixed for now) XML file
 *
 * @return data set to be provided to database tester (or used for
 * comparison)
 */
private IDataSet getDataSet() throws DataSetException, IOException {
    URL url = DatabaseHandler.class.getClassLoader().getResource("DatabaseHandlerTest.xml");
    FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
    builder.setColumnSensing(true);
    return builder.build(url);
}
 
开发者ID:UQdeco2800,项目名称:minesim,代码行数:13,代码来源:DatabaseHandlerTests.java

示例14: setUp

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  ds = UnitTestDSProvider.getDataSource();

  //clean any existing records and load some records into the database.
  FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
  builder.setColumnSensing(true);
  Connection setup = ds.getConnection();
  IDatabaseConnection con = new DatabaseConnection(setup);
  {
    InputStream xmlInput = DeviceDAOImplTest.class.getResourceAsStream("/data/pushmessage-data-1.xml");
    IDataSet dataSet = builder.build(xmlInput);
    DatabaseOperation.CLEAN_INSERT.execute(con, dataSet);
  }
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:16,代码来源:PushMessageDAOImplTest.java

示例15: setupDB

import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; //导入方法依赖的package包/类
@BeforeClass
public static void setupDB() throws Exception {
  ds = UnitTestDSProvider.getDataSource();
  //clean any existing records and load some records into the database.
  FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
  builder.setColumnSensing(true);
  Connection setup = ds.getConnection();
  IDatabaseConnection con = new DatabaseConnection(setup);
  {
    InputStream xmlInput = DeviceDAOImplTest.class.getResourceAsStream("/data/app-data-1.xml");
    IDataSet dataSet = builder.build(xmlInput);
    DatabaseOperation.CLEAN_INSERT.execute(con, dataSet);
  }
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:15,代码来源:AppConfigurationEntityDAOImplTest.java


注:本文中的org.dbunit.dataset.xml.FlatXmlDataSetBuilder.setColumnSensing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。