Source Code Cross Referenced for OrgLaborPersistenceTest.java in  » Portal » liferay-portal-4.4.2 » com » liferay » portal » service » persistence » 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 » Portal » liferay portal 4.4.2 » com.liferay.portal.service.persistence 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003:         *
004:         * Permission is hereby granted, free of charge, to any person obtaining a copy
005:         * of this software and associated documentation files (the "Software"), to deal
006:         * in the Software without restriction, including without limitation the rights
007:         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008:         * copies of the Software, and to permit persons to whom the Software is
009:         * furnished to do so, subject to the following conditions:
010:         *
011:         * The above copyright notice and this permission notice shall be included in
012:         * all copies or substantial portions of the Software.
013:         *
014:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015:         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016:         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017:         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018:         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019:         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020:         * SOFTWARE.
021:         */package com.liferay.portal.service.persistence;
022:
023:        import com.liferay.portal.NoSuchOrgLaborException;
024:        import com.liferay.portal.kernel.bean.BeanLocatorUtil;
025:        import com.liferay.portal.model.OrgLabor;
026:        import com.liferay.portal.service.persistence.BasePersistenceTestCase;
027:
028:        /**
029:         * <a href="OrgLaborPersistenceTest.java.html"><b><i>View Source</i></b></a>
030:         *
031:         * @author Brian Wing Shun Chan
032:         *
033:         */
034:        public class OrgLaborPersistenceTest extends BasePersistenceTestCase {
035:            protected void setUp() throws Exception {
036:                super .setUp();
037:
038:                _persistence = (OrgLaborPersistence) BeanLocatorUtil
039:                        .locate(_TX_IMPL);
040:            }
041:
042:            public void testCreate() throws Exception {
043:                long pk = nextLong();
044:
045:                OrgLabor orgLabor = _persistence.create(pk);
046:
047:                assertNotNull(orgLabor);
048:
049:                assertEquals(orgLabor.getPrimaryKey(), pk);
050:            }
051:
052:            public void testRemove() throws Exception {
053:                OrgLabor newOrgLabor = addOrgLabor();
054:
055:                _persistence.remove(newOrgLabor);
056:
057:                OrgLabor existingOrgLabor = _persistence
058:                        .fetchByPrimaryKey(newOrgLabor.getPrimaryKey());
059:
060:                assertNull(existingOrgLabor);
061:            }
062:
063:            public void testUpdateNew() throws Exception {
064:                addOrgLabor();
065:            }
066:
067:            public void testUpdateExisting() throws Exception {
068:                long pk = nextLong();
069:
070:                OrgLabor newOrgLabor = _persistence.create(pk);
071:
072:                newOrgLabor.setOrganizationId(nextLong());
073:                newOrgLabor.setTypeId(nextInt());
074:                newOrgLabor.setSunOpen(nextInt());
075:                newOrgLabor.setSunClose(nextInt());
076:                newOrgLabor.setMonOpen(nextInt());
077:                newOrgLabor.setMonClose(nextInt());
078:                newOrgLabor.setTueOpen(nextInt());
079:                newOrgLabor.setTueClose(nextInt());
080:                newOrgLabor.setWedOpen(nextInt());
081:                newOrgLabor.setWedClose(nextInt());
082:                newOrgLabor.setThuOpen(nextInt());
083:                newOrgLabor.setThuClose(nextInt());
084:                newOrgLabor.setFriOpen(nextInt());
085:                newOrgLabor.setFriClose(nextInt());
086:                newOrgLabor.setSatOpen(nextInt());
087:                newOrgLabor.setSatClose(nextInt());
088:
089:                _persistence.update(newOrgLabor);
090:
091:                OrgLabor existingOrgLabor = _persistence
092:                        .findByPrimaryKey(newOrgLabor.getPrimaryKey());
093:
094:                assertEquals(existingOrgLabor.getOrgLaborId(), newOrgLabor
095:                        .getOrgLaborId());
096:                assertEquals(existingOrgLabor.getOrganizationId(), newOrgLabor
097:                        .getOrganizationId());
098:                assertEquals(existingOrgLabor.getTypeId(), newOrgLabor
099:                        .getTypeId());
100:                assertEquals(existingOrgLabor.getSunOpen(), newOrgLabor
101:                        .getSunOpen());
102:                assertEquals(existingOrgLabor.getSunClose(), newOrgLabor
103:                        .getSunClose());
104:                assertEquals(existingOrgLabor.getMonOpen(), newOrgLabor
105:                        .getMonOpen());
106:                assertEquals(existingOrgLabor.getMonClose(), newOrgLabor
107:                        .getMonClose());
108:                assertEquals(existingOrgLabor.getTueOpen(), newOrgLabor
109:                        .getTueOpen());
110:                assertEquals(existingOrgLabor.getTueClose(), newOrgLabor
111:                        .getTueClose());
112:                assertEquals(existingOrgLabor.getWedOpen(), newOrgLabor
113:                        .getWedOpen());
114:                assertEquals(existingOrgLabor.getWedClose(), newOrgLabor
115:                        .getWedClose());
116:                assertEquals(existingOrgLabor.getThuOpen(), newOrgLabor
117:                        .getThuOpen());
118:                assertEquals(existingOrgLabor.getThuClose(), newOrgLabor
119:                        .getThuClose());
120:                assertEquals(existingOrgLabor.getFriOpen(), newOrgLabor
121:                        .getFriOpen());
122:                assertEquals(existingOrgLabor.getFriClose(), newOrgLabor
123:                        .getFriClose());
124:                assertEquals(existingOrgLabor.getSatOpen(), newOrgLabor
125:                        .getSatOpen());
126:                assertEquals(existingOrgLabor.getSatClose(), newOrgLabor
127:                        .getSatClose());
128:            }
129:
130:            public void testFindByPrimaryKeyExisting() throws Exception {
131:                OrgLabor newOrgLabor = addOrgLabor();
132:
133:                OrgLabor existingOrgLabor = _persistence
134:                        .findByPrimaryKey(newOrgLabor.getPrimaryKey());
135:
136:                assertEquals(existingOrgLabor, newOrgLabor);
137:            }
138:
139:            public void testFindByPrimaryKeyMissing() throws Exception {
140:                long pk = nextLong();
141:
142:                try {
143:                    _persistence.findByPrimaryKey(pk);
144:
145:                    fail("Missing entity did not throw NoSuchOrgLaborException");
146:                } catch (NoSuchOrgLaborException nsee) {
147:                }
148:            }
149:
150:            public void testFetchByPrimaryKeyExisting() throws Exception {
151:                OrgLabor newOrgLabor = addOrgLabor();
152:
153:                OrgLabor existingOrgLabor = _persistence
154:                        .fetchByPrimaryKey(newOrgLabor.getPrimaryKey());
155:
156:                assertEquals(existingOrgLabor, newOrgLabor);
157:            }
158:
159:            public void testFetchByPrimaryKeyMissing() throws Exception {
160:                long pk = nextLong();
161:
162:                OrgLabor missingOrgLabor = _persistence.fetchByPrimaryKey(pk);
163:
164:                assertNull(missingOrgLabor);
165:            }
166:
167:            protected OrgLabor addOrgLabor() throws Exception {
168:                long pk = nextLong();
169:
170:                OrgLabor orgLabor = _persistence.create(pk);
171:
172:                orgLabor.setOrganizationId(nextLong());
173:                orgLabor.setTypeId(nextInt());
174:                orgLabor.setSunOpen(nextInt());
175:                orgLabor.setSunClose(nextInt());
176:                orgLabor.setMonOpen(nextInt());
177:                orgLabor.setMonClose(nextInt());
178:                orgLabor.setTueOpen(nextInt());
179:                orgLabor.setTueClose(nextInt());
180:                orgLabor.setWedOpen(nextInt());
181:                orgLabor.setWedClose(nextInt());
182:                orgLabor.setThuOpen(nextInt());
183:                orgLabor.setThuClose(nextInt());
184:                orgLabor.setFriOpen(nextInt());
185:                orgLabor.setFriClose(nextInt());
186:                orgLabor.setSatOpen(nextInt());
187:                orgLabor.setSatClose(nextInt());
188:
189:                _persistence.update(orgLabor);
190:
191:                return orgLabor;
192:            }
193:
194:            private static final String _TX_IMPL = OrgLaborPersistence.class
195:                    .getName()
196:                    + ".transaction";
197:            private OrgLaborPersistence _persistence;
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.