Source Code Cross Referenced for TaskDescriptorDaoTest.java in  » Workflow-Engines » wilos » wilos » test » hibernate » spem2 » task » 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.task 
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.task;
018:
019:        import static org.junit.Assert.assertEquals;
020:        import static org.junit.Assert.assertNotNull;
021:        import static org.junit.Assert.assertNull;
022:        import static org.junit.Assert.assertTrue;
023:
024:        import java.util.List;
025:
026:        import org.junit.After;
027:        import org.junit.Before;
028:        import org.junit.Test;
029:
030:        import wilos.hibernate.misc.concretetask.ConcreteTaskDescriptorDao;
031:        import wilos.hibernate.spem2.task.TaskDescriptorDao;
032:        import wilos.model.misc.concretetask.ConcreteTaskDescriptor;
033:        import wilos.model.spem2.task.TaskDescriptor;
034:        import wilos.test.TestConfiguration;
035:
036:        /**
037:         * Unit test for TaskDescriptorDao
038:         *
039:         * @author eperico
040:         *
041:         */
042:        public class TaskDescriptorDaoTest {
043:
044:            private TaskDescriptorDao taskDescriptorDao = (TaskDescriptorDao) TestConfiguration
045:                    .getInstance().getApplicationContext().getBean(
046:                            "TaskDescriptorDao");
047:
048:            private ConcreteTaskDescriptorDao concreteTaskDescriptorDao = (ConcreteTaskDescriptorDao) TestConfiguration
049:                    .getInstance().getApplicationContext().getBean(
050:                            "ConcreteTaskDescriptorDao");
051:
052:            private TaskDescriptor taskDescriptor = null;
053:
054:            /**
055:             * attributes from Element
056:             */
057:            public static final String ID = "thisId";
058:
059:            public static final String NAME = "thisTaskDescriptor";
060:
061:            public static final String DESCRIPTION = "taskDescriptor description";
062:
063:            /**
064:             * attributes from BreakdownElement
065:             */
066:            public static final String PREFIX = "prefix";
067:
068:            public static final Boolean IS_PLANNED = true;
069:
070:            public static final Boolean HAS_MULTIPLE_OCCURENCES = true;
071:
072:            public static final Boolean IS_OPTIONAL = true;
073:
074:            /**
075:             * attributes from WorkBreakdownElement
076:             */
077:            public static final Boolean IS_REPEATABLE = true;
078:
079:            public static final Boolean IS_ON_GOING = true;
080:
081:            public static final Boolean IS_EVEN_DRIVEN = true;
082:
083:            @Before
084:            public void setUp() {
085:
086:                // Create empty TaskDescriptor
087:                this .taskDescriptor = new TaskDescriptor();
088:                this .taskDescriptor.setName(NAME);
089:                this .taskDescriptor.setDescription(DESCRIPTION);
090:
091:                this .taskDescriptor.setPrefix(PREFIX);
092:                this .taskDescriptor.setIsPlanned(IS_PLANNED);
093:                this .taskDescriptor
094:                        .setHasMultipleOccurrences(HAS_MULTIPLE_OCCURENCES);
095:                this .taskDescriptor.setIsOptional(IS_OPTIONAL);
096:
097:                this .taskDescriptor.setIsRepeatable(IS_REPEATABLE);
098:                this .taskDescriptor.setIsOngoing(IS_ON_GOING);
099:                this .taskDescriptor.setIsEvenDriven(IS_EVEN_DRIVEN);
100:            }
101:
102:            @After
103:            public void tearDown() {
104:                this .taskDescriptor = null;
105:            }
106:
107:            @Test
108:            public void testSaveOrUpdateTaskDescriptor() {
109:                // Rk: the setUp method is called here.
110:
111:                // Save the taskDescriptor with the method to test.
112:                String id = this .taskDescriptorDao
113:                        .saveOrUpdateTaskDescriptor(this .taskDescriptor);
114:
115:                // Check the saving.
116:                TaskDescriptor taskDescriptorTmp = (TaskDescriptor) this .taskDescriptorDao
117:                        .getHibernateTemplate().load(TaskDescriptor.class, id);
118:                assertNotNull(taskDescriptorTmp);
119:
120:                this .taskDescriptorDao
121:                        .deleteTaskDescriptor(this .taskDescriptor);
122:
123:                // Rk: the tearDown method is called here.
124:            }
125:
126:            @Test
127:            public void testGetAllTaskDescriptors() {
128:                // Rk: the setUp method is called here.
129:
130:                // Save the taskDescriptor into the database.
131:                this .taskDescriptorDao
132:                        .saveOrUpdateTaskDescriptor(this .taskDescriptor);
133:
134:                // Look if this taskDescriptor is also into the database and look if the
135:                // size of the set is >= 1.
136:                List<TaskDescriptor> taskDescriptors = this .taskDescriptorDao
137:                        .getAllTaskDescriptors();
138:                assertNotNull(taskDescriptors);
139:                assertTrue(taskDescriptors.size() >= 1);
140:
141:                this .taskDescriptorDao
142:                        .deleteTaskDescriptor(this .taskDescriptor);
143:
144:                // Rk: the tearDown method is called here.
145:            }
146:
147:            @Test
148:            public void testGetTaskDescriptor() {
149:                // Rk: the setUp method is called here.
150:
151:                // Save the taskDescriptor into the database.
152:                String id = this .taskDescriptorDao
153:                        .saveOrUpdateTaskDescriptor(this .taskDescriptor);
154:
155:                ConcreteTaskDescriptor concreteTaskDescriptor = new ConcreteTaskDescriptor();
156:                concreteTaskDescriptor.setConcreteName("My name");
157:
158:                this .concreteTaskDescriptorDao
159:                        .saveOrUpdateConcreteTaskDescriptor(concreteTaskDescriptor);
160:
161:                this .taskDescriptor
162:                        .addConcreteTaskDescriptor(concreteTaskDescriptor);
163:                this .concreteTaskDescriptorDao
164:                        .saveOrUpdateConcreteTaskDescriptor(concreteTaskDescriptor);
165:
166:                this .taskDescriptorDao
167:                        .saveOrUpdateTaskDescriptor(this .taskDescriptor);
168:
169:                // Test the method getTaskDescriptor with an existing taskDescriptor.
170:                TaskDescriptor taskDescriptorTmp = this .taskDescriptorDao
171:                        .getTaskDescriptor(id);
172:                assertNotNull(taskDescriptorTmp);
173:                assertEquals("Name", taskDescriptorTmp.getName(), NAME);
174:                assertEquals("Description", taskDescriptorTmp.getDescription(),
175:                        DESCRIPTION);
176:                assertEquals("Prefix", taskDescriptorTmp.getPrefix(), PREFIX);
177:                assertEquals("IsPlanned", taskDescriptorTmp.getIsPlanned(),
178:                        IS_PLANNED);
179:                assertEquals("HasMultipleOccurences", taskDescriptorTmp
180:                        .getHasMultipleOccurrences(), HAS_MULTIPLE_OCCURENCES);
181:                assertEquals("IsOptional", taskDescriptorTmp.getIsOptional(),
182:                        IS_OPTIONAL);
183:                assertEquals("IsRepeatable", taskDescriptorTmp
184:                        .getIsRepeatable(), IS_REPEATABLE);
185:                assertEquals("IsOnGoing", taskDescriptorTmp.getIsOngoing(),
186:                        IS_ON_GOING);
187:                assertEquals("IsEvenDriven", taskDescriptorTmp
188:                        .getIsEvenDriven(), IS_EVEN_DRIVEN);
189:
190:                // clean temporary data
191:                this .concreteTaskDescriptorDao
192:                        .deleteConcreteTaskDescriptor(concreteTaskDescriptor);
193:                this .taskDescriptorDao
194:                        .deleteTaskDescriptor(this .taskDescriptor);
195:
196:                // Rk: the tearDown method is called here.
197:            }
198:
199:            @Test
200:            public void testDeleteTaskDescriptor() {
201:                // Rk: the setUp method is called here.
202:
203:                // Save the taskDescriptor into the database.
204:                String id = this .taskDescriptorDao
205:                        .saveOrUpdateTaskDescriptor(this .taskDescriptor);
206:
207:                // Test the method deleteTaskDescriptor with an activity existing into
208:                // the db.
209:                this .taskDescriptorDao
210:                        .deleteTaskDescriptor(this .taskDescriptor);
211:
212:                // See if this.taskDescriptor is now absent in the db.
213:                TaskDescriptor taskDescriptorTmp = (TaskDescriptor) this .taskDescriptorDao
214:                        .getHibernateTemplate().get(TaskDescriptor.class, id);
215:                assertNull(taskDescriptorTmp);
216:
217:                // Rk: the tearDown method is called here.
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.