Package org.dbunit.dataset.filter

Examples of org.dbunit.dataset.filter.ITableFilter


            FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
            builder.setColumnSensing(true);
            IDataSet ds = builder.build(new File(file));

            // Load the data set through a sequence filter to ensure statements are executed in correct order
            ITableFilter filter = new DatabaseSequenceFilter(connection);
            IDataSet dataset = new FilteredDataSet(filter, ds);

            dboperation.execute(connection, dataset);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
View Full Code Here


       conn = new DatabaseConnection(ds.getConnection());
      
       //conn = DatabaseConnectionFactory.getConnection();       
       String targetDbName = DatabaseConnectionFactory.getDatabaseName()
      
       ITableFilter tablefilter = new DatabaseSequenceFilter(conn);       
       IDataSet databaseDataSet = new FilteredDataSet(tablefilter, conn.createDataSet());  
      
       //the name of the created file is equal at the DB name
       FlatXmlDataSet.write(databaseDataSet, new FileOutputStream(outputFolder+File.separator+targetDbName+".xml"));          
     
View Full Code Here

     try
       BasicDataSource ds = DatabaseConnectionFactory.getDataSource();
         
       //ITableFilter filter = new DatabaseSequenceFilter(conn, tables);
       IDatabaseConnection conn = new DatabaseConnection(ds.getConnection());
       ITableFilter filter = new DatabaseSequenceFilter(conn, tables);
     
       //The target dataSet: ie all the tables in the input list
       IDataSet dataSet = new FilteredDataSet(filter, conn.createDataSet());     
     
       DatabaseOperation.DELETE_ALL.execute(conn, dataSet)
View Full Code Here

         ArrayList<String> tableListOrdered = new ArrayList<String>();        
        
         BasicDataSource ds = DatabaseConnectionFactory.getDataSource();
         conn = new DatabaseConnection(ds.getConnection());
           
         ITableFilter filter = new DatabaseSequenceFilter(conn);
         
         //The dataSet: ie the list of ALL tables name
         IDataSet dataSet = new FilteredDataSet(filter, conn.createDataSet());
       
         ITableIterator iter = dataSet.iterator();
View Full Code Here

         ArrayList<String> tableListOrdered = new ArrayList<String>()
        
         BasicDataSource ds = DatabaseConnectionFactory.getDataSource();
         conn = new DatabaseConnection(ds.getConnection());
           
         ITableFilter filter = new DatabaseSequenceFilter(conn);
         
         //The dataSet: ie the list of ALL tables name
         IDataSet dataSet = new FilteredDataSet(filter, conn.createDataSet());
       
         ITableIterator iter = dataSet.iterator();
View Full Code Here

      final DatabaseConnection connection = databaseConnection.get();
      IDataSet initialDataSet = mergeDataSets(dataSetRegister.get().getInitial());
      if (dbunitConfigurationInstance.get().isFilterTables())
      {
         final TableFilterProvider sequenceFilterProvider = new TableFilterResolver(dbunitConfigurationInstance.get()).resolve();
         final ITableFilter databaseSequenceFilter = sequenceFilterProvider.provide(connection, initialDataSet.getTableNames());
         initialDataSet = new FilteredDataSet(databaseSequenceFilter, initialDataSet);
      }
      seedingStrategy().execute(connection, initialDataSet);
   }
View Full Code Here

         final IDataSet mergeDataSets = DataSetUtils.mergeDataSets(dataSetRegister.getInitial());
         IDataSet dataSet = DataSetUtils.excludeTables(mergeDataSets, tablesToExclude);
         if (dbUnitConfiguration.isFilterTables())
         {
            final TableFilterProvider tableFilterProvider = new TableFilterResolver(dbUnitConfiguration).resolve();
            final ITableFilter tableFilter = tableFilterProvider.provide(connection, dataSet.getTableNames());
            dataSet = new FilteredDataSet(tableFilter, dataSet);
         }
         DatabaseOperation.DELETE_ALL.execute(connection, dataSet);
      }
      catch (Exception e)
View Full Code Here

      {
         IDataSet dataSet = DataSetUtils.excludeTables(connection.createDataSet(), tablesToExclude);
         if (dbUnitConfiguration.isFilterTables())
         {
            final TableFilterProvider tableFilterProvider = new TableFilterResolver(dbUnitConfiguration).resolve();
            final ITableFilter tableFilter = tableFilterProvider.provide(connection, dataSet.getTableNames());
            dataSet = new FilteredDataSet(tableFilter, dataSet);
         }
         DatabaseOperation.DELETE_ALL.execute(connection, dataSet);
      }
      catch (Exception e)
View Full Code Here

         final IDataSet mergeDataSets = DataSetUtils.mergeDataSets(dataSetRegister.getInitial());
         IDataSet dataSet = DataSetUtils.excludeTables(mergeDataSets, tablesToExclude);
         if (dbUnitConfiguration.isFilterTables())
         {
            final TableFilterProvider sequenceFilterProvider = new TableFilterResolver(dbUnitConfiguration).resolve();
            final ITableFilter tableFilter = sequenceFilterProvider.provide(connection, dataSet.getTableNames());
            dataSet = new FilteredDataSet(tableFilter, dataSet);
         }
         DatabaseOperation.DELETE.execute(connection, dataSet);
      }
      catch (Exception e)
View Full Code Here

    throws SearchException, SQLException, DataSetException
    {
        logger.debug("getDataset(connection={}, rootTables={}) - start", connection, rootTables);

        ImportedKeysSearchCallbackFilteredByPKs callback = new ImportedKeysSearchCallbackFilteredByPKs(connection, rootTables);
        ITableFilter filter = callback.getFilter();
        DepthFirstSearch search = new DepthFirstSearch();
        String[] tableNames = rootTables.getTableNames();
        ListOrderedSet tmpTables = search.search( tableNames, callback );
        String[] dependentTables  = CollectionsHelper.setToStrings( tmpTables );
        IDataSet tmpDataset = connection.createDataSet( dependentTables );
View Full Code Here

TOP

Related Classes of org.dbunit.dataset.filter.ITableFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.