use of org.pentaho.metaverse.impl.model.MongoDbResourceInfo in project pentaho-metaverse by pentaho.
the class MongoDbInputExternalResourceConsumer method getResourcesFromMeta.
@Override
public Collection<IExternalResourceInfo> getResourcesFromMeta(MongoDbInputMeta meta, IAnalysisContext context) {
Set<IExternalResourceInfo> resources = new HashSet<IExternalResourceInfo>();
MongoDbResourceInfo mongoDbResourceInfo = new MongoDbResourceInfo(meta);
mongoDbResourceInfo.setInput(true);
resources.add(mongoDbResourceInfo);
return resources;
}
use of org.pentaho.metaverse.impl.model.MongoDbResourceInfo in project pentaho-metaverse by pentaho.
the class MongoDbInputStepAnalyzer method createTableNode.
@Override
protected IMetaverseNode createTableNode(IExternalResourceInfo resource) throws MetaverseAnalyzerException {
MongoDbResourceInfo resourceInfo = (MongoDbResourceInfo) resource;
// create a node for the collection
MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor(resourceInfo.getCollection(), DictionaryConst.NODE_TYPE_MONGODB_COLLECTION, getConnectionNode(), getDescriptor().getContext());
// set the namespace to be the id of the connection node.
IMetaverseNode node = createNodeFromDescriptor(componentDescriptor);
node.setProperty(DictionaryConst.PROPERTY_NAMESPACE, componentDescriptor.getNamespace().getNamespaceId());
node.setProperty(COLLECTION, resourceInfo.getCollection());
node.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_DEFAULT);
return node;
}
use of org.pentaho.metaverse.impl.model.MongoDbResourceInfo in project pentaho-metaverse by pentaho.
the class MongoDbInputStepAnalyzerTest method testCreateTableNode.
@Test
public void testCreateTableNode() throws Exception {
IConnectionAnalyzer connectionAnalyzer = mock(IConnectionAnalyzer.class);
doReturn(connectionAnalyzer).when(analyzer).getConnectionAnalyzer();
IMetaverseNode connNode = mock(IMetaverseNode.class);
when(connectionAnalyzer.analyze(any(IComponentDescriptor.class), anyObject())).thenReturn(connNode);
MongoDbResourceInfo resourceInfo = mock(MongoDbResourceInfo.class);
when(resourceInfo.getCollection()).thenReturn("myCollection");
IMetaverseNode connectionNode = mock(IMetaverseNode.class);
doReturn(connectionNode).when(analyzer).getConnectionNode();
when(connectionNode.getLogicalId()).thenReturn("CONNECTION_ID");
IMetaverseNode resourceNode = analyzer.createTableNode(resourceInfo);
assertEquals("myCollection", resourceNode.getProperty(MongoDbInputStepAnalyzer.COLLECTION));
assertEquals("myCollection", resourceNode.getName());
assertEquals("CONNECTION_ID", resourceNode.getProperty(DictionaryConst.PROPERTY_NAMESPACE));
}
Aggregations