/** Tests the {@link CallProcess} class */
  public void noTestCallProcess() {
    setSystemAdministratorContext();

    // Set Core in development
    final Module core = OBDal.getInstance().get(Module.class, "0");
    core.setInDevelopment(true);
    OBDal.getInstance().flush();

    final Tab tabtest = OBDal.getInstance().get(Tab.class, "100");

    final Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("AD_Tab_ID", tabtest.getId());

    final org.openbravo.model.ad.ui.Process process =
        OBDal.getInstance().get(org.openbravo.model.ad.ui.Process.class, "114");
    assertNotNull("No copy test line process defined with id 114", process);
    assertNotNull("id of attest not set", tabtest.getId());
    final int fieldsNo = tabtest.getADFieldList().size();
    assertTrue(fieldsNo > 0);

    final Tab copyToTab = OBProvider.getInstance().get(Tab.class);
    copyToTab.setName("CopyToTab");
    copyToTab.setTable(tabtest.getTable());
    copyToTab.setWindow(tabtest.getWindow());
    copyToTab.setSequenceNumber(new Long("10"));
    copyToTab.setTabLevel(new Long("0"));
    copyToTab.setModule(tabtest.getModule());
    OBDal.getInstance().save(copyToTab);
    OBDal.getInstance().flush();
    final ProcessInstance pInstance =
        CallProcess.getInstance().call(process, copyToTab.getId(), parameters);
    OBDal.getInstance().getSession().refresh(tabtest);
    OBDal.getInstance().getSession().refresh(copyToTab);
    assertEquals("@Copied@=" + fieldsNo, pInstance.getErrorMsg());
    assertEquals(fieldsNo, tabtest.getADFieldList().size());
    assertEquals(fieldsNo, copyToTab.getADFieldList().size());

    // always rollback to prevent updating the db
    OBDal.getInstance().rollbackAndClose();
  }
  public static OBError openClosePeriodControl(String periodControlId) {
    OBError myMessage = new OBError();
    OBContext.setAdminMode(true);
    Process process = null;
    try {
      process = OBDal.getInstance().get(Process.class, "168");
    } finally {
      OBContext.restorePreviousMode();
    }

    Map<String, String> parameters = new HashMap<String, String>();
    final ProcessInstance pinstance =
        CallProcess.getInstance().call(process, periodControlId, parameters);
    VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
    try {
      ConnectionProvider conn = new DalConnectionProvider(false);
      myMessage =
          Utility.getProcessInstanceMessage(
              conn, vars, PInstanceProcessData.select(conn, pinstance.getId()));
    } catch (ServletException e) {
      throw new OBException("Failure getting error message", e);
    }
    return myMessage;
  }