use of com.google.refine.ProjectMetadata 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();
}
}
use of com.google.refine.ProjectMetadata 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.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);
}
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();
ImportingJob spiedJob = ImportingManager.createJob();
job = Mockito.spy(spiedJob);
when(job.getRetrievalRecord()).thenReturn(ParsingUtilities.mapper.createObjectNode());
options = Mockito.mock(ObjectNode.class);
}
use of com.google.refine.ProjectMetadata in project OpenRefine by OpenRefine.
the class ProjectMetadataTests method serializeProjectMetadata.
@Test
public void serializeProjectMetadata() throws IOException {
ProjectMetadata metadata = ParsingUtilities.mapper.readValue(jsonSaveMode, ProjectMetadata.class);
TestUtils.isSerializedTo(metadata, jsonNonSaveMode);
TestUtils.isSerializedTo(metadata, jsonSaveMode, true);
}
Aggregations