Package org.pentaho.platform.api.engine

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


  public static boolean setResourceInputStreamCalled = false;
  public static boolean setActionSequenceResourceCalled = false;

  public void testSimplePojoInput() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo1a.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.setSessionCalled = false;
      PojoComponentTest.setLoggerCalled = false;
      TestPojo1.int1 = 0;
      TestPojo1.int2 = null;
      SimpleParameterProvider inputs = new SimpleParameterProvider();
      inputs.setParameter( "int2", new Integer( 22 ) );
      inputs.setParameter( "bool2", new Boolean( true ) );
      inputs.setParameter( "long2", new Long( 99 ) );
      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" );
View Full Code Here


  }

  public void testSimplePojoInputFormat2() {
    // test the alternate action definition format
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo1-alternate.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.setSessionCalled = false;
      PojoComponentTest.setLoggerCalled = false;
      TestPojo1.int1 = 0;
      TestPojo1.int2 = null;
      SimpleParameterProvider inputs = new SimpleParameterProvider();
      inputs.setParameter( "int2", new Integer( 22 ) );
      inputs.setParameter( "bool2", new Boolean( true ) );
      inputs.setParameter( "long2", new Long( 99 ) );
      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" );
View Full Code Here

    finishTest();
  }

  public void testSimplePojoSettings() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo1b.xaction" );
      PojoComponentTest.doneCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "pojo1b.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 );
View Full Code Here

    finishTest();
  }

  public void testSimplestCase() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo4.xaction" );
      PojoComponentTest.doneCalled = false;
      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 );
View Full Code Here

    finishTest();
  }

  public void testRuntimeInputsAndOutputs() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo5.xaction" );
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  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(),
View Full Code Here

    finishTest();
  }

  public void testMissingClassSetting() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo-bad1.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.executeCalled = false;
      PojoComponentTest.validateCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test", "invalid class setting 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( "execute was called", false, PojoComponentTest.executeCalled );
View Full Code Here

    finishTest();
  }

  public void testBadClassSetting() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo-bad2.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.executeCalled = false;
      PojoComponentTest.validateCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test", "invalid class setting 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( "execute was called", false, PojoComponentTest.executeCalled );
View Full Code Here

    finishTest();
  }

  public void testBadValidate() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo-bad3.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.executeCalled = false;
      PojoComponentTest.validateCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test", "invalid class setting 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( "execute was called", false, PojoComponentTest.executeCalled );
View Full Code Here

   * Test that unused parameters being passed in do not impact the running of the PojoComponent. A warning is
   * written to the log for user feedback on execution.
   */
  public void testUnusedInput() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo-bad4.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.executeCalled = false;
      PojoComponentTest.validateCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test", "invalid class setting 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 succeeded", IRuntimeContext.RUNTIME_STATUS_SUCCESS, runtimeContext.getStatus() );
View Full Code Here

    finishTest();
  }

  public void testBadOutput() {
    startTest();
    ISolutionEngine solutionEngine = ServiceTestHelper.getSolutionEngine();
    try {
      String xactionStr = ServiceTestHelper.getXAction( SOLUTION_PATH, "test/pojo/pojo-bad5.xaction" );
      PojoComponentTest.doneCalled = false;
      PojoComponentTest.executeCalled = false;
      PojoComponentTest.validateCalled = false;
      IRuntimeContext runtimeContext =
          solutionEngine
              .execute(
                  xactionStr,
                  "test", "invalid class setting 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 succeeded", runtimeContext.getStatus(), IRuntimeContext.RUNTIME_STATUS_FAILURE );
View Full Code Here

TOP

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

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.