Add support for getTempDir() as required by new importers
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2273 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
ac4a0ca747
commit
e064dcce3e
@ -33,6 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
package com.google.refine.tests;
|
package com.google.refine.tests;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@ -48,6 +49,8 @@ import com.google.refine.commands.Command;
|
|||||||
*/
|
*/
|
||||||
public class RefineServletStub extends RefineServlet {
|
public class RefineServletStub extends RefineServlet {
|
||||||
|
|
||||||
|
private static File tempDir = null;
|
||||||
|
|
||||||
//requirement of extending HttpServlet, not required for testing
|
//requirement of extending HttpServlet, not required for testing
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -59,6 +62,19 @@ public class RefineServletStub extends RefineServlet {
|
|||||||
return super.getCommandKey(request);
|
return super.getCommandKey(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getTempDir() {
|
||||||
|
if (tempDir == null) {
|
||||||
|
try {
|
||||||
|
tempDir = File.createTempFile("refine-test-dir", "");
|
||||||
|
tempDir.deleteOnExit();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to create temp directory",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tempDir;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------helper methods--------------
|
//-------------------helper methods--------------
|
||||||
/**
|
/**
|
||||||
* Helper method for inserting a mock object
|
* Helper method for inserting a mock object
|
||||||
|
Loading…
Reference in New Issue
Block a user