当前位置: 首页>>代码示例>>Java>>正文


Java KettleLogStore类代码示例

本文整理汇总了Java中org.pentaho.di.core.logging.KettleLogStore的典型用法代码示例。如果您正苦于以下问题:Java KettleLogStore类的具体用法?Java KettleLogStore怎么用?Java KettleLogStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KettleLogStore类属于org.pentaho.di.core.logging包,在下文中一共展示了KettleLogStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRemoveJobServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testRemoveJobServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Job mockJob = mock( Job.class );
  JobMeta mockJobMeta = mock( JobMeta.class );
  LogChannelInterface mockLogChannelInterface = mock( LogChannelInterface.class );
  mockJob.setName( ServletTestUtils.BAD_STRING );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( RemoveJobServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockJobMap.getJob( any( CarteObjectEntry.class ) ) ).thenReturn( mockJob );
  when( mockJob.getLogChannelId() ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockJob.getLogChannel() ).thenReturn( mockLogChannelInterface );
  when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
  when( mockJobMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  removeJobServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H3", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:RemoveJobServletIT.java

示例2: testStopTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testStopTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( StopTransServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  stopTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:StopTransServletIT.java

示例3: testStartJobServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testStartJobServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Job mockJob = mock( Job.class );
  JobMeta mockJobMeta = mock( JobMeta.class );
  LogChannelInterface mockLogChannelInterface = mock( LogChannelInterface.class );
  mockJob.setName( ServletTestUtils.BAD_STRING );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( StartJobServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockJobMap.getJob( any( CarteObjectEntry.class ) ) ).thenReturn( mockJob );
  when( mockJob.getLogChannelId() ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockJob.getLogChannel() ).thenReturn( mockLogChannelInterface );
  when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
  when( mockJobMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  startJobServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:StartJobServletIT.java

示例4: testPauseTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testPauseTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( PauseTransServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  pauseTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( out.toString().contains( ServletTestUtils.BAD_STRING ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:PauseTransServletIT.java

示例5: testStartTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testStartTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( StartTransServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  startTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:StartTransServletIT.java

示例6: testStartExecutionTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testStartExecutionTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( StartExecutionTransServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.isReadyToStart() ).thenReturn( true );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  startExecutionTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  System.out.println( out );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:StartExecutionTransServletIT.java

示例7: testGetJobStatusServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testGetJobStatusServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Job mockJob = mock( Job.class );
  JobMeta mockJobMeta = mock( JobMeta.class );
  LogChannelInterface mockLogChannelInterface = mock( LogChannelInterface.class );
  mockJob.setName( ServletTestUtils.BAD_STRING );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( GetJobStatusServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockJobMap.getJob( any( CarteObjectEntry.class ) ) ).thenReturn( mockJob );
  when( mockJob.getLogChannel() ).thenReturn( mockLogChannelInterface );
  when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
  when( mockJobMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  getJobStatusServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );

  assertFalse( out.toString().contains( ServletTestUtils.BAD_STRING ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:GetJobStatusServletIT.java

示例8: testStopJobServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testStopJobServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Job mockJob = mock( Job.class );
  JobMeta mockJobMeta = mock( JobMeta.class );
  LogChannelInterface mockLogChannelInterface = mock( LogChannelInterface.class );
  mockJob.setName( ServletTestUtils.BAD_STRING );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( StopJobServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockJobMap.getJob( any( CarteObjectEntry.class ) ) ).thenReturn( mockJob );
  when( mockJob.getLogChannelId() ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockJob.getLogChannel() ).thenReturn( mockLogChannelInterface );
  when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
  when( mockJobMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  stopJobServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:StopJobServletIT.java

示例9: testGetTransStatusServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testGetTransStatusServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( GetTransStatusServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  getTransStatusServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( out.toString().contains( ServletTestUtils.BAD_STRING ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:GetTransStatusServletIT.java

示例10: testRemoveTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testRemoveTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  when( mockHttpServletRequest.getContextPath() ).thenReturn( RemoveTransServlet.CONTEXT_PATH );
  when( mockHttpServletRequest.getParameter( anyString() ) ).thenReturn( ServletTestUtils.BAD_STRING );
  when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );
  when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans );
  when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  removeTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H3", out.toString() ) ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:RemoveTransServletIT.java

示例11: startTransformation

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@GET
@Path( "/start/{id : .+}" )
@Produces( { MediaType.APPLICATION_JSON } )
public TransformationStatus startTransformation( @PathParam( "id" ) String id ) {
  Trans trans = CarteResource.getTransformation( id );
  try {
    // Discard old log lines from old transformation runs
    //
    KettleLogStore.discardLines( trans.getLogChannelId(), true );

    String carteObjectId = UUID.randomUUID().toString();
    SimpleLoggingObject servletLoggingObject =
      new SimpleLoggingObject( getClass().getName(), LoggingObjectType.CARTE, null );
    servletLoggingObject.setContainerObjectId( carteObjectId );
    servletLoggingObject.setLogLevel( trans.getLogLevel() );
    trans.setParent( servletLoggingObject );
    trans.execute( null );
  } catch ( KettleException e ) {
    e.printStackTrace();
  }
  return getTransformationStatus( id );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:TransformationResource.java

示例12: handleError

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
private boolean handleError() throws KettleStepException {
  SingleThreaderData singleThreaderData = getData();
  if ( getStepMeta().isDoingErrorHandling() ) {
    int lastLogLine = KettleLogStore.getLastBufferLineNr();
    StringBuffer logText =
      KettleLogStore.getAppender().getBuffer(  singleThreaderData.mappingTrans.getLogChannelId(), false,  singleThreaderData.lastLogLine );
    singleThreaderData.lastLogLine = lastLogLine;

    for ( Object[] row :  singleThreaderData.errorBuffer ) {
      putError( getInputRowMeta(), row, 1L, logText.toString(), null, "STR-001" );
    }

    singleThreaderData.executor.clearError();

    return true; // continue
  } else {
    setErrors( 1 );
    stopAll();
    logError( BaseMessages.getString( PKG, "SingleThreader.Log.ErrorOccurredInSubTransformation" ) );
    return false; // stop running
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:SingleThreader.java

示例13: exitJVM

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
private static final void exitJVM( int status ) {

    // Let's not forget to close the log file we're writing to...
    //
    if ( fileLoggingEventListener != null ) {
      try {
        fileLoggingEventListener.close();
      } catch ( Exception e ) {
        e.printStackTrace( System.err );
        status = 1;
      }
      KettleLogStore.getAppender().removeLoggingEventListener( fileLoggingEventListener );
    }

    System.exit( status );
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:Pan.java

示例14: testStartTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
@PrepareForTest( { Encode.class } )
public void testStartTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  PowerMockito.spy( Encode.class );
  when( mockHttpServletRequest.getContextPath() ).thenReturn( StartTransServlet.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( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  startTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );

  PowerMockito.verifyStatic( atLeastOnce() );
  Encode.forHtml( anyString() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:StartTransServletTest.java

示例15: testStopTransServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
@PrepareForTest( { Encode.class } )
public void testStopTransServletEscapesHtmlWhenTransFound() throws ServletException, IOException {
  KettleLogStore.init();
  HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
  HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
  Trans mockTrans = mock( Trans.class );
  TransMeta mockTransMeta = mock( TransMeta.class );
  LogChannelInterface mockChannelInterface = mock( LogChannelInterface.class );
  StringWriter out = new StringWriter();
  PrintWriter printWriter = new PrintWriter( out );

  PowerMockito.spy( Encode.class );
  when( mockHttpServletRequest.getContextPath() ).thenReturn( StopTransServlet.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( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface );
  when( mockTrans.getLogChannelId() ).thenReturn( "test" );
  when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

  stopTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  assertFalse( ServletTestUtils.hasBadText( ServletTestUtils.getInsideOfTag( "H1", out.toString() ) ) );

  PowerMockito.verifyStatic( atLeastOnce() );
  Encode.forHtml( anyString() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:StopTransServletTest.java


注:本文中的org.pentaho.di.core.logging.KettleLogStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。