Skip to content

Commit

Permalink
Add Xls format support, close #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Landelle committed Dec 4, 2012
1 parent 254808a commit e1265df
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.csv.CsvDataSet;
import org.dbunit.dataset.excel.XlsDataSet;
import org.dbunit.dataset.stream.StreamingDataSet;
import org.dbunit.dataset.xml.FlatDtdDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSet;
Expand Down Expand Up @@ -84,6 +85,7 @@ protected IDataSet fromResource(Resource resource, DataSetFormatOptions options)
return builder.build(resource.getInputStream());
}
},

/**
* @see {@link XmlDataSet}.
*/
Expand All @@ -96,6 +98,7 @@ protected IDataSet fromResource(Resource resource, DataSetFormatOptions options)
return new XmlDataSet(resource.getInputStream());
}
},

/**
* @see {@link StreamingXmlDataSet}.
*/
Expand All @@ -108,6 +111,7 @@ protected IDataSet fromResource(Resource resource, DataSetFormatOptions options)
return new StreamingDataSet(new XmlProducer(new InputSource(resource.getInputStream())));
}
},

/**
* @see {@link FlatDtdDataSet}.
*/
Expand All @@ -118,6 +122,7 @@ protected IDataSet fromResource(Resource resource, DataSetFormatOptions options)
return new FlatDtdDataSet(new LinkedHashMapFlatDtdProducer(new InputSource(resource.getInputStream())));
}
},

/**
* @see {@link CsvDataSet}.
*/
Expand All @@ -126,6 +131,16 @@ protected IDataSet fromResource(Resource resource, DataSetFormatOptions options)
protected IDataSet fromResource(Resource resource, DataSetFormatOptions options) throws DataSetException, IOException {
return new CsvDataSet(resource.getFile());
}
},

/**
* @see {@link CsvDataSet}.
*/
XLS {
@Override
protected IDataSet fromResource(Resource resource, DataSetFormatOptions options) throws DataSetException, IOException {
return new XlsDataSet(resource.getFile());
}
};

private static final ResourcePatternResolver RESOURCE_LOADER = new PathMatchingResourcePatternResolver();
Expand Down

0 comments on commit e1265df

Please sign in to comment.