Search in sources :

Example 31 with ProjectMetadata

use of com.google.refine.ProjectMetadata 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 32 with ProjectMetadata

use of com.google.refine.ProjectMetadata 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 33 with ProjectMetadata

use of com.google.refine.ProjectMetadata 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)

Example 34 with ProjectMetadata

use of com.google.refine.ProjectMetadata in project OpenRefine by OpenRefine.

the class MassChangeTests method SetUp.

@BeforeMethod
public void SetUp() throws IOException, ModelException {
    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);
}
Also used : Project(com.google.refine.model.Project) ProjectMetadata(com.google.refine.ProjectMetadata) File(java.io.File) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 35 with ProjectMetadata

use of com.google.refine.ProjectMetadata in project OpenRefine by OpenRefine.

the class ImportingJob method prepareNewProject.

public void prepareNewProject() {
    if (project != null) {
        project.dispose();
    }
    // Make sure all projects have been saved in case we run out of memory
    // or have some other catastrophe on import
    ProjectManager.singleton.save(true);
    project = new Project();
    metadata = new ProjectMetadata();
}
Also used : Project(com.google.refine.model.Project) ProjectMetadata(com.google.refine.ProjectMetadata)

Aggregations

ProjectMetadata (com.google.refine.ProjectMetadata)48 Project (com.google.refine.model.Project)34 BeforeMethod (org.testng.annotations.BeforeMethod)21 Properties (java.util.Properties)15 File (java.io.File)12 Engine (com.google.refine.browsing.Engine)11 IOException (java.io.IOException)9 ServletException (javax.servlet.ServletException)7 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)6 ProjectManagerStub (com.google.refine.ProjectManagerStub)6 Test (org.testng.annotations.Test)6 StringWriter (java.io.StringWriter)5 JSONObject (org.json.JSONObject)5 ImportingJob (com.google.refine.importing.ImportingJob)4 Column (com.google.refine.model.Column)4 ProjectManagerStub (com.google.refine.tests.ProjectManagerStub)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 SeparatorBasedImporter (com.google.refine.importers.SeparatorBasedImporter)3 BeforeTest (org.testng.annotations.BeforeTest)3 ProjectManager (com.google.refine.ProjectManager)2