/*
* Copyright (C) 2004 Paul Browne, http://www.firstpartners.net,
* built with the help of Fast-Soft (fastsoftdev@yahoo.com)
*
* released under terms of the GPL license
* http://www.opensource.org/licenses/gpl-license.php
*
* This product includes software developed by the
* Apache Software Foundation (http://www.apache.org)."
*
* This product includes software developed by the
* Spring Framework Project (http://www.springframework.org)."
*
*/
package net.fp.rp.search.back.extractor;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import net.fp.rp.search.common.AddInfo;
import net.fp.rp.common.exception.RpException;
import net.fp.rp.search.plugins.IDataExtractor;
/**
* General extractor test case which define the location to extract and
* the associated extractor to handle this.
*
*
* @author Firstpartners.net
* @version 1.4
*/
public class ExtractorTestCase extends TestCase {
/** Location of the information*/
private String location;
/** Extractor name used */
private String extractor;
/** Extractor object */
private IDataExtractor dataextractor;
/**
* Creates a new ExtractorTestCase object.
*/
public ExtractorTestCase() {
super();
}
/**
* Creates a new ExtractorTestCase object.
*
* @param name DOCUMENT ME!
*/
public ExtractorTestCase(String name) {
super(name);
}
/**
*
* @return Returns the extractor.
*/
public String getExtractor() {
return extractor;
}
/**
*
* @param extractor The extractor to set.
*/
public void setExtractor(String extractor) {
this.extractor = extractor;
}
/**
*
* @return Returns the location.
*/
public String getLocation() {
return location;
}
/**
*
* @param location The location to set.
*/
public void setLocation(String location) {
this.location = location;
}
/**
*
* @return Returns the dataextractor.
*/
public IDataExtractor getDataextractor() {
return dataextractor;
}
/**
*
* @param dataextractor The dataextractor to set.
*/
public void setDataextractor(IDataExtractor dataextractor) {
this.dataextractor = dataextractor;
}
/**
* Test the conversion of the information
*
* @throws AssertionFailedError If an error occur
*/
public void test() {
assertNotNull(extractor);
//define a new add information
AddInfo info = new AddInfo(location,location);
try {
dataextractor.convert(info);
/*
if (docList.size() == 0) {
throw new AssertionFailedError(
"No document in the conversion process" +
"for the location :" + location);
}
*/
} catch (RpException e) {
System.out.println("Exception in converting the data " +
e.getMessage());
throw new AssertionFailedError(
"Exception occur in the conversion process" +
"for the location :" + location);
}
}
}