Examples of SimpleParameterProvider


Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

      StandaloneSession session = new StandaloneSession( userId );

      solutionEngine = PentahoSystem.get( SolutionEngine.class, session );
      solutionEngine.init( session );

      SimpleParameterProvider parameterProvider = new SimpleParameterProvider( parameters );

      HashMap<String, IParameterProvider> parameterProviderMap = new HashMap<String, IParameterProvider>();
      parameterProviderMap.put( IParameterProvider.SCOPE_REQUEST, parameterProvider );

      IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext();
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

          parameterContentGenerator.setOutputHandler( new SimpleOutputHandler( outputStream, false ) );
          parameterContentGenerator.setMessagesList( new ArrayList<String>() );

          Map<String, IParameterProvider> parameterProviders = new HashMap<String, IParameterProvider>();

          SimpleParameterProvider parameterProvider = getSimpleParameterProvider();
          parameterProvider.setParameter( "path", encode( repositoryFile.getPath() ) );
          parameterProvider.setParameter( "renderMode", "PARAMETER" );
          parameterProviders.put( IParameterProvider.SCOPE_REQUEST, parameterProvider );

          parameterContentGenerator.setParameterProviders( parameterProviders );
          parameterContentGenerator.setSession( getSession() );
          parameterContentGenerator.createContent();
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    return PentahoSystem.get( IPluginManager.class ).getContentGenerator(
        repositoryFile.getName().substring( repositoryFile.getName().lastIndexOf( '.' ) + 1 ), "parameter" );
  }

  protected SimpleParameterProvider getSimpleParameterProvider() {
    return new SimpleParameterProvider();
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    doReturn( true ).when( fileResource ).hasParameterUi( mockRepositoryFile );

    IContentGenerator mockContentGenerator = mock( IContentGenerator.class );
    doReturn( mockContentGenerator ).when( fileResource ).getContentGenerator( mockRepositoryFile );

    SimpleParameterProvider mockSimpleParameterProvider = mock( SimpleParameterProvider.class );
    doReturn( mockSimpleParameterProvider ).when( fileResource ).getSimpleParameterProvider();

    String repositoryPath = "repositoryPath";
    doReturn( repositoryPath ).when( mockRepositoryFile ).getPath();
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

  }

  public void testHelloWorldComponent() {
    startTest();
    String testName = HW_TEST_NAME + System.currentTimeMillis();
    SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
    IRuntimeContext context = run( "/test/platform/HelloWorld.xaction", parameterProvider, testName, HW_TEST_EXTN ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    InputStream is = this.getInputStreamFromOutput( testName, HW_TEST_EXTN );
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

  protected IParameterProvider createSessionParameterProvider() {
    return new HttpSessionParameterProvider( PentahoSessionHolder.getSession() );
  }

  protected IParameterProvider createHeaderParamProvider() {
    SimpleParameterProvider headerParams = new SimpleParameterProvider();
    Enumeration<?> names = httpServletRequest.getHeaderNames();
    while ( names.hasMoreElements() ) {
      String name = (String) names.nextElement();
      String value = httpServletRequest.getHeader( name );
      headerParams.setParameter( name, value );
    }
    return headerParams;
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    }
    return headerParams;
  }

  protected IParameterProvider createPathParamProvider() throws IOException {
    SimpleParameterProvider pathParams = null;
    if ( StringUtils.isEmpty( httpServletRequest.getPathInfo() ) ) {
      httpServletResponse.sendError( 403 );
    } else {
      pathParams = new SimpleParameterProvider();
      pathParams.setParameter( "query", httpServletRequest.getQueryString() ); //$NON-NLS-1$

      List<String> mediaTypes = new ArrayList<String>( acceptableMediaTypes.size() );
      for ( MediaType type : acceptableMediaTypes ) {
        mediaTypes.add( type.toString() );
      }
      pathParams.setParameter( "acceptableMediaTypes", mediaTypes ); //$NON-NLS-1$
      if ( mediaTypes.size() > 0 ) {
        pathParams.setParameter( "contentType", acceptableMediaTypes.get( 0 ) ); //$NON-NLS-1$
      }
      pathParams.setParameter( "inputstream", httpServletRequest.getInputStream() ); //$NON-NLS-1$
      pathParams.setParameter( "httpresponse", httpServletResponse ); //$NON-NLS-1$
      pathParams.setParameter( "httprequest", httpServletRequest ); //$NON-NLS-1$
      pathParams.setParameter( "remoteaddr", httpServletRequest.getRemoteAddr() ); //$NON-NLS-1$
      if ( file != null ) {
        pathParams.setParameter( "path", URLEncoder.encode( file.getPath(), "UTF-8" ) ); //$NON-NLS-1$
        pathParams.setParameter( "file", file ); //$NON-NLS-1$
      }
      if ( command != null ) {
        // path beyond that which matched the GeneratorResource
        pathParams.setParameter( "cmd", command ); //$NON-NLS-1$
      }
    }
    return pathParams;
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    }

  }

  public void testHQLConnection() {
    SimpleParameterProvider parameters = new SimpleParameterProvider();
    OutputStream outputStream = getOutputStream( SOLUTION_PATH, "Chart_Bubble", ".html" ); //$NON-NLS-1$ //$NON-NLS-2$
    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, true );
    IRuntimeContext context =
        run( getSolutionPath() + "/test/datasource/", "HQL_Datasource.xaction", parameters, outputHandler ); //$NON-NLS-1$
    assertEquals(
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    return SOLUTION_PATH;
  }

  public void testTemplate1() {
    startTest();
    SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
    parameterProvider.setParameter( "customer", "Acme" ); //$NON-NLS-1$ //$NON-NLS-2$

    IRuntimeContext context = run( "/test/template/template1.xaction", parameterProvider ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$
    assertNotNull( "", context.getOutputParameter( "output" ) ); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

Examples of org.pentaho.platform.engine.core.solution.SimpleParameterProvider

    finishTest();
  }

  public void testTemplate2() {
    startTest();
    SimpleParameterProvider parameterProvider = new SimpleParameterProvider();

    IRuntimeContext context = run( "/test/template/template2.xaction", parameterProvider ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$
    assertNotNull( "", context.getOutputParameter( "output" ) ); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.