use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class ExpressionUtils method bind.
public static void bind(Properties bindings, Row row, int rowIndex, String columnName, Cell cell) {
Project project = (Project) bindings.get("project");
bindings.put("rowIndex", rowIndex);
bindings.put("row", new WrappedRow(project, rowIndex, row));
bindings.put("cells", new CellTuple(project, row));
if (columnName != null) {
bindings.put("columnName", columnName);
}
if (cell == null) {
bindings.remove("cell");
bindings.remove("value");
} else {
bindings.put("cell", new WrappedCell(project, columnName, cell));
if (cell.value == null) {
bindings.remove("value");
} else {
bindings.put("value", cell.value);
}
}
for (Binder binder : s_binders) {
binder.bind(bindings, row, rowIndex, columnName, cell);
}
}
use of com.google.refine.model.Project in project OpenRefine by OpenRefine.
the class TsvExporterTests method SetUp.
@BeforeMethod
public void SetUp() {
// new TsvExporter();
SUT = new CsvExporter('\t');
writer = new StringWriter();
project = new Project();
engine = new Engine(project);
options = mock(Properties.class);
}
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 SqlExporterTests method SetUp.
@BeforeMethod
public void SetUp() {
SUT = new SqlExporter();
writer = new StringWriter();
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 SetProjectMetadataCommandTests method SetUp.
@BeforeMethod
public void SetUp() throws IOException {
projMan = mock(ProjectManager.class);
ProjectManager.singleton = projMan;
proj = mock(Project.class);
pw = mock(PrintWriter.class);
request = mock(HttpServletRequest.class);
response = mock(HttpServletResponse.class);
SUT = new SetProjectMetadataCommand();
ProjectMetadata metadata = new ProjectMetadata();
metadata.setUserMetadata((ArrayNode) ParsingUtilities.mapper.readTree("[ {name: \"clientID\", display: true} ]"));
// mock dependencies
when(request.getParameter("project")).thenReturn(PROJECT_ID);
when(request.getParameter("csrf_token")).thenReturn(Command.csrfFactory.getFreshToken());
when(projMan.getProject(anyLong())).thenReturn(proj);
when(proj.getMetadata()).thenReturn(metadata);
try {
when(response.getWriter()).thenReturn(pw);
} catch (IOException e1) {
Assert.fail();
}
}
Aggregations