KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > harness > SkipTest


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.harness.SkipTest
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyTesting.functionTests.harness;
23
24 import java.util.Properties JavaDoc;
25 import java.io.BufferedReader JavaDoc;
26 import java.io.InputStream JavaDoc;
27 import java.io.InputStreamReader JavaDoc;
28
29
30 /**
31   Determine if the named test is one which should not be
32   run in a particular framework (defined by the propFileName).
33   For instance, there could be a nowl.properties for a list of
34   tests which do not currently work under the WebLogic framework.
35   */

36 public class SkipTest
37 {
38  
39     private SkipTest()
40     {
41     }
42
43     public static boolean skipIt(String JavaDoc listFileName, String JavaDoc testName)
44         throws Exception JavaDoc
45     {
46         boolean answer = false;
47         InputStream JavaDoc is =
48         RunTest.loadTestResource("suites" + '/' + listFileName);
49         if (is == null)
50         {
51             System.out.println("File not found: " + listFileName);
52             answer = false;
53             return answer;
54         }
55         
56         // Create a BufferedReader to read the list of tests to skip
57
BufferedReader JavaDoc listFile = new BufferedReader JavaDoc(new InputStreamReader JavaDoc(is, "UTF-8"));
58         String JavaDoc str = "";
59         // Read the list of tests to skip, compare to testName
60
while ( (str = listFile.readLine()) != null )
61         {
62            if ( (testName.equals(str)) )
63                 answer = true;
64         }
65         return answer;
66     }
67 }
68         
69             
70
Popular Tags