Search in sources :

Example 11 with PipelineMeta

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);
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) PipelineMeta(org.apache.hop.pipeline.PipelineMeta)

Example 12 with PipelineMeta

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/";
}
Also used : LocalPipelineEngine(org.apache.hop.pipeline.engines.local.LocalPipelineEngine) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) Before(org.junit.Before)

Example 13 with PipelineMeta

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);
}
Also used : LocalPipelineEngine(org.apache.hop.pipeline.engines.local.LocalPipelineEngine) PluginRegistry(org.apache.hop.core.plugins.PluginRegistry) TransformMeta(org.apache.hop.pipeline.transform.TransformMeta) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) Pipeline(org.apache.hop.pipeline.Pipeline) Before(org.junit.Before)

Example 14 with PipelineMeta

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();
}
Also used : IVariables(org.apache.hop.core.variables.IVariables) TransformMeta(org.apache.hop.pipeline.transform.TransformMeta) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) HopTransformException(org.apache.hop.core.exception.HopTransformException) HopValueException(org.apache.hop.core.exception.HopValueException) HopPluginException(org.apache.hop.core.exception.HopPluginException) HopGui(org.apache.hop.ui.hopgui.HopGui) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) GuiContextAction(org.apache.hop.core.action.GuiContextAction)

Example 15 with PipelineMeta

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);
    }
}
Also used : HopException(org.apache.hop.core.exception.HopException) IHopMetadataProvider(org.apache.hop.metadata.api.IHopMetadataProvider) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) Combo(org.eclipse.swt.widgets.Combo) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) HopException(org.apache.hop.core.exception.HopException) HopTransformException(org.apache.hop.core.exception.HopTransformException) HopValueException(org.apache.hop.core.exception.HopValueException) HopPluginException(org.apache.hop.core.exception.HopPluginException) HopGui(org.apache.hop.ui.hopgui.HopGui) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) GuiToolbarElement(org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement)

Aggregations

PipelineMeta (org.apache.hop.pipeline.PipelineMeta)218 HopException (org.apache.hop.core.exception.HopException)83 TransformMeta (org.apache.hop.pipeline.transform.TransformMeta)73 Pipeline (org.apache.hop.pipeline.Pipeline)61 LocalPipelineEngine (org.apache.hop.pipeline.engines.local.LocalPipelineEngine)42 IVariables (org.apache.hop.core.variables.IVariables)40 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)36 PipelinePreviewProgressDialog (org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog)33 Test (org.junit.Test)33 IRowMeta (org.apache.hop.core.row.IRowMeta)31 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)29 HopTransformException (org.apache.hop.core.exception.HopTransformException)26 IHopMetadataProvider (org.apache.hop.metadata.api.IHopMetadataProvider)24 PipelineHopMeta (org.apache.hop.pipeline.PipelineHopMeta)22 PrintWriter (java.io.PrintWriter)19 HopGui (org.apache.hop.ui.hopgui.HopGui)19 IOException (java.io.IOException)16 Before (org.junit.Before)16 ArrayList (java.util.ArrayList)15 HopPluginException (org.apache.hop.core.exception.HopPluginException)15