Search in sources :

Example 11 with LogChannelInterface

use of org.pentaho.di.core.logging.LogChannelInterface in project pentaho-kettle by pentaho.

the class RepositoryImporterTest method createRepositoryImporter.

private static RepositoryImporter createRepositoryImporter(final JobEntryInterface jobEntryInterface, final StepMetaInterface stepMetaInterface, final boolean needToCheckPathForVariables) {
    Repository repository = mock(Repository.class);
    LogChannelInterface log = mock(LogChannelInterface.class);
    RepositoryImporter importer = new RepositoryImporter(repository, log) {

        @Override
        JobMeta createJobMetaForNode(Node jobnode) throws KettleXMLException {
            JobMeta meta = mock(JobMeta.class);
            JobEntryCopy jec = mock(JobEntryCopy.class);
            when(jec.isTransformation()).thenReturn(true);
            when(jec.getEntry()).thenReturn(jobEntryInterface);
            when(meta.getJobCopies()).thenReturn(Collections.singletonList(jec));
            return meta;
        }

        @Override
        TransMeta createTransMetaForNode(Node transnode) throws KettleMissingPluginsException, KettleXMLException {
            TransMeta meta = mock(TransMeta.class);
            StepMeta stepMeta = mock(StepMeta.class);
            when(stepMeta.isMapping()).thenReturn(true);
            when(stepMeta.getStepMetaInterface()).thenReturn(stepMetaInterface);
            when(meta.getSteps()).thenReturn(Collections.singletonList(stepMeta));
            return meta;
        }

        @Override
        protected void replaceSharedObjects(JobMeta transMeta) throws KettleException {
        }

        @Override
        protected void replaceSharedObjects(TransMeta transMeta) throws KettleException {
        }

        @Override
        boolean needToCheckPathForVariables() {
            return needToCheckPathForVariables;
        }
    };
    return importer;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Node(org.w3c.dom.Node) TransMeta(org.pentaho.di.trans.TransMeta) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 12 with LogChannelInterface

use of org.pentaho.di.core.logging.LogChannelInterface in project pentaho-kettle by pentaho.

the class TransSplitterTest method setUp.

@Before
public void setUp() throws Exception {
    LogChannelInterfaceFactory logChannelInterfaceFactory = mock(LogChannelInterfaceFactory.class);
    LogChannelInterface logChannelInterface = mock(LogChannelInterface.class);
    oldLogChannelInterfaceFactory = KettleLogStore.getLogChannelInterfaceFactory();
    KettleLogStore.setLogChannelInterfaceFactory(logChannelInterfaceFactory);
    when(logChannelInterfaceFactory.create(any(), any(LoggingObjectInterface.class))).thenReturn(logChannelInterface);
}
Also used : LogChannelInterfaceFactory(org.pentaho.di.core.logging.LogChannelInterfaceFactory) LoggingObjectInterface(org.pentaho.di.core.logging.LoggingObjectInterface) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) Before(org.junit.Before)

Example 13 with LogChannelInterface

use of org.pentaho.di.core.logging.LogChannelInterface in project pentaho-kettle by pentaho.

the class DimensionLookupMetaTest method setUp.

@Before
public void setUp() throws Exception {
    LogChannelInterfaceFactory logChannelInterfaceFactory = mock(LogChannelInterfaceFactory.class);
    LogChannelInterface logChannelInterface = mock(LogChannelInterface.class);
    KettleLogStore.setLogChannelInterfaceFactory(logChannelInterfaceFactory);
    when(logChannelInterfaceFactory.create(any(), any(LoggingObjectInterface.class))).thenReturn(logChannelInterface);
}
Also used : LogChannelInterfaceFactory(org.pentaho.di.core.logging.LogChannelInterfaceFactory) LoggingObjectInterface(org.pentaho.di.core.logging.LoggingObjectInterface) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) Before(org.junit.Before)

Example 14 with LogChannelInterface

use of org.pentaho.di.core.logging.LogChannelInterface in project pentaho-kettle by pentaho.

the class PrepareExecutionTransServletTest method testPauseTransServletEscapesHtmlWhenTransFound.

