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: ProcContext.java,v 1.4 2006/10/13 13:58:32 drmlipp Exp $
021: *
022: * $Log: ProcContext.java,v $
023: * Revision 1.4 2006/10/13 13:58:32 drmlipp
024: * Adapted to new environment.
025: *
026: * Revision 1.3 2006/10/07 20:41:34 mlipp
027: * Merged J2EE 1.4 adaptions from test branch.
028: *
029: * Revision 1.2 2006/09/29 12:32:09 drmlipp
030: * Consistently using WfMOpen as projct name now.
031: *
032: * Revision 1.1.1.2 2003/12/19 13:01:47 drmlipp
033: * Updated to 1.1rc1
034: *
035: * Revision 1.10 2003/10/21 21:00:45 lipp
036: * Moved EJBClientTest to new junit sub-package.
037: *
038: * Revision 1.9 2003/10/08 07:42:34 lipp
039: * Made tests weblogic compatible.
040: *
041: * Revision 1.8 2003/06/27 09:44:13 lipp
042: * Fixed copyright/license information.
043: *
044: * Revision 1.7 2003/05/14 08:30:07 lipp
045: * Package import behaviour changed.
046: *
047: * Revision 1.6 2003/04/26 16:46:55 lipp
048: * Made unittests and systemtests coexist in eclipse.
049: *
050: * Revision 1.5 2003/04/16 19:25:04 lipp
051: * Adapted to jdk 1.4
052: *
053: * Revision 1.4 2003/04/08 14:01:03 lipp
054: * Fixed test case.
055: *
056: * Revision 1.3 2003/03/31 16:50:29 huaiyang
057: * Logging using common-logging.
058: *
059: * Revision 1.2 2003/03/28 12:46:48 huaiyang
060: * more datatypes for datafield supported.
061: *
062: * Revision 1.1 2002/11/05 08:20:14 huaiyang
063: * new test.
064: *
065: *
066: */
067: package procdef;
068:
069: import javax.naming.InitialContext;
070: import javax.rmi.PortableRemoteObject;
071: import javax.security.auth.login.LoginException;
072:
073: import de.danet.an.util.junit.EJBClientTest;
074:
075: import de.danet.an.workflow.omgcore.ProcessDataInfo;
076:
077: import de.danet.an.workflow.api.ProcessDefinitionDirectory;
078: import de.danet.an.workflow.api.ProcessMgr;
079: import de.danet.an.workflow.api.WorkflowServiceFactory;
080:
081: import de.danet.an.workflow.ejbs.admin.ProcessDefinitionDirectoryHome;
082:
083: import common.UTLoginContext;
084: import junit.framework.Test;
085: import junit.framework.TestCase;
086: import junit.framework.TestSuite;
087:
088: public class ProcContext extends TestCase {
089:
090: static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
091: .getLog(ProcContext.class);
092:
093: private static UTLoginContext plc = null;
094: static {
095: try {
096: plc = new UTLoginContext();
097: plc.login();
098: } catch (LoginException e) {
099: throw new IllegalStateException(e.getMessage());
100: }
101: }
102:
103: /**
104: * Constructor of this TestCase
105: */
106: public ProcContext(String name) {
107: super (name);
108: }
109:
110: /**
111: * Stellt diese TestSuite zusammen.
112: */
113: public static Test suite() {
114: TestSuite suite = new TestSuite();
115: suite.addTest(new ProcContext("contextSignature"));
116: return new EJBClientTest(plc, suite);
117: }
118:
119: private ProcessMgr getProcessMgr(String pkgId, String prcId)
120: throws Exception {
121: ProcessDefinitionDirectory procDir = WorkflowServiceFactory
122: .newInstance().newWorkflowService()
123: .processDefinitionDirectory();
124: return procDir.processMgr(pkgId, prcId);
125: }
126:
127: /**
128: * Check context signature.
129: */
130: public void contextSignature() throws Exception {
131: Basic.importProcessDefinitions("/procdef/initialProcesses.xml");
132: // create the process
133: ProcessMgr processMgr = getProcessMgr("ut-procdef", "jut1");
134: ProcessDataInfo procDataInfo = processMgr.contextSignature();
135: assertTrue(procDataInfo.containsKey("packageTestValue1"));
136: assertTrue(procDataInfo.get("packageTestValue1").equals(
137: java.lang.String.class));
138: assertTrue(procDataInfo.containsKey("packageTestValue2"));
139: assertTrue(procDataInfo.get("packageTestValue2").equals(
140: java.lang.Double.class));
141: assertTrue(procDataInfo.containsKey("processTestValue1"));
142: assertTrue(procDataInfo.get("processTestValue1").equals(
143: java.lang.Long.class));
144: assertTrue(procDataInfo.containsKey("processTestValue2"));
145: assertTrue(procDataInfo.get("processTestValue2").equals(
146: java.util.Date.class));
147: assertTrue(procDataInfo.containsKey("processTestValue3"));
148: assertTrue(procDataInfo.get("processTestValue3").equals(
149: java.lang.Boolean.class));
150: }
151:
152: }
|