Source Code Cross Referenced for ConfigurationTest.java in  » Workflow-Engines » osbl-1_0 » org » concern » controller » 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 » osbl 1_0 » org.concern.controller 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.concern.controller;
002:
003:        import junit.framework.TestCase;
004:
005:        import org.concern.model.AsynchronousActivity;
006:        import org.concern.model.EnvironmentEntry;
007:        import org.concern.model.Loader;
008:        import org.concern.model.Process;
009:        import org.concern.model.SynchronousActivity;
010:
011:        import java.util.*;
012:
013:        public class ConfigurationTest extends TestCase {
014:            protected Process process;
015:
016:            public ConfigurationTest(String name) {
017:                super (name);
018:            }
019:
020:            protected void setUp() throws Exception {
021:                org.concern.model.Loader loaderModel = new org.concern.model.Loader(
022:                        "Loader", DummyLoader.class.getName());
023:                org.concern.model.Actor actorModel = new org.concern.model.Actor(
024:                        "Actor", DummyActor.class.getName());
025:                org.concern.model.Condition conditionModel = new org.concern.model.Condition(
026:                        "Condition", DummyCondition.class.getName());
027:                org.concern.model.Activity synchronousActivityModel = new SynchronousActivity(
028:                        "SynchronousActivity", DummySynchronousActivity.class
029:                                .getName());
030:                org.concern.model.Activity asynchronousActivityModel = new AsynchronousActivity(
031:                        "AsynchronousActivity", DummyAsynchronousActivity.class
032:                                .getName());
033:                org.concern.model.Event eventModel = new org.concern.model.Event(
034:                        "Event", DummyEvent.class.getName());
035:                org.concern.model.Listener listenerModel = new org.concern.model.Listener(
036:                        "Listener", DummyListener.class.getName());
037:
038:                loaderModel.getEnvironment().add(
039:                        new EnvironmentEntry("name", "java.lang.String",
040:                                "value"));
041:                loaderModel.getEnvironment().add(
042:                        new EnvironmentEntry("dummy", "java.lang.Integer",
043:                                "resource:blubber"));
044:                actorModel.getEnvironment().add(
045:                        new EnvironmentEntry("name", "java.lang.String",
046:                                "value"));
047:                actorModel.getEnvironment()
048:                        .add(
049:                                new EnvironmentEntry("dummy",
050:                                        "java.lang.Integer", "10"));
051:                conditionModel.getEnvironment().add(
052:                        new EnvironmentEntry("name", "java.lang.String",
053:                                "value"));
054:                conditionModel.getEnvironment()
055:                        .add(
056:                                new EnvironmentEntry("dummy",
057:                                        "java.lang.Integer", "10"));
058:                synchronousActivityModel.getEnvironment().add(
059:                        new EnvironmentEntry("name", "java.lang.String",
060:                                "value"));
061:                synchronousActivityModel.getEnvironment()
062:                        .add(
063:                                new EnvironmentEntry("dummy",
064:                                        "java.lang.Integer", "10"));
065:                asynchronousActivityModel.getEnvironment().add(
066:                        new EnvironmentEntry("name", "java.lang.String",
067:                                "value"));
068:                asynchronousActivityModel.getEnvironment()
069:                        .add(
070:                                new EnvironmentEntry("dummy",
071:                                        "java.lang.Integer", "10"));
072:                eventModel.getEnvironment().add(
073:                        new EnvironmentEntry("name", "java.lang.String",
074:                                "value"));
075:                eventModel.getEnvironment()
076:                        .add(
077:                                new EnvironmentEntry("dummy",
078:                                        "java.lang.Integer", "10"));
079:                listenerModel.getEnvironment().add(
080:                        new EnvironmentEntry("name", "java.lang.String",
081:                                "value"));
082:                listenerModel.getEnvironment()
083:                        .add(
084:                                new EnvironmentEntry("dummy",
085:                                        "java.lang.Integer", "10"));
086:
087:                process = new Process("ControllerManagerTest");
088:                process.getEnvironment().add(
089:                        new EnvironmentEntry("name", "java.lang.String",
090:                                "value"));
091:                process.setLoader(loaderModel);
092:                process.addActor(actorModel);
093:                process.addCondition(conditionModel);
094:                process.addActivity(synchronousActivityModel);
095:                process.addActivity(asynchronousActivityModel);
096:                process.addEvent(eventModel);
097:                process.addListener(listenerModel);
098:            }
099:
100:            protected void tearDown() throws Exception {
101:            }
102:
103:            public void testDeployment() throws Exception {
104:                Configuration configuration = new Configuration();
105:                configuration.setProcess(process);
106:                configuration.setClassLoader(getClass().getClassLoader());
107:                DefaultResourceLocator resourceLocator = new DefaultResourceLocator();
108:                resourceLocator.setResources(Collections.singletonMap(
109:                        "blubber", new Integer(11)));
110:                configuration.setResourceLocator(resourceLocator);
111:                Controller controller = configuration.buildController();
112:
113:                DummyLoader loader = (DummyLoader) controller.getLoader();
114:                DummyActor actor = (DummyActor) controller.getActors().get(0);
115:                DummyCondition condition = (DummyCondition) controller
116:                        .getConditions().get(0);
117:                DummySynchronousActivity synchronousActivity = null;
118:                DummyAsynchronousActivity asynchronousActivity = null;
119:                for (Iterator iterator = controller.getActivities().iterator(); iterator
120:                        .hasNext();) {
121:                    Activity activity = (Activity) iterator.next();
122:                    if (activity instanceof  DummySynchronousActivity)
123:                        synchronousActivity = (DummySynchronousActivity) activity;
124:                    if (activity instanceof  DummyAsynchronousActivity)
125:                        asynchronousActivity = (DummyAsynchronousActivity) activity;
126:                }
127:                DummyEvent event = (DummyEvent) controller.getEvents()
128:                        .iterator().next();
129:                DummyListener listener = (DummyListener) controller
130:                        .getListeners().iterator().next();
131:
132:                assertEquals("Loader", loader.getName());
133:                assertEquals("Actor", actor.getName());
134:                assertEquals("Condition", condition.getName());
135:                assertEquals("SynchronousActivity", synchronousActivity
136:                        .getName());
137:                assertEquals("AsynchronousActivity", asynchronousActivity
138:                        .getName());
139:                assertEquals("Event", event.getName());
140:                assertEquals("Listener", listener.getName());
141:
142:                assertEquals("value", controller.environment.get("name"));
143:                assertEquals("value", loader.environment.get("name"));
144:                assertEquals("value", actor.environment.get("name"));
145:                assertEquals("value", condition.environment.get("name"));
146:                assertEquals("value", synchronousActivity.environment
147:                        .get("name"));
148:                assertEquals("value", asynchronousActivity.environment
149:                        .get("name"));
150:                assertEquals("value", event.environment.get("name"));
151:                assertEquals("value", listener.environment.get("name"));
152:
153:                assertEquals(new Integer(11), loader.getDummy());
154:                assertEquals(new Integer(10), actor.getDummy());
155:                assertEquals(new Integer(10), condition.getDummy());
156:                assertEquals(new Integer(10), synchronousActivity.getDummy());
157:                assertEquals(new Integer(10), asynchronousActivity.getDummy());
158:                assertEquals(new Integer(10), event.getDummy());
159:                assertEquals(new Integer(10), listener.getDummy());
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.