Moved variable to local scope
This commit is contained in:
parent
c10f72437f
commit
df920777ac
@ -70,7 +70,6 @@ import com.google.refine.tests.util.TestUtils;
|
|||||||
|
|
||||||
public class JoinMultiValuedCellsTests extends RefineTest {
|
public class JoinMultiValuedCellsTests extends RefineTest {
|
||||||
// dependencies
|
// dependencies
|
||||||
private RefineServlet servlet;
|
|
||||||
private Project project;
|
private Project project;
|
||||||
private ProjectMetadata pm;
|
private ProjectMetadata pm;
|
||||||
private JSONObject options;
|
private JSONObject options;
|
||||||
@ -86,17 +85,17 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void setUp() throws JSONException, IOException, ModelException {
|
public void setUp() throws JSONException, IOException, ModelException {
|
||||||
servlet = new RefineServletStub();
|
RefineServlet servlet = new RefineServletStub();
|
||||||
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||||
FileProjectManager.initialize(dir);
|
FileProjectManager.initialize(dir);
|
||||||
project = new Project();
|
project = new Project();
|
||||||
pm = new ProjectMetadata();
|
pm = new ProjectMetadata();
|
||||||
pm.setName("JoinMultiValuedCells test");
|
pm.setName("JoinMultiValuedCells test");
|
||||||
ProjectManager.singleton.registerProject(project, pm);
|
ProjectManager.singleton.registerProject(project, pm);
|
||||||
options = mock(JSONObject.class);
|
options = mock(JSONObject.class);
|
||||||
|
|
||||||
ImportingManager.initialize(servlet);
|
ImportingManager.initialize(servlet);
|
||||||
job = ImportingManager.createJob();
|
job = ImportingManager.createJob();
|
||||||
importer = new SeparatorBasedImporter();
|
importer = new SeparatorBasedImporter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,9 +104,9 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
ImportingManager.disposeJob(job.id);
|
ImportingManager.disposeJob(job.id);
|
||||||
ProjectManager.singleton.deleteProject(project.id);
|
ProjectManager.singleton.deleteProject(project.id);
|
||||||
job = null;
|
job = null;
|
||||||
project = null;
|
project = null;
|
||||||
pm = null;
|
pm = null;
|
||||||
options = null;
|
options = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,17 +121,17 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
+ ",three\n"
|
+ ",three\n"
|
||||||
+ ",four\n";
|
+ ",four\n";
|
||||||
prepareOptions(",", 10, 0, 0, 1, false, false);
|
prepareOptions(",", 10, 0, 0, 1, false, false);
|
||||||
List<Exception> exceptions = new ArrayList<Exception>();
|
List<Exception> exceptions = new ArrayList<Exception>();
|
||||||
importer.parseOneFile(project, pm, job, "filesource", new StringReader(csv), -1, options, exceptions);
|
importer.parseOneFile(project, pm, job, "filesource", new StringReader(csv), -1, options, exceptions);
|
||||||
project.update();
|
project.update();
|
||||||
ProjectManager.singleton.registerProject(project, pm);
|
ProjectManager.singleton.registerProject(project, pm);
|
||||||
|
|
||||||
AbstractOperation op = new MultiValuedCellJoinOperation(
|
AbstractOperation op = new MultiValuedCellJoinOperation(
|
||||||
"Value",
|
"Value",
|
||||||
"Key",
|
"Key",
|
||||||
",");
|
",");
|
||||||
Process process = op.createProcess(project, new Properties());
|
Process process = op.createProcess(project, new Properties());
|
||||||
process.performImmediate();
|
process.performImmediate();
|
||||||
|
|
||||||
int keyCol = project.columnModel.getColumnByName("Key").getCellIndex();
|
int keyCol = project.columnModel.getColumnByName("Key").getCellIndex();
|
||||||
int valueCol = project.columnModel.getColumnByName("Value").getCellIndex();
|
int valueCol = project.columnModel.getColumnByName("Value").getCellIndex();
|
||||||
@ -149,17 +148,17 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
+ ",three\n"
|
+ ",three\n"
|
||||||
+ ",four\n";
|
+ ",four\n";
|
||||||
prepareOptions(",", 10, 0, 0, 1, false, false);
|
prepareOptions(",", 10, 0, 0, 1, false, false);
|
||||||
List<Exception> exceptions = new ArrayList<Exception>();
|
List<Exception> exceptions = new ArrayList<Exception>();
|
||||||
importer.parseOneFile(project, pm, job, "filesource", new StringReader(csv), -1, options, exceptions);
|
importer.parseOneFile(project, pm, job, "filesource", new StringReader(csv), -1, options, exceptions);
|
||||||
project.update();
|
project.update();
|
||||||
ProjectManager.singleton.registerProject(project, pm);
|
ProjectManager.singleton.registerProject(project, pm);
|
||||||
|
|
||||||
AbstractOperation op = new MultiValuedCellJoinOperation(
|
AbstractOperation op = new MultiValuedCellJoinOperation(
|
||||||
"Value",
|
"Value",
|
||||||
"Key",
|
"Key",
|
||||||
", ,");
|
", ,");
|
||||||
Process process = op.createProcess(project, new Properties());
|
Process process = op.createProcess(project, new Properties());
|
||||||
process.performImmediate();
|
process.performImmediate();
|
||||||
|
|
||||||
int keyCol = project.columnModel.getColumnByName("Key").getCellIndex();
|
int keyCol = project.columnModel.getColumnByName("Key").getCellIndex();
|
||||||
int valueCol = project.columnModel.getColumnByName("Value").getCellIndex();
|
int valueCol = project.columnModel.getColumnByName("Value").getCellIndex();
|
||||||
@ -169,19 +168,18 @@ public class JoinMultiValuedCellsTests extends RefineTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void prepareOptions(
|
private void prepareOptions(
|
||||||
String sep, int limit, int skip, int ignoreLines,
|
String sep, int limit, int skip, int ignoreLines,
|
||||||
int headerLines, boolean guessValueType, boolean ignoreQuotes) {
|
int headerLines, boolean guessValueType, boolean ignoreQuotes) {
|
||||||
|
|
||||||
whenGetStringOption("separator", options, sep);
|
whenGetStringOption("separator", options, sep);
|
||||||
whenGetIntegerOption("limit", options, limit);
|
whenGetIntegerOption("limit", options, limit);
|
||||||
whenGetIntegerOption("skipDataLines", options, skip);
|
whenGetIntegerOption("skipDataLines", options, skip);
|
||||||
whenGetIntegerOption("ignoreLines", options, ignoreLines);
|
whenGetIntegerOption("ignoreLines", options, ignoreLines);
|
||||||
whenGetIntegerOption("headerLines", options, headerLines);
|
whenGetIntegerOption("headerLines", options, headerLines);
|
||||||
whenGetBooleanOption("guessCellValueTypes", options, guessValueType);
|
whenGetBooleanOption("guessCellValueTypes", options, guessValueType);
|
||||||
whenGetBooleanOption("processQuotes", options, !ignoreQuotes);
|
whenGetBooleanOption("processQuotes", options, !ignoreQuotes);
|
||||||
whenGetBooleanOption("storeBlankCellsAsNulls", options, true);
|
whenGetBooleanOption("storeBlankCellsAsNulls", options, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user