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());
}
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());
}
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;
}
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);
}
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());
}
Aggregations