use of org.pentaho.di.core.logging.ChannelLogTable 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());
}
use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.
the class SpoonExportXmlTest method savingJobToXmlNotChangesLogTables.
@Test
public void savingJobToXmlNotChangesLogTables() {
JobMeta jobMeta = new JobMeta();
initTables(jobMeta);
JobLogTable originJobLogTable = jobMeta.getJobLogTable();
JobEntryLogTable originJobEntryLogTable = jobMeta.getJobEntryLogTable();
ChannelLogTable originChannelLogTable = jobMeta.getChannelLogTable();
when(spoon.getActiveTransformation()).thenReturn(null);
when(spoon.getActiveJob()).thenReturn(jobMeta);
when(spoon.saveXMLFile(any(JobMeta.class), anyBoolean())).thenReturn(true);
when(spoon.saveXMLFile(anyBoolean())).thenCallRealMethod();
spoon.saveXMLFile(true);
tablesCommonValuesEqual(originJobLogTable, jobMeta.getJobLogTable());
assertEquals(originJobLogTable.getLogInterval(), jobMeta.getJobLogTable().getLogInterval());
assertEquals(originJobLogTable.getLogSizeLimit(), jobMeta.getJobLogTable().getLogSizeLimit());
tablesCommonValuesEqual(originJobEntryLogTable, jobMeta.getJobEntryLogTable());
tablesCommonValuesEqual(originChannelLogTable, jobMeta.getChannelLogTable());
}
use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.
the class XmlExportHelper method swapTables.
/**
* @param jobMeta
* contains log tables to be refactored before export
*/
public static void swapTables(JobMeta jobMeta) {
JobLogTable jobLogTable = jobMeta.getJobLogTable();
if (jobLogTable != null) {
JobLogTable cloneJobLogTable = (JobLogTable) jobLogTable.clone();
cloneJobLogTable.setAllGlobalParametersToNull();
jobMeta.setJobLogTable(cloneJobLogTable);
}
JobEntryLogTable jobEntryLogTable = jobMeta.getJobEntryLogTable();
if (jobEntryLogTable != null) {
JobEntryLogTable cloneEntryLogTable = (JobEntryLogTable) jobEntryLogTable.clone();
cloneEntryLogTable.setAllGlobalParametersToNull();
jobMeta.setJobEntryLogTable(cloneEntryLogTable);
}
ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
if (channelLogTable != null) {
ChannelLogTable cloneChannelLogTable = (ChannelLogTable) channelLogTable.clone();
cloneChannelLogTable.setAllGlobalParametersToNull();
jobMeta.setChannelLogTable(cloneChannelLogTable);
}
List<LogTableInterface> extraLogTables = jobMeta.getExtraLogTables();
if (extraLogTables != null) {
List<LogTableInterface> cloneExtraLogTables = new ArrayList<>();
for (LogTableInterface logTable : extraLogTables) {
if (logTable instanceof BaseLogTable) {
if (logTable instanceof Cloneable) {
BaseLogTable cloneExtraLogTable = (BaseLogTable) logTable.clone();
cloneExtraLogTable.setAllGlobalParametersToNull();
cloneExtraLogTables.add((LogTableInterface) cloneExtraLogTable);
}
}
}
jobMeta.setExtraLogTables(cloneExtraLogTables);
}
}
use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.
the class JobDialog method showLogTypeOptions.
private void showLogTypeOptions(int index) {
if (index != previousLogTableIndex) {
getLogInfo(previousLogTableIndex);
//
for (Control control : wLogOptionsComposite.getChildren()) {
control.dispose();
}
previousLogTableIndex = index;
LogTableInterface logTable = logTables.get(index);
LogTableUserInterface logTableUserInterface = logTableUserInterfaces.get(index);
if (logTableUserInterface != null) {
logTableUserInterface.showLogTableOptions(wLogOptionsComposite, logTable);
} else {
if (logTable instanceof JobLogTable) {
showJobLogTableOptions((JobLogTable) logTable);
} else if (logTable instanceof ChannelLogTable) {
showChannelLogTableOptions((ChannelLogTable) logTable);
}
if (logTable instanceof JobEntryLogTable) {
showJobEntryLogTableOptions((JobEntryLogTable) logTable);
}
}
wLogOptionsComposite.layout(true, true);
wLogComp.layout(true, true);
}
}
use of org.pentaho.di.core.logging.ChannelLogTable in project pentaho-kettle by pentaho.
the class Job method writeLogChannelInformation.
/**
* Write log channel information.
*
* @throws KettleException
* the kettle exception
*/
protected void writeLogChannelInformation() throws KettleException {
Database db = null;
ChannelLogTable channelLogTable = jobMeta.getChannelLogTable();
// PDI-7070: If parent job has the same channel logging info, don't duplicate log entries
Job j = getParentJob();
if (j != null) {
if (channelLogTable.equals(j.getJobMeta().getChannelLogTable())) {
return;
}
}
try {
db = new Database(this, channelLogTable.getDatabaseMeta());
db.shareVariablesWith(this);
db.connect();
db.setCommit(logCommitSize);
List<LoggingHierarchy> loggingHierarchyList = getLoggingHierarchy();
for (LoggingHierarchy loggingHierarchy : loggingHierarchyList) {
db.writeLogRecord(channelLogTable, LogStatus.START, loggingHierarchy, null);
}
// Also time-out the log records in here...
//
db.cleanupLogRecords(channelLogTable);
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(PKG, "Trans.Exception.UnableToWriteLogChannelInformationToLogTable"), e);
} finally {
if (!db.isAutoCommit()) {
db.commit(true);
}
db.disconnect();
}
}
Aggregations