Package org.pentaho.platform.uifoundation.chart

Examples of org.pentaho.platform.uifoundation.chart.DashboardWidgetComponent


  public void testWidget2() {

    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();

    DashboardWidgetComponent widget =
        new DashboardWidgetComponent( DashboardWidgetComponent.TYPE_DIAL, getSolutionPath()
            + "/samples/charts/dashboardwidget1.dial.xml", 200, 200, urlFactory, messages ); //$NON-NLS-1$

    widget.setValue( 49 );
    widget.setTitle( "test widget 1" ); //$NON-NLS-1$
    widget.setUnits( "" ); //$NON-NLS-1$

    StandaloneSession session = new StandaloneSession( "BaseTest.DEBUG_JUNIT_SESSION" ); //$NON-NLS-1$
    widget.validate( session, null );

    SimpleParameterProvider requestParameters = new SimpleParameterProvider();
    SimpleParameterProvider sessionParameters = new SimpleParameterProvider();
    widget.setParameterProvider( HttpRequestParameterProvider.SCOPE_REQUEST, requestParameters );
    widget.setParameterProvider( HttpSessionParameterProvider.SCOPE_SESSION, sessionParameters );

    String content = widget.getContent( "text/html" ); //$NON-NLS-1$
    OutputStream outputStream = getOutputStream( "DashboardWidgetTest.testWidget1", ".html" ); //$NON-NLS-1$//$NON-NLS-2$
    try {
      outputStream.write( content.getBytes() );
    } catch ( Exception e ) {
      // content check will test this
View Full Code Here


    startTest();

    SimpleUrlFactory urlFactory = new SimpleUrlFactory( "/testurl?" ); //$NON-NLS-1$
    ArrayList messages = new ArrayList();

    DashboardWidgetComponent widget =
        new DashboardWidgetComponent( DashboardWidgetComponent.TYPE_DIAL, getSolutionPath()
            + "/samples/charts/dashboardwidget1.dial.xml", 300, 300, urlFactory, messages ); //$NON-NLS-1$

    widget.setLoggingLevel( getLoggingLevel() );
    widget.setValue( 72.5 );
    widget.setTitle( "test widget 1" ); //$NON-NLS-1$
    widget.setUnits( "$" ); //$NON-NLS-1$

    OutputStream outputStream = getOutputStream( "DashboardWidgetTest.testWidget1", ".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( HttpRequestParameterProvider.SCOPE_REQUEST, requestParameters );
    parameterProviders.put( HttpSessionParameterProvider.SCOPE_SESSION, sessionParameters );
    StandaloneSession session = new StandaloneSession( "BaseTest.DEBUG_JUNIT_SESSION" ); //$NON-NLS-1$

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

    try {
      widget.validate( session, requestHandler );
      widget.handleRequest( outputStream, requestHandler, contentType, parameterProviders );
    } catch ( IOException e ) {
      e.printStackTrace();
    }
    finishTest();
View Full Code Here

TOP

Related Classes of org.pentaho.platform.uifoundation.chart.DashboardWidgetComponent

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.