日期:2014-05-16 浏览次数:20791 次
<dataset> <Person Name="Kirin" Age="31" Location="Beijing"/> <Person Name="Jade" Age="30"/> </dataset>
<dataset> <Person> <Name>Kirin</Name> <Age>31</Age> <Location>Beijing</Location> </Person> <Person> <Name>Jade</Name> <Age>30</Age> <Location/> </Person> </dataset>
QueryDataSet dataSet = new QueryDataSet(connection); dataSet.addTable(TABLE_NAME, "select * from " + TABLE_NAME); dataSet.addTable(...); FlatXmlDataSet.write(dataSet, new FileOutputStream("data.xml"));
@Override protected IDataSet getDataSet() throws Exception { // set column sensing as true, so it can dynamically and columns with null value. return new FlatXmlDataSetBuilder() .setColumnSensing(true) .build(new FileInputStream("data.xml")); }
protected void setUp() throws Exception { super.setUp(); final IDatabaseTester databaseTester = getDatabaseTester(); assertNotNull( "DatabaseTester is not set", databaseTester ); databaseTester.setSetUpOperation( getSetUpOperation() ); databaseTester.setDataSet( getDataSet() ); databaseTester.setOperationListener(getOperationListener()); databaseTester.onSetup(); } protected void tearDown() throws Exception { try { final IDatabaseTester databaseTester = getDatabaseTester(); assertNotNull( "DatabaseTester is not set", databaseTester ); databaseTester.setTearDownOperation( getTearDownOperation() ); databaseTester.setDataSet( getDataSet() ); databaseTester.setOperationListener(getOperationListener()); databaseTester.onTearDown(); } finally { tester = null; super.tearDown(); } }