Package org.dbunit.dataset

Examples of org.dbunit.dataset.IDataSet


    public void assertEqualsAll() {
      this.dbDataUtil.execute(new DbUnitWork() {
        @Override
        public void execute(IDatabaseConnection conn) {
          try {
            IDataSet  dbDataSet = conn.createDataSet();
            Assertion.assertEquals(flatXmlDataSet, dbDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't assert DB data", ex);
          }
        }
View Full Code Here


   private void createInitialDataSets(List<DataSetResourceDescriptor> dataSetDescriptors)
   {
      DataSetRegister dataSetRegister = getOrCreateDataSetRegister();
      for (DataSetResourceDescriptor dataSetDescriptor : dataSetDescriptors)
      {
         IDataSet initialDataSet = createInitialDataSet(dataSetDescriptor);
         dataSetRegister.addInitial(initialDataSet);
      }
      dataSetRegisterProducer.set(dataSetRegister);
   }
View Full Code Here

   private void createExpectedDataSets(List<DataSetResourceDescriptor> dataSetDescriptors)
   {
      DataSetRegister dataSetRegister = getOrCreateDataSetRegister();
      for (DataSetResourceDescriptor dataSetDescriptor : dataSetDescriptors)
      {
         IDataSet expectedDataSet = createExpectedDataSet(dataSetDescriptor);
         dataSetRegister.addExpected(expectedDataSet);
      }
      dataSetRegisterProducer.set(dataSetRegister);
   }
View Full Code Here

   private void dumpDatabaseState(TestEvent event, Phase phase)
   {
      final String path = configuration.get().getDumpDirectory() + "/" + createFileName(event, phase.getName());
      try
      {
         final IDataSet dbContent = databaseConnection.get().createDataSet();
         DataDump dumpData = createDataDump(path, dbContent);
         commandService.get().execute(new DumpDataCommand(dumpData));
      }
      catch (Exception e)
      {
View Full Code Here

   @Override
   public void compare(@Observes CompareData compareDataEvent)
   {
      try
      {
         IDataSet currentDataSet = databaseConnection.get().createDataSet();
         IDataSet expectedDataSet = DataSetUtils.mergeDataSets(dataSetRegister.get().getExpected());
         new DataSetComparator(compareDataEvent.getColumnsToExclude()).compare(currentDataSet, expectedDataSet, assertionErrorCollector.get());
      }
      catch (Exception e)
      {
         throw new DBUnitDataSetHandlingException("Failed while comparing database state with provided data sets.", e);
View Full Code Here

   {
      final DBUnitConfiguration dbUnitConfiguration = dbunitConfigurationInstance.get();
      final DataSeedStrategy dataSeedStrategy = dbUnitConfiguration.getDataSeedStrategy();
      final boolean useIdentityInsert = dbUnitConfiguration.isUseIdentityInsert();
      final DatabaseConnection connection = databaseConnection.get();
      final IDataSet initialDataSet = DataSetUtils.mergeDataSets(dataSetRegister.get().getInitial());

      new TransactionOperation(dataSeedStrategy.get(useIdentityInsert)).execute(connection, initialDataSet);
   }
View Full Code Here

   }

   public IDataSet build(final String file)
   {
      final InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
      IDataSet dataSet = null;
      try
      {
         switch (format)
         {
            case XML:
View Full Code Here

   }

   private IDataSet loadYamlDataSet(final String file, final InputStream inputStream) throws IOException,
         DataSetException
   {
      IDataSet dataSet;
      if (isYamlEmpty(file))
      {
         dataSet = new DefaultDataSet();
      }
      else
View Full Code Here

   // Private methods

   private IDataSet loadXmlDataSet(final InputStream inputStream) throws DataSetException
   {
      IDataSet dataSet;
      final FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
      flatXmlDataSetBuilder.setColumnSensing(true);
      dataSet = flatXmlDataSetBuilder.build(inputStream);
      return dataSet;
   }
View Full Code Here

      for (DataSupplier op : datasets) {

        try {

          IDataSet dataSet = op.get();

          DatabaseOperation operacao = op.getOperation();
          DatabaseOperation trx = DatabaseOperation.TRANSACTION(operacao);
          trx.execute(conn, dataSet);
View Full Code Here

TOP

Related Classes of org.dbunit.dataset.IDataSet

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.