Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IActionParameter


      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "pojo4.xaction", "empty action sequence test", false, true, null, false, new HashMap(), null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
      IActionParameter param = runtimeContext.getOutputParameter( "output1" );
      assertNotNull( "RuntimeContext is null", runtimeContext );
      assertNotNull( "param is null", param );
      assertEquals( "abcdeabcde", param.getValue().toString() );
      assertEquals( "done() was called", false, PojoComponentTest.doneCalled );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
    } catch ( Exception e ) {
      // we should not get here
View Full Code Here


                  xactionStr,
                  "pojo5.xaction", "empty action sequence test", false, true, null, false, new HashMap(), null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
      assertNotNull( "RuntimeContext is null", runtimeContext );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
      IActionParameter param = runtimeContext.getOutputParameter( "output1" );
      assertNotNull( "param is null", param );
      assertEquals( "hello", param.getValue().toString() );
      param = runtimeContext.getOutputParameter( "output2" );
      assertNotNull( "param is null", param );
      assertEquals( "world", param.getValue().toString() );
    } catch ( Exception e ) {
      // we should not get here
      e.printStackTrace();
      assertTrue( e.getMessage(), false );
    }
View Full Code Here

      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test1.xaction", "empty action sequence test", false, true, null, false, new HashMap(), outputHandler, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
      IActionParameter param = runtimeContext.getOutputParameter( "outputstream" );
      assertNotNull( "RuntimeContext is null", runtimeContext );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
      assertTrue( "setResource was not called", PojoComponentTest.setResourceInputStreamCalled );
      assertTrue( "setResource was not called", PojoComponentTest.setActionSequenceResourceCalled );
View Full Code Here

      // noinspection unchecked
      final Map<String, IActionParameter> params =
        actionSequence.getInputDefinitionsForParameterProvider( IParameterProvider.SCOPE_REQUEST );
      for ( final Map.Entry<String, IActionParameter> entry : params.entrySet() ) {
        final String paramName = entry.getKey();
        final IActionParameter paramDef = entry.getValue();
        final String value = paramDef.getStringValue();
        final Class type;
        // yes, the actual type-code uses equals-ignore-case and thus allows the user
        // to specify type information in a random case. sTrInG is equal to STRING is equal to the value
        // defined as constant (string)
        if ( IActionParameter.TYPE_LIST.equalsIgnoreCase( paramDef.getType() ) ) {
          type = String[].class;
        } else {
          type = String.class;
        }
        final String label = paramDef.getSelectionDisplayName();

        final String[] values;
        if ( StringUtils.isEmpty( value ) ) {
          values = new String[ 0 ];
        } else {
View Full Code Here

          parameterElement.setAttribute( "hint", "" + hint );
          parameterElement.setAttribute( "optional", "" + optional );
          parameterElement.setAttribute( "visible", "" + visible );

          try {
            IActionParameter actionParameter = runtimeContext.getInputParameter( fieldName );
            if ( actionParameter != null ) {
              List variables = actionParameter.getVariables();
              for ( int i = 0; variables != null && i < variables.size(); i++ ) {
                Object var = variables.get( i );
                if ( var instanceof ActionParameterSource ) {
                  String sourceName = ( (ActionParameterSource) var ).getSourceName();
                  String sourceValue = ( (ActionParameterSource) var ).getValue();
View Full Code Here

        solutionEngine.execute( actionSeqPath, processId, false, true, instanceId, false, parameterProviders,
            outputHandler, null, urlFactory, messages );

    if ( actionOutput != null ) {
      if ( context.getOutputNames().contains( actionOutput ) ) {
        IActionParameter output = context.getOutputParameter( actionOutput );
        IPentahoResultSet results = output.getValueAsResultSet();
        if ( results != null ) {
          results = results.memoryCopy();
        }
        return results;
      } else {
        // this is an error
        return null;
      }
    } else {
      // return the first list that we find...
      Iterator it = context.getOutputNames().iterator();
      while ( it.hasNext() ) {
        IActionParameter output = (IActionParameter) it.next();
        if ( output.getType().equalsIgnoreCase( IActionParameter.TYPE_RESULT_SET ) ) {
          IPentahoResultSet results = output.getValueAsResultSet();
          if ( results != null ) {
            results = results.memoryCopy();
          }
          return results;
        }
View Full Code Here

    IRuntimeContext context =
        run( "/" + SOLUTION_NAME + "/platform/" + TEST_XACTION, parameterProvider, testName, CO_TEST_EXTN );
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn = context.getOutputParameter( TEST_OUTPUT_PARAM );
    Object value = rtn.getValue();
    assertEquals( TEST_STRING, value );

    finishTest();
  }
View Full Code Here

  public String setupQueryParameters( String query ) {
    Set inputNames = getInputNames();
    Iterator iter = inputNames.iterator();
    while ( iter.hasNext() ) {
      String inputName = (String) iter.next();
      final IActionParameter inputParameter = getInputParameter( inputName );
      final Object value = inputParameter.getValue();
      if ( ( value instanceof String ) == false ) {
        continue;
      }
      String paramValue = (String) value;
      String param = "\\{" + inputName + "\\}"; //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

    // describe the inputs, outputs and resources available to us
    Set inputNames = getInputNames();
    Iterator inputNamesIterator = inputNames.iterator();
    String inputName;
    IActionParameter actionParameter;
    while ( inputNamesIterator.hasNext() ) {
      inputName = (String) inputNamesIterator.next();
      actionParameter = getInputParameter( inputName );
      message( Messages.getInstance().getString(
        "TestComponent.DEBUG_INPUT_DESCRIPTION", inputName, actionParameter.getType() ) ); //$NON-NLS-1$
    }

    Set outputNames = getOutputNames();
    Iterator outputNamesIterator = outputNames.iterator();
    String outputName;
    while ( outputNamesIterator.hasNext() ) {
      outputName = (String) outputNamesIterator.next();
      actionParameter = getOutputItem( outputName );
      message( Messages.getInstance().getString(
        "TestComponent.DEBUG_OUTPUT_DESCRIPTION", outputName, actionParameter.getType() ) ); //$NON-NLS-1$
    }

    Set resourceNames = getResourceNames();
    Iterator resourceNamesIterator = resourceNames.iterator();
    String resourceName;
View Full Code Here

    Node componentNode = getComponentDefinition();

    Set inputNames = getInputNames();
    Iterator inputNamesIterator = inputNames.iterator();
    String inputName;
    IActionParameter actionParameter;
    while ( inputNamesIterator.hasNext() ) {
      inputName = (String) inputNamesIterator.next();
      actionParameter = getInputParameter( inputName );

      message( Messages
          .getInstance()
          .getString(
            "TestComponent.DEBUG_INPUT_DESCRIPTION", inputName,
            actionParameter.getValue().getClass().toString() + "=" + actionParameter.getValue().toString() ) ); //$NON-NLS-1$ //$NON-NLS-2$
    }

    String test = XmlDom4JHelper.getNodeText( "test", componentNode ); //$NON-NLS-1$
    if ( ( test == null ) || ( test.length() < 1 ) ) {
      message( componentNode.asXML() );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IActionParameter

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.