Search in sources :

Example 91 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class JobGeneratorTest method testGenerateDimensionTransformations.

@Test
public void testGenerateDimensionTransformations() throws Exception {
    final LogicalModel logicalModel = mock(LogicalModel.class);
    when(jobGenerator.domain.getLogicalModels()).thenReturn(new LinkedList<LogicalModel>() {

        {
            add(logicalModel);
        }
    });
    final LogicalTable logicalTable = mock(LogicalTable.class);
    when(logicalTable.getProperty(eq(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME))).thenReturn("test_table_name");
    when(logicalModel.getLogicalTables()).thenReturn(new LinkedList<LogicalTable>() {

        {
            add(logicalTable);
        }
    });
    when(logicalTable.getProperty(eq(DefaultPropertyID.TABLE_TYPE.getId()))).thenReturn(TableType.DIMENSION);
    when(logicalTable.getProperty(eq(DefaultIDs.LOGICAL_TABLE_DIMENSION_TYPE))).thenReturn(DimensionType.JUNK_DIMENSION.name());
    final List<TransMeta> transMetas = jobGenerator.generateDimensionTransformations();
    assertNotNull(transMetas);
    assertEquals(1, transMetas.size());
}
Also used : LogicalModel(org.pentaho.metadata.model.LogicalModel) TransMeta(org.pentaho.di.trans.TransMeta) LogicalTable(org.pentaho.metadata.model.LogicalTable) Test(org.junit.Test)

