Package org.pentaho.platform.api.engine

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


  }

  public void testSQLExecuteErrorSQLWithSemiColons() {
    startTest();
    info( "Expected: Failed execution - should error out because of the semi-colon" ); //$NON-NLS-1$
    IRuntimeContext context = run( "/test/rules/sqlexecute_error2.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_FAILURE, context.getStatus() ); //$NON-NLS-1$
  }
View Full Code Here


  }

  public void testSQLExecuteErrorDropTableSingleStatement() {
    startTest();
    info( "Expected: Failed execution - should error out at the drop table statement" ); //$NON-NLS-1$
    IRuntimeContext context = run( "/test/rules/sqlexecute_error3.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_FAILURE, context.getStatus() ); //$NON-NLS-1$
  }
View Full Code Here

  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$
    assertEquals( "", "Customer 'Acme' is in region West", context.getOutputParameter( "output" ).getStringValue() ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    finishTest();
  }
View Full Code Here

  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$
    assertEquals(
        "", "Eastern is 120000 with a color of #00ff00, Western is 90000 with a color of #ffff00, Southern is 75000 with a color of #ff0000", context.getOutputParameter( "output" ).getStringValue() ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    finishTest();
  }
View Full Code Here

    parameterProvider.setParameter( "type", "html" ); //$NON-NLS-1$ //$NON-NLS-2$
    OutputStream outputStream = getOutputStream( "TemplateTest.testTemplate3", ".svg" ); //$NON-NLS-1$ //$NON-NLS-2$
    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, true );
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$
    IRuntimeContext context =
        run( "/test/template/europemap.xaction", null, false, parameterProvider, outputHandler, session ); //$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( "svg" ) ); //$NON-NLS-1$ //$NON-NLS-2$

    finishTest();
  }
View Full Code Here

  public void testMultiOutput() {

    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "services/MultiOutputTest.xaction" );
    IRuntimeContext runtimeContext =
        solutionEngine
            .execute(
                xactionStr,
                "test1a.xaction", "empty action sequence test", false, true, null, false, new HashMap(), null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
    finishTest();
View Full Code Here

        n = reader.read( buffer );
      }
      String xactionStr = str.toString();

      solutionEngine.setSession( session );
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test1.xaction", "empty action sequence test", false, true, instanceId, false, parameterProviderMap, null, null, urlFactory, messages ); //$NON-NLS-1$ //$NON-NLS-2$
      assertNotNull( "RuntimeContext is null", runtimeContext );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
    } catch ( Exception e ) {
      // we should not get here
      e.printStackTrace();
      assertTrue( e.getMessage(), false );
View Full Code Here

      }
    }
    Assert.assertEquals( "expected 2 outputable parameters in xaction", 2, outParameters.size() );
    Assert.assertEquals( "expected 1 paramater with is-output-parameter=false", 1, nonOutParameters.size() );

    IRuntimeContext runtimeContext =
        solutionEngine
            .execute(
                xactionStr,
                xactionName,
                "simple output test", false, true, null, false, new HashMap(), null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
    IParameterManager paramManager = runtimeContext.getParameterManager();
    Assert.assertEquals( outParameters.size(), paramManager.getCurrentOutputNames().size() );
    for ( Object key : paramManager.getCurrentOutputNames() ) {
      Assert.assertTrue( "output parameter not found in definition", outParameters.contains( key ) );
      Assert.assertFalse( "non-output parameter in output", nonOutParameters.contains( key ) );
    }
View Full Code Here

      inputs.setParameter( "bigdecimal", new BigDecimal( "77.7" ) );
      inputs.setParameter( "float2", new Float( 44.4 ) );
      inputs.setParameter( "double2", new Double( 66.6 ) );
      Map providers = new HashMap();
      providers.put( IParameterProvider.SCOPE_REQUEST, inputs );
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test1a.xaction", "empty action sequence test", false, true, null, false, providers, null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
      assertNotNull( "RuntimeContext is null", runtimeContext );
      IActionParameter param = runtimeContext.getOutputParameter( "output1" );
      assertNotNull( "param is null", param );
      assertEquals( "setting is wrong", "value1", TestPojo1.setting1 );
      assertEquals( "setting is wrong", "value2", TestPojo1.setting2 );
      assertEquals( "setting is wrong", null, TestPojo1.setting3 );
      assertEquals( "param is wrong", "abcdeabcde", param.getValue() );
      assertEquals( "setInt2 failed", new Integer( 22 ), TestPojo1.int2 );
      assertEquals( "setBoolean2 failed", new Boolean( true ), TestPojo1.bool2 );
      assertEquals( "setLong2 failed", new Long( 99 ), TestPojo1.long2 );
      assertEquals( "setBigDecimal failed", new BigDecimal( "77.7" ), TestPojo1.bigDecimal );
      assertEquals( "setFloat2 failed", "44.4", TestPojo1.float2.toString() );
      assertEquals( "setDouble2 failed", "66.6", TestPojo1.double2.toString() );
      assertTrue( "done() was not called", PojoComponentTest.doneCalled );
      assertTrue( "setSession() was not called", PojoComponentTest.setSessionCalled );
      assertTrue( "setLogger() was not called", PojoComponentTest.setLoggerCalled );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
    } catch ( Exception e ) {
      // we should not get here
      e.printStackTrace();
      assertTrue( e.getMessage(), false );
View Full Code Here

      inputs.setParameter( "bigdecimal", new BigDecimal( "77.7" ) );
      inputs.setParameter( "float2", new Float( 44.4 ) );
      inputs.setParameter( "double2", new Double( 66.6 ) );
      Map providers = new HashMap();
      providers.put( IParameterProvider.SCOPE_REQUEST, inputs );
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test1a.xaction", "empty action sequence test", false, true, null, false, providers, null, null, new SimpleUrlFactory( "" ), new ArrayList() ); //$NON-NLS-1$ //$NON-NLS-2$
      assertNotNull( "RuntimeContext is null", runtimeContext );
      IActionParameter param = runtimeContext.getOutputParameter( "output1" );
      assertNotNull( "param is null", param );
      assertEquals( "setting is wrong", "value1", TestPojo1.setting1 );
      assertEquals( "setting is wrong", "value2", TestPojo1.setting2 );
      assertEquals( "setting is wrong", null, TestPojo1.setting3 );
      assertEquals( "param is wrong", "abcdeabcde", param.getValue() );
      assertEquals( "setInt2 failed", new Integer( 22 ), TestPojo1.int2 );
      assertEquals( "setBoolean2 failed", new Boolean( true ), TestPojo1.bool2 );
      assertEquals( "setLong2 failed", new Long( 99 ), TestPojo1.long2 );
      assertEquals( "setBigDecimal failed", new BigDecimal( "77.7" ), TestPojo1.bigDecimal );
      assertEquals( "setFloat2 failed", "44.4", TestPojo1.float2.toString() );
      assertEquals( "setDouble2 failed", "66.6", TestPojo1.double2.toString() );
      assertTrue( "done() was not called", PojoComponentTest.doneCalled );
      assertTrue( "setSession() was not called", PojoComponentTest.setSessionCalled );
      assertTrue( "setLogger() was not called", PojoComponentTest.setLoggerCalled );
      assertEquals( "Action sequence execution failed", runtimeContext.getStatus(),
          IRuntimeContext.RUNTIME_STATUS_SUCCESS );
    } catch ( Exception e ) {
      // we should not get here
      e.printStackTrace();
      assertTrue( e.getMessage(), false );
View Full Code Here

TOP

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

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.