Search in sources :

Example 11 with TransMeta

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

the class SharedObjectSyncUtilTest method synchronizeSteps_should_not_sync_unshared.

@Test
public void synchronizeSteps_should_not_sync_unshared() throws Exception {
    final String stepName = "Step";
    TransMeta transformarion1 = createTransMeta();
    StepMeta step1 = createStepMeta(stepName, true);
    transformarion1.addStep(step1);
    spoonDelegates.trans.addTransformation(transformarion1);
    TransMeta transformarion2 = createTransMeta();
    StepMeta step2 = createStepMeta(stepName, false);
    transformarion2.addStep(step2);
    spoonDelegates.trans.addTransformation(transformarion2);
    step2.setDescription(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeSteps(step2);
    assertThat(step1.getDescription(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 12 with TransMeta

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

the class SharedObjectSyncUtilTest method synchronizePartitionSchemas_sync_shared_only.

@Test
public void synchronizePartitionSchemas_sync_shared_only() throws Exception {
    final String partitionSchemaName = "PartitionSchema";
    TransMeta transformarion1 = createTransMeta();
    PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
    transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
    spoonDelegates.trans.addTransformation(transformarion1);
    TransMeta transformarion2 = createTransMeta();
    PartitionSchema unsharedPartitionSchema2 = createPartitionSchema(partitionSchemaName, false);
    transformarion2.setPartitionSchemas(Collections.singletonList(unsharedPartitionSchema2));
    spoonDelegates.trans.addTransformation(transformarion2);
    TransMeta transformarion3 = createTransMeta();
    PartitionSchema partitionSchema3 = createPartitionSchema(partitionSchemaName, true);
    transformarion3.setPartitionSchemas(Collections.singletonList(partitionSchema3));
    spoonDelegates.trans.addTransformation(transformarion3);
    partitionSchema3.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
    sharedUtil.synchronizePartitionSchemas(partitionSchema3);
    assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(AFTER_SYNC_VALUE));
    assertThat(unsharedPartitionSchema2.getNumberOfPartitionsPerSlave(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Example 13 with TransMeta

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

the class SharedObjectSyncUtilTest method synchronizePartitionSchemas_should_not_sync_unshared.

@Test
public void synchronizePartitionSchemas_should_not_sync_unshared() throws Exception {
    final String partitionSchemaName = "PartitionSchema";
    TransMeta transformarion1 = createTransMeta();
    PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
    transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
    spoonDelegates.trans.addTransformation(transformarion1);
    TransMeta transformarion2 = createTransMeta();
    PartitionSchema partitionSchema2 = createPartitionSchema(partitionSchemaName, false);
    transformarion2.setPartitionSchemas(Collections.singletonList(partitionSchema2));
    spoonDelegates.trans.addTransformation(transformarion2);
    partitionSchema2.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
    sharedUtil.synchronizePartitionSchemas(partitionSchema2);
    assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Example 14 with TransMeta

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

the class SharedObjectSyncUtilTest method synchronizePartitionSchemas.

@Test
public void synchronizePartitionSchemas() throws Exception {
    final String partitionSchemaName = "SharedPartitionSchema";
    TransMeta transformarion1 = createTransMeta();
    PartitionSchema partitionSchema1 = createPartitionSchema(partitionSchemaName, true);
    transformarion1.setPartitionSchemas(Collections.singletonList(partitionSchema1));
    spoonDelegates.trans.addTransformation(transformarion1);
    TransMeta transformarion2 = createTransMeta();
    PartitionSchema partitionSchema2 = createPartitionSchema(partitionSchemaName, true);
    transformarion2.setPartitionSchemas(Collections.singletonList(partitionSchema2));
    spoonDelegates.trans.addTransformation(transformarion2);
    partitionSchema2.setNumberOfPartitionsPerSlave(AFTER_SYNC_VALUE);
    sharedUtil.synchronizePartitionSchemas(partitionSchema2);
    assertThat(partitionSchema1.getNumberOfPartitionsPerSlave(), equalTo(AFTER_SYNC_VALUE));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) TransMeta(org.pentaho.di.trans.TransMeta) Test(org.junit.Test)

Example 15 with TransMeta

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

the class SpoonExportXmlTest method savingTransToXmlNotChangesLogTables.

@Test
public void savingTransToXmlNotChangesLogTables() {
    TransMeta transMeta = new TransMeta();
    initTables(transMeta);
    TransLogTable originTransLogTable = transMeta.getTransLogTable();
    StepLogTable originStepLogTable = transMeta.getStepLogTable();
    PerformanceLogTable originPerformanceLogTable = transMeta.getPerformanceLogTable();
    ChannelLogTable originChannelLogTable = transMeta.getChannelLogTable();
    MetricsLogTable originMetricsLogTable = transMeta.getMetricsLogTable();
    when(spoon.getActiveTransformation()).thenReturn(transMeta);
    when(spoon.saveXMLFile(any(TransMeta.class), anyBoolean())).thenReturn(true);
    when(spoon.saveXMLFile(anyBoolean())).thenCallRealMethod();
    spoon.saveXMLFile(true);
    tablesCommonValuesEqual(originTransLogTable, transMeta.getTransLogTable());
    assertEquals(originTransLogTable.getLogInterval(), transMeta.getTransLogTable().getLogInterval());
    assertEquals(originTransLogTable.getLogSizeLimit(), transMeta.getTransLogTable().getLogSizeLimit());
    tablesCommonValuesEqual(originStepLogTable, transMeta.getStepLogTable());
    tablesCommonValuesEqual(originPerformanceLogTable, transMeta.getPerformanceLogTable());
    assertEquals(originPerformanceLogTable.getLogInterval(), transMeta.getPerformanceLogTable().getLogInterval());
    tablesCommonValuesEqual(originChannelLogTable, transMeta.getChannelLogTable());
    tablesCommonValuesEqual(originMetricsLogTable, transMeta.getMetricsLogTable());
}
Also used : PerformanceLogTable(org.pentaho.di.core.logging.PerformanceLogTable) MetricsLogTable(org.pentaho.di.core.logging.MetricsLogTable) ChannelLogTable(org.pentaho.di.core.logging.ChannelLogTable) StepLogTable(org.pentaho.di.core.logging.StepLogTable) TransMeta(org.pentaho.di.trans.TransMeta) TransLogTable(org.pentaho.di.core.logging.TransLogTable) Test(org.junit.Test)

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