Search in sources :

Example 76 with Project

use of com.google.refine.model.Project in project OpenRefine by OpenRefine.

the class FunctionTests 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);
    }
}
Also used : Project(com.google.refine.model.Project) Column(com.google.refine.model.Column) ProjectMetadata(com.google.refine.ProjectMetadata) Row(com.google.refine.model.Row) Properties(java.util.Properties) File(java.io.File) Cell(com.google.refine.model.Cell) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 77 with Project

use of com.google.refine.model.Project in project OpenRefine by OpenRefine.

the class HistoryTests method SetUp.

@BeforeMethod
public void SetUp() {
    projectManager = mock(ProjectManager.class);
    ProjectManager.singleton = projectManager;
    proj = new Project();
    SUT = new History(proj);
}
Also used : Project(com.google.refine.model.Project) History(com.google.refine.history.History) ProjectManager(com.google.refine.ProjectManager) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 78 with Project

use of com.google.refine.model.Project in project OpenRefine by OpenRefine.

the class ImporterTest method setUp.

public void setUp() {
    //FIXME - should we try and use mock(Project.class); - seems unnecessary complexity
    servlet = new RefineServletStub();
    ImportingManager.initialize(servlet);
    project = new Project();
    metadata = new ProjectMetadata();
    job = ImportingManager.createJob();
    options = Mockito.mock(JSONObject.class);
}
Also used : Project(com.google.refine.model.Project) RefineServletStub(com.google.refine.tests.RefineServletStub) JSONObject(org.json.JSONObject) ProjectMetadata(com.google.refine.ProjectMetadata)

Example 79 with Project

use of com.google.refine.model.Project in project OpenRefine by OpenRefine.

the class ImporterUtilitiesTests method setupColumns.

@Test
public void setupColumns() {
    Project project = new Project();
    List<String> columnNames = new ArrayList<String>();
    columnNames.add("col1");
    columnNames.add("col2");
    columnNames.add("");
    ImporterUtilities.setupColumns(project, columnNames);
    Assert.assertEquals(project.columnModel.columns.get(0).getName(), "col1");
    Assert.assertEquals(project.columnModel.columns.get(1).getName(), "col2");
    Assert.assertEquals(project.columnModel.columns.get(2).getName(), "Column");
}
Also used : Project(com.google.refine.model.Project) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) RefineTest(com.google.refine.tests.RefineTest)

Example 80 with Project

use of com.google.refine.model.Project in project OpenRefine by OpenRefine.

the class UrlFetchingTests method SetUp.

@BeforeMethod
public void SetUp() throws JSONException, IOException, ModelException {
    File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
    FileProjectManager.initialize(dir);
    project = new Project();
    ProjectMetadata pm = new ProjectMetadata();
    pm.setName("URL Fetching Test Project");
    ProjectManager.singleton.registerProject(project, pm);
    int index = project.columnModel.allocateNewCellIndex();
    Column column = new Column(index, "fruits");
    project.columnModel.addColumn(index, column, true);
    options = mock(Properties.class);
    engine = new Engine(project);
    engine_config = new JSONObject(ENGINE_JSON_URLS);
    engine.initializeFromJSON(engine_config);
    engine.setMode(Engine.Mode.RowBased);
    bindings = new Properties();
    bindings.put("project", project);
}
Also used : Project(com.google.refine.model.Project) JSONObject(org.json.JSONObject) Column(com.google.refine.model.Column) ProjectMetadata(com.google.refine.ProjectMetadata) Properties(java.util.Properties) File(java.io.File) Engine(com.google.refine.browsing.Engine) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Project (com.google.refine.model.Project)146 Properties (java.util.Properties)46 IOException (java.io.IOException)40 Engine (com.google.refine.browsing.Engine)37 Test (org.testng.annotations.Test)37 ServletException (javax.servlet.ServletException)35 ProjectMetadata (com.google.refine.ProjectMetadata)33 BeforeMethod (org.testng.annotations.BeforeMethod)31 Cell (com.google.refine.model.Cell)29 Row (com.google.refine.model.Row)29 RefineTest (com.google.refine.RefineTest)25 Column (com.google.refine.model.Column)25 BeforeTest (org.testng.annotations.BeforeTest)18 Process (com.google.refine.process.Process)17 AbstractOperation (com.google.refine.model.AbstractOperation)14 StringWriter (java.io.StringWriter)13 RowVisitor (com.google.refine.browsing.RowVisitor)11 ArrayList (java.util.ArrayList)11 File (java.io.File)10 WrappedCell (com.google.refine.expr.WrappedCell)9