holmos.webtest.junitextentions.parameters.filepathanalysis.analysisimp.DefaultDataFilePathAnalysisRobot Maven / Gradle / Ivy
package holmos.webtest.junitextentions.parameters.filepathanalysis.analysisimp;
import holmos.webtest.basetools.HolmosPropertiesTool;
import holmos.webtest.constvalue.ConfigConstValue;
import holmos.webtest.junitextentions.parameters.filepathanalysis.DataFilePathAnalysisRobot;
import java.util.Properties;
/**
* @author 吴银龙([email protected])
* */
public class DefaultDataFilePathAnalysisRobot implements DataFilePathAnalysisRobot{
/*实际的路径分析器,这个是为了扩展,开发者可以更改此器来设置不同的 DefaultDataFilePathAnalysisRobot*/
protected LocalFilePathAnalysisRobot filePathAnalysisRobot;
public DefaultDataFilePathAnalysisRobot(){
this.filePathAnalysisRobot=new LocalFilePathAnalysisRobot();
}
public DefaultDataFilePathAnalysisRobot(Properties properties){
init(properties);
}
public void init(Properties properties){
boolean usePackagePath=HolmosPropertiesTool.getBoolean(properties, ConfigConstValue.DATA_SOURCE_PACKAGE_PREFIX_USEABLE);
String prefixPath=HolmosPropertiesTool.getValue(properties, ConfigConstValue.DATA_SOURCE_PREFIX_VALUE);
filePathAnalysisRobot=new LocalFilePathAnalysisRobot(usePackagePath, prefixPath);
}
public String analysis(Class> testClass, String fileName) {
return filePathAnalysisRobot.getFilePath(fileName, testClass).getPath();
}
}