Really restore Java 6 compatibilty
This commit is contained in:
parent
3b835fabad
commit
8cb1dc05f8
@ -60,8 +60,7 @@ import com.google.refine.model.ModelException;
|
||||
import com.google.refine.model.Project;
|
||||
import com.google.refine.model.Row;
|
||||
import com.google.refine.tests.RefineTest;
|
||||
//import java.nio.file.Files;
|
||||
//import java.nio.file.Path;
|
||||
import com.google.refine.tests.util.TestUtils;
|
||||
|
||||
|
||||
public class FunctionTests extends RefineTest {
|
||||
@ -83,9 +82,7 @@ public class FunctionTests extends RefineTest {
|
||||
public void SetUp() throws IOException, ModelException {
|
||||
bindings = new Properties();
|
||||
|
||||
File dir = File.createTempFile("openrefine-test-workspace-dir", "");
|
||||
dir.delete();
|
||||
dir.mkdir();
|
||||
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||
FileProjectManager.initialize(dir);
|
||||
project = new Project();
|
||||
ProjectMetadata pm = new ProjectMetadata();
|
||||
@ -108,6 +105,7 @@ public class FunctionTests extends RefineTest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@AfterMethod
|
||||
public void TearDown() {
|
||||
bindings = null;
|
||||
|
@ -35,9 +35,8 @@ package com.google.refine.tests.model;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
@ -64,6 +63,7 @@ import com.google.refine.model.Row;
|
||||
import com.google.refine.operations.EngineDependentOperation;
|
||||
import com.google.refine.operations.row.RowRemovalOperation;
|
||||
import com.google.refine.tests.RefineTest;
|
||||
import com.google.refine.tests.util.TestUtils;
|
||||
|
||||
|
||||
public class CacheTests extends RefineTest {
|
||||
@ -92,8 +92,8 @@ public class CacheTests extends RefineTest {
|
||||
|
||||
@BeforeMethod
|
||||
public void SetUp() throws JSONException, IOException, ModelException {
|
||||
Path dir = Files.createTempDirectory("openrefine-test-workspace-dir");
|
||||
FileProjectManager.initialize(dir.toFile());
|
||||
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||
FileProjectManager.initialize(dir);
|
||||
project = new Project();
|
||||
ProjectMetadata pm = new ProjectMetadata();
|
||||
pm.setName("TNG Test Project");
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.google.refine.tests.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class TestUtils {
|
||||
|
||||
/**
|
||||
* Create a temporary directory. NOTE: This is a quick and dirty
|
||||
* implementation suitable for tests, not production code.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static File createTempDirectory(String name)
|
||||
throws IOException {
|
||||
File dir = File.createTempFile(name, "");
|
||||
dir.delete();
|
||||
dir.mkdir();
|
||||
return dir;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user