use of org.pentaho.metaverse.impl.LineageWriter in project pentaho-metaverse by pentaho.
the class BaseRuntimeExtensionPointTest method testWriteLineageHolder.
@Test
public void testWriteLineageHolder() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
assertEquals(0, baos.size());
PrintStream stringStream = new PrintStream(baos);
IGraphWriter graphWriter = mock(IGraphWriter.class);
IExecutionProfile executionProfile = new ExecutionProfile();
executionProfile.setName("testName");
IMetaverseBuilder builder = mock(IMetaverseBuilder.class);
LineageHolder holder = new LineageHolder(executionProfile, builder);
LineageWriter lineageWriter = new LineageWriter();
lineageWriter.setProfileOutputStream(stringStream);
lineageWriter.setGraphOutputStream(System.out);
lineageWriter.setOutputStrategy("all");
lineageWriter.setGraphWriter(graphWriter);
extensionPoint.setLineageWriter(lineageWriter);
extensionPoint.writeLineageInfo(holder);
assertNotEquals(0, baos.size());
assertTrue(baos.toString().contains("testName"));
verify(graphWriter, times(1)).outputGraph(any(Graph.class), any(OutputStream.class));
}
Aggregations