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.Project;
|
||||||
import com.google.refine.model.Row;
|
import com.google.refine.model.Row;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
//import java.nio.file.Files;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
//import java.nio.file.Path;
|
|
||||||
|
|
||||||
|
|
||||||
public class FunctionTests extends RefineTest {
|
public class FunctionTests extends RefineTest {
|
||||||
@ -83,9 +82,7 @@ public class FunctionTests extends RefineTest {
|
|||||||
public void SetUp() throws IOException, ModelException {
|
public void SetUp() throws IOException, ModelException {
|
||||||
bindings = new Properties();
|
bindings = new Properties();
|
||||||
|
|
||||||
File dir = File.createTempFile("openrefine-test-workspace-dir", "");
|
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||||
dir.delete();
|
|
||||||
dir.mkdir();
|
|
||||||
FileProjectManager.initialize(dir);
|
FileProjectManager.initialize(dir);
|
||||||
project = new Project();
|
project = new Project();
|
||||||
ProjectMetadata pm = new ProjectMetadata();
|
ProjectMetadata pm = new ProjectMetadata();
|
||||||
@ -108,6 +105,7 @@ public class FunctionTests extends RefineTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterMethod
|
@AfterMethod
|
||||||
public void TearDown() {
|
public void TearDown() {
|
||||||
bindings = null;
|
bindings = null;
|
||||||
|
@ -35,9 +35,8 @@ package com.google.refine.tests.model;
|
|||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
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.EngineDependentOperation;
|
||||||
import com.google.refine.operations.row.RowRemovalOperation;
|
import com.google.refine.operations.row.RowRemovalOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
|
||||||
|
|
||||||
public class CacheTests extends RefineTest {
|
public class CacheTests extends RefineTest {
|
||||||
@ -92,8 +92,8 @@ public class CacheTests extends RefineTest {
|
|||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void SetUp() throws JSONException, IOException, ModelException {
|
public void SetUp() throws JSONException, IOException, ModelException {
|
||||||
Path dir = Files.createTempDirectory("openrefine-test-workspace-dir");
|
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||||
FileProjectManager.initialize(dir.toFile());
|
FileProjectManager.initialize(dir);
|
||||||
project = new Project();
|
project = new Project();
|
||||||
ProjectMetadata pm = new ProjectMetadata();
|
ProjectMetadata pm = new ProjectMetadata();
|
||||||
pm.setName("TNG Test Project");
|
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