• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java KettleLogStore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testWillStopInputStepsOnly

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
@PrepareForTest( { Encode.class } )
public void testWillStopInputStepsOnly() 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( "inputOnly" ) ).thenReturn( "Y" );
  when( mockHttpServletRequest.getParameter( "name" ) ).thenReturn( "test" );
  when( mockHttpServletRequest.getParameter( "id" ) ).thenReturn( "123" );
  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 );

  stopTransServlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
  Mockito.verify( mockTrans ).safeStop();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:StopTransServletTest.java


示例17: testGetStatusServletEscapesHtmlWhenTransFound

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
@Test
public void testGetStatusServletEscapesHtmlWhenTransFound() 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( GetStatusServlet.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.getTransMeta() ).thenReturn( mockTransMeta );
  when( mockTransMeta.getMaximum() ).thenReturn( new Point( 10, 10 ) );

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


示例18: StepMockHelper

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
public StepMockHelper( String stepName, Class<Meta> stepMetaClass, Class<Data> stepDataClass ) {
  originalLogChannelInterfaceFactory = KettleLogStore.getLogChannelInterfaceFactory();
  logChannelInterfaceFactory = mock( LogChannelInterfaceFactory.class );
  logChannelInterface = mock( LogChannelInterface.class );
  KettleLogStore.setLogChannelInterfaceFactory( logChannelInterfaceFactory );
  stepMeta = mock( StepMeta.class );
  when( stepMeta.getName() ).thenReturn( stepName );
  stepDataInterface = mock( stepDataClass );
  transMeta = mock( TransMeta.class );
  when( transMeta.findStep( stepName ) ).thenReturn( stepMeta );
  trans = mock( Trans.class );
  initStepMetaInterface = mock( stepMetaClass );
  initStepDataInterface = mock( stepDataClass );
  processRowsStepDataInterface = mock( stepDataClass );
  processRowsStepMetaInterface = mock( stepMetaClass );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:StepMockHelper.java


示例19: main

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
public static void main( String[] args ) {

    Display display = new Display(  );
    try {
      KettleEnvironment.init();

      PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );

      KettleLogStore
          .init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes() );

    } catch ( KettleException e ) {
      e.printStackTrace();
    }

    KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON );
    Shell shell = new Shell( display, SWT.DIALOG_TRIM );
    shell.open();
    CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog( shell );
    capabilityManagerDialog.open();
    while ( !shell.isDisposed() ) {
      if ( !display.readAndDispatch() ) {
        display.sleep();
      }
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:CapabilityManagerDialog.java


示例20: initLogging

import org.pentaho.di.core.logging.KettleLogStore; //导入依赖的package包/类
private static void initLogging( CommandLineOption[] options ) throws KettleException {
  StringBuilder optionLogFile = getCommandLineOption( options, "logfile" ).getArgument();
  StringBuilder optionLogLevel = getCommandLineOption( options, "level" ).getArgument();

  // Set default Locale:
  Locale.setDefault( Const.DEFAULT_LOCALE );

  if ( !Utils.isEmpty( optionLogFile ) ) {
    fileLoggingEventListener = new FileLoggingEventListener( optionLogFile.toString(), true );
    if ( log.isBasic() ) {
      String filename = fileLoggingEventListener.getFilename();
      log.logBasic( BaseMessages.getString( PKG, "Spoon.Log.LoggingToFile" ) + filename );
    }
    KettleLogStore.getAppender().addLoggingEventListener( fileLoggingEventListener );
  } else {
    fileLoggingEventListener = null;
  }

  if ( !Utils.isEmpty( optionLogLevel ) ) {
    log.setLogLevel( LogLevel.getLogLevelForCode( optionLogLevel.toString() ) );
    if ( log.isBasic() ) {
      // "Logging is at level : "
      log.logBasic( BaseMessages.getString( PKG, "Spoon.Log.LoggingAtLevel" ) + log.getLogLevel().getDescription() );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:Spoon.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BasicCassandraMappingContext类代码示例发布时间:2022-05-22
下一篇:
Java HttpScheme类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap