Source Code Cross Referenced for ApplicationConstantsTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » applicationconstants » 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 » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.applicationconstants 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        // Created on Dec 14, 2005
018:        package edu.iu.uis.eden.applicationconstants;
019:
020:        import junit.framework.AssertionFailedError;
021:
022:        import org.junit.Test;
023:        import org.kuali.workflow.test.WorkflowTestCase;
024:
025:        import edu.iu.uis.eden.KEWServiceLocator;
026:        import edu.iu.uis.eden.WorkflowServiceErrorException;
027:
028:        /**
029:         * Tests adding/modifying an application constant
030:         * @author Aaron Hamid
031:         * @author rkirkend
032:         */
033:        public class ApplicationConstantsTest extends WorkflowTestCase {
034:            private static final String CONSTANT_NAME = "BogusConstant";
035:            private static final String CONSTANT_VALUE = "test value";
036:
037:            @Test
038:            public void testApplicationConstantsDeleteCacheInteraction() {
039:                ApplicationConstantsService appConstSrv = KEWServiceLocator
040:                        .getApplicationConstantsService();
041:                String name = "testName";
042:                String value = "testValue";
043:                ApplicationConstant constant = new ApplicationConstant(name,
044:                        value);
045:                appConstSrv.save(constant);
046:
047:                //verify that the constant is there.
048:                constant = appConstSrv.findByName(name);
049:                assertNotNull("Constant should have been fetched.", constant);
050:
051:                //that fetch should have put the constant in the cache. verify using the cache service
052:                constant = (ApplicationConstant) KEWServiceLocator
053:                        .getCacheAdministrator().getFromCache(name);
054:                assertNotNull("Constant should have been in cache", constant);
055:
056:                //delete the constant and verify that it's not in the cache
057:                appConstSrv.delete(constant);
058:                constant = (ApplicationConstant) KEWServiceLocator
059:                        .getCacheAdministrator().getFromCache(name);
060:                assertNull("Constant should no longer be in the cache",
061:                        constant);
062:
063:                //verify that the service isn't giving any deleted constants
064:                constant = appConstSrv.findByName(name);
065:                assertNull("Constant should be deleted and not fetched.",
066:                        constant);
067:            }
068:
069:            @Test
070:            public void testApplicationConstantsUpdateCacheInteraction() {
071:                ApplicationConstantsService appConstSrv = KEWServiceLocator
072:                        .getApplicationConstantsService();
073:                String name = "testName";
074:                String value = "testValue";
075:                ApplicationConstant constant = new ApplicationConstant(name,
076:                        value);
077:                appConstSrv.save(constant);
078:
079:                //verify that the constant is there.
080:                constant = appConstSrv.findByName(name);
081:                assertNotNull("Constant should have been fetched.", constant);
082:
083:                //that fetch should have put the constant in the cache. verify using the cache service
084:                constant = (ApplicationConstant) KEWServiceLocator
085:                        .getCacheAdministrator().getFromCache(name);
086:                assertNotNull("Constant should have been in cache", constant);
087:
088:                String newValue = "new Value";
089:
090:                constant.setApplicationConstantValue(newValue);
091:                appConstSrv.save(constant);
092:
093:                constant = appConstSrv.findByName(name);
094:                assertEquals("Constants value should have been updated",
095:                        newValue, constant.getApplicationConstantValue());
096:
097:                //check that it's in the cache correctly
098:                constant = (ApplicationConstant) KEWServiceLocator
099:                        .getCacheAdministrator().getFromCache(name);
100:                assertEquals(
101:                        "Constants value should have been updated in the cache",
102:                        newValue, constant.getApplicationConstantValue());
103:            }
104:
105:            @Test
106:            public void testConstants() {
107:                ApplicationConstantsService acs = KEWServiceLocator
108:                        .getApplicationConstantsService();
109:                ApplicationConstant ac = acs.findByName(CONSTANT_NAME);
110:                assertNull(ac);
111:                ac = new ApplicationConstant();
112:                ac.setApplicationConstantName(CONSTANT_NAME);
113:
114:                try {
115:                    acs.save(ac);
116:                    throw new AssertionFailedError("Empty constant was saved");
117:                } catch (WorkflowServiceErrorException wsee) {
118:                    // should be thrown due to empty constant value
119:                    //            log.info("WorkflowServiceErrorException due to empty constant value should follow.");
120:                    //            wsee.printStackTrace();
121:                }
122:
123:                assertNull(acs.findByName(CONSTANT_NAME));
124:
125:                ac.setApplicationConstantValue(CONSTANT_VALUE);
126:                acs.save(ac);
127:                ac = acs.findByName(CONSTANT_NAME);
128:                assertNotNull(ac);
129:                assertEquals(CONSTANT_NAME, ac.getApplicationConstantName());
130:                assertEquals(CONSTANT_VALUE, ac.getApplicationConstantValue());
131:
132:                ac = new ApplicationConstant();
133:                ac.setApplicationConstantName(CONSTANT_NAME);
134:                ac.setApplicationConstantValue(CONSTANT_VALUE);
135:                //        try {
136:                acs.save(ac);
137:                //            fail("Exception should have been thrown from lack of version number");
138:                //        } catch (OjbOperationException ooe) {
139:                // should throw an exception because lockvernbr is not set
140:                //        }
141:
142:                ac = acs.findByName(CONSTANT_NAME);
143:                assertNotNull(ac);
144:                assertEquals(CONSTANT_NAME, ac.getApplicationConstantName());
145:                assertEquals(CONSTANT_VALUE, ac.getApplicationConstantValue());
146:                ac.setApplicationConstantValue(CONSTANT_VALUE + "2");
147:
148:                acs.save(ac);
149:
150:                ac = acs.findByName(CONSTANT_NAME);
151:                assertNotNull(ac);
152:                assertEquals(CONSTANT_NAME, ac.getApplicationConstantName());
153:                assertEquals(CONSTANT_VALUE + "2", ac
154:                        .getApplicationConstantValue());
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.