Source Code Cross Referenced for ActivityDaoTest.java in  » Workflow-Engines » wilos » wilos » test » hibernate » spem2 » activity » 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 » wilos » wilos.test.hibernate.spem2.activity 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003:         * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004:         * Copyright (C) 2007 Sebastien BALARD <sbalard@wilos-project.org>
005:         *
006:         * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
007:         * General Public License as published by the Free Software Foundation; either version 2 of the License,
008:         * or (at your option) any later version.
009:         *
010:         * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
011:         * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012:         * GNU General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU General Public License along with this program; if not,
015:         * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
016:         */
017:        package wilos.test.hibernate.spem2.activity;
018:
019:        import static org.junit.Assert.*;
020:
021:        import java.util.List;
022:
023:        import org.junit.After;
024:        import org.junit.Before;
025:        import org.junit.Test;
026:
027:        import wilos.hibernate.spem2.activity.ActivityDao;
028:        import wilos.model.spem2.activity.Activity;
029:        import wilos.test.TestConfiguration;
030:
031:        public class ActivityDaoTest {
032:
033:            private ActivityDao activityDao = (ActivityDao) TestConfiguration
034:                    .getInstance().getApplicationContext().getBean(
035:                            "ActivityDao");
036:
037:            private Activity activity = null;
038:
039:            public static final String NAME = "thisActivity";
040:
041:            public static final String DESCRIPTION = "activity description";
042:
043:            public static final String PREFIX = "prefix";
044:
045:            public static final Boolean IS_OPTIONAL = true;
046:
047:            public static final Boolean HAS_MULTIPLE_OCCURENCES = true;
048:
049:            public static final Boolean IS_EVEN_DRIVEN = true;
050:
051:            public static final Boolean IS_ON_GOING = true;
052:
053:            public static final Boolean IS_PLANNED = true;
054:
055:            public static final Boolean IS_REPEATABLE = true;
056:
057:            @Before
058:            public void setUp() {
059:
060:                this .activity = new Activity();
061:                this .activity.setName(NAME);
062:                this .activity.setDescription(DESCRIPTION);
063:                this .activity.setPrefix(PREFIX);
064:                this .activity
065:                        .setHasMultipleOccurrences(HAS_MULTIPLE_OCCURENCES);
066:                this .activity.setIsEvenDriven(IS_EVEN_DRIVEN);
067:                this .activity.setIsOngoing(IS_ON_GOING);
068:                this .activity.setIsOptional(IS_OPTIONAL);
069:                this .activity.setIsPlanned(IS_PLANNED);
070:                this .activity.setIsRepeatable(IS_REPEATABLE);
071:            }
072:
073:            @After
074:            public void tearDown() {
075:                this .activity = null;
076:            }
077:
078:            @Test
079:            public void testSaveOrUpdateActivity() {
080:                // Rk: the setUp method is called here.
081:
082:                // Save the activity with the method to test.
083:                String id = this .activityDao
084:                        .saveOrUpdateActivity(this .activity);
085:
086:                Activity activityTmp = (Activity) this .activityDao
087:                        .getActivity(id);
088:                assertNotNull(activityTmp);
089:
090:                this .activityDao.deleteActivity(this .activity);
091:                // Rk: the tearDown method is called here.
092:            }
093:
094:            @Test
095:            public void testGetAllActivities() {
096:                // Rk: the setUp method is called here.
097:
098:                // Save the activity with the method to test.
099:                this .activityDao.saveOrUpdateActivity(this .activity);
100:
101:                // Look if this activity is also into the database and look if the size
102:                // of the set is >= 1.
103:                List<Activity> activities = this .activityDao.getAllActivities();
104:                assertNotNull(activities);
105:                assertTrue(activities.size() >= 1);
106:
107:                this .activityDao.deleteActivity(this .activity);
108:
109:                // Rk: the tearDown method is called here.
110:            }
111:
112:            @Test
113:            public void testGetActivity() {
114:
115:                // Save the activity into the database.
116:                String id = this .activityDao
117:                        .saveOrUpdateActivity(this .activity);
118:
119:                // Test the method getActivity with an existing activity.
120:                Activity activityTmp = this .activityDao.getActivity(id);
121:                assertNotNull(activityTmp);
122:                assertEquals("Name", activityTmp.getName(), NAME);
123:                assertEquals("Description", activityTmp.getDescription(),
124:                        DESCRIPTION);
125:                assertEquals("Prefix", activityTmp.getPrefix(), PREFIX);
126:                assertEquals("HasMultipleOccurences", activityTmp
127:                        .getHasMultipleOccurrences(), HAS_MULTIPLE_OCCURENCES);
128:                assertEquals("IsEvenDriven", activityTmp.getIsEvenDriven(),
129:                        IS_EVEN_DRIVEN);
130:                assertEquals("IsOnGoing", activityTmp.getIsOngoing(),
131:                        IS_ON_GOING);
132:                assertEquals("IsOptional", activityTmp.getIsOptional(),
133:                        IS_OPTIONAL);
134:                assertEquals("IsPlanned", activityTmp.getIsPlanned(),
135:                        IS_PLANNED);
136:                assertEquals("IsRepeatale", activityTmp.getIsRepeatable(),
137:                        IS_REPEATABLE);
138:
139:                // Test the method getActivity with an unexisting activity.
140:                this .activityDao.deleteActivity(this .activity);
141:
142:                // Rk: the tearDown method is called here.
143:            }
144:
145:            @Test
146:            public void testDeleteActivity() {
147:                // Rk: the setUp method is called here.
148:
149:                // Save the activity into the database.
150:                String id = this .activityDao
151:                        .saveOrUpdateActivity(this .activity);
152:
153:                // Test the method deleteActivity with an activity existing into the db.
154:                this .activityDao.deleteActivity(this .activity);
155:
156:                // See if this.activity is now absent in the db.
157:                Activity activityTmp = (Activity) this .activityDao
158:                        .getActivity(id);
159:                assertNull(activityTmp);
160:
161:                // Rk: the tearDown method is called here.
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.