org.etlunit.LoggingProcessExecutor Maven / Gradle / Ivy
package org.etlunit;
import org.etlunit.io.NullInputStream;
import org.etlunit.io.NullReader;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.*;
public class LoggingProcessExecutor implements ProcessExecutor
{
private Log applicationLog;
private final StringBuilder processLog = new StringBuilder();
public StringBuilder getProcessLog()
{
return processLog;
}
@Inject
public void setLogger(@Named("applicationLog") Log log)
{
this.applicationLog = log;
}
@Override
public ProcessFacade execute(final ProcessDescription pd)
{
processLog.append(pd.debugString() + "\n");
return new ProcessFacade()
{
@Override
public ProcessDescription getDescriptor()
{
return pd;
}
@Override
public void waitForCompletion()
{
}
@Override
public int getCompletionCode()
{
return 0;
}
@Override
public void kill()
{
}
@Override
public Writer getWriter()
{
return null;
}
@Override
public BufferedReader getReader()
{
return new BufferedReader(new NullReader());
}
@Override
public BufferedReader getErrorReader()
{
return new BufferedReader(new NullReader());
}
@Override
public StringBuffer getInputBuffered() throws IOException
{
return new StringBuffer();
}
@Override
public StringBuffer getErrorBuffered() throws IOException
{
return new StringBuffer();
}
@Override
public void waitForStreams()
{
}
@Override
public OutputStream getOutputStream()
{
return null;
}
@Override
public InputStream getInputStream()
{
return new NullInputStream();
}
@Override
public InputStream getErrorStream()
{
return new NullInputStream();
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy