Search in sources :

Example 1 with LineageWriter

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));
}
Also used : PrintStream(java.io.PrintStream) Graph(com.tinkerpop.blueprints.Graph) LineageWriter(org.pentaho.metaverse.impl.LineageWriter) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) IGraphWriter(org.pentaho.metaverse.api.IGraphWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) ExecutionProfile(org.pentaho.metaverse.impl.model.ExecutionProfile) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) Test(org.junit.Test)

Aggregations

Graph (com.tinkerpop.blueprints.Graph)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 Test (org.junit.Test)1 IGraphWriter (org.pentaho.metaverse.api.IGraphWriter)1 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)1 IExecutionProfile (org.pentaho.metaverse.api.model.IExecutionProfile)1 LineageHolder (org.pentaho.metaverse.api.model.LineageHolder)1 LineageWriter (org.pentaho.metaverse.impl.LineageWriter)1 ExecutionProfile (org.pentaho.metaverse.impl.model.ExecutionProfile)1