Package org.pentaho.platform.uifoundation.component

Examples of org.pentaho.platform.uifoundation.component.HtmlComponent


    startTest();
    // This should succeed
    String url = "http://www.pentaho.org/demo/news.html"; //$NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();
    HtmlComponent component = new HtmlComponent( HtmlComponent.TYPE_URL, url, "", urlFactory, messages ); //$NON-NLS-1$
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$
    try {
      OutputStream outputStream = getOutputStream( "HTMLComponentTest.testComponent1", ".html" ); //$NON-NLS-1$//$NON-NLS-2$
      component.validate( session, null );
      String content = component.getContent( "text/html" ); //$NON-NLS-1$
      outputStream.write( content.getBytes() );
    } catch ( IOException e ) {
      e.printStackTrace();
    }
View Full Code Here


    info( Messages.getInstance().getString( "HTMLComponentTest.USER_ERRORS_EXPECTED_CONTENT_TYPE_INVALID" ) ); //$NON-NLS-1$
    // this should fail because the requested content type is not supported
    String url = "http://www.pentaho.org/demo/news.html"; //$NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();
    HtmlComponent component = new HtmlComponent( HtmlComponent.TYPE_URL, url, "", urlFactory, messages ); //$NON-NLS-1$
    component.setLoggingLevel( getLoggingLevel() );
    OutputStream outputStream = getOutputStream( "HTMLComponentTest.testComponent2", ".html" ); //$NON-NLS-1$//$NON-NLS-2$
    String contentType = "text/xml"; //$NON-NLS-1$

    SimpleParameterProvider requestParameters = new SimpleParameterProvider();
    SimpleParameterProvider sessionParameters = new SimpleParameterProvider();

    HashMap parameterProviders = new HashMap();
    parameterProviders.put( IParameterProvider.SCOPE_REQUEST, requestParameters );
    parameterProviders.put( IParameterProvider.SCOPE_SESSION, sessionParameters );
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$

    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, false );
    BaseRequestHandler requestHandler = new BaseRequestHandler( session, null, outputHandler, null, urlFactory );

    try {
      component.validate( session, requestHandler );
      component.handleRequest( outputStream, requestHandler, contentType, parameterProviders );
    } catch ( IOException e ) {
      e.printStackTrace();
    }

    finishTest();
View Full Code Here

    info( Messages.getInstance().getString( "HTMLComponentTest.USER_ERRORS_EXPECTED_URL_INVALID" ) ); //$NON-NLS-1$
    // this should fail because the url is bad
    String url = "xttp://a"; //$NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();
    HtmlComponent component =
        new HtmlComponent( HtmlComponent.TYPE_URL, url, Messages.getInstance().getString(
          "HTML.ERROR_0001_NOT_AVAILABLE" ), urlFactory, messages ); //$NON-NLS-1$
    component.setLoggingLevel( getLoggingLevel() );
    OutputStream outputStream = getOutputStream( "HTMLComponentTest.testComponent3", ".html" ); //$NON-NLS-1$//$NON-NLS-2$
    String contentType = "text/html"; //$NON-NLS-1$

    SimpleParameterProvider requestParameters = new SimpleParameterProvider();
    SimpleParameterProvider sessionParameters = new SimpleParameterProvider();

    HashMap parameterProviders = new HashMap();
    parameterProviders.put( IParameterProvider.SCOPE_REQUEST, requestParameters );
    parameterProviders.put( IParameterProvider.SCOPE_SESSION, sessionParameters );
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$

    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, false );
    BaseRequestHandler requestHandler = new BaseRequestHandler( session, null, outputHandler, null, urlFactory );

    try {
      component.validate( session, requestHandler );
      component.handleRequest( outputStream, requestHandler, contentType, parameterProviders );
    } catch ( IOException e ) {
      e.printStackTrace();
    }

    finishTest();
View Full Code Here

TOP

Related Classes of org.pentaho.platform.uifoundation.component.HtmlComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.