use of org.pentaho.metaverse.api.IMetaverseBuilder in project pentaho-metaverse by pentaho.
the class VfsLineageWriterTest method testOutputLineageGraph.
@Test
public void testOutputLineageGraph() throws Exception {
Graph g = new TinkerGraph();
IMetaverseBuilder builder = new MetaverseBuilder(g);
holder.setMetaverseBuilder(builder);
writer.outputLineageGraph(holder);
}
use of org.pentaho.metaverse.api.IMetaverseBuilder in project pentaho-metaverse by pentaho.
the class DIRepositoryLocatorTest method testStartLocator.
/**
* Runs the spyLocator and checks the results
*
* @throws Exception When bad things happen
*/
@Test
public void testStartLocator() throws Exception {
TinkerGraph graph = new TinkerGraph();
IMetaverseBuilder metaverseBuilder = new MetaverseBuilder(graph);
spyLocator.setMetaverseBuilder(metaverseBuilder);
spyLocator.addDocumentListener(this);
spyLocator.setRepository(LocatorTestUtils.getFakeDiRepository());
LocatorTestUtils.delay = 0;
spyLocator.setRepositoryId("testrepo");
assertEquals("Repo id is wrong", "testrepo", spyLocator.getRepositoryId());
assertNotNull("Indexer type is null", spyLocator.getLocatorType());
events = new ArrayList<IDocumentEvent>();
spyLocator.startScan();
spyLocator.futureTask.get();
assertEquals("Event count is wrong", 7, events.size());
for (IDocumentEvent event : events) {
System.out.println(event.getDocument().getStringID());
assertNotNull(event.getDocument());
MetaverseDocument document = (MetaverseDocument) event.getDocument();
if (document.getExtension().equals("ktr")) {
assertTrue(document.getContent() instanceof TransMeta);
} else if (document.getExtension().equals("kjb")) {
assertTrue(document.getContent() instanceof JobMeta);
}
}
spyLocator.removeDocumentListener(this);
events = new ArrayList<IDocumentEvent>();
spyLocator.startScan();
spyLocator.futureTask.get();
assertEquals("Event count is wrong", 0, events.size());
}
use of org.pentaho.metaverse.api.IMetaverseBuilder in project pentaho-metaverse by pentaho.
the class FileSystemLocatorTest method testStopLocatorScan.
/**
* Runs the spyLocator and checks the results
*
* @throws Exception When bad things happen
*/
@Test
public void testStopLocatorScan() throws Exception {
TinkerGraph graph = new TinkerGraph();
IMetaverseBuilder metaverseBuilder = new MetaverseBuilder(graph);
spyLocator.setRepositoryId("test_repo");
spyLocator.setMetaverseBuilder(metaverseBuilder);
spyLocator.addDocumentListener(this);
spyLocator.setRootFolder("src/test/resources/solution");
TestFileSystemLocator.delay = 300;
assertNotNull("Indexer type is null", spyLocator.getLocatorType());
events = new ArrayList<IDocumentEvent>();
System.out.println("call startScan");
spyLocator.startScan();
Thread.sleep(1000);
System.out.println("call stopScan");
spyLocator.stopScan();
assertTrue("Event count is wrong", events.size() < 5);
assertTrue("Event count is wrong", events.size() > 0);
for (IDocumentEvent event : events) {
System.out.println(event.getDocument().getStringID());
assertNotNull(event.getDocument());
MetaverseDocument document = (MetaverseDocument) event.getDocument();
if (document.getExtension().equals("ktr")) {
assertTrue(document.getContent() instanceof String);
} else if (document.getExtension().equals("kjb")) {
assertTrue(document.getContent() instanceof String);
}
}
}
use of org.pentaho.metaverse.api.IMetaverseBuilder in project pentaho-metaverse by pentaho.
the class BaseKettleMetaverseComponentTest method testCreateFileNode.
@Test
public void testCreateFileNode() throws Exception {
component.createFileNode(null, null);
assertNull(component.createFileNode("/path/to/my/file", null));
IMetaverseBuilder metaverseBuilder = mock(IMetaverseBuilder.class);
when(metaverseBuilder.getMetaverseObjectFactory()).thenReturn(new MetaverseObjectFactory());
component.setMetaverseBuilder(metaverseBuilder);
IComponentDescriptor descriptor = mock(IComponentDescriptor.class);
INamespace ns = mock(INamespace.class);
when(descriptor.getNamespace()).thenReturn(ns);
assertNotNull(component.createFileNode("/path/to/my/file", descriptor));
}
use of org.pentaho.metaverse.api.IMetaverseBuilder in project pentaho-metaverse by pentaho.
the class MetaverseTestUtils method getDocumentController.
public static IDocumentController getDocumentController() {
IDocumentController documentController = mock(IDocumentController.class);
IMetaverseBuilder metaverseBuilder = mock(IMetaverseBuilder.class);
when(metaverseBuilder.getMetaverseObjectFactory()).thenReturn(getMetaverseObjectFactory());
when(documentController.getMetaverseObjectFactory()).thenReturn(getMetaverseObjectFactory());
when(documentController.getMetaverseBuilder()).thenReturn(metaverseBuilder);
return documentController;
}
Aggregations