Search in sources :

Example 6 with LineageHolder

use of org.pentaho.metaverse.api.model.LineageHolder in project pentaho-metaverse by pentaho.

the class JobLineageHolderMapTest method testGetPutLineageHolder.

@Test
public void testGetPutLineageHolder() throws Exception {
    Job job = mock(Job.class);
    LineageHolder holder = jobLineageHolderMap.getLineageHolder(job);
    // We always get a (perhaps empty) holder
    assertNotNull(holder);
    assertFalse(holder == mockHolder);
    assertNull(holder.getExecutionProfile());
    assertNull(holder.getMetaverseBuilder());
    mockHolder.setMetaverseBuilder(mockBuilder);
    mockHolder.setExecutionProfile(mockExecutionProfile);
    jobLineageHolderMap.putLineageHolder(job, mockHolder);
    holder = jobLineageHolderMap.getLineageHolder(job);
    // We always get a (perhaps empty) holder
    assertNotNull(holder);
    assertTrue(holder == mockHolder);
    assertTrue(holder.getExecutionProfile() == mockExecutionProfile);
    assertTrue(holder.getMetaverseBuilder() == mockBuilder);
}
Also used : Job(org.pentaho.di.job.Job) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) Test(org.junit.Test)

Example 7 with LineageHolder

use of org.pentaho.metaverse.api.model.LineageHolder in project pentaho-metaverse by pentaho.

the class TransLineageHolderMapTest method testGetPutLineageHolder.

@Test
public void testGetPutLineageHolder() throws Exception {
    Trans trans = mock(Trans.class);
    LineageHolder holder = jobLineageHolderMap.getLineageHolder(trans);
    // We always get a (perhaps empty) holder
    assertNotNull(holder);
    assertFalse(holder == mockHolder);
    assertNull(holder.getExecutionProfile());
    assertNull(holder.getMetaverseBuilder());
    mockHolder.setMetaverseBuilder(mockBuilder);
    mockHolder.setExecutionProfile(mockExecutionProfile);
    jobLineageHolderMap.putLineageHolder(trans, mockHolder);
    holder = jobLineageHolderMap.getLineageHolder(trans);
    // We always get a (perhaps empty) holder
    assertNotNull(holder);
    assertTrue(holder == mockHolder);
    assertTrue(holder.getExecutionProfile() == mockExecutionProfile);
    assertTrue(holder.getMetaverseBuilder() == mockBuilder);
}
Also used : Trans(org.pentaho.di.trans.Trans) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) Test(org.junit.Test)

Example 8 with LineageHolder

use of org.pentaho.metaverse.api.model.LineageHolder in project pentaho-metaverse by pentaho.

the class StepExternalConsumerRowListenerTest method testStepExternalConsumerRowListener.

@Test
public void testStepExternalConsumerRowListener() throws Exception {
    IStepExternalResourceConsumer consumer = mock(IStepExternalResourceConsumer.class);
    BaseStep mockStep = mock(BaseStep.class, withSettings().extraInterfaces(StepInterface.class));
    StepMeta mockStepMeta = mock(StepMeta.class);
    BaseStepMeta bsm = mock(BaseStepMeta.class, withSettings().extraInterfaces(StepMetaInterface.class));
    StepMetaInterface stepMetaInterface = (StepMetaInterface) bsm;
    when(mockStep.getStepMeta()).thenReturn(mockStepMeta);
    when(mockStepMeta.getStepMetaInterface()).thenReturn(stepMetaInterface);
    Trans mockTrans = mock(Trans.class);
    when(mockStep.getTrans()).thenReturn(mockTrans);
    IExecutionProfile executionProfile = mock(IExecutionProfile.class);
    IExecutionData executionData = mock(IExecutionData.class);
    when(executionProfile.getExecutionData()).thenReturn(executionData);
    LineageHolder holder = new LineageHolder();
    holder.setExecutionProfile(executionProfile);
    TransLineageHolderMap.getInstance().putLineageHolder(mockTrans, holder);
    StepExternalConsumerRowListener listener = new StepExternalConsumerRowListener(consumer, mockStep);
    RowMetaInterface rmi = mock(RowMetaInterface.class);
    Object[] row = new Object[0];
    listener.rowReadEvent(rmi, row);
}
Also used : BaseStep(org.pentaho.di.trans.step.BaseStep) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) IStepExternalResourceConsumer(org.pentaho.metaverse.api.analyzer.kettle.step.IStepExternalResourceConsumer) StepInterface(org.pentaho.di.trans.step.StepInterface) IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) Trans(org.pentaho.di.trans.Trans) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) Test(org.junit.Test)

