Search in sources :

Example 6 with ProjectMetadata

use of com.google.refine.ProjectMetadata 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);
}
Also used : Project(com.google.refine.model.Project) ProjectManagerStub(com.google.refine.tests.ProjectManagerStub) XlsExporter(com.google.refine.exporters.XlsExporter) ProjectMetadata(com.google.refine.ProjectMetadata) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Properties(java.util.Properties) Engine(com.google.refine.browsing.Engine) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with ProjectMetadata

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

use of com.google.refine.ProjectMetadata 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);
}
Also used : Project(com.google.refine.model.Project) ProjectMetadata(com.google.refine.ProjectMetadata) HistoryEntry(com.google.refine.history.HistoryEntry) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) RefineTest(com.google.refine.tests.RefineTest)

Example 9 with ProjectMetadata

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

the class HtmlExporterTests method SetUp.

@BeforeMethod
public void SetUp() {
    SUT = new HtmlTableExporter();
    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);
}
Also used : Project(com.google.refine.model.Project) ProjectManagerStub(com.google.refine.tests.ProjectManagerStub) StringWriter(java.io.StringWriter) ProjectMetadata(com.google.refine.ProjectMetadata) HtmlTableExporter(com.google.refine.exporters.HtmlTableExporter) Properties(java.util.Properties) Engine(com.google.refine.browsing.Engine) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 10 with ProjectMetadata

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

the class TemplatingExporterTests method SetUp.

@BeforeMethod
public void SetUp() {
    SUT = new TemplatingExporter();
    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);
}
Also used : Project(com.google.refine.model.Project) ProjectManagerStub(com.google.refine.tests.ProjectManagerStub) StringWriter(java.io.StringWriter) ProjectMetadata(com.google.refine.ProjectMetadata) TemplatingExporter(com.google.refine.exporters.TemplatingExporter) Properties(java.util.Properties) Engine(com.google.refine.browsing.Engine) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ProjectMetadata (com.google.refine.ProjectMetadata)22 Project (com.google.refine.model.Project)16 Properties (java.util.Properties)10 BeforeMethod (org.testng.annotations.BeforeMethod)9 File (java.io.File)7 JSONObject (org.json.JSONObject)6 Engine (com.google.refine.browsing.Engine)5 Column (com.google.refine.model.Column)4 ProjectManagerStub (com.google.refine.tests.ProjectManagerStub)4 IOException (java.io.IOException)4 ServletException (javax.servlet.ServletException)3 JSONException (org.json.JSONException)3 Cell (com.google.refine.model.Cell)2 Row (com.google.refine.model.Row)2 RefineServletStub (com.google.refine.tests.RefineServletStub)2 StringWriter (java.io.StringWriter)2 JSONWriter (org.json.JSONWriter)2 BeforeTest (org.testng.annotations.BeforeTest)2 Test (org.testng.annotations.Test)2 AuthenticationException (com.google.gdata.util.AuthenticationException)1