/*
* 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: WSIFLocal.java 1607 2006-09-29 12:32:13Z drmlipp $
*
* $Log$
* Revision 1.1.1.2 2003/12/19 13:01:45 drmlipp
* Updated to 1.1rc1
*
* Revision 1.4 2003/10/21 21:00:45 lipp
* Moved EJBClientTest to new junit sub-package.
*
* Revision 1.3 2003/10/08 12:39:40 huaiyang
* make test weblogic compatible.
*
* Revision 1.2 2003/06/27 09:44:03 lipp
* Fixed copyright/license information.
*
* Revision 1.1 2003/06/10 14:42:58 huaiyang
* initial.
*
*
*/
package tools;
import java.util.Iterator;
import java.util.Map;
import junit.framework.Test;
import junit.framework.TestSuite;
import process.WfMOpenTestCase;
import de.danet.an.workflow.api.ProcessDefinitionDirectory;
import de.danet.an.workflow.api.ProcessMgr;
import de.danet.an.workflow.omgcore.WfProcess;
import de.danet.an.util.junit.EJBClientTest;
/**
* Test the tool of WSIFDynamicInvocationTool.
* @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
* @version 1.0
*/
public class WSIFLocal extends WfMOpenTestCase {
private ProcessDefinitionDirectory pdd = null;
/**
* Constructor of this TestCase
* @param name a <code>String</code> value
*/
public WSIFLocal(String name) {
super (name);
}
/**
* Construct this test suite.
* @return a <code>Test</code> value
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new WSIFLocal("importProcessDefinitions"));
suite.addTest(new WSIFLocal("addressBook"));
suite.addTest(new WSIFLocal("removeProcessDefinition"));
return new EJBClientTest (plc, suite);
}
/**
* Initialisation.
* The <code>setUp</code> method defines the way a state change is
* realized. Override this method to change this way.
* @exception Exception if an error occurs
*/
protected void setUp() throws Exception {
super.setUp();
xpdlFile = "/tools/testWSIF.xml";
System.out.println("xpdlFile = " + xpdlFile);
pdd = workflowService().processDefinitionDirectory();
}
/**
* Test a soap tool invocation which returns a complex data type of JDOM
* element.
* @exception Exception if an error occurs
*/
public void addressBook() throws Exception {
ProcessMgr pmgr4 = pdd.processMgr("st-testWSIF", "testWSIF4");
WfProcess process4 = pmgr4.createProcess(defaultRequester());
process4.start();
Thread.sleep(30000);
Map map = (Map)process4.result();
for (Iterator it2 = map.keySet().iterator(); it2.hasNext();) {
String name = (String) it2.next();
System.out.println("name = " + name);
if (name.equals("searchresult")) {
String returnResult = (String)map.get(name);
System.out.println("return = " + returnResult);
}
}
}
/**
* Test a simple process definition with a simple soap tool invocation.
* @exception Exception if an error occurs
*/
public void removeProcessDefinition() throws Exception {
removeProcessDefinition("st-testWSIF", "testWSIF1");
removeProcessDefinition("st-testWSIF", "testWSIF2");
removeProcessDefinition("st-testWSIF", "testWSIF3");
}
}