001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: WSIFLocal.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: WSIFLocal.java,v $
023: * Revision 1.2 2006/09/29 12:32:08 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.2 2003/12/19 13:01:45 drmlipp
027: * Updated to 1.1rc1
028: *
029: * Revision 1.4 2003/10/21 21:00:45 lipp
030: * Moved EJBClientTest to new junit sub-package.
031: *
032: * Revision 1.3 2003/10/08 12:39:40 huaiyang
033: * make test weblogic compatible.
034: *
035: * Revision 1.2 2003/06/27 09:44:03 lipp
036: * Fixed copyright/license information.
037: *
038: * Revision 1.1 2003/06/10 14:42:58 huaiyang
039: * initial.
040: *
041: *
042: */
043: package tools;
044:
045: import java.util.Iterator;
046: import java.util.Map;
047:
048: import junit.framework.Test;
049: import junit.framework.TestSuite;
050: import process.WfMOpenTestCase;
051: import de.danet.an.workflow.api.ProcessDefinitionDirectory;
052: import de.danet.an.workflow.api.ProcessMgr;
053: import de.danet.an.workflow.omgcore.WfProcess;
054: import de.danet.an.util.junit.EJBClientTest;
055:
056: /**
057: * Test the tool of WSIFDynamicInvocationTool.
058: * @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
059: * @version 1.0
060: */
061: public class WSIFLocal extends WfMOpenTestCase {
062: private ProcessDefinitionDirectory pdd = null;
063:
064: /**
065: * Constructor of this TestCase
066: * @param name a <code>String</code> value
067: */
068: public WSIFLocal(String name) {
069: super (name);
070: }
071:
072: /**
073: * Construct this test suite.
074: * @return a <code>Test</code> value
075: */
076: public static Test suite() {
077: TestSuite suite = new TestSuite();
078: suite.addTest(new WSIFLocal("importProcessDefinitions"));
079: suite.addTest(new WSIFLocal("addressBook"));
080: suite.addTest(new WSIFLocal("removeProcessDefinition"));
081: return new EJBClientTest(plc, suite);
082: }
083:
084: /**
085: * Initialisation.
086: * The <code>setUp</code> method defines the way a state change is
087: * realized. Override this method to change this way.
088: * @exception Exception if an error occurs
089: */
090: protected void setUp() throws Exception {
091: super .setUp();
092: xpdlFile = "/tools/testWSIF.xml";
093: System.out.println("xpdlFile = " + xpdlFile);
094: pdd = workflowService().processDefinitionDirectory();
095: }
096:
097: /**
098: * Test a soap tool invocation which returns a complex data type of JDOM
099: * element.
100: * @exception Exception if an error occurs
101: */
102: public void addressBook() throws Exception {
103: ProcessMgr pmgr4 = pdd.processMgr("st-testWSIF", "testWSIF4");
104: WfProcess process4 = pmgr4.createProcess(defaultRequester());
105: process4.start();
106: Thread.sleep(30000);
107: Map map = (Map) process4.result();
108: for (Iterator it2 = map.keySet().iterator(); it2.hasNext();) {
109: String name = (String) it2.next();
110: System.out.println("name = " + name);
111: if (name.equals("searchresult")) {
112: String returnResult = (String) map.get(name);
113: System.out.println("return = " + returnResult);
114: }
115: }
116: }
117:
118: /**
119: * Test a simple process definition with a simple soap tool invocation.
120: * @exception Exception if an error occurs
121: */
122: public void removeProcessDefinition() throws Exception {
123: removeProcessDefinition("st-testWSIF", "testWSIF1");
124: removeProcessDefinition("st-testWSIF", "testWSIF2");
125: removeProcessDefinition("st-testWSIF", "testWSIF3");
126: }
127: }
|