Example 92 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class JmsProducerDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    setShellImage(shell, meta);
    shell.setMinimumSize(SHELL_MIN_WIDTH, SHELL_MIN_HEIGHT);
    changed = meta.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 15;
    formLayout.marginHeight = 15;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JmsProducerDialog.Shell.Title"));
    Label wicon = new Label(shell, SWT.RIGHT);
    wicon.setImage(getImage());
    FormData fdlicon = new FormData();
    fdlicon.top = new FormAttachment(0, 0);
    fdlicon.right = new FormAttachment(100, 0);
    wicon.setLayoutData(fdlicon);
    props.setLook(wicon);
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "JmsProducerDialog.Stepname.Label"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.top = new FormAttachment(0, 0);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.width = 250;
    fdStepname.left = new FormAttachment(0, 0);
    fdStepname.top = new FormAttachment(wlStepname, 5);
    wStepname.setLayoutData(fdStepname);
    Label spacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    props.setLook(spacer);
    FormData fdSpacer = new FormData();
    fdSpacer.height = 2;
    fdSpacer.left = new FormAttachment(0, 0);
    fdSpacer.top = new FormAttachment(wStepname, 15);
    fdSpacer.right = new FormAttachment(100, 0);
    fdSpacer.width = 497;
    spacer.setLayoutData(fdSpacer);
    // Start of tabbed display
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    wTabFolder.setSimple(false);
    wTabFolder.setUnselectedCloseVisible(true);
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    FormData fdCancel = new FormData();
    fdCancel.right = new FormAttachment(100, 0);
    fdCancel.bottom = new FormAttachment(100, 0);
    wCancel.setLayoutData(fdCancel);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fdOk = new FormData();
    fdOk.right = new FormAttachment(wCancel, -5);
    fdOk.bottom = new FormAttachment(100, 0);
    wOK.setLayoutData(fdOk);
    Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    props.setLook(hSpacer);
    FormData fdhSpacer = new FormData();
    fdhSpacer.height = 2;
    fdhSpacer.left = new FormAttachment(0, 0);
    fdhSpacer.bottom = new FormAttachment(wCancel, -15);
    fdhSpacer.right = new FormAttachment(100, 0);
    hSpacer.setLayoutData(fdhSpacer);
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(spacer, 15);
    fdTabFolder.bottom = new FormAttachment(hSpacer, -15);
    fdTabFolder.right = new FormAttachment(100, 0);
    wTabFolder.setLayoutData(fdTabFolder);
    // Setup Tab
    wSetupTab = new CTabItem(wTabFolder, SWT.NONE);
    wSetupTab.setText(BaseMessages.getString(PKG, "JmsProducerDialog.SetupTab"));
    wSetupComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSetupComp);
    FormLayout setupLayout = new FormLayout();
    setupLayout.marginHeight = 15;
    setupLayout.marginWidth = 15;
    wSetupComp.setLayout(setupLayout);
    connectionForm = new ConnectionForm(wSetupComp, props, transMeta, lsMod, jmsDelegate);
    Group group = connectionForm.layoutForm();
    destinationForm = new DestinationForm(wSetupComp, group, props, transMeta, lsMod, jmsDelegate.destinationType, jmsDelegate.destinationName);
    Composite destinationFormComposite = destinationForm.layoutForm();
    Label lbMessageField = new Label(wSetupComp, SWT.LEFT);
    props.setLook(lbMessageField);
    lbMessageField.setText(getString(PKG, "JmsProducerDialog.MessageField"));
    FormData fdMessage = new FormData();
    fdMessage.left = new FormAttachment(0, 0);
    fdMessage.top = new FormAttachment(destinationFormComposite, 15);
    fdMessage.width = 250;
    lbMessageField.setLayoutData(fdMessage);
    wMessageField = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMessageField);
    wMessageField.addModifyListener(lsMod);
    FormData fdMessageField = new FormData();
    fdMessageField.left = new FormAttachment(0, 0);
    fdMessageField.top = new FormAttachment(lbMessageField, 5);
    fdMessageField.width = 250;
    wMessageField.setLayoutData(fdMessageField);
    Listener lsMessageFocus = e -> {
        String current = wMessageField.getText();
        wMessageField.getCComboWidget().removeAll();
        wMessageField.setText(current);
        try {
            RowMetaInterface rmi = transMeta.getPrevStepFields(meta.getParentStepMeta().getName());
            List ls = rmi.getValueMetaList();
            for (Object l : ls) {
                ValueMetaBase vmb = (ValueMetaBase) l;
                wMessageField.add(vmb.getName());
            }
        } catch (KettleStepException ex) {
        // do nothing
        }
    };
    wMessageField.getCComboWidget().addListener(SWT.FocusIn, lsMessageFocus);
    FormData fdSetupComp = new FormData();
    fdSetupComp.left = new FormAttachment(0, 0);
    fdSetupComp.top = new FormAttachment(0, 0);
    fdSetupComp.right = new FormAttachment(100, 0);
    fdSetupComp.bottom = new FormAttachment(100, 0);
    wSetupComp.setLayoutData(fdSetupComp);
    wSetupComp.layout();
    wSetupTab.setControl(wSetupComp);
    wTabFolder.setSelection(0);
    wOK.addListener(SWT.Selection, lsOK);
    wCancel.addListener(SWT.Selection, lsCancel);
    // get data for message field, other fields data is loaded by the forms
    wMessageField.setText(nullToEmpty(meta.getFieldToSend()));
    setSize();
    meta.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) StepPluginType(org.pentaho.di.core.plugins.StepPluginType) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) Image(org.eclipse.swt.graphics.Image) StepDialogInterface(org.pentaho.di.trans.step.StepDialogInterface) GUIResource(org.pentaho.di.ui.core.gui.GUIResource) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) TransMeta(org.pentaho.di.trans.TransMeta) Composite(org.eclipse.swt.widgets.Composite) Listener(org.eclipse.swt.widgets.Listener) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) ConstUI(org.pentaho.di.ui.core.ConstUI) BaseStepDialog(org.pentaho.di.ui.trans.step.BaseStepDialog) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) JmsProducerMeta(org.pentaho.di.trans.step.jms.JmsProducerMeta) BaseMessages(org.pentaho.di.i18n.BaseMessages) Props(org.pentaho.di.core.Props) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) Group(org.eclipse.swt.widgets.Group) CTabItem(org.eclipse.swt.custom.CTabItem) List(java.util.List) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) KettleStepException(org.pentaho.di.core.exception.KettleStepException) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) PKG(org.pentaho.di.trans.step.jms.JmsConstants.PKG) Label(org.eclipse.swt.widgets.Label) JmsDelegate(org.pentaho.di.trans.step.jms.JmsDelegate) Group(org.eclipse.swt.widgets.Group) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) List(java.util.List) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase)

Example 93 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class MQTTProducerDialog method buildSetupTab.