Example 9 with LineageHolder

use of org.pentaho.metaverse.api.model.LineageHolder in project pentaho-metaverse by pentaho.

the class LineageWriterTest method setUp.

@Before
public void setUp() throws Exception {
    LineageWriter fslw = new LineageWriter();
    writer = spy(fslw);
    holder = new LineageHolder();
    IExecutionProfile profile = new ExecutionProfile();
    profile.setName("test");
    IExecutionData data = new ExecutionData();
    data.setStartTime(now);
    profile.setExecutionData(data);
    holder.setExecutionProfile(profile);
}
Also used : IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) ExecutionProfile(org.pentaho.metaverse.impl.model.ExecutionProfile) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) ExecutionData(org.pentaho.metaverse.impl.model.ExecutionData) Before(org.junit.Before)

Example 10 with LineageHolder

use of org.pentaho.metaverse.api.model.LineageHolder in project pentaho-metaverse by pentaho.

the class VfsLineageWriterTest method setUp.

@Before
public void setUp() throws Exception {
    String basePath = new File(".").getCanonicalPath();
    writer = new VfsLineageWriter();
    writer = spy(writer);
    holder = new LineageHolder();
    IExecutionProfile profile = new ExecutionProfile();
    profile.setName("test");
    IExecutionData data = new ExecutionData();
    data.setStartTime(now);
    profile.setExecutionData(data);
    holder.setExecutionProfile(profile);
    BAD_OUTPUT_FOLDER = FilenameUtils.separatorsToSystem("file://" + basePath + BAD_OUTPUT_FOLDER_DEFAULT + random.nextInt());
    GOOD_OUTPUT_FOLDER = FilenameUtils.separatorsToSystem("file://" + basePath + GOOD_OUTPUT_FOLDER_DEFAULT + random.nextInt());
    writer.setOutputFolder(GOOD_OUTPUT_FOLDER);
}
Also used : IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) File(java.io.File) ExecutionProfile(org.pentaho.metaverse.impl.model.ExecutionProfile) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) LineageHolder(org.pentaho.metaverse.api.model.LineageHolder) IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) ExecutionData(org.pentaho.metaverse.impl.model.ExecutionData) Before(org.junit.Before)

Aggregations

LineageHolder (org.pentaho.metaverse.api.model.LineageHolder)16 IExecutionProfile (org.pentaho.metaverse.api.model.IExecutionProfile)10 ExecutionProfile (org.pentaho.metaverse.impl.model.ExecutionProfile)8 Test (org.junit.Test)7 IExecutionData (org.pentaho.metaverse.api.model.IExecutionData)7 Trans (org.pentaho.di.trans.Trans)6 Job (org.pentaho.di.job.Job)5 IMetaverseBuilder (org.pentaho.metaverse.api.IMetaverseBuilder)5 ExecutionData (org.pentaho.metaverse.impl.model.ExecutionData)5 Before (org.junit.Before)3 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2 Future (java.util.concurrent.Future)2 Result (org.pentaho.di.core.Result)2 StepInterface (org.pentaho.di.trans.step.StepInterface)2 AnalysisContext (org.pentaho.metaverse.api.AnalysisContext)2 IDocument (org.pentaho.metaverse.api.IDocument)2 IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)2 INamespace (org.pentaho.metaverse.api.INamespace)2 MetaverseException (org.pentaho.metaverse.api.MetaverseException)2