@Test
@PrepareForTest({ Encode.class })
public void testPauseTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
    KettleLogStore.init();
    HttpServletRequest mockHttpServletRequest = mock(HttpServletRequest.class);
    HttpServletResponse mockHttpServletResponse = mock(HttpServletResponse.class);
    Trans mockTrans = mock(Trans.class);
    TransConfiguration mockTransConf = mock(TransConfiguration.class);
    TransMeta mockTransMeta = mock(TransMeta.class);
    TransExecutionConfiguration mockTransExecutionConf = mock(TransExecutionConfiguration.class);
    LogChannelInterface mockChannelInterface = mock(LogChannelInterface.class);
    StringWriter out = new StringWriter();
    PrintWriter printWriter = new PrintWriter(out);
    PowerMockito.spy(Encode.class);
    when(mockHttpServletRequest.getContextPath()).thenReturn(PrepareExecutionTransServlet.CONTEXT_PATH);
    when(mockHttpServletRequest.getParameter(anyString())).thenReturn(ServletTestUtils.BAD_STRING_TO_TEST);
    when(mockHttpServletResponse.getWriter()).thenReturn(printWriter);
    when(mockTransformationMap.getTransformation(any(CarteObjectEntry.class))).thenReturn(mockTrans);
    when(mockTransformationMap.getConfiguration(any(CarteObjectEntry.class))).thenReturn(mockTransConf);
    when(mockTransConf.getTransExecutionConfiguration()).thenReturn(mockTransExecutionConf);
    when(mockTrans.getLogChannel()).thenReturn(mockChannelInterface);
    when(mockTrans.getTransMeta()).thenReturn(mockTransMeta);
    when(mockTransMeta.getMaximum()).thenReturn(new Point(10, 10));
    prepareExecutionTransServlet.doGet(mockHttpServletRequest, mockHttpServletResponse);
    assertFalse(ServletTestUtils.hasBadText(ServletTestUtils.getInsideOfTag("H1", out.toString())));
    PowerMockito.verifyStatic(atLeastOnce());
    Encode.forHtml(anyString());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) StringWriter(java.io.StringWriter) TransMeta(org.pentaho.di.trans.TransMeta) HttpServletResponse(javax.servlet.http.HttpServletResponse) Point(org.pentaho.di.core.gui.Point) Trans(org.pentaho.di.trans.Trans) TransConfiguration(org.pentaho.di.trans.TransConfiguration) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) PrintWriter(java.io.PrintWriter) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 15 with LogChannelInterface

use of org.pentaho.di.core.logging.LogChannelInterface in project pentaho-kettle by pentaho.

the class MailConnectionTest method beforeExec.

@Before
public void beforeExec() throws KettleException, MessagingException {
    Object subj = new Object();
    LogChannelInterface log = new LogChannel(subj);
    conn = new Mconn(log);
}
Also used : LogChannel(org.pentaho.di.core.logging.LogChannel) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) Before(org.junit.Before)

Aggregations

LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)65 Test (org.junit.Test)42 HttpServletRequest (javax.servlet.http.HttpServletRequest)27 HttpServletResponse (javax.servlet.http.HttpServletResponse)27 PrintWriter (java.io.PrintWriter)26 Point (org.pentaho.di.core.gui.Point)26 StringWriter (java.io.StringWriter)25 TransMeta (org.pentaho.di.trans.TransMeta)24 Trans (org.pentaho.di.trans.Trans)20 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)16 KettleException (org.pentaho.di.core.exception.KettleException)12 JobMeta (org.pentaho.di.job.JobMeta)12 Job (org.pentaho.di.job.Job)11 ArrayList (java.util.ArrayList)8 LogChannel (org.pentaho.di.core.logging.LogChannel)6 Matchers.anyString (org.mockito.Matchers.anyString)5 Before (org.junit.Before)4 StepInterface (org.pentaho.di.trans.step.StepInterface)4 ServletOutputStream (javax.servlet.ServletOutputStream)3 LoggingObjectInterface (org.pentaho.di.core.logging.LoggingObjectInterface)3