當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。