All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.springtestdbunit.dataset.XmlDataSetLoader Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
package com.github.springtestdbunit.dataset;

import java.io.IOException;
import java.io.InputStream;

import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
import org.springframework.core.io.Resource;

/**
 * A {@link DataSetLoader data set loader} that can be used to load {@link XmlDataSet XmlDataSets}.
 *
 * @author Jorge Davison
 * @since 1.3.0
 */
public class XmlDataSetLoader extends AbstractDataSetLoader {

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy