use of org.pentaho.di.core.logging.StepLogTable in project pentaho-kettle by pentaho.
the class PurRepositoryUnitTest method onlyGlobalVariablesOfLogTablesSetToNull.
@Test
public void onlyGlobalVariablesOfLogTablesSetToNull() {
try {
System.setProperty(Const.KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT, "true");
PurRepositoryExporter purRepoExporter = new PurRepositoryExporter(mock(PurRepository.class));
String hardcodedString = "hardcoded";
String globalParam = "${" + Const.KETTLE_TRANS_LOG_TABLE + "}";
StepLogTable stepLogTable = StepLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
stepLogTable.setConnectionName(hardcodedString);
stepLogTable.setSchemaName(hardcodedString);
stepLogTable.setTimeoutInDays(hardcodedString);
stepLogTable.setTableName(globalParam);
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
jobEntryLogTable.setConnectionName(hardcodedString);
jobEntryLogTable.setSchemaName(hardcodedString);
jobEntryLogTable.setTimeoutInDays(hardcodedString);
jobEntryLogTable.setTableName(globalParam);
List<LogTableInterface> logTables = new ArrayList<>();
logTables.add(jobEntryLogTable);
logTables.add(stepLogTable);
purRepoExporter.setGlobalVariablesOfLogTablesNull(logTables);
for (LogTableInterface logTable : logTables) {
assertEquals(logTable.getConnectionName(), hardcodedString);
assertEquals(logTable.getSchemaName(), hardcodedString);
assertEquals(logTable.getTimeoutInDays(), hardcodedString);
assertEquals(logTable.getTableName(), null);
}
} finally {
System.setProperty(Const.KETTLE_GLOBAL_LOG_VARIABLES_CLEAR_ON_EXPORT, "false");
}
}
use of org.pentaho.di.core.logging.StepLogTable in project pentaho-kettle by pentaho.
the class PurRepositoryUnitTest method globalVariablesOfLogTablesNotSetToNull.
@Test
public void globalVariablesOfLogTablesNotSetToNull() {
PurRepositoryExporter purRepoExporter = new PurRepositoryExporter(mock(PurRepository.class));
String globalParam = "${" + Const.KETTLE_TRANS_LOG_TABLE + "}";
StepLogTable stepLogTable = StepLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
stepLogTable.setConnectionName(globalParam);
stepLogTable.setSchemaName(globalParam);
stepLogTable.setTimeoutInDays(globalParam);
stepLogTable.setTableName(globalParam);
JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
jobEntryLogTable.setConnectionName(globalParam);
jobEntryLogTable.setSchemaName(globalParam);
jobEntryLogTable.setTimeoutInDays(globalParam);
jobEntryLogTable.setTableName(globalParam);
List<LogTableInterface> logTables = new ArrayList<>();
logTables.add(jobEntryLogTable);
logTables.add(stepLogTable);
purRepoExporter.setGlobalVariablesOfLogTablesNull(logTables);
for (LogTableInterface logTable : logTables) {
assertEquals(logTable.getConnectionName(), globalParam);
assertEquals(logTable.getSchemaName(), globalParam);
assertEquals(logTable.getTimeoutInDays(), globalParam);
assertEquals(logTable.getTableName(), globalParam);
}
}
use of org.pentaho.di.core.logging.StepLogTable in project pentaho-kettle by pentaho.
the class XmlExportHelper method swapTables.
/**
* When exporting meta we should not export user global parameters.
* Method makes clone for each table and deletes all global parameters.
* We have to make clones of each table, because we don't want to change real tables content.
*
* @param transMeta
* meta, that contains log tables to be refactored before export
*/
public static void swapTables(TransMeta transMeta) {
TransLogTable transLogTable = transMeta.getTransLogTable();
if (transLogTable != null) {
TransLogTable cloneTransLogTable = (TransLogTable) transLogTable.clone();
cloneTransLogTable.setAllGlobalParametersToNull();
transMeta.setTransLogTable(cloneTransLogTable);
}
StepLogTable stepLogTable = transMeta.getStepLogTable();
if (stepLogTable != null) {
StepLogTable cloneStepLogTable = (StepLogTable) stepLogTable.clone();
cloneStepLogTable.setAllGlobalParametersToNull();
transMeta.setStepLogTable(cloneStepLogTable);
}
PerformanceLogTable performanceLogTable = transMeta.getPerformanceLogTable();
if (performanceLogTable != null) {
PerformanceLogTable clonePerformanceLogTable = (PerformanceLogTable) performanceLogTable.clone();
clonePerformanceLogTable.setAllGlobalParametersToNull();
transMeta.setPerformanceLogTable(clonePerformanceLogTable);
}
ChannelLogTable channelLogTable = transMeta.getChannelLogTable();
if (channelLogTable != null) {
ChannelLogTable cloneChannelLogTable = (ChannelLogTable) channelLogTable.clone();
cloneChannelLogTable.setAllGlobalParametersToNull();
transMeta.setChannelLogTable(cloneChannelLogTable);
}
MetricsLogTable metricsLogTable = transMeta.getMetricsLogTable();
if (metricsLogTable != null) {
MetricsLogTable cloneMetricsLogTable = (MetricsLogTable) metricsLogTable.clone();
cloneMetricsLogTable.setAllGlobalParametersToNull();
transMeta.setMetricsLogTable(cloneMetricsLogTable);
}
}
use of org.pentaho.di.core.logging.StepLogTable in project pentaho-kettle by pentaho.
the class SpoonExportXmlTest method initTables.
private void initTables(TransMeta transMeta) {
TransLogTable transLogTable = TransLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface, null);
initTableWithSampleParams(transLogTable);
transLogTable.setLogInterval(GLOBAL_PARAM);
transLogTable.setLogSizeLimit(GLOBAL_PARAM);
transMeta.setTransLogTable(transLogTable);
StepLogTable stepLogTable = StepLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
initTableWithSampleParams(stepLogTable);
transMeta.setStepLogTable(stepLogTable);
PerformanceLogTable performanceLogTable = PerformanceLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
initTableWithSampleParams(performanceLogTable);
performanceLogTable.setLogInterval(GLOBAL_PARAM);
transMeta.setPerformanceLogTable(performanceLogTable);
ChannelLogTable channelLogTable = ChannelLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
initTableWithSampleParams(channelLogTable);
transMeta.setChannelLogTable(channelLogTable);
MetricsLogTable metricsLogTable = MetricsLogTable.getDefault(mockedVariableSpace, mockedHasDbInterface);
initTableWithSampleParams(metricsLogTable);
transMeta.setMetricsLogTable(metricsLogTable);
}
use of org.pentaho.di.core.logging.StepLogTable in project pentaho-kettle by pentaho.
the class Spoon method saveTransAsXmlFile.
private boolean saveTransAsXmlFile(TransMeta transMeta, boolean export) {
TransLogTable origTransLogTable = transMeta.getTransLogTable();
StepLogTable origStepLogTable = transMeta.getStepLogTable();
PerformanceLogTable origPerformanceLogTable = transMeta.getPerformanceLogTable();
ChannelLogTable origChannelLogTable = transMeta.getChannelLogTable();
MetricsLogTable origMetricsLogTable = transMeta.getMetricsLogTable();
try {
XmlExportHelper.swapTables(transMeta);
return saveXMLFile(transMeta, export);
} finally {
transMeta.setTransLogTable(origTransLogTable);
transMeta.setStepLogTable(origStepLogTable);
transMeta.setPerformanceLogTable(origPerformanceLogTable);
transMeta.setChannelLogTable(origChannelLogTable);
transMeta.setMetricsLogTable(origMetricsLogTable);
}
}
Aggregations