Source Code Cross Referenced for ProcessFactoryTest.java in  » Workflow-Engines » bexee » bexee » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » bexee » bexee.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ProcessFactoryTest.java,v 1.4 2004/11/22 08:48:10 kowap Exp $
003:         *
004:         * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
005:         * Berne University of Applied Sciences
006:         * School of Engineering and Information Technology
007:         * All rights reserved.
008:         */
009:        package bexee.model;
010:
011:        import javax.xml.namespace.QName;
012:
013:        import junit.framework.TestCase;
014:
015:        import org.apache.commons.digester.Digester;
016:        import org.xml.sax.Attributes;
017:        import org.xml.sax.helpers.AttributesImpl;
018:
019:        import bexee.model.activity.*;
020:        import bexee.model.activity.impl.SequenceImpl;
021:        import bexee.model.elements.*;
022:        import bexee.model.process.*;
023:        import bexee.model.process.Process;
024:        import bexee.model.process.impl.BPELProcessImpl;
025:        import bexee.model.xmltobpel.*;
026:
027:        /**
028:         * @author Pawel Kowalski
029:         * @version $Revision: 1.4 $, $Date: 2004/11/22 08:48:10 $
030:         */
031:
032:        public class ProcessFactoryTest extends TestCase implements 
033:                AttributeNames {
034:
035:            private Digester digester;
036:
037:            private BPELProcess bpelProcess;
038:
039:            private String processName = "LoanFlow";
040:
041:            private String targetNamespace = "http://samples.otn.com";
042:
043:            private String suppressJoinFailure = "yes";
044:
045:            private String[] xmlns_tns = { "xmls:tns", "http://samples.otn.com" };
046:
047:            private String[] xmlns_services = { "xmls:services",
048:                    "http://services.otn.com" };
049:
050:            private String xmlns = "http://schemas.xmlsoap.org/ws/2003/03/business-process/";
051:
052:            private String firstReceiveName = "receiveInput";
053:
054:            private String firstReceivePLinkName = "client";
055:
056:            private String firstReceivePortType = "tns:FlowSample";
057:
058:            private String firstReceiveOperation = "initiate";
059:
060:            private String firstReceiveVariable = "input";
061:
062:            private String firstReceiveCreateInstance = "YES";
063:
064:            private String defaultQueryExpressionLanguage = "http://www.w3.org/TR/1999/REC-xpath-19991116";
065:
066:            private String flowSample = "FlowSample";
067:
068:            private String loanService = "LoanService";
069:
070:            private String invokeUnitedLoan = "invokeUnitedLoan";
071:
072:            private String unitedLoanService = "UnitedLoanService";
073:
074:            private String services_LoanService = "services:LoanService";
075:
076:            private String initiate = "initiate";
077:
078:            private String loanApplicationVarName = "loanApplication";
079:
080:            protected void setUp() throws Exception {
081:                super .setUp();
082:
083:                digester = new Digester();
084:                bpelProcess = new BPELProcessImpl();
085:
086:                digester.push(bpelProcess);
087:            }
088:
089:            public void testPartnerLinks() {
090:                try {
091:
092:                    ProcessImplFactory processFactory = new ProcessImplFactory();
093:                    processFactory.setDigester(digester);
094:
095:                    Process process = (Process) processFactory
096:                            .createObject(getProcessAtts());
097:
098:                    assertEquals(processName, process.getName());
099:                    assertEquals(targetNamespace, process.getTargetNamespace());
100:                    assertEquals(true, process.isSuppressJoinFailure());
101:                    assertEquals(defaultQueryExpressionLanguage, process
102:                            .getExpressionLanguage());
103:                    assertEquals(defaultQueryExpressionLanguage, process
104:                            .getQueryLanguage());
105:
106:                    PartnerLinkImplFactory pLinkFactory = new PartnerLinkImplFactory();
107:                    pLinkFactory.setDigester(digester);
108:
109:                    PartnerLink clientPLink = (PartnerLink) pLinkFactory
110:                            .createObject(getClientPLinkAtts());
111:                    PartnerLink unitedPLink = (PartnerLink) pLinkFactory
112:                            .createObject(getUnitedLoanPLinkAtts());
113:                    PartnerLink americanPLink = (PartnerLink) pLinkFactory
114:                            .createObject(getAmericanLoanPLinkAtts());
115:
116:                    assertEquals(new QName(xmlns_tns[1], flowSample),
117:                            clientPLink.getPartnerLinkType());
118:                    assertEquals(new QName(xmlns_services[1], loanService),
119:                            unitedPLink.getPartnerLinkType());
120:                    assertEquals(new QName(xmlns_services[1], loanService),
121:                            americanPLink.getPartnerLinkType());
122:
123:                    VariableImplFactory varFactory = new VariableImplFactory();
124:                    varFactory.setDigester(digester);
125:
126:                    Variable inVar = (Variable) varFactory
127:                            .createObject(getInputVarAtts());
128:                    Variable outVar = (Variable) varFactory
129:                            .createObject(getOutputVarAtts());
130:                    Variable loanAppVar = (Variable) varFactory
131:                            .createObject(getLoanAppVarAtts());
132:                    Variable loan1Var = (Variable) varFactory
133:                            .createObject(getLoanOffer1VarAtts());
134:                    Variable loan2Var = (Variable) varFactory
135:                            .createObject(getLoanOffer2VarAtts());
136:
137:                    Sequence sequence = new SequenceImpl();
138:                    process.setActivity(sequence);
139:
140:                    ReceiveImplFactory receiveFactory = new ReceiveImplFactory();
141:                    receiveFactory.setDigester(digester);
142:
143:                    Receive receive = (Receive) receiveFactory
144:                            .createObject(getFirstReceiveAtts());
145:                    assertEquals(inVar, receive.getVariable());
146:                    assertEquals(clientPLink, receive.getPartnerLink());
147:                    assertEquals(new QName(xmlns_tns[1], flowSample), receive
148:                            .getPortType());
149:
150:                    InvokeImplFactory invokeFactory = new InvokeImplFactory();
151:                    invokeFactory.setDigester(digester);
152:
153:                    Invoke invoke = (Invoke) invokeFactory
154:                            .createObject(getInvokeAtts());
155:                    assertEquals(loanAppVar, invoke.getInputVariable());
156:                    assertEquals(unitedPLink, invoke.getPartnerLink());
157:                    assertEquals(new QName(xmlns_services[1], loanService),
158:                            invoke.getPortType());
159:
160:                } catch (Exception e) {
161:                    e.printStackTrace();
162:                    fail("Should not throw exception");
163:                }
164:            }
165:
166:            private Attributes getProcessAtts() {
167:                AttributesImpl a = new AttributesImpl();
168:                a.addAttribute("", "", NAME, "", processName);
169:                a.addAttribute("", "", TARGET_NAMESPACE, "", targetNamespace);
170:                a.addAttribute("", "", SUPPRESS_JOIN_FAILURE, "",
171:                        suppressJoinFailure);
172:                a.addAttribute("", "", xmlns_tns[0], "", xmlns_tns[1]);
173:                a
174:                        .addAttribute("", "", xmlns_services[0], "",
175:                                xmlns_services[1]);
176:                return a;
177:            }
178:
179:            private Attributes getClientPLinkAtts() {
180:                AttributesImpl a = new AttributesImpl();
181:                a.addAttribute("", "", NAME, "", "client");
182:                a.addAttribute("", "", PARTNER_LINK_TYPE, "", "tns:"
183:                        + flowSample);
184:                a.addAttribute("", "", PARTNER_ROLE, "", "FlowSampleRequester");
185:                a.addAttribute("", "", MY_ROLE, "", "FlowSampleProvider");
186:                return a;
187:            }
188:
189:            private Attributes getUnitedLoanPLinkAtts() {
190:                AttributesImpl a = new AttributesImpl();
191:                a.addAttribute("", "", NAME, "", "UnitedLoanService");
192:                a.addAttribute("", "", PARTNER_LINK_TYPE, "", "services:"
193:                        + loanService);
194:                a.addAttribute("", "", PARTNER_ROLE, "", "LoanServiceProvider");
195:                a.addAttribute("", "", MY_ROLE, "", "LoanServiceRequester");
196:                return a;
197:            }
198:
199:            private Attributes getAmericanLoanPLinkAtts() {
200:                AttributesImpl a = new AttributesImpl();
201:                a.addAttribute("", "", NAME, "", "AmericanLoanService");
202:                a.addAttribute("", "", PARTNER_LINK_TYPE, "", "services:"
203:                        + loanService);
204:                a.addAttribute("", "", PARTNER_ROLE, "", "LoanServiceProvider");
205:                a.addAttribute("", "", MY_ROLE, "", "LoanServiceRequester");
206:                return a;
207:            }
208:
209:            private Attributes getInputVarAtts() {
210:                AttributesImpl a = new AttributesImpl();
211:                a.addAttribute("", "", NAME, "", "input");
212:                a.addAttribute("", "", MESSAGE_TYPE, "",
213:                        "tns:FlowSampleRequestMessage");
214:                return a;
215:            }
216:
217:            private Attributes getOutputVarAtts() {
218:                AttributesImpl a = new AttributesImpl();
219:                a.addAttribute("", "", NAME, "", "output");
220:                a.addAttribute("", "", MESSAGE_TYPE, "",
221:                        "tns:FlowSampleResultMessage");
222:                return a;
223:            }
224:
225:            private Attributes getLoanAppVarAtts() {
226:                AttributesImpl a = new AttributesImpl();
227:                a.addAttribute("", "", NAME, "", "loanApplication");
228:                a.addAttribute("", "", MESSAGE_TYPE, "",
229:                        "services:LoanServiceRequestMessage");
230:                return a;
231:            }
232:
233:            private Attributes getLoanOffer1VarAtts() {
234:                AttributesImpl a = new AttributesImpl();
235:                a.addAttribute("", "", NAME, "", "loanOffer1");
236:                a.addAttribute("", "", MESSAGE_TYPE, "",
237:                        "services:LoanServiceResultMessage");
238:                return a;
239:            }
240:
241:            private Attributes getLoanOffer2VarAtts() {
242:                AttributesImpl a = new AttributesImpl();
243:                a.addAttribute("", "", NAME, "", "loanOffer2");
244:                a.addAttribute("", "", MESSAGE_TYPE, "",
245:                        "services:LoanServiceResultMessage");
246:                return a;
247:            }
248:
249:            private Attributes getFirstReceiveAtts() {
250:                AttributesImpl a = new AttributesImpl();
251:                a.addAttribute("", "", NAME, "", firstReceiveName);
252:                a.addAttribute("", "", PARTNER_LINK, "", firstReceivePLinkName);
253:                a.addAttribute("", "", PORT_TYPE, "", firstReceivePortType);
254:                a.addAttribute("", "", OPERATION, "", firstReceiveOperation);
255:                a.addAttribute("", "", VARIABLE, "", firstReceiveVariable);
256:                a.addAttribute("", "", CREATE_INSTANCE, "",
257:                        firstReceiveCreateInstance);
258:                return a;
259:            }
260:
261:            private Attributes getInvokeAtts() {
262:                AttributesImpl a = new AttributesImpl();
263:                a.addAttribute("", "", NAME, "", invokeUnitedLoan);
264:                a.addAttribute("", "", PARTNER_LINK, "", unitedLoanService);
265:                a.addAttribute("", "", PORT_TYPE, "", services_LoanService);
266:                a.addAttribute("", "", OPERATION, "", initiate);
267:                a.addAttribute("", "", INPUT_VARIABLE, "",
268:                        loanApplicationVarName);
269:                return a;
270:            }
271:
272:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.