use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class HopGuiUnitTestCreated method callExtensionPoint.
@Override
public void callExtensionPoint(ILogChannel log, IVariables variables, Object object) throws HopException {
// Refresh the tests list
//
super.callExtensionPoint(log, variables, object);
//
if (!(object instanceof PipelineUnitTest)) {
return;
}
PipelineUnitTest test = (PipelineUnitTest) object;
HopGui hopGui = HopGui.getInstance();
TestingGuiPlugin testingGuiPlugin = TestingGuiPlugin.getInstance();
// Create this for the active pipeline...
//
PipelineMeta pipelineMeta = testingGuiPlugin.getActivePipelineMeta();
if (pipelineMeta == null) {
return;
}
MessageBox messageBox = new MessageBox(hopGui.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION);
messageBox.setText("Attach?");
messageBox.setMessage("Do you want to use this unit test for the active pipeline '" + pipelineMeta.getName() + "'?");
int answer = messageBox.open();
if ((answer & SWT.YES) == 0) {
return;
}
// Attach it to the active pipeline
// Calculate a relative filename
//
test.setRelativeFilename(variables, pipelineMeta.getFilename());
// Also switch to this unit test
//
TestingGuiPlugin.selectUnitTest(pipelineMeta, test);
// Refresh
//
hopGui.getActiveFileTypeHandler().updateGui();
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class DrawGoldenDataSetOnTransformExtensionPoint method callExtensionPoint.
@Override
public void callExtensionPoint(ILogChannel log, IVariables variables, PipelinePainterExtension ext) throws HopException {
TransformMeta transformMeta = ext.transformMeta;
PipelineMeta pipelineMeta = ext.pipelineMeta;
PipelineUnitTest unitTest = TestingGuiPlugin.getCurrentUnitTest(pipelineMeta);
if (unitTest != null) {
drawGoldenSetMarker(ext, transformMeta, unitTest, ext.areaOwners);
}
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class DrawInputDataSetOnTransformExtensionPoint method callExtensionPoint.
@Override
public void callExtensionPoint(ILogChannel log, IVariables variables, PipelinePainterExtension ext) throws HopException {
TransformMeta transformMeta = ext.transformMeta;
PipelineMeta pipelineMeta = ext.pipelineMeta;
PipelineUnitTest unitTest = TestingGuiPlugin.getCurrentUnitTest(pipelineMeta);
if (unitTest != null) {
drawInputDataSetMarker(ext, transformMeta, unitTest, ext.areaOwners);
}
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class CombinationLookupTest method setup.
@Before
public void setup() {
databaseMeta = mock(DatabaseMeta.class);
doReturn("").when(databaseMeta).quoteField(anyString());
combinationLookupMeta = mock(CombinationLookupMeta.class);
doReturn(databaseMeta).when(combinationLookupMeta).getDatabaseMeta();
doReturn("sasas").when(combinationLookupMeta).getTechnicalKeyField();
doReturn(new String[] {}).when(combinationLookupMeta).getKeyLookup();
transformMeta = mock(TransformMeta.class);
doReturn("transform").when(transformMeta).getName();
doReturn(mock(TransformPartitioningMeta.class)).when(transformMeta).getTargetTransformPartitioningMeta();
doReturn(combinationLookupMeta).when(transformMeta).getTransform();
Database db = mock(Database.class);
doReturn(mock(Connection.class)).when(db).getConnection();
combinationLookupData = mock(CombinationLookupData.class);
combinationLookupData.db = db;
combinationLookupData.keynrs = new int[] {};
PipelineMeta pipelineMeta = mock(PipelineMeta.class);
doReturn(transformMeta).when(pipelineMeta).findTransform(anyString());
Pipeline pipeline = spy(new LocalPipelineEngine());
combinationLookup = spy(new CombinationLookup(transformMeta, combinationLookupMeta, combinationLookupData, 1, pipelineMeta, pipeline));
doReturn(false).when(combinationLookup).isRowLevel();
doReturn(true).when(combinationLookup).isAutoIncrement();
doNothing().when(combinationLookup).logDetailed(anyString());
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class JsonOutputTest method test.
public String test(boolean compatibilityMode) throws Exception {
HopEnvironment.init();
// Create a new transformation...
//
PipelineMeta pipelineMeta = new PipelineMeta();
pipelineMeta.setName("testJsonOutput");
PluginRegistry registry = PluginRegistry.getInstance();
// create an injector transform
String injectorTransformName = "injector transform";
TransformMeta injectorTransform = TestUtilities.createInjectorTransform(injectorTransformName, registry);
pipelineMeta.addTransform(injectorTransform);
// create a row generator transform
TransformMeta rowGeneratorTransform = createRowGeneratorTransform("Create rows for testJsonOutput1", registry);
pipelineMeta.addTransform(rowGeneratorTransform);
// create a PipelineHopMeta for injector and add it to the pipelineMeta
PipelineHopMeta hop_injectoryRowGenerator = new PipelineHopMeta(injectorTransform, rowGeneratorTransform);
pipelineMeta.addPipelineHop(hop_injectoryRowGenerator);
// create the json output transform
// but first lets get a filename
String jsonFileName = TestUtilities.createEmptyTempFile("testJsonOutput1_");
TransformMeta jsonOutputTransform = createJsonOutputTransform("json output transform", jsonFileName, registry);
((JsonOutputMeta) jsonOutputTransform.getTransform()).setCompatibilityMode(compatibilityMode);
pipelineMeta.addTransform(jsonOutputTransform);
// create a PipelineHopMeta for jsonOutputTransform and add it to the pipelineMeta
PipelineHopMeta hop_RowGeneratorOutputTextFile = new PipelineHopMeta(rowGeneratorTransform, jsonOutputTransform);
pipelineMeta.addPipelineHop(hop_RowGeneratorOutputTextFile);
// Create a dummy transform and add it to the tranMeta
String dummyTransformName = "dummy transform";
TransformMeta dummyTransform = createDummyTransform(dummyTransformName, registry);
pipelineMeta.addTransform(dummyTransform);
// create a PipelineHopMeta for the
PipelineHopMeta hopOutputJson_dummyTransform = new PipelineHopMeta(jsonOutputTransform, dummyTransform);
pipelineMeta.addPipelineHop(hopOutputJson_dummyTransform);
// Now execute the transformation...
Pipeline pipeline = new LocalPipelineEngine(pipelineMeta);
pipeline.prepareExecution();
// Create a row collector and add it to the dummy transform interface
IEngineComponent dummyITransform = pipeline.findComponent(dummyTransformName, 0);
TransformRowsCollector dummyRowCollector = new TransformRowsCollector();
dummyITransform.addRowListener(dummyRowCollector);
// RowProducer rowProducer = pipeline.addRowProducer(injectorTransformName, 0);
pipeline.startThreads();
pipeline.waitUntilFinished();
// get the results and return it
File outputFile = new File(jsonFileName + ".js");
String jsonStructure = FileUtils.readFileToString(outputFile);
return jsonStructure;
}
Aggregations