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