Search in sources :

Example 1 with CellTuple

use of com.google.refine.expr.CellTuple in project OpenRefine by OpenRefine.

the class JythonEvaluableTest method testJythonConcurrent.

@Test
public void testJythonConcurrent() {
    Properties props = new Properties();
    Project project = new Project();
    Row row = new Row(2);
    row.setCell(0, new Cell("one", null));
    row.setCell(0, new Cell("1", null));
    props.put("columnName", "number");
    props.put("true", "true");
    props.put("false", "false");
    props.put("rowIndex", "0");
    props.put("value", 1);
    props.put("project", project);
    props.put("call", "number");
    props.put("PI", "3.141592654");
    props.put("cells", new CellTuple(project, row));
    Evaluable eval1 = new JythonEvaluable("a = value\nreturn a * 2");
    Long value1 = (Long) eval1.evaluate(props);
    // create some unrelated evaluable
    new JythonEvaluable("a = value\nreturn a * 10");
    // repeat same previous test
    Long value2 = (Long) eval1.evaluate(props);
    Assert.assertEquals(value1, value2);
}
Also used : Project(com.google.refine.model.Project) Evaluable(com.google.refine.expr.Evaluable) CellTuple(com.google.refine.expr.CellTuple) Row(com.google.refine.model.Row) Properties(java.util.Properties) Cell(com.google.refine.model.Cell) Test(org.testng.annotations.Test)

Aggregations

CellTuple (com.google.refine.expr.CellTuple)1 Evaluable (com.google.refine.expr.Evaluable)1 Cell (com.google.refine.model.Cell)1 Project (com.google.refine.model.Project)1 Row (com.google.refine.model.Row)1 Properties (java.util.Properties)1 Test (org.testng.annotations.Test)1