Source Code Cross Referenced for ProjectDaoTest.java in  » Workflow-Engines » wilos » wilos » test » hibernate » misc » project » 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.misc.project 
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) 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:
018:        package wilos.test.hibernate.misc.project;
019:
020:        import static org.junit.Assert.assertEquals;
021:        import static org.junit.Assert.assertNotNull;
022:        import static org.junit.Assert.assertNotSame;
023:        import static org.junit.Assert.assertNull;
024:
025:        import java.text.ParseException;
026:        import java.util.Date;
027:        import java.util.List;
028:
029:        import org.junit.After;
030:        import org.junit.Before;
031:        import org.junit.Test;
032:
033:        import wilos.hibernate.misc.project.ProjectDao;
034:        import wilos.model.misc.project.Project;
035:        import wilos.test.TestConfiguration;
036:        import wilos.utils.Constantes;
037:
038:        public class ProjectDaoTest {
039:
040:            private ProjectDao projectDao = (ProjectDao) TestConfiguration
041:                    .getInstance().getApplicationContext()
042:                    .getBean("ProjectDao");
043:
044:            private Project project;
045:            Date date = null;
046:
047:            @Before
048:            public void setUp() {
049:
050:                try {
051:                    date = Constantes.DATE_FORMAT.parse("18/01/2007 10:00");
052:                } catch (ParseException e) {
053:                    e.printStackTrace();
054:                }
055:
056:                this .project = new Project();
057:                this .project.setConcreteName("testProject");
058:                this .project.setDescription("testDesc");
059:            }
060:
061:            @After
062:            public void tearDown() {
063:                this .project = null;
064:            }
065:
066:            @Test
067:            public void testStorageOfANullProject() {
068:
069:                Project project = null;
070:
071:                String id = this .projectDao.saveOrUpdateProject(project);
072:                Project retrievedProject = this .projectDao.getProject(id);
073:
074:                assertNull("null", retrievedProject);
075:            }
076:
077:            @Test
078:            public void testStorageOfAProject() {
079:
080:                String id = this .projectDao.saveOrUpdateProject(this .project);
081:                Project retrievedProject = this .projectDao.getProject(id);
082:
083:                assertEquals("project : concrete name", this .project
084:                        .getConcreteName(), retrievedProject.getConcreteName());
085:                assertEquals("project : planned time", this .project
086:                        .getPlannedTime(), retrievedProject.getPlannedTime());
087:                assertEquals("project : planned finishing date", this .project
088:                        .getPlannedFinishingDate(), retrievedProject
089:                        .getPlannedFinishingDate());
090:                assertNotSame("same object", this .project, retrievedProject);
091:
092:                this .projectDao.deleteProject(this .project);
093:            }
094:
095:            @Test
096:            public void testDeletionOfAProject() {
097:
098:                String id = this .projectDao.saveOrUpdateProject(this .project);
099:                this .projectDao.deleteProject(this .project);
100:                Project retrievedProject = this .projectDao.getProject(id);
101:
102:                assertNull("null", retrievedProject);
103:            }
104:
105:            @Test
106:            public void testRetrievalOfAllProjects() {
107:
108:                int nb = this .projectDao.getAllProjects().size();
109:
110:                Project project1 = new Project();
111:                project1.setConcreteName("My concrete name");
112:                project1.setPlannedTime(25.0f);
113:                project1.setPlannedFinishingDate(date);
114:
115:                Project project2 = new Project();
116:                project2.setConcreteName("Your concrete name");
117:                project2.setPlannedTime(7.0f);
118:                project2.setPlannedFinishingDate(date);
119:
120:                this .projectDao.saveOrUpdateProject(this .project);
121:                this .projectDao.saveOrUpdateProject(project1);
122:                this .projectDao.saveOrUpdateProject(project2);
123:
124:                List<Project> projects = this .projectDao.getAllProjects();
125:                assertNotNull("list not null", projects);
126:                assertEquals("size", 3, projects.size() - nb);
127:
128:                this.projectDao.deleteProject(project2);
129:                this.projectDao.deleteProject(project1);
130:                this.projectDao.deleteProject(this.project);
131:
132:                project2 = null;
133:                project1 = null;
134:
135:            }
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.