use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class PipelineExecutorDialog method selectPipelineFile.
private void selectPipelineFile() {
String curFile = variables.resolve(wPath.getText());
String parentFolder = null;
try {
parentFolder = HopVfs.getFileObject(variables.resolve(pipelineMeta.getFilename())).getParent().toString();
} catch (Exception e) {
// Take no action
}
try {
HopPipelineFileType<PipelineMeta> fileType = HopGui.getDataOrchestrationPerspective().getPipelineFileType();
String filename = BaseDialog.presentFileDialog(shell, wPath, variables, fileType.getFilterExtensions(), fileType.getFilterNames(), true);
if (filename != null) {
loadPipelineFile(filename);
if (parentFolder != null && filename.startsWith(parentFolder)) {
filename = filename.replace(parentFolder, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER + "}");
}
wPath.setText(filename);
}
if (filename != null) {
replaceNameWithBaseFilename(filename);
}
} catch (HopException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PipelineExecutorDialog.ErrorLoadingPipeline.DialogTitle"), BaseMessages.getString(PKG, "PipelineExecutorDialog.ErrorLoadingPipeline.DialogMessage"), e);
}
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class BaseParsingTest method beforeCommon.
/**
* Initialize transform info. Method is final against redefine in descendants.
*/
@Before
public final void beforeCommon() throws Exception {
HopEnvironment.init();
PluginRegistry.addPluginType(CompressionPluginType.getInstance());
PluginRegistry.init();
transformMeta = new TransformMeta();
transformMeta.setName("test");
pipeline = new LocalPipelineEngine();
pipeline.setLogChannel(log);
pipeline.setRunning(true);
pipelineMeta = new PipelineMeta() {
@Override
public TransformMeta findTransform(String name) {
return transformMeta;
}
};
fs = VFS.getManager();
inPrefix = '/' + this.getClass().getPackage().getName().replace('.', '/') + "/files/";
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class PGBulkLoaderMetaTest method setUp.
@Before
public void setUp() {
PipelineMeta pipelineMeta = new PipelineMeta();
pipelineMeta.setName("loader");
lm = new PGBulkLoaderMeta();
ld = new PGBulkLoaderData();
PluginRegistry plugReg = PluginRegistry.getInstance();
String loaderPid = plugReg.getPluginId(TransformPluginType.class, lm);
transformMeta = new TransformMeta(loaderPid, "loader", lm);
Pipeline pipeline = new LocalPipelineEngine(pipelineMeta);
pipelineMeta.addTransform(transformMeta);
loader = new PGBulkLoader(transformMeta, lm, ld, 1, pipelineMeta, pipeline);
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class TestingGuiPlugin method clearGoldenDataSet.
/**
* We set an golden data set on the selected unit test
*/
@GuiContextAction(id = ACTION_ID_PIPELINE_GRAPH_TRANSFORM_CLEAR_GOLDEN_DATA_SET, parentId = HopGuiPipelineTransformContext.CONTEXT_ID, type = GuiActionType.Delete, name = "i18n::TestingGuiPlugin.ContextAction.ClearGoldenDataset.Name", tooltip = "i18n::TestingGuiPlugin.ContextAction.ClearGoldenDataset.Tooltip", image = "clear-golden-dataset.svg", category = "i18n::TestingGuiPlugin.Category", categoryOrder = "8")
public void clearGoldenDataSet(HopGuiPipelineTransformContext context) {
HopGui hopGui = HopGui.getInstance();
PipelineMeta pipelineMeta = context.getPipelineMeta();
TransformMeta transformMeta = context.getTransformMeta();
IVariables variables = context.getPipelineGraph().getVariables();
if (checkTestPresent(hopGui, pipelineMeta)) {
return;
}
try {
PipelineUnitTest currentUnitTest = getCurrentUnitTest(pipelineMeta);
PipelineUnitTestSetLocation goldenLocation = currentUnitTest.findGoldenLocation(transformMeta.getName());
if (goldenLocation != null) {
currentUnitTest.getGoldenDataSets().remove(goldenLocation);
}
saveUnitTest(variables, hopGui.getMetadataProvider(), currentUnitTest, pipelineMeta);
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.ClearGoldenDataset.Error.Header"), BaseMessages.getString(PKG, "TestingGuiPlugin.ContextAction.ClearGoldenDataset.Error.Message"), e);
}
pipelineMeta.setChanged();
context.getPipelineGraph().updateGui();
}
use of org.apache.hop.pipeline.PipelineMeta in project hop by apache.
the class TestingGuiPlugin method selectUnitTest.
@GuiToolbarElement(root = HopGuiPipelineGraph.GUI_PLUGIN_TOOLBAR_PARENT_ID, id = ID_TOOLBAR_UNIT_TESTS_COMBO, type = GuiToolbarElementType.COMBO, comboValuesMethod = "getUnitTestsList", extraWidth = 200, toolTip = "i18n::TestingGuiPlugin.ToolbarElement.GetUnitTestList.Tooltip")
public void selectUnitTest() {
HopGui hopGui = HopGui.getInstance();
try {
PipelineMeta pipelineMeta = getActivePipelineMeta();
if (pipelineMeta == null) {
return;
}
IHopMetadataProvider metadataProvider = hopGui.getMetadataProvider();
Combo combo = getUnitTestsCombo();
if (combo == null) {
return;
}
IHopMetadataSerializer<PipelineUnitTest> testSerializer = metadataProvider.getSerializer(PipelineUnitTest.class);
String testName = combo.getText();
if (testName != null) {
PipelineUnitTest unitTest = testSerializer.load(testName);
if (unitTest == null) {
throw new HopException(BaseMessages.getString(PKG, "TestingGuiPlugin.ToolbarElement.GetUnitTestList.Exception", testName));
}
selectUnitTest(pipelineMeta, unitTest);
// Update the pipeline graph
//
hopGui.getActiveFileTypeHandler().updateGui();
}
} catch (Exception e) {
new ErrorDialog(hopGui.getShell(), BaseMessages.getString(PKG, "TestingGuiPlugin.ToolbarElement.GetUnitTestList.Error.Header"), BaseMessages.getString(PKG, "TestingGuiPlugin.ToolbarElement.GetUnitTestList.Error.Message"), e);
}
}
Aggregations