Source Code Cross Referenced for AvailableTest.java in  » Build » ANT » org » apache » tools » ant » taskdefs » 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 » Build » ANT » org.apache.tools.ant.taskdefs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
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:         */
018:
019:        package org.apache.tools.ant.taskdefs;
020:
021:        import org.apache.tools.ant.BuildFileTest;
022:
023:        /**
024:         * JUnit test for the Available task/condition.
025:         */
026:        public class AvailableTest extends BuildFileTest {
027:
028:            public AvailableTest(String name) {
029:                super (name);
030:            }
031:
032:            public void setUp() {
033:                configureProject("src/etc/testcases/taskdefs/available.xml");
034:            }
035:
036:            // Nothing specified -> Fail
037:            public void test1() {
038:                expectBuildException("test1", "required argument not specified");
039:            }
040:
041:            // Only property specified -> Fail
042:            public void test2() {
043:                expectBuildException("test2", "required argument not specified");
044:            }
045:
046:            // Only file specified -> Fail
047:            public void test3() {
048:                expectBuildException("test3", "required argument not specified");
049:            }
050:
051:            // file doesn't exist -> property 'test' == null
052:            public void test4() {
053:                executeTarget("test4");
054:                assertTrue(project.getProperty("test") == null);
055:            }
056:
057:            // file does exist -> property 'test' == 'true'
058:            public void test5() {
059:                executeTarget("test5");
060:                assertEquals("true", project.getProperty("test"));
061:            }
062:
063:            // resource doesn't exist -> property 'test' == null
064:            public void test6() {
065:                executeTarget("test6");
066:                assertTrue(project.getProperty("test") == null);
067:            }
068:
069:            // resource does exist -> property 'test' == 'true'
070:            public void test7() {
071:                executeTarget("test7");
072:                assertEquals("true", project.getProperty("test"));
073:            }
074:
075:            // class doesn't exist -> property 'test' == null
076:            public void test8() {
077:                executeTarget("test8");
078:                assertTrue(project.getProperty("test") == null);
079:            }
080:
081:            // class does exist -> property 'test' == 'true'
082:            public void test9() {
083:                executeTarget("test9");
084:                assertEquals("true", project.getProperty("test"));
085:            }
086:
087:            // All three specified and all three exist -> true
088:            public void test10() {
089:                executeTarget("test10");
090:                assertEquals("true", project.getProperty("test"));
091:            }
092:
093:            // All three specified but class missing -> null
094:            public void test11() {
095:                executeTarget("test11");
096:                assertNull(project.getProperty("test"));
097:            }
098:
099:            // Specified property-name is "" -> true
100:            public void test12() {
101:                executeTarget("test12");
102:                assertNull(project.getProperty("test"));
103:                assertEquals("true", project.getProperty(""));
104:            }
105:
106:            // Specified file is "" -> invalid files do not exist
107:            public void test13() {
108:                executeTarget("test13");
109:                assertNull(project.getProperty("test"));
110:            }
111:
112:            // Specified file is "" actually a directory, so it should pass
113:            public void test13b() {
114:                executeTarget("test13b");
115:                assertEquals("true", project.getProperty("test"));
116:            }
117:
118:            // Specified resource is "" -> can such a thing exist?
119:            /*
120:             * returns non null IBM JDK 1.3 Linux
121:             */
122:            //    public void test14() {
123:            //        executeTarget("test14");
124:            //        assertEquals(project.getProperty("test"), null);
125:            //    }
126:            // Specified class is "" -> can not exist
127:            public void test15() {
128:                executeTarget("test15");
129:                assertNull(project.getProperty("test"));
130:            }
131:
132:            // Specified dir is "" -> this is the current directory and should
133:            // always exist
134:            public void test16() {
135:                executeTarget("test16");
136:                assertEquals("true", project.getProperty("test"));
137:            }
138:
139:            // Specified dir is "../taskdefs" -> should exist since it's the
140:            // location of the buildfile used...
141:            public void test17() {
142:                executeTarget("test17");
143:                assertEquals("true", project.getProperty("test"));
144:            }
145:
146:            // Specified dir is "../this_dir_should_never_exist" -> null
147:            public void test18() {
148:                executeTarget("test18");
149:                assertNull(project.getProperty("test"));
150:            }
151:
152:            // Invalid type specified
153:            public void test19() {
154:                expectBuildException("test19",
155:                        "Invalid value for type attribute.");
156:            }
157:
158:            // Core class that exists in system classpath is ignored
159:            public void test20() {
160:                executeTarget("test20");
161:                assertNull(project.getProperty("test"));
162:            }
163:
164:            // Core class that exists in system classpath is ignored, but found in specified classpath
165:            public void test21() {
166:                executeTarget("test21");
167:                assertEquals("true", project.getProperty("test"));
168:            }
169:
170:            // Core class that exists in system classpath is not ignored with ignoresystemclass="false"
171:            public void test22() {
172:                executeTarget("test22");
173:                assertEquals("true", project.getProperty("test"));
174:            }
175:
176:            // Core class that exists in system classpath is not ignored with default ignoresystemclasses value
177:            public void test23() {
178:                executeTarget("test23");
179:                assertEquals("true", project.getProperty("test"));
180:            }
181:
182:            // Class is found in specified classpath
183:            public void test24() {
184:                executeTarget("test24");
185:                assertEquals("true", project.getProperty("test"));
186:            }
187:
188:            // File is not found in specified filepath
189:            public void testSearchInPathNotThere() {
190:                executeTarget("searchInPathNotThere");
191:                assertNull(project.getProperty("test"));
192:            }
193:
194:            // File is not found in specified filepath
195:            public void testSearchInPathIsThere() {
196:                executeTarget("searchInPathIsThere");
197:                assertEquals("true", project.getProperty("test"));
198:            }
199:
200:            // test when file begins with basedir twice
201:            public void testDoubleBasedir() {
202:                executeTarget("testDoubleBasedir");
203:            }
204:
205:            // test for searching parents
206:            public void testSearchParents() {
207:                executeTarget("search-parents");
208:            }
209:
210:            // test for not searching parents
211:            public void testSearchParentsNot() {
212:                executeTarget("search-parents-not");
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.