Package load

Source Code of load.ProcHandling

/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* $Id: ProcHandling.java 2550 2007-10-22 14:00:54Z  $
*
* $Log$
* Revision 1.2  2006/09/29 12:32:13  drmlipp
* Consistently using WfMOpen as projct name now.
*
* Revision 1.1.1.2  2004/08/18 15:18:46  drmlipp
* Update to 1.2
*
* Revision 1.5  2004/01/27 11:45:33  lipp
* Preserve newlines when reading process definitions.
*
* Revision 1.4  2003/10/22 15:26:54  lipp
* Added create and start test.
*
* Revision 1.3  2003/10/22 11:00:58  lipp
* Extended.
*
* Revision 1.2  2003/10/21 21:00:45  lipp
* Moved EJBClientTest to new junit sub-package.
*
* Revision 1.1  2003/10/20 21:04:34  lipp
* Getting started.
*
*/
package load;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.security.auth.login.LoginException;

import de.danet.an.util.junit.EJBClientTest;

import de.danet.an.workflow.omgcore.WfProcess;
import de.danet.an.workflow.omgcore.WfRequester;

import de.danet.an.workflow.api.DefaultRequester;
import de.danet.an.workflow.api.ProcessDefinitionDirectory;
import de.danet.an.workflow.api.ProcessMgr;
import de.danet.an.workflow.api.WorkflowService;
import de.danet.an.workflow.api.WorkflowServiceFactory;

import common.UTLoginContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* This class provides ...
*
* @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
* @version $Revision: 2550 $
*/

public class ProcHandling extends TestCase {

    private static UTLoginContext plc = null;
    static {
  try {
      plc = new UTLoginContext();
      plc.login();
  } catch (LoginException e) {
      throw new IllegalStateException (e.getMessage ());
  }
    }

    private static ProcessDefinitionDirectory pdd = null;
    private static ProcessMgr mgr1To5par = null;
    private static ProcessMgr mgr1To10par = null;
    private static ProcessMgr mgr1To20par = null;
    private static WfRequester defReq = null;

    /**
     * Constructor of this TestCase
     */
    public ProcHandling(String name) {
  super (name);
    }

    /**
     * Make this test suite.
     */
    public static Test suite() {
        TestSuite suite = new TestSuite();
     suite.addTest(new ProcHandling("importProcessDefinitions"));
     suite.addTest(new ProcHandling("createProcess6Acts"));
     suite.addTest(new ProcHandling("createProcess11Acts"));
     suite.addTest(new ProcHandling("createProcess21Acts"));
        return new EJBClientTest (plc, suite);
    }

    /**
     * Import the process definitions from a XPDL file
     * unsing the ProcessDefinitionDirectory bean.
     */
    public void importProcessDefinitions() throws Exception {
  WorkflowServiceFactory wsf = WorkflowServiceFactory.newInstance();
  WorkflowService ws = wsf.newWorkflowService();
  pdd = ws.processDefinitionDirectory();
  InputStream is = getClass().getResourceAsStream("/load/processes.xml");
  assertTrue (is != null);
  BufferedReader br = new BufferedReader
      (new InputStreamReader(is, "ISO-8859-1"));
  StringBuffer sb = new StringBuffer();
  String st;
  while ((st = br.readLine()) != null) {
      sb.append(st + "\n");
  }
  pdd.importProcessDefinitions(sb.toString());
  mgr1To5par = pdd.processMgr("loadUnitTests", "1plus5actsPar");
  mgr1To10par = pdd.processMgr("loadUnitTests", "1plus10actsPar");
  mgr1To20par = pdd.processMgr("loadUnitTests", "1plus20actsPar");
  defReq = new DefaultRequester (ws);
    }

    public void createProcess6Acts () throws Exception {
  WfProcess p = mgr1To5par.createProcess(defReq);
    }

    public void createProcess11Acts () throws Exception {
  WfProcess p = mgr1To10par.createProcess(defReq);
    }

    public void createProcess21Acts () throws Exception {
  WfProcess p = mgr1To20par.createProcess(defReq);
    }

    public void createStart11Acts () throws Exception {
  WfProcess p = mgr1To10par.createProcess(defReq);
  p.start ();
    }

}
TOP

Related Classes of load.ProcHandling

TOP
Copyright © 2018 www.massapi.com. 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.