private void buildSetupTab() {
    CTabItem wSetupTab = new CTabItem(wTabFolder, SWT.NONE);
    wSetupTab.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.SetupTab"));
    Composite wSetupComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSetupComp);
    FormLayout setupLayout = new FormLayout();
    setupLayout.marginHeight = 15;
    setupLayout.marginWidth = 15;
    wSetupComp.setLayout(setupLayout);
    Label wlMqttServer = new Label(wSetupComp, SWT.LEFT);
    props.setLook(wlMqttServer);
    wlMqttServer.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.Connection"));
    FormData fdlBootstrapServers = new FormData();
    fdlBootstrapServers.left = new FormAttachment(0, 0);
    fdlBootstrapServers.top = new FormAttachment(0, 0);
    fdlBootstrapServers.right = new FormAttachment(0, INPUT_WIDTH);
    wlMqttServer.setLayoutData(fdlBootstrapServers);
    wMqttServer = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMqttServer);
    wMqttServer.addModifyListener(lsMod);
    FormData fdBootstrapServers = new FormData();
    fdBootstrapServers.left = new FormAttachment(0, 0);
    fdBootstrapServers.top = new FormAttachment(wlMqttServer, 5);
    fdBootstrapServers.right = new FormAttachment(0, INPUT_WIDTH);
    wMqttServer.setLayoutData(fdBootstrapServers);
    Label wlClientId = new Label(wSetupComp, SWT.LEFT);
    props.setLook(wlClientId);
    wlClientId.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.ClientId"));
    FormData fdlClientId = new FormData();
    fdlClientId.left = new FormAttachment(0, 0);
    fdlClientId.top = new FormAttachment(wMqttServer, 10);
    fdlClientId.right = new FormAttachment(50, 0);
    wlClientId.setLayoutData(fdlClientId);
    wClientId = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wClientId);
    wClientId.addModifyListener(lsMod);
    FormData fdClientId = new FormData();
    fdClientId.left = new FormAttachment(0, 0);
    fdClientId.top = new FormAttachment(wlClientId, 5);
    fdClientId.right = new FormAttachment(0, INPUT_WIDTH);
    wClientId.setLayoutData(fdClientId);
    Label wlTopic = new Label(wSetupComp, SWT.LEFT);
    props.setLook(wlTopic);
    wlTopic.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.Topic"));
    FormData fdlTopic = new FormData();
    fdlTopic.left = new FormAttachment(0, 0);
    fdlTopic.top = new FormAttachment(wClientId, 10);
    fdlTopic.width = 200;
    wlTopic.setLayoutData(fdlTopic);
    wTopic = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTopic);
    wTopic.addModifyListener(lsMod);
    FormData fdTopic = new FormData();
    fdTopic.left = new FormAttachment(0, 0);
    fdTopic.top = new FormAttachment(wlTopic, 5);
    fdTopic.width = 200;
    wTopic.setLayoutData(fdTopic);
    Label wlQOS = new Label(wSetupComp, SWT.LEFT);
    props.setLook(wlQOS);
    wlQOS.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.QOS"));
    FormData fdlQOS = new FormData();
    fdlQOS.left = new FormAttachment(wlTopic, 15);
    fdlQOS.top = new FormAttachment(wClientId, 10);
    fdlQOS.width = 120;
    wlQOS.setLayoutData(fdlQOS);
    wQOS = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wQOS);
    wQOS.addModifyListener(lsMod);
    FormData fdQOS = new FormData();
    fdQOS.left = new FormAttachment(wTopic, 15);
    fdQOS.top = new FormAttachment(wlQOS, 5);
    fdQOS.width = 135;
    wQOS.setLayoutData(fdQOS);
    wQOS.add("0");
    wQOS.add("1");
    wQOS.add("2");
    Label wlMessageField = new Label(wSetupComp, SWT.LEFT);
    props.setLook(wlMessageField);
    wlMessageField.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.MessageField"));
    FormData fdlMessageField = new FormData();
    fdlMessageField.left = new FormAttachment(0, 0);
    fdlMessageField.top = new FormAttachment(wTopic, 10);
    fdlMessageField.right = new FormAttachment(50, 0);
    wlMessageField.setLayoutData(fdlMessageField);
    wMessageField = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMessageField);
    wMessageField.addModifyListener(lsMod);
    FormData fdMessageField = new FormData();
    fdMessageField.left = new FormAttachment(0, 0);
    fdMessageField.top = new FormAttachment(wlMessageField, 5);
    fdMessageField.right = new FormAttachment(0, INPUT_WIDTH);
    wMessageField.setLayoutData(fdMessageField);
    Listener lsMessageFocus = e -> {
        String current = wMessageField.getText();
        wMessageField.getCComboWidget().removeAll();
        wMessageField.setText(current);
        try {
            RowMetaInterface rmi = transMeta.getPrevStepFields(meta.getParentStepMeta().getName());
            List ls = rmi.getValueMetaList();
            for (Object l : ls) {
                ValueMetaBase vmb = (ValueMetaBase) l;
                wMessageField.add(vmb.getName());
            }
        } catch (KettleStepException ex) {
        // do nothing
        }
    };
    wMessageField.getCComboWidget().addListener(SWT.FocusIn, lsMessageFocus);
    FormData fdSetupComp = new FormData();
    fdSetupComp.left = new FormAttachment(0, 0);
    fdSetupComp.top = new FormAttachment(0, 0);
    fdSetupComp.right = new FormAttachment(100, 0);
    fdSetupComp.bottom = new FormAttachment(100, 0);
    wSetupComp.setLayoutData(fdSetupComp);
    wSetupComp.layout();
    wSetupTab.setControl(wSetupComp);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase) StepPluginType(org.pentaho.di.core.plugins.StepPluginType) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) MQTT_VERSION(org.pentaho.di.trans.step.mqtt.MQTTConstants.MQTT_VERSION) Image(org.eclipse.swt.graphics.Image) StepDialogInterface(org.pentaho.di.trans.step.StepDialogInterface) GUIResource(org.pentaho.di.ui.core.gui.GUIResource) TextVar(org.pentaho.di.ui.core.widget.TextVar) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) KEEP_ALIVE_INTERVAL(org.pentaho.di.trans.step.mqtt.MQTTConstants.KEEP_ALIVE_INTERVAL) TransMeta(org.pentaho.di.trans.TransMeta) SERVER_URIS(org.pentaho.di.trans.step.mqtt.MQTTConstants.SERVER_URIS) Composite(org.eclipse.swt.widgets.Composite) Listener(org.eclipse.swt.widgets.Listener) CONNECTION_TIMEOUT(org.pentaho.di.trans.step.mqtt.MQTTConstants.CONNECTION_TIMEOUT) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) AUTOMATIC_RECONNECT(org.pentaho.di.trans.step.mqtt.MQTTConstants.AUTOMATIC_RECONNECT) ConstUI(org.pentaho.di.ui.core.ConstUI) BaseStepDialog(org.pentaho.di.ui.trans.step.BaseStepDialog) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) CLEAN_SESSION(org.pentaho.di.trans.step.mqtt.MQTTConstants.CLEAN_SESSION) PluginDialog(org.pentaho.di.core.annotations.PluginDialog) BaseMessages(org.pentaho.di.i18n.BaseMessages) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Props(org.pentaho.di.core.Props) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) ShellEvent(org.eclipse.swt.events.ShellEvent) FormData(org.eclipse.swt.layout.FormData) FormAttachment(org.eclipse.swt.layout.FormAttachment) Display(org.eclipse.swt.widgets.Display) ShellAdapter(org.eclipse.swt.events.ShellAdapter) STORAGE_LEVEL(org.pentaho.di.trans.step.mqtt.MQTTConstants.STORAGE_LEVEL) CTabItem(org.eclipse.swt.custom.CTabItem) List(java.util.List) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) KettleStepException(org.pentaho.di.core.exception.KettleStepException) MAX_INFLIGHT(org.pentaho.di.trans.step.mqtt.MQTTConstants.MAX_INFLIGHT) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) ComboVar(org.pentaho.di.ui.core.widget.ComboVar) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) KettleStepException(org.pentaho.di.core.exception.KettleStepException) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.pentaho.di.ui.core.widget.TextVar) List(java.util.List) FormAttachment(org.eclipse.swt.layout.FormAttachment) ValueMetaBase(org.pentaho.di.core.row.value.ValueMetaBase)

