Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
37   139   12   18.5
18   56   0.35   2
2     6.5  
1    
 
 
  PullFromFileWithEmptyDN       Line # 63 37 12 78.9% 0.7894737
 
No Tests
 
1    /*
2    * SimpleTestingObject.java
3    *
4    * Created on 30 July 2007, 14:44
5    *
6    * Copyright (c) 2006, University of Kent
7    * All rights reserved.
8    *
9    * Redistribution and use in source and binary forms, with or without
10    * modification, are permitted provided that the following conditions are met:
11    *
12    * Redistributions of source code must retain the above copyright notice, this
13    * list of conditions and the following disclaimer.
14    *
15    * Redistributions in binary form must reproduce the above copyright notice,
16    * this list of conditions and the following disclaimer in the documentation
17    * and/or other materials provided with the distribution.
18    *
19    * 1. Neither the name of the University of Kent nor the names of its
20    * contributors may be used to endorse or promote products derived from this
21    * software without specific prior written permission.
22    *
23    * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26    * PURPOSE ARE DISCLAIMED.
27    *
28    * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35    * POSSIBILITY OF SUCH DAMAGE.
36    *
37    * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE
38    * IN THE CIRCUMSTANCES. IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS
39    * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS
40    * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH
41    * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH
42    * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY
43    * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE
44    * SERIOUS FAULTS, IN THIS SOFTWARE.
45    *
46    * 5. This license is governed, except to the extent that local laws
47    * necessarily apply, by the laws of England and Wales.
48    *
49    * Author : Linying Su
50    *
51    */
52   
53   
54    package issrg.test.emptyDN;
55   
56   
57    import issrg.utils.handler.Handler;
58   
59    import org.w3c.dom.*;
60   
61    import java.io.*;
62   
 
63    public class PullFromFileWithEmptyDN {
64   
65    /**
66    * Creates a new instance of SimpleTesting
67    */
 
68  0 toggle public PullFromFileWithEmptyDN() {
69    }
70   
71    private static PrintStream out = System.out;
72   
73    /**
74    * This method is used to test Permis CVS with an empty subject DN.
75    * In pull model, from local AC files, it should return an empty set.
76    * the first argument is an input file, which configure the Permis CVS
77    * the second argument is an output file, which contains the expected output
78    */
79   
 
80  1 toggle public static void main(String [] args){
81   
82  1 System.setProperty("line.separator", "\r\n");
83   
84  1 if (args.length==2) {
85  1 try{
86  1 out = new PrintStream(new FileOutputStream(args[1]));
87    }catch(IOException ioe){
88  0 out.println("This shouldn't have happened! "+ioe.getMessage());
89    }
90    }
91   
92  1 try{
93    //out = new PrintStream(new FileOutputStream("EmptyDNPullFile.out"));
94   
95  1 Handler test = new Handler();
96   
97    //test.initialise("/home/pip/init.test",1);
98   
99  1 test.initialise(args[0],1);
100   
101    //System.out.println(new EncodeXML().encode(test.getCreds("","Subject"),0));
102   
103  1 out.println("pull from local AC files");
104  1 Element response = test.getCreds("","Subject");
105  1 NodeList list = response.getChildNodes();
106  2 for (int i=0; i<list.getLength(); i++) {
107  1 Node node = list.item(i);
108  0 if (Text.class.isAssignableFrom(node.getClass())) continue;
109  1 out.println(node.getNodeName());
110  1 NodeList list1 = node.getChildNodes();
111  2 for (int j=0; j<list1.getLength(); j++) {
112  1 Node node1 = list1.item(j);
113  0 if (Text.class.isAssignableFrom(node1.getClass())) continue;
114  1 out.println(node1.getNodeName());
115  1 NodeList list2= node1.getChildNodes();
116  2 for (int k=0; k<list2.getLength(); k++) {
117  1 Node node2 = list2.item(k);
118  0 if (Text.class.isAssignableFrom(node2.getClass())) continue;
119  1 out.println(node2.getNodeName());
120  1 NodeList list3 = node2.getChildNodes();
121  2 for (int l=0; l<list3.getLength(); l++) {
122  1 Node node3 = list3.item(l);
123  1 if (Text.class.isAssignableFrom(node3.getClass())) {
124  1 String result = node3.getNodeValue();
125  1 out.println("["+result.trim()+"]");
126    }
127    }
128    }
129    }
130    }
131    } catch (Exception pe) {
132  0 out.println("error:"+pe);
133  0 out.close();
134    } finally {
135  1 out.close(); // flush and close the output stream
136    }
137    }
138   
139    }