use of org.pentaho.dictionary.MetaverseTransientNode in project pentaho-metaverse by pentaho.
the class StepAnalyzerTest method testCreateFieldNode.
@Test
public void testCreateFieldNode() throws Exception {
IComponentDescriptor fieldDescriptor = mock(IComponentDescriptor.class);
ValueMetaInterface fieldMeta = new ValueMeta("address");
MetaverseTransientNode node = new MetaverseTransientNode("hello");
doReturn(node).when(analyzer).createNodeFromDescriptor(fieldDescriptor);
IMetaverseNode fieldNode = analyzer.createFieldNode(fieldDescriptor, fieldMeta, "nextStep", true);
assertNotNull(fieldNode);
assertNotNull(fieldNode.getProperty(DictionaryConst.PROPERTY_KETTLE_TYPE));
assertEquals("nextStep", fieldNode.getProperty(DictionaryConst.PROPERTY_TARGET_STEP));
// make sure it got added to the graph
verify(builder).addNode(node);
}
use of org.pentaho.dictionary.MetaverseTransientNode in project pentaho-metaverse by pentaho.
the class TableOutputStepAnalyzerTest method testCustomAnalyze.
@Test
public void testCustomAnalyze() throws Exception {
when(meta.truncateTable()).thenReturn(true);
IMetaverseNode node = new MetaverseTransientNode("new node");
analyzer.customAnalyze(meta, node);
assertNotNull(node);
assertTrue((Boolean) node.getProperty(TableOutputStepAnalyzer.TRUNCATE_TABLE));
}
use of org.pentaho.dictionary.MetaverseTransientNode in project pentaho-metaverse by pentaho.
the class TransJobEntryAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
when(metaverseBuilder.getMetaverseObjectFactory()).thenReturn(objectFactory);
when(objectFactory.createNodeObject(anyString(), anyString(), anyString())).thenReturn(new MetaverseTransientNode("name"));
when(jobEntryTrans.getName()).thenReturn("job entry");
when(jobEntryTrans.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.FILENAME);
when(jobEntryTrans.getFilename()).thenReturn(TEST_FILE_NAME);
when(jobEntryTrans.getParentJob()).thenReturn(mockParentJob);
when(mockParentJob.getJobMeta()).thenReturn(mockParentJobMeta);
when(namespace.getParentNamespace()).thenReturn(namespace);
when(mockParentJobMeta.environmentSubstitute(anyString())).thenAnswer(new Answer<String>() {
@Override
public String answer(InvocationOnMock invocation) throws Throwable {
return (String) invocation.getArguments()[0];
}
});
descriptor = new MetaverseComponentDescriptor("job entry", DictionaryConst.NODE_TYPE_JOB_ENTRY, namespace);
analyzer = new TransJobEntryAnalyzer();
spyAnalyzer = spy(analyzer);
spyAnalyzer.setMetaverseBuilder(metaverseBuilder);
spyAnalyzer.setDescriptor(descriptor);
doReturn(childTransMeta).when(spyAnalyzer).getSubTransMeta(anyString());
doReturn(documentDescriptor).when(spyAnalyzer).getDocumentDescriptor();
}
use of org.pentaho.dictionary.MetaverseTransientNode 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));
}
use of org.pentaho.dictionary.MetaverseTransientNode in project pentaho-metaverse by pentaho.
the class MetaverseObjectFactory method createNodeObject.
@Override
public IMetaverseNode createNodeObject(INamespace namespace, ILogicalIdGenerator idGenerator, Map<String, Object> properties) {
MetaverseTransientNode node = new MetaverseTransientNode();
node.setProperties(properties);
node.setProperty(DictionaryConst.PROPERTY_NAMESPACE, namespace.getNamespaceId());
node.setLogicalIdGenerator(idGenerator);
node.setProperty(DictionaryConst.NODE_VIRTUAL, true);
String id = node.getLogicalId();
node.setStringID(id);
return node;
}
Aggregations