Source Code Cross Referenced for BaseScarabTestCase.java in  » Issue-Tracking » scarab-0.21 » org » tigris » scarab » test » 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 » Issue Tracking » scarab 0.21 » org.tigris.scarab.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.tigris.scarab.test;
002:
003:        /* ================================================================
004:         * Copyright (c) 2000-2002 CollabNet.  All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions are
008:         * met:
009:         *
010:         * 1. Redistributions of source code must retain the above copyright
011:         * notice, this list of conditions and the following disclaimer.
012:         *
013:         * 2. Redistributions in binary form must reproduce the above copyright
014:         * notice, this list of conditions and the following disclaimer in the
015:         * documentation and/or other materials provided with the distribution.
016:         *
017:         * 3. The end-user documentation included with the redistribution, if
018:         * any, must include the following acknowlegement: "This product includes
019:         * software developed by Collab.Net <http://www.Collab.Net/>."
020:         * Alternately, this acknowlegement may appear in the software itself, if
021:         * and wherever such third-party acknowlegements normally appear.
022:         *
023:         * 4. The hosted project names must not be used to endorse or promote
024:         * products derived from this software without prior written
025:         * permission. For written permission, please contact info@collab.net.
026:         *
027:         * 5. Products derived from this software may not use the "Tigris" or
028:         * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
029:         * prior written permission of Collab.Net.
030:         *
031:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
032:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
033:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
034:         * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
035:         * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
036:         * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
037:         * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
038:         * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
039:         * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
040:         * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
041:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
042:         *
043:         * ====================================================================
044:         *
045:         * This software consists of voluntary contributions made by many
046:         * individuals on behalf of Collab.Net.
047:         */
048:
049:        import java.io.File;
050:
051:        import org.apache.torque.om.NumberKey;
052:        import org.tigris.scarab.om.ActivitySet;
053:        import org.tigris.scarab.om.ActivitySetManager;
054:        import org.tigris.scarab.om.ActivitySetTypePeer;
055:        import org.tigris.scarab.om.Attachment;
056:        import org.tigris.scarab.om.Attribute;
057:        import org.tigris.scarab.om.AttributeManager;
058:        import org.tigris.scarab.om.Issue;
059:        import org.tigris.scarab.om.IssueManager;
060:        import org.tigris.scarab.om.IssueType;
061:        import org.tigris.scarab.om.IssueTypeManager;
062:        import org.tigris.scarab.om.Module;
063:        import org.tigris.scarab.om.ModuleManager;
064:        import org.tigris.scarab.om.ScarabUser;
065:        import org.tigris.scarab.om.ScarabUserManager;
066:
067:        /**
068:         * Test case that provides scaffolding for other Scarab test cases.
069:         * 
070:         * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh </a>
071:         * @version $Id: BaseScarabTestCase.java 9966 2005-11-27 22:10:05Z jorgeuriarte $
072:         */
073:        public class BaseScarabTestCase extends BaseTurbineTestCase {
074:            private static Module module = null;
075:            private static IssueType defaultIssueType = null;
076:            protected static int nbrDfltModules = 7;
077:            protected static int nbrDfltIssueTypes = 5;
078:            private ScarabUser user0 = null;
079:            private ScarabUser user1 = null;
080:            private ScarabUser user2 = null;
081:
082:            private Issue issue0 = null;
083:            private Attribute platformAttribute = null;
084:            private Attribute voteAttribute = null;
085:            private Attribute assignAttribute = null;
086:            private Attribute ccAttribute = null;
087:
088:            private static boolean initialized = false;
089:
090:            public BaseScarabTestCase() {
091:                System.setProperty("applicationRoot", "./src/webapp");
092:                System.setProperty("urn:avalon:home", "./src/webapp");
093:            }
094:
095:            public BaseScarabTestCase(String name) throws Exception {
096:                super (name);
097:            }
098:
099:            /*
100:             * @see TestCase#setUp()
101:             */
102:            protected void setUp() throws Exception {
103:                super .setUp();
104:                if (!initialized) {
105:                    initScarab();
106:                    initialized = true;
107:                }
108:            }
109:
110:            /*
111:             * @see TestCase#tearDown()
112:             */
113:            protected void tearDown() throws Exception {
114:                super .tearDown();
115:            }
116:
117:            /**
118:             * Grab Module #5 for testing. This is the same as what the web application
119:             * does and this is setup in ScarabPage.tempWorkAround()
120:             */
121:            private void initScarab() throws Exception {
122:                module = ModuleManager.getInstance(new NumberKey(5), false);
123:                defaultIssueType = IssueTypeManager.getInstance(
124:                        new NumberKey(1), false);
125:            }
126:
127:            protected ScarabUser getUser1() throws Exception {
128:                if (user1 == null) {
129:                    user1 = ScarabUserManager.getInstance(new NumberKey(1),
130:                            false);
131:                }
132:                return user1;
133:            }
134:
135:            protected ScarabUser getUser2() throws Exception {
136:                if (user2 == null) {
137:                    user2 = ScarabUserManager.getInstance(new NumberKey(2),
138:                            false);
139:
140:                }
141:                return user2;
142:            }
143:
144:            protected ScarabUser getUser5() throws Exception {
145:                if (user0 == null) {
146:                    user0 = ScarabUserManager.getInstance(new NumberKey(5),
147:                            false);
148:                }
149:                return user0;
150:            }
151:
152:            protected Issue getIssue0() throws Exception {
153:                if (issue0 == null) {
154:                    issue0 = IssueManager.getInstance(new NumberKey(1), false);
155:                }
156:                return issue0;
157:            }
158:
159:            protected Attribute getPlatformAttribute() throws Exception {
160:                if (platformAttribute == null) {
161:                    platformAttribute = AttributeManager
162:                            .getInstance(new NumberKey(5));
163:                }
164:                return platformAttribute;
165:            }
166:
167:            protected Attribute getVoteAttribute() throws Exception {
168:                if (voteAttribute == null) {
169:                    voteAttribute = AttributeManager.getInstance(new NumberKey(
170:                            8));
171:                }
172:                return voteAttribute;
173:            }
174:
175:            protected ActivitySet getEditActivitySet() throws Exception {
176:                Attachment attach = new Attachment();
177:                attach.setTextFields(getUser1(), getIssue0(),
178:                        Attachment.MODIFICATION__PK);
179:                attach.setName("commenttest");
180:                attach.save();
181:
182:                ActivitySet trans = ActivitySetManager.getInstance(
183:                        ActivitySetTypePeer.EDIT_ISSUE__PK, getUser1(), attach);
184:                trans.save();
185:                return trans;
186:            }
187:
188:            /**
189:             * If something like an Issue needs a mapping to a Module, then this is
190:             * Module #5 that you can use. For example, you should call:
191:             * issue.setModule(getModule()) in your Test before you use any of the rest
192:             * of the methods on the Issue object.
193:             */
194:            protected Module getModule() {
195:                return BaseScarabTestCase.module;
196:            }
197:
198:            protected IssueType getDefaultIssueType() {
199:                return BaseScarabTestCase.defaultIssueType;
200:            }
201:
202:            protected Attribute getAssignAttribute() throws Exception {
203:                if (assignAttribute == null) {
204:                    assignAttribute = AttributeManager
205:                            .getInstance(new NumberKey(2));
206:                }
207:                return assignAttribute;
208:            }
209:
210:            protected Attribute getCcAttribute() throws Exception {
211:                if (ccAttribute == null) {
212:                    ccAttribute = AttributeManager
213:                            .getInstance(new NumberKey(13));
214:                }
215:                return ccAttribute;
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.