KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > serverbeans > validation > tests > StaticTestTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * StaticTestTest.java
26  *
27  * Created on October 7, 2003, 5:26 PM
28  */

29
30 package com.sun.enterprise.config.serverbeans.validation.tests;
31
32 import junit.framework.*;
33 import junit.textui.TestRunner;
34
35 /**
36  *
37  * @author Rob
38  */

39 public class StaticTestTest extends TestCase {
40     
41     public StaticTestTest(String JavaDoc name) throws Exception JavaDoc {
42         super(name);
43     }
44     
45     /**
46      * JUnit test for method isClassPathValid in StaticTest.java. In order to
47      * successfully test this method you must set the validPath variables to valid
48      * paths on your filesystem.
49      *
50      * @author Rob Ruyak
51      */

52     public void testIsClassPathValid() {
53         String JavaDoc validPath = null;
54         String JavaDoc invalidPath = "badPath";
55         String JavaDoc OS = System.getProperty("os.name");
56         if(OS.startsWith("Win")) {
57             validPath = "C:/Sun/appserver8/jdk";
58         } else {
59             validPath = "/export/appserver8/jdk";
60         }
61         Assert.assertTrue(StaticTest.classPathCheck);
62         Assert.assertTrue(StaticTest.isClassPathValid(validPath));
63         Assert.assertFalse(StaticTest.isClassPathValid(invalidPath));
64     }
65
66     protected void setUp() {
67     }
68
69     protected void tearDown() {
70     }
71
72     public static junit.framework.Test suite() {
73         TestSuite suite = new TestSuite(StaticTestTest.class);
74         return suite;
75     }
76
77     public static void main(String JavaDoc args[]) throws Exception JavaDoc {
78         final TestRunner runner= new TestRunner();
79         final TestResult result = runner.doRun(StaticTestTest.suite(), false);
80         System.exit(result.errorCount() + result.failureCount());
81     }
82     
83 }
84
Popular Tags