Search in sources :

Example 1 with IGraphWriter

use of org.pentaho.metaverse.api.IGraphWriter in project pentaho-metaverse by pentaho.

the class LineageWriterTest method testOutputLineageGraph.

@Test
public void testOutputLineageGraph() throws Exception {
    Graph g = new TinkerGraph();
    IMetaverseBuilder builder = new MetaverseBuilder(g);
    holder.setMetaverseBuilder(builder);
    writer.setGraphOutputStream(System.out);
    IGraphWriter graphWriter = mock(IGraphWriter.class);
    writer.setGraphWriter(graphWriter);
    writer.outputLineageGraph(holder);
}
Also used : TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) Graph(com.tinkerpop.blueprints.Graph) TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) IGraphWriter(org.pentaho.metaverse.api.IGraphWriter) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) IMetaverseBuilder(org.pentaho.metaverse.api.IMetaverseBuilder) Test(org.junit.Test)

Example 2 with IGraphWriter

use of org.pentaho.metaverse.api.IGraphWriter in project pentaho-metaverse by pentaho.

the class LineageWriterTest method testGetSetGraphWriter.

@Test
public void testGetSetGraphWriter() throws Exception {
    assertNull(writer.getGraphWriter());
    IGraphWriter graphWriter = mock(IGraphWriter.class);
    writer.setGraphWriter(graphWriter);
    assertEquals(graphWriter, writer.getGraphWriter());
}
Also used : IGraphWriter(org.pentaho.metaverse.api.IGraphWriter) Test(org.junit.Test)

Example 3 with IGraphWriter

use of org.pentaho.metaverse.api.IGraphWriter 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)

Example 4 with IGraphWriter

use of org.pentaho.metaverse.api.IGraphWriter in project pentaho-metaverse by pentaho.

the class FileSystemLineageWriterTest method testGetSetGraphOutputStream.

@Test
public void testGetSetGraphOutputStream() {
    assertNull(writer.getGraphOutputStream(null));
    IGraphWriter graphWriter = new GraphMLWriter();
    writer.setGraphWriter(graphWriter);
    assertNotNull(writer.getGraphOutputStream(holder));
    graphWriter = new GraphSONWriter();
    writer.setGraphWriter(graphWriter);
    assertNotNull(writer.getGraphOutputStream(holder));
    graphWriter = new GraphCsvWriter();
    writer.setGraphWriter(graphWriter);
    assertNotNull(writer.getGraphOutputStream(holder));
}
Also used : GraphSONWriter(org.pentaho.metaverse.graph.GraphSONWriter) GraphCsvWriter(org.pentaho.metaverse.graph.GraphCsvWriter) IGraphWriter(org.pentaho.metaverse.api.IGraphWriter) GraphMLWriter(org.pentaho.metaverse.graph.GraphMLWriter) Test(org.junit.Test)

Example 5 with IGraphWriter

use of org.pentaho.metaverse.api.IGraphWriter in project pentaho-metaverse by pentaho.

the class FileSystemLineageWriterTest method testGetSetGraphWriter.

@Test
public void testGetSetGraphWriter() throws Exception {
    IGraphWriter graphWriter = writer.getGraphWriter();
    assertNotNull(graphWriter);
    writer.setGraphWriter(null);
    assertNull(writer.getGraphWriter());
}
Also used : IGraphWriter(org.pentaho.metaverse.api.IGraphWriter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 IGraphWriter (org.pentaho.metaverse.api.IGraphWriter)7 Graph (com.tinkerpop.blueprints.Graph)2 OutputStream (java.io.OutputStream)2 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)2 GraphCsvWriter (org.pentaho.metaverse.graph.GraphCsvWriter)2 GraphMLWriter (org.pentaho.metaverse.graph.GraphMLWriter)2 GraphSONWriter (org.pentaho.metaverse.graph.GraphSONWriter)2 TinkerGraph (com.tinkerpop.blueprints.impls.tg.TinkerGraph)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)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