示例#1
0
  public void testForcePrompt() {
    startTest();
    SimpleParameterProvider parameterProvider = new SimpleParameterProvider();
    OutputStream outputStream =
        getOutputStream("RuntimeTest.testForcePrompt", ".html"); // $NON-NLS-1$ //$NON-NLS-2$
    SimpleOutputHandler outputHandler = new SimpleOutputHandler(outputStream, true);
    outputHandler.setOutputPreference(IOutputHandler.OUTPUT_TYPE_PARAMETERS);
    StandaloneSession session =
        new StandaloneSession(Messages.getString("BaseTest.DEBUG_JUNIT_SESSION")); // $NON-NLS-1$

    ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
    solutionEngine.setLoggingLevel(getLoggingLevel());
    solutionEngine.init(session);
    solutionEngine.setForcePrompt(true);
    IRuntimeContext context =
        run(
            solutionEngine,
            "test",
            "reporting",
            "jfreereport-reports-test-param.xaction",
            null,
            false,
            parameterProvider,
            outputHandler); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    assertEquals(
        Messages.getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"),
        IRuntimeContext.RUNTIME_STATUS_SUCCESS,
        context.getStatus()); // $NON-NLS-1$

    finishTest();
  }
示例#2
0
  @SuppressWarnings("rawtypes")
  protected static IRuntimeContext executeInternal(
      RepositoryFile file,
      IParameterProvider requestParams,
      HttpServletRequest httpServletRequest,
      IOutputHandler outputHandler,
      Map<String, IParameterProvider> parameterProviders,
      IPentahoSession userSession,
      boolean forcePrompt,
      List messages)
      throws Exception {
    String processId = XactionUtil.class.getName();
    String instanceId = httpServletRequest.getParameter("instance-id"); // $NON-NLS-1$
    SimpleUrlFactory urlFactory = new SimpleUrlFactory(""); // $NON-NLS-1$
    ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, userSession);
    ISystemSettings systemSettings = PentahoSystem.getSystemSettings();

    if (solutionEngine == null) {
      throw new ObjectFactoryException("No Solution Engine");
    }

    boolean instanceEnds =
        "true"
            .equalsIgnoreCase(
                requestParams.getStringParameter(
                    "instanceends", "true")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    String parameterXsl =
        systemSettings.getSystemSetting(
            "default-parameter-xsl", "DefaultParameterForm.xsl"); // $NON-NLS-1$ //$NON-NLS-2$

    solutionEngine.setLoggingLevel(2);
    solutionEngine.init(userSession);
    solutionEngine.setForcePrompt(forcePrompt);
    if (parameterXsl != null) {
      solutionEngine.setParameterXsl(parameterXsl);
    }
    return solutionEngine.execute(
        file.getPath(),
        processId,
        false,
        instanceEnds,
        instanceId,
        false,
        parameterProviders,
        outputHandler,
        null,
        urlFactory,
        messages);
  }
  public IRuntimeContext handleActionRequest(final int timeout, final int timeoutType) {

    // Get the solution engine
    ISolutionEngine solutionEngine = PentahoSystem.get(ISolutionEngine.class, session);
    solutionEngine.setCreateFeedbackParameterCallback(createFeedbackParameterCallback);
    if (solutionEngine == null) {
      Logger.error(
          this,
          Messages.getInstance()
              .getErrorString("BaseRequestHandler.ERROR_0001_NO_SOLUTION_ENGINE")); // $NON-NLS-1$
      return null;
    }
    solutionEngine.setLoggingLevel(ILogger.DEBUG);
    solutionEngine.init(session);
    solutionEngine.setForcePrompt(forcePrompt);
    if (parameterXsl != null) {
      solutionEngine.setParameterXsl(parameterXsl);
    }

    dispose();
    runtime =
        solutionEngine.execute(
            actionPath,
            processId,
            false,
            instanceEnds,
            instanceId,
            true,
            parameterProviders,
            outputHandler,
            this,
            urlFactory,
            messages);

    // need to wait until this is complete
    // TODO

    // if this times out check the timeoutType before cancelling or
    // returning and leaving the component running

    return runtime;
  }