Example 94 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class MQTTConsumerMetaTest method testXmlHasAllFields.

@Test
public void testXmlHasAllFields() {
    String serverName = "some_cluster";
    meta.setDefault();
    meta.setMqttServer(serverName);
    ArrayList<String> topicList = new ArrayList<>();
    topicList.add("temperature");
    meta.setTopics(topicList);
    meta.setQos("1");
    meta.setUsername("testuser");
    meta.setPassword("test");
    meta.setUseSsl(true);
    meta.setTransformationPath("/home/pentaho/myKafkaTransformation.ktr");
    meta.setBatchSize("54321");
    meta.setBatchDuration("987");
    StepMeta stepMeta = new StepMeta();
    TransMeta transMeta = mock(TransMeta.class);
    stepMeta.setParentTransMeta(transMeta);
    meta.setParentStepMeta(stepMeta);
    // tests serialization/deserialization round trip
    assertTrue(meta.equals(fromXml(meta.getXML())));
}
Also used : ArrayList(java.util.ArrayList) TransMeta(org.pentaho.di.trans.TransMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 95 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class MQTTProducerTest method setup.

@Before
public void setup() throws Exception {
    KettleLogStore.setLogChannelInterfaceFactory(logChannelFactory);
    when(logChannelFactory.create(any(), any())).thenReturn(logChannel);
    when(logChannelFactory.create(any())).thenReturn(logChannel);
    TransMeta transMeta = new TransMeta(getClass().getResource("/ProduceFourRows.ktr").getPath());
    trans = new Trans(transMeta);
    trans.setVariable("mqttServer", "127.0.0.1:1883");
    trans.setVariable("clientId", "client1");
    trans.setVariable("topic", "TestWinning");
    trans.setVariable("messageField", "message");
    trans.setVariable("qos", "0");
    trans.prepareExecution(new String[] {});
    StepMetaDataCombi combi = trans.getSteps().get(1);
    MQTTProducer step = (MQTTProducer) combi.step;
    MQTTProducerData data = (MQTTProducerData) combi.data;
    data.mqttClient = mqttClient;
    step.first = false;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) Trans(org.pentaho.di.trans.Trans) Before(org.junit.Before)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49