Search in sources :

Example 21 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class MQTTProducerMetaTest method testCheckOptions.

@Test
public void testCheckOptions() {
    List<CheckResultInterface> remarks = new ArrayList<>();
    MQTTProducerMeta meta = new MQTTProducerMeta();
    meta.setMqttServer("theserver:1883");
    meta.setClientId("client100");
    meta.setTopic("newtopic");
    meta.setQOS("2");
    meta.setMessageField("Messages");
    meta.setUsername("testuser");
    meta.setPassword("test");
    meta.setKeepAliveInterval("1000");
    meta.setMaxInflight("2000");
    meta.setConnectionTimeout("3000");
    meta.setCleanSession("true");
    meta.setStorageLevel("/Users/noname/temp");
    meta.setServerUris("mqttHost2:1883");
    meta.setMqttVersion("3");
    meta.setAutomaticReconnect("true");
    meta.check(remarks, null, null, null, null, null, null, new Variables(), null, null);
    assertEquals(0, remarks.size());
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ArrayList(java.util.ArrayList) CheckResultInterface(org.pentaho.di.core.CheckResultInterface) Test(org.junit.Test)

Example 22 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class SalesforceUpdateMetaTest method testGetFields.

@Test
public void testGetFields() throws KettleStepException {
    SalesforceUpdateMeta meta = new SalesforceUpdateMeta();
    meta.setDefault();
    RowMetaInterface r = new RowMeta();
    meta.getFields(r, "thisStep", null, null, new Variables(), null, null);
    assertEquals(0, r.size());
    r.clear();
    r.addValueMeta(new ValueMetaString("testString"));
    meta.getFields(r, "thisStep", null, null, new Variables(), null, null);
    assertEquals(1, r.size());
    assertEquals(ValueMetaInterface.TYPE_STRING, r.getValueMeta(0).getType());
    assertEquals("testString", r.getValueMeta(0).getName());
}
Also used : Variables(org.pentaho.di.core.variables.Variables) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) SalesforceMetaTest(org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest) Test(org.junit.Test)

Example 23 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class StarModelerPerspective method addSharedDimensionsGroupToDomainTab.

private Control addSharedDimensionsGroupToDomainTab(final StarDomain starDomain, final XulTabAndPanel tabAndPanel, Composite parentComposite, Control lastControl) {
    PropsUI props = PropsUI.getInstance();
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Add a group for the logical stars
    // 
    final Group dimsGroup = new Group(parentComposite, SWT.SHADOW_NONE);
    props.setLook(dimsGroup);
    dimsGroup.setText(BaseMessages.getString(PKG, "StarModelerPerspective.SharedDimensions.Label"));
    FormLayout groupLayout = new FormLayout();
    groupLayout.marginLeft = 10;
    groupLayout.marginRight = 10;
    groupLayout.marginTop = 10;
    groupLayout.marginBottom = 10;
    groupLayout.spacing = margin;
    dimsGroup.setLayout(groupLayout);
    FormData fdDimsGroup = new FormData();
    fdDimsGroup.top = new FormAttachment(lastControl, margin);
    fdDimsGroup.left = new FormAttachment(0, 0);
    fdDimsGroup.right = new FormAttachment(100, 0);
    dimsGroup.setLayoutData(fdDimsGroup);
    // Then we'll add a table view for the shared dimensions
    // 
    Label dimensionsLabel = new Label(dimsGroup, SWT.RIGHT);
    props.setLook(dimensionsLabel);
    dimensionsLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.ListOfSharedDimensions.Label"));
    FormData fdDimensionsLabel = new FormData();
    fdDimensionsLabel.left = new FormAttachment(0, 0);
    fdDimensionsLabel.right = new FormAttachment(middle, 0);
    fdDimensionsLabel.top = new FormAttachment(lastControl, margin);
    dimensionsLabel.setLayoutData(fdDimensionsLabel);
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.DimensionName.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.DimensionDescription.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
    final TableView dimensionsList = new TableView(new Variables(), dimsGroup, SWT.BORDER, colinf, 1, null, props);
    dimensionsList.setReadonly(true);
    dimensionsList.table.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            if (dimensionsList.getSelectionIndex() < 0)
                return;
            TableItem item = dimensionsList.table.getSelection()[0];
            String name = item.getText(1);
            if (editModel(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
                refreshDimensionsList(starDomain, dimensionsList);
            }
        }
    });
    refreshDimensionsList(starDomain, dimensionsList);
    FormData fdDimensionsList = new FormData();
    fdDimensionsList.top = new FormAttachment(lastControl, margin);
    fdDimensionsList.bottom = new FormAttachment(lastControl, 250);
    fdDimensionsList.left = new FormAttachment(middle, margin);
    fdDimensionsList.right = new FormAttachment(100, 0);
    dimensionsList.setLayoutData(fdDimensionsList);
    lastControl = dimensionsList;
    // A few buttons to edit the list
    // 
    Button newDimensionButton = new Button(dimsGroup, SWT.PUSH);
    newDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.NewSharedDimension"));
    FormData fdNewModelButton = new FormData();
    fdNewModelButton.top = new FormAttachment(lastControl, margin);
    fdNewModelButton.left = new FormAttachment(middle, margin);
    newDimensionButton.setLayoutData(fdNewModelButton);
    newDimensionButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (newSharedDimension(dimsGroup.getShell(), starDomain)) {
                refreshDimensionsList(starDomain, dimensionsList);
            }
        }
    });
    Button editDimensionButton = new Button(dimsGroup, SWT.PUSH);
    editDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.EditDimension"));
    FormData fdEditModelButton = new FormData();
    fdEditModelButton.top = new FormAttachment(lastControl, margin);
    fdEditModelButton.left = new FormAttachment(newDimensionButton, margin);
    editDimensionButton.setLayoutData(fdEditModelButton);
    editDimensionButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (dimensionsList.getSelectionIndex() < 0)
                return;
            TableItem item = dimensionsList.table.getSelection()[0];
            String name = item.getText(1);
            if (editSharedDimension(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
                refreshDimensionsList(starDomain, dimensionsList);
            }
        }
    });
    Button delDimensionButton = new Button(dimsGroup, SWT.PUSH);
    delDimensionButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.DeleteDimension"));
    FormData fdDelDimensionButton = new FormData();
    fdDelDimensionButton.top = new FormAttachment(lastControl, margin);
    fdDelDimensionButton.left = new FormAttachment(editDimensionButton, margin);
    delDimensionButton.setLayoutData(fdDelDimensionButton);
    delDimensionButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            if (dimensionsList.getSelectionIndex() < 0)
                return;
            TableItem item = dimensionsList.table.getSelection()[0];
            String name = item.getText(1);
            if (deleteSharedDimension(dimsGroup.getShell(), starDomain, defaultLocale, name)) {
                refreshDimensionsList(starDomain, dimensionsList);
            }
        }
    });
    Button testDimensionButton = new Button(dimsGroup, SWT.PUSH);
    testDimensionButton.setText("TEST PUR");
    FormData fdtestDimensionButton = new FormData();
    fdtestDimensionButton.top = new FormAttachment(lastControl, margin);
    fdtestDimensionButton.left = new FormAttachment(delDimensionButton, margin);
    testDimensionButton.setLayoutData(fdtestDimensionButton);
    testDimensionButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            testMetaStore();
        }
    });
    return dimsGroup;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) LocalizedString(org.pentaho.metadata.model.concept.types.LocalizedString) PropsUI(org.pentaho.di.ui.core.PropsUI) Variables(org.pentaho.di.core.variables.Variables) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.pentaho.di.ui.core.widget.TableView)

Example 24 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class TransSupplier method get.

/**
 * Creates the appropriate trans.  Either
 * 1)  A {@link TransWebSocketEngineAdapter} wrapping an Engine
 * if an alternate execution engine has been selected
 * 2)  A legacy {@link Trans} otherwise.
 */
public Trans get() {
    if (Utils.isEmpty(transMeta.getVariable("engine"))) {
        log.logBasic("Using legacy execution engine");
        return fallbackSupplier.get();
    }
    Variables variables = new Variables();
    variables.initializeVariablesFrom(null);
    String protocol = transMeta.getVariable("engine.protocol");
    String host = transMeta.getVariable("engine.host");
    String port = transMeta.getVariable("engine.port");
    // default value for ssl for now false
    boolean ssl = "https".equalsIgnoreCase(protocol) || "wss".equalsIgnoreCase(protocol);
    return new TransWebSocketEngineAdapter(transMeta, host, port, ssl);
}
Also used : Variables(org.pentaho.di.core.variables.Variables) TransWebSocketEngineAdapter(org.pentaho.di.trans.ael.websocket.TransWebSocketEngineAdapter)

Example 25 with Variables

use of org.pentaho.di.core.variables.Variables in project pentaho-kettle by pentaho.

the class DaemonMessagesClientEndpoint method setAuthProperties.

// TODO: this is temporary for testing purpose we should get this values from the shim properties
private void setAuthProperties() {
    Variables variables = new Variables();
    variables.initializeVariablesFrom(null);
    this.principal = variables.getVariable(KETTLE_AEL_PDI_DAEMON_PRINCIPAL, null);
    this.keytab = variables.getVariable(KETTLE_AEL_PDI_DAEMON_KEYTAB, null);
    String reuse = variables.getVariable(KETTLE_AEL_PDI_DAEMON_CONTEXT_REUSE, Boolean.FALSE.toString());
    this.reuseSparkContext = Boolean.TRUE.toString().equals(reuse.toLowerCase()) || Y_LWC.equals(reuse.toLowerCase());
}
Also used : Variables(org.pentaho.di.core.variables.Variables)

Aggregations

Variables (org.pentaho.di.core.variables.Variables)119 Test (org.junit.Test)67 TransMeta (org.pentaho.di.trans.TransMeta)31 ArrayList (java.util.ArrayList)25 CheckResultInterface (org.pentaho.di.core.CheckResultInterface)20 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)20 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)20 StepMeta (org.pentaho.di.trans.step.StepMeta)18 RowMeta (org.pentaho.di.core.row.RowMeta)17 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)16 VariableSpace (org.pentaho.di.core.variables.VariableSpace)14 Repository (org.pentaho.di.repository.Repository)12 TableView (org.pentaho.di.ui.core.widget.TableView)10 FormAttachment (org.eclipse.swt.layout.FormAttachment)9 FormData (org.eclipse.swt.layout.FormData)9 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)9 Label (org.eclipse.swt.widgets.Label)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)7