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


Java FlatDtdDataSet类代码示例

本文整理汇总了Java中org.dbunit.dataset.xml.FlatDtdDataSet的典型用法代码示例。如果您正苦于以下问题:Java FlatDtdDataSet类的具体用法?Java FlatDtdDataSet怎么用?Java FlatDtdDataSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getDtdSchema

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
private Reader getDtdSchema(boolean resetDtdSchema) throws Exception {
        if (resetDtdSchema || dtdSchema == null) {
            Connection c = getEmireCfg().getConnection();
            try {

                IDatabaseConnection dc = createProgresConnection(c);
                StringWriter sw = new StringWriter();
                FlatDtdDataSet.write(dc.createDataSet(), sw);
                dtdSchema = sw.toString();
//                System.out.println(dtdSchema);
            } finally {
                c.close();
            }
        }
        return new StringReader(dtdSchema);
    }
 
开发者ID:proarc,项目名称:proarc,代码行数:17,代码来源:DbUnitSupport.java

示例2: run

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
@Scheduled(cron = "0 0 3 * * *")
public void run() throws SQLException, DatabaseUnitException, IOException {
    if (enable) {
        log.info("begin backup database");

        String bak = root + "/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());

        ITableFilter filter = new DatabaseSequenceFilter(conn);
        IDataSet dataSet = new FilteredDataSet(filter, conn.createDataSet());

        //IDataSet dataSet = conn.createDataSet();
        FlatXmlDataSet.write(dataSet, new FileOutputStream(bak + ".xml"));
        FlatDtdDataSet.write(dataSet, new FileOutputStream(bak + ".dtd"));
        log.info("end backup database");
    }


}
 
开发者ID:chonglou,项目名称:itpkg,代码行数:19,代码来源:BackupJob.java

示例3: main

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    DataSource dataSource = new DataSourceFactoryBean().getDataSource();
    File file = new File("src/main/resources/mycollab.dtd");
    IDatabaseConnection connection = new DatabaseDataSourceConnection(dataSource);
    connection.getConfig().setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
    // write DTD file
    FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream(file));
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:9,代码来源:DbUnitUtil.java

示例4: main

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Config config = new Config();
    Class.forName(config.getDbDriver());
    Connection jdbcConnection = DriverManager.getConnection(config.getDbUrl(), config.getDbUser(), config.getDbPass());
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection, "public");

    // dtd
    FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream("src/test/java/it/pronetics/acl/conf/dbunit/database-schema.dtd"));

    // export
    IDataSet fullDataSet = connection.createDataSet();
    FlatXmlDataSet.write(fullDataSet, new FileOutputStream("src/test/java/opennms/opennms/acl/conf/dbunit/full.xml"));
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:14,代码来源:DbUnit.java

示例5: writeDtd

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
protected void writeDtd(IDatabaseConnection dbunitConnection,String tableName) throws IOException,
		DataSetException, SQLException {
	
	File placeholder = new File(DatabaseCapable.class
			.getResource("/expected/.dbunit-comparison-files")
			.getFile());
	
	File dtdFile = new File(placeholder.getParentFile()
			.getPath()
			+ System.getProperty("file.separator")
			+ tableName + ".dtd");
	
       FlatDtdDataSet.write(dbunitConnection.createDataSet(new String[] { tableName } ), new FileOutputStream(dtdFile));
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:15,代码来源:DatabaseCapable.java

示例6: main

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
/**
 * Cambiar los datos de la conexión de acuerdo a la base de datos que se quiera usar como muestra
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception
{
    String url  = JOptionPane.showInputDialog("Escriba la URL de MySQL incluyendo driver");
    String user = JOptionPane.showInputDialog("Escriba el nombre de usuario de la BD");
    String pass = JOptionPane.showInputDialog("Escriba la clave de la BD");
    String dir  = "test/src/omoikane/repository/sampleData.xml";

    Class driverClass = Class.forName("com.mysql.jdbc.Driver");
    Connection jdbcConnection = DriverManager.getConnection(
            url, user, pass);
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

    // Datos seleccionados considerando la base de datos de Omoikane 1.3.3 -> 1.4.0 alpha
    QueryDataSet partialDataSet = new QueryDataSet(connection);
    partialDataSet.addTable("articulos"        , "SELECT * FROM articulos         ORDER BY id_articulo DESC LIMIT 200");
    partialDataSet.addTable("base_para_precios", "SELECT * FROM base_para_precios ORDER BY id_articulo DESC LIMIT 200");
    partialDataSet.addTable("ventas"           , "SELECT * FROM ventas            ORDER BY id_venta DESC LIMIT 50");
    partialDataSet.addTable("ventas_detalles"  , "SELECT vd.* FROM ventas_detalles vd JOIN (SELECT id_venta FROM ventas ORDER BY id_venta DESC LIMIT 50) v ON (vd.id_venta = v.id_venta)");
    partialDataSet.addTable("cajas"            , "SELECT * FROM cajas");
    FlatXmlDataSet.write(partialDataSet, new FileOutputStream(dir));

    FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream("test/src/omoikane/repository/sampleBDSchema.dtd"));

    System.out.println("{}");
    JOptionPane.showMessageDialog(null, "Proceso completado. BD importada en "+dir);

}
 
开发者ID:ZooMMX,项目名称:Omoikane,代码行数:33,代码来源:CreateFixturesFromDB.java

示例7: extractXmlSchema

import org.dbunit.dataset.xml.FlatDtdDataSet; //导入依赖的package包/类
/**
 * Extracts the XML DTD from the database schema.
 * 
 * @throws Exception
 *             If any errors occur connecting to the database, reading the
 *             database contents, or writing the DTD file.
 */
public static void extractXmlSchema() throws Exception {
    IDatabaseConnection connection = getDatabaseConnection();
    FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream("src/test/resources/dbunit/export.dtd"));
}
 
开发者ID:Fosstrak,项目名称:fosstrak-epcis,代码行数:12,代码来源:FosstrakDatabaseHelper.java


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