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

org.etlunit.io.file.DataFileManager Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
package org.etlunit.io.file;

import org.etlunit.DiffManager;
import org.etlunit.parser.ETLTestOperation;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface DataFileManager
{
	String DEFAULT_COLUMN_DELIMITER = "\t";
	String DEFAULT_ROW_DELIMITER = "\n";
	String DEFAULT_NULL_TOKEN = "null";

	DataFileSchema.format_type DEFAULT_FORMAT_TYPE = DataFileSchema.format_type.delimited;

	void setDefaultColumnDelimiter(String delimiter);

	void setDefaultRowDelimiter(String delimiter);

	void setDefaultNullToken(String token);

	void setDefaultFormatType(DataFileSchema.format_type type);


	String getDefaultColumnDelimiter();

	String getDefaultRowDelimiter();

	String getDefaultNullToken();

	DataFileSchema.format_type getDefaultFormatType();

	DataFileSchema loadDataFileSchemaFromResource(String resourcePath);

	DataFileSchema loadDataFileSchemaFromResource(String resourcePath, Object classLoaderContext);

	DataFileSchema createDataFileSchema(String id);

	DataFileSchema loadDataFileSchema(File schema);

	DataFile loadDataFile(File file, DataFileSchema schema);

	/**
	 * Compares l-file to r-file, using the column list in lfile as the basis for comparison.  Any
	 * additional columns in the r-file will be ignored.   Both files must be ordered according to the
	 * order key (defined by the order columns in the schema).
	 *
	 * @param lfile
	 * @param rfile
	 * @return
	 */
	List diff(DataFile lfile, DataFile rfile) throws IOException;

	List diff(DataFile lfile, DataFile rfile, List columns) throws IOException;

	void report(DiffManager dManager, ETLTestOperation operation, String failureId, List diffs);

	DataFormatValidator resolveValidatorById(String id);

	/**
	 * Copies a data file from one schema to another.  These schemas must be compatible
	 * or else the copy will fail (E.G., if there is no intersection between the two schemas
	 * then the resulting file will be all nulls.
	 *
	 * @param source
	 * @param dest
	 */
	void copyDataFile(DataFile source, DataFile dest, Map defaultValues) throws IOException;

	void copyDataFile(DataFile source, DataFile dest) throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy