Search in sources :

Example 26 with IMetaverseNode

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

the class ExcelOutputStepAnalyzerTest method testCreateResourceNode.

@Test
public void testCreateResourceNode() throws Exception {
    IExternalResourceInfo res = mock(IExternalResourceInfo.class);
    when(res.getName()).thenReturn("file:///Users/home/tmp/xyz.ktr");
    IMetaverseNode resourceNode = analyzer.createResourceNode(res);
    assertNotNull(resourceNode);
    assertEquals(DictionaryConst.NODE_TYPE_FILE, resourceNode.getType());
}
Also used : IExternalResourceInfo(org.pentaho.metaverse.api.model.IExternalResourceInfo) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) Test(org.junit.Test)

Example 27 with IMetaverseNode

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

the class HTTPClientStepAnalyzerTest method testCreateResourceNode.

@Test
public void testCreateResourceNode() throws Exception {
    IExternalResourceInfo res = mock(IExternalResourceInfo.class);
    when(res.getName()).thenReturn("http://my.rest.url");
    IMetaverseNode resourceNode = analyzer.createResourceNode(res);
    assertNotNull(resourceNode);
    assertEquals(DictionaryConst.NODE_TYPE_WEBSERVICE, resourceNode.getType());
    assertEquals("http://my.rest.url", resourceNode.getName());
}
Also used : IExternalResourceInfo(org.pentaho.metaverse.api.model.IExternalResourceInfo) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) Test(org.junit.Test)

Example 28 with IMetaverseNode

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

the class HTTPPostStepAnalyzerTest method testCreateResourceNode.

@Test
public void testCreateResourceNode() throws Exception {
    IExternalResourceInfo res = mock(IExternalResourceInfo.class);
    when(res.getName()).thenReturn("http://my.rest.url");
    IMetaverseNode resourceNode = analyzer.createResourceNode(res);
    assertNotNull(resourceNode);
    assertEquals(DictionaryConst.NODE_TYPE_WEBSERVICE, resourceNode.getType());
    assertEquals("http://my.rest.url", resourceNode.getName());
}
Also used : IExternalResourceInfo(org.pentaho.metaverse.api.model.IExternalResourceInfo) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) Test(org.junit.Test)

Example 29 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode 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));
}
Also used : IComponentDescriptor(org.pentaho.metaverse.api.IComponentDescriptor) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) IConnectionAnalyzer(org.pentaho.metaverse.api.IConnectionAnalyzer) MongoDbResourceInfo(org.pentaho.metaverse.impl.model.MongoDbResourceInfo) Test(org.junit.Test)

Example 30 with IMetaverseNode

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

the class MongoDbInputStepAnalyzerTest method testCustomAnalyze_jsonOutput.

@Test
public void testCustomAnalyze_jsonOutput() throws Exception {
    when(meta.getOutputJson()).thenReturn(true);
    when(meta.getCollection()).thenReturn("myCollection");
    IMetaverseNode node = new MetaverseTransientNode("new node");
    analyzer.customAnalyze(meta, node);
    assertNotNull(node);
    assertEquals("myCollection", node.getProperty(MongoDbInputStepAnalyzer.COLLECTION));
    assertTrue((Boolean) node.getProperty(MongoDbInputStepAnalyzer.OUTPUT_JSON));
    assertNull(node.getProperty(DictionaryConst.PROPERTY_QUERY));
    assertNull(node.getProperty(MongoDbInputStepAnalyzer.AGG_PIPELINE));
}
Also used : IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) MetaverseTransientNode(org.pentaho.dictionary.MetaverseTransientNode) Test(org.junit.Test)

Aggregations

IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)131 Test (org.junit.Test)77 IComponentDescriptor (org.pentaho.metaverse.api.IComponentDescriptor)30 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)23 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)16 ValueMeta (org.pentaho.di.core.row.ValueMeta)13 IExternalResourceInfo (org.pentaho.metaverse.api.model.IExternalResourceInfo)12 IAnalysisContext (org.pentaho.metaverse.api.IAnalysisContext)11 MetaverseAnalyzerException (org.pentaho.metaverse.api.MetaverseAnalyzerException)11 Vertex (com.tinkerpop.blueprints.Vertex)10 ArrayList (java.util.ArrayList)10 INamespace (org.pentaho.metaverse.api.INamespace)10 TransMeta (org.pentaho.di.trans.TransMeta)9 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)9 MetaverseTransientNode (org.pentaho.dictionary.MetaverseTransientNode)9 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)8 Namespace (org.pentaho.metaverse.api.Namespace)8 StepField (org.pentaho.metaverse.api.StepField)8 HashMap (java.util.HashMap)7 Matchers.anyString (org.mockito.Matchers.anyString)7