Source Code Cross Referenced for Scheduler.java in  » Test-Coverage » Quilt » org » quilt » frontend » ant » 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 » Test Coverage » Quilt » org.quilt.frontend.ant 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Scheduler.java */
002:
003:        package org.quilt.frontend.ant;
004:
005:        import java.util.Vector;
006:
007:        import org.apache.tools.ant.Project;
008:        import org.apache.tools.ant.Task;
009:        import org.quilt.framework.QuiltTest;
010:
011:        /** 
012:         * Collects individual and batch tests during initial processing of the
013:         * Ant build.xml file, then schedules tests for running.  Before running
014:         * any tests, batch tests are unpacked and attributes assigned.
015:         */
016:        public class Scheduler {
017:
018:            private QuiltTask task = null;
019:            private TaskControl tc = null;
020:            private boolean batched = true;
021:
022:            /** Vector of QuiltTests */
023:            private Vector tests = new Vector();
024:            /** Index into that Vector. */
025:            private int testIndex = 0;
026:
027:            /** Vector of BatchTests */
028:            private Vector batchTests = new Vector();
029:            /** Index into Vector of BatchTests. */
030:            private int batchIndex = 0;
031:
032:            /** All tests are clones of this one. */
033:            private QuiltTest modelTest = new QuiltTest();
034:
035:            /** One-arg constructor called at beginning of run */
036:            public Scheduler(QuiltTask t) {
037:                task = t;
038:                tc = new TaskControl(task);
039:            }
040:
041:            // SCHEDULING METHODS /////////////////////////////////
042:            /**
043:             * Ant-compatible method for adding a batch test.  When Ant
044:             * encounters a <batchtest ... it calls QuiltTask.createBatchTest
045:             * to get an instance, then uses the set* methods to set test
046:             * parameters for the batch.  QuiltTask uses this method to pass
047:             * the batch test to the Scheduler.
048:             *
049:             * @param bt BatchTest instance created by QuiltTask
050:             */
051:            public void addBatchTest(BatchTest bt) {
052:                task.log("--> Scheduler.addBatchTest", Project.MSG_VERBOSE);
053:                batchTests.addElement(bt);
054:            }
055:
056:            /** 
057:             * Ant-compatible method for adding test to queue.  When Ant 
058:             * counters a <test name=... it uses this method to create
059:             * the QuiltTest object and then calls set* methods to set
060:             * test parameters.
061:             * 
062:             * @param test QuiltTest structure containing test parameters.
063:             */
064:            public void addTest(QuiltTest test) {
065:                task.log("--> Scheduler.addTest", Project.MSG_VERBOSE);
066:                tests.addElement(test);
067:            }
068:
069:            /** 
070:             * Zero out indexes into lists of tests and batch tests.  This
071:             * will be called whenever the user wants to rescan the lists of
072:             * tests and batch tests.
073:             */
074:            public void schedule() {
075:                testIndex = 0;
076:                batchIndex = 0;
077:
078:                task
079:                        .log(
080:                                "\n===========================================================\n"
081:                                        + "--> Scheduler.schedule: there are "
082:                                        + tests.size()
083:                                        + " tests and "
084:                                        + batchTests.size()
085:                                        + " batch tests"
086:                                        + "\n===========================================================\n",
087:                                Project.MSG_DEBUG);
088:            }
089:
090:            /**
091:             * Returns the next test or batch test available.
092:             * 
093:             * @return QuiltTest-compatible structure 
094:             */
095:            public QuiltTest nextTest() {
096:                if (testIndex < tests.size()) {
097:                    return (QuiltTest) tests.elementAt(testIndex++);
098:                } else if (batchIndex < batchTests.size()) {
099:                    return (BatchTest) batchTests.elementAt(batchIndex++);
100:                } else {
101:                    return null;
102:                }
103:            }
104:
105:            /**
106:             * Pass through the list of batch tests, creating individual tests
107:             * and passing these to the scheduler.
108:             */
109:            public void unbatch() {
110:                task.log("--> Scheduler.unbatch", Project.MSG_VERBOSE);
111:                for (int i = 0; i < batchTests.size(); i++) {
112:                    ((BatchTest) batchTests.elementAt(i)).unbatch(this );
113:                }
114:                batched = false;
115:                batchTests = new Vector();
116:            }
117:
118:            // GET/SET METHODS //////////////////////////////////////////////
119:            /** 
120:             * Get a reference to the TaskControl object created by the 
121:             * constructor. 
122:             * */
123:            public TaskControl getTaskControl() {
124:                return tc;
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.