Package org.dbunit.dataset

Examples of org.dbunit.dataset.ReplacementDataSet


        public DataSetOperation(String dataSetLocation, DatabaseOperation operation) {
            // Load the base dataset file
            InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(dataSetLocation);
            try {
                this.dataSet = new ReplacementDataSet( new FlatXmlDataSet(input) );
            } catch (Exception ex) {
                throw new RuntimeException("Could not load dataset for import: " + dataSetLocation, ex);
            }
            this.dataSet.addReplacementObject("[NULL]", null);
            this.dataSet.addReplacementSubstring("[BINARY_DIR]", getBinaryDirFullpath());
View Full Code Here


               {
                   dtdInput = Thread.currentThread().getContextClassLoader().getResourceAsStream(dtdLocation);
               }
               if (dtdInput == null)
               {
                   this.dataSet = new ReplacementDataSet( new FlatXmlDataSet(input) );
               }
               else
               {
                   this.dataSet = new ReplacementDataSet( new FlatXmlDataSet(input, dtdInput) );
               }
           }
           catch (Exception ex)
           {
               throw new RuntimeException(ex);
View Full Code Here

            } else {
                EntityRelationshipFilter filter = new EntityRelationshipFilter(connection, pksToLoad, new ConfigurableDependencyInclusionResolver(config));
                data = new FilteredDataSet(filter, connection.createDataSet());
            }

            ReplacementDataSet nullReplacingData = new ReplacementDataSet(data);
            nullReplacingData.addReplacementObject(null, Settings.NULL_REPLACEMENT);

            DataSetProducerAdapter producer = new DataSetProducerAdapter(nullReplacingData);
            producer.setConsumer(consumer);
            producer.produce();
        } finally {
View Full Code Here

    public static void run(Properties settings, Input input) throws Exception {
        run(DbUnitUtil.getConnection(settings), input);
    }

    public static void run(IDatabaseConnection connection, Input input) throws Exception {
        ReplacementDataSet dataSet = new ReplacementDataSet(new StreamingDataSet(input.getProducer()));
        dataSet.addReplacementObject(Settings.NULL_REPLACEMENT, null);

        DatabaseOperation.DELETE_ALL.execute(connection, dataSet);

        input.close();

        dataSet = new ReplacementDataSet(new StreamingDataSet(input.getProducer()));
        dataSet.addReplacementObject(Settings.NULL_REPLACEMENT, null);

        DatabaseOperation.INSERT.execute(connection, dataSet);
    }
View Full Code Here

    this.service.save(issuer);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testAddCRLIssuerRequiredFieldsOnlyOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
    SortedTable expectedSortedTable = new SortedTable(expectedTable, new String[] {"name"});
    expectedSortedTable.setUseComparable(true);
   
    IDataSet dataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = dataSet.getTable("CRL_ISSUER");
View Full Code Here

    this.service.save(issuers);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testBatchAddCRLIssuerOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
    SortedTable expectedSortedTable = new SortedTable(expectedTable, new String[] {"name"});
    expectedSortedTable.setUseComparable(true);
   
    IDataSet dataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = dataSet.getTable("CRL_ISSUER");
View Full Code Here

    this.service.save(issuers);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testBulkAddCRLIssuerBatchSizeOverlimitOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
    SortedTable expectedSortedTable = new SortedTable(expectedTable, new String[] {"name"});
    expectedSortedTable.setUseComparable(true);
   
    IDataSet dataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = dataSet.getTable("CRL_ISSUER");
View Full Code Here

    this.service.delete(item);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testDeleteCRLIssuerOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
   
    IDataSet actualDataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = actualDataSet.getTable("crl_issuer");
    ITable filteredActualTable = DefaultColumnFilter.includedColumnsTable(actualTable, expectedTable.getTableMetaData().getColumns());
   
View Full Code Here

    this.service.delete(issuer);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testDeleteInvalidCRLIssuerOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
   
    IDataSet actualDataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = actualDataSet.getTable("crl_issuer");
    ITable filteredActualTable = DefaultColumnFilter.includedColumnsTable(actualTable, expectedTable.getTableMetaData().getColumns());
   
View Full Code Here

    this.service.delete(issuers);
   
    StringBuffer dataSetFile = new StringBuffer();
    dataSetFile.append("config").append(File.separator).append("testDeleteAllIssuersOK.xml");
    IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new FileInputStream(dataSetFile.toString()));
    ReplacementDataSet replacement = new ReplacementDataSet(expectedDataSet);
    replacement.addReplacementObject("[null]", null);
    ITable expectedTable = replacement.getTable("CRL_ISSUER");
   
    IDataSet actualDataSet = this.databaseTester.getConnection().createDataSet();
    ITable actualTable = actualDataSet.getTable("crl_issuer");
    ITable filteredActualTable = DefaultColumnFilter.includedColumnsTable(actualTable, expectedTable.getTableMetaData().getColumns());
   
View Full Code Here

TOP

Related Classes of org.dbunit.dataset.ReplacementDataSet

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.