use of org.pentaho.metaverse.impl.MetaverseBuilder 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);
}
}
}
Aggregations