use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class ImportingUtilities method createProject.
public static long createProject(final ImportingJob job, final String format, final JSONObject optionObj, final List<Exception> exceptions, boolean synchronous) {
final Format record = ImportingManager.formatToRecord.get(format);
if (record == null || record.parser == null) {
// TODO: what to do?
return -1;
}
job.setState("creating-project");
final Project project = new Project();
if (synchronous) {
createProjectSynchronously(job, format, optionObj, exceptions, record, project);
} else {
new Thread() {
@Override
public void run() {
createProjectSynchronously(job, format, optionObj, exceptions, record, project);
}
}.start();
}
return project.id;
}
use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class XlsExporterTests method SetUp.
@BeforeMethod
public void SetUp() {
SUT = new XlsExporter(false);
stream = new ByteArrayOutputStream();
ProjectManager.singleton = new ProjectManagerStub();
projectMetadata = new ProjectMetadata();
project = new Project();
projectMetadata.setName(TEST_PROJECT_NAME);
ProjectManager.singleton.registerProject(project, projectMetadata);
engine = new Engine(project);
options = mock(Properties.class);
}
use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class BooleanTests method SetUp.
@BeforeMethod
public void SetUp() throws IOException, ModelException {
bindings = new Properties();
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
FileProjectManager.initialize(dir);
project = new Project();
ProjectMetadata pm = new ProjectMetadata();
pm.setName("TNG Test Project");
ProjectManager.singleton.registerProject(project, pm);
int index = project.columnModel.allocateNewCellIndex();
Column column = new Column(index, "Column A");
project.columnModel.addColumn(index, column, true);
options = mock(Properties.class);
bindings.put("project", project);
// Five rows of a's and five of 1s
for (int i = 0; i < 10; i++) {
Row row = new Row(1);
row.setCell(0, new Cell(i < 5 ? "a" : new Integer(1), null));
project.rows.add(row);
}
}
use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class GrelTests method SetUp.
@BeforeMethod
public void SetUp() {
project = new Project();
bindings = ExpressionUtils.createBindings(project);
}
use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class HistoryTests method canAddEntry.
@Test
public void canAddEntry() {
//local dependencies
HistoryEntry entry = mock(HistoryEntry.class);
Project project = mock(Project.class);
ProjectMetadata projectMetadata = mock(ProjectMetadata.class);
when(projectManager.getProject(Mockito.anyLong())).thenReturn(project);
when(projectManager.getProjectMetadata(Mockito.anyLong())).thenReturn(projectMetadata);
SUT.addEntry(entry);
verify(projectManager, times(1)).getProject(Mockito.anyLong());
verify(entry, times(1)).apply(project);
verify(projectMetadata, times(1)).updateModified();
Assert.assertEquals(SUT.getLastPastEntries(1).get(0), entry);
}
Aggregations