gpt4 book ai didi

org.dbunit.dataset.xml.XmlDataSet.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 15:47:05 26 4
gpt4 key购买 nike

本文整理了Java中org.dbunit.dataset.xml.XmlDataSet.<init>()方法的一些代码示例,展示了XmlDataSet.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlDataSet.<init>()方法的具体详情如下:
包路径:org.dbunit.dataset.xml.XmlDataSet
类名称:XmlDataSet
方法名:<init>

XmlDataSet.<init>介绍

暂无

代码示例

代码示例来源:origin: openmrs/openmrs-core

xmlDataSet = new XmlDataSet(fileInInputStreamFormat);
xmlDataSetToRun = xmlDataSet;

代码示例来源:origin: e-biz/spring-dbunit

/**
   * {@inheritDoc}
   */
  @Override
  protected IDataSet fromResource(Resource resource, DataSetFormatOptions options) throws DataSetException, IOException {
    return new XmlDataSet(resource.getInputStream());
  }
},

代码示例来源:origin: springtestdbunit/spring-test-dbunit

@Override
protected IDataSet createDataSet(Resource resource) throws Exception {
  InputStream inputStream = resource.getInputStream();
  try {
    return new XmlDataSet(inputStream);
  } finally {
    inputStream.close();
  }
}

代码示例来源:origin: com.github.springtestdbunit/spring-test-dbunit

@Override
protected IDataSet createDataSet(Resource resource) throws Exception {
  InputStream inputStream = resource.getInputStream();
  try {
    return new XmlDataSet(inputStream);
  } finally {
    inputStream.close();
  }
}

代码示例来源:origin: stackoverflow.com

protected static IDataSet getDataSet() throws Exception {
  URL url = MyTest.class.getClassLoader().getResource("MyDataSet.xml");
  return new XmlDataSet(new FileInputStream(url.getPath()));

代码示例来源:origin: dayatang/dddlib

private IDataSet getDataSetObject(String path) throws Exception {
  if (getDataSetStrategy().equals(DataSetStrategy.Xml)) {
    return new XmlDataSet(Dbunit.class.getResourceAsStream(path));
  } else if (getDataSetStrategy().equals(DataSetStrategy.FlatXml)) {
    boolean enableColumnSensing = true;
    InputStreamReader inReader = new InputStreamReader(Dbunit.class
        .getResourceAsStream(path), "UTF-8");
    // FlatXmlDataSet fxset = new FlatXmlDataSet(inReader, true,
    // enableColumnSensing, false);
    // return fxset;
    return new CachedDataSet(new FlatXmlProducer(new InputSource(
        inReader), true, enableColumnSensing, false));
  } else {
    return new XmlDataSet(Dbunit.class.getResourceAsStream(path));
  }
}

代码示例来源:origin: org.iternine/jeppetto-test-support

public void loadXmlDataSet(InputStream inputStream) {
  try {
    IDataSet dataSet = new XmlDataSet(inputStream);
    executeArbitrarySql("SET REFERENTIAL_INTEGRITY FALSE");
    DatabaseOperation.REFRESH.execute(getIDatabaseConnection(), dataSet);
    executeArbitrarySql("SET REFERENTIAL_INTEGRITY TRUE");
  } catch (DatabaseUnitException e) {
    throw new RuntimeException(e);
  } catch (SQLException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: net.sourceforge.openutils/openutils-testing

dataSet = new XmlDataSet(is);

代码示例来源:origin: org.iternine/jeppetto-test-support

public void loadXmlDataSet(InputStream inputStream) {
  IDatabaseConnection databaseConnection = null;
  try {
    databaseConnection = getIDatabaseConnection();
    IDataSet dataSet = new XmlDataSet(inputStream);
    DatabaseOperation.REFRESH.execute(databaseConnection, dataSet);
  } catch (DatabaseUnitException e) {
    throw new RuntimeException(e);
  } catch (SQLException e) {
    throw new RuntimeException(e);
  } finally {
    if (databaseConnection != null) {
      try { databaseConnection.close(); } catch (SQLException ignore) { }
    }
  }
}

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-bluebill-stats-test-commons

/*******************************************************************************************************************
 *
 * Populates the database from the given XML file.
 * 
 * @param  transactionManager   the Spring transaction manager
 * @param  xmlFile              the file with the data to populate the database with
 * 
 ******************************************************************************************************************/
public static void populate (final @Nonnull JpaTransactionManager transactionManager,
               final @Nonnull File xmlFile) 
 throws SQLException, DatabaseUnitException, IOException
 {
  log.info("******** populate(.., {})", xmlFile);
  final @Cleanup IDatabaseConnection connection = createConnection(transactionManager);
  final @Cleanup Reader r = new FileReader(xmlFile);
  DatabaseOperation.INSERT.execute(connection, new XmlDataSet(r));
  r.close();
  connection.close();
 }

代码示例来源:origin: org.iternine/jeppetto-test-support

public static void assertDatabaseContentsEquals(Database database, InputStream inputStream,
                        Map<String, String[]> ignoreMap) {
  Map<ITableFilter, IColumnFilter> filterMap = createFilterMap(ignoreMap);
  try {
    IDataSet databaseDataSet = database.getIDatabaseConnection().createDataSet();
    IDataSet actualDataSet = removeIgnoredColumns(databaseDataSet, filterMap);
    IDataSet xmlDataSet = new XmlDataSet(inputStream);
    IDataSet expectedDataSet = removeIgnoredColumns(xmlDataSet, filterMap);
    String[] expectedTableNames = expectedDataSet.getTableNames();
    for (String expectedTableName : expectedTableNames) {
      Assertion.assertEquals(new SortedTable(expectedDataSet.getTable(expectedTableName)),
                  new SortedTable(actualDataSet.getTable(expectedTableName),
                          expectedDataSet.getTable(expectedTableName).getTableMetaData()));
    }
  } catch (SQLException e) {
    throw new RuntimeException(e);
  } catch (DataSetException e) {
    throw new RuntimeException(e);
  } catch (DatabaseUnitException e) {
    throw new AssertionFailedError(e.getMessage());
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com