Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
22   201   3   1.69
4   60   0.68   13
13     1.15  
1    
 
 
  AttCertValidityPeriod       Line # 86 22 3 61.5% 0.61538464
 
  (1)
 
1    /*
2    * Copyright (c) 2006, University of Kent
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * Redistributions of source code must retain the above copyright notice, this
9    * list of conditions and the following disclaimer.
10    *
11    * Redistributions in binary form must reproduce the above copyright notice,
12    * this list of conditions and the following disclaimer in the documentation
13    * and/or other materials provided with the distribution.
14    *
15    * 1. Neither the name of the University of Kent nor the names of its
16    * contributors may be used to endorse or promote products derived from this
17    * software without specific prior written permission.
18    *
19    * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22    * PURPOSE ARE DISCLAIMED.
23    *
24    * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31    * POSSIBILITY OF SUCH DAMAGE.
32    *
33    * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE
34    * IN THE CIRCUMSTANCES. IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS
35    * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS
36    * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH
37    * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH
38    * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY
39    * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE
40    * SERIOUS FAULTS, IN THIS SOFTWARE.
41    *
42    * 5. This license is governed, except to the extent that local laws
43    * necessarily apply, by the laws of England and Wales.
44    */
45    /*
46    * Copyright (c) 2000-2005, University of Salford
47    * All rights reserved.
48    *
49    * Redistribution and use in source and binary forms, with or without
50    * modification, are permitted provided that the following conditions are met:
51    *
52    * Redistributions of source code must retain the above copyright notice, this
53    * list of conditions and the following disclaimer.
54    *
55    * Redistributions in binary form must reproduce the above copyright notice,
56    * this list of conditions and the following disclaimer in the documentation
57    * and/or other materials provided with the distribution.
58    *
59    * Neither the name of the University of Salford nor the names of its
60    * contributors may be used to endorse or promote products derived from this
61    * software without specific prior written permission.
62    *
63    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
64    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
65    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
66    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
67    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
68    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
69    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
70    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
71    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
72    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
73    * POSSIBILITY OF SUCH DAMAGE.
74    */
75   
76    package issrg.ac;
77   
78    import iaik.asn1.*;
79    import iaik.asn1.structures.*;
80   
81    /**
82    * This class represents the AttCertValidityPeriod ASN.1 construct, which is
83    * basically a sequence of two GeneralizedTime.
84    */
85   
 
86    public class AttCertValidityPeriod implements ASN1Type, Cloneable{
87   
88    protected Generalized_Time notBeforeTime = new Generalized_Time(); // by default set to Now
89    protected Generalized_Time notAfterTime = new Generalized_Time(); // by default set to Now
90   
91    /**
92    * Returns notBefore time.
93    */
 
94  1799 toggle public Generalized_Time getNotBefore(){
95  1799 return notBeforeTime;
96    }
97   
98    /**
99    * Sets notBefore time.
100    */
 
101  0 toggle public void setNotBefore(Generalized_Time notBefore){
102  0 notBeforeTime=notBefore;
103    }
104   
105    /**
106    * Returns notAfter time.
107    */
 
108  1799 toggle public Generalized_Time getNotAfter(){
109  1799 return notAfterTime;
110    }
111   
112    /**
113    * Sets notAfter time.
114    */
 
115  0 toggle public void setNotAfter(Generalized_Time notAfter){
116  0 notAfterTime=notAfter;
117    }
118   
 
119  5998 toggle protected AttCertValidityPeriod() {
120    }
121   
122    /**
123    * This constructor copies AttCertValidityPeriod.
124    *
125    * @param acvp - the AttCertValidityPeriod to copy
126    */
 
127  0 toggle public AttCertValidityPeriod(AttCertValidityPeriod acvp) {
128  0 notBeforeTime = new Generalized_Time(acvp.notBeforeTime);
129  0 notAfterTime = new Generalized_Time(acvp.notAfterTime);
130    }
131   
132    /**
133    * This constructor builds a AttCertValidityPeriod given two
134    * GeneralizedTimes, one for notBefore, one for notAfter.
135    *
136    * @param notBeforeTime - the notBefore Generalized_Time
137    * @param notAfterTime - the notAfter Generalized_Time
138    */
 
139  20 toggle public AttCertValidityPeriod(Generalized_Time notBeforeTime, Generalized_Time notAfterTime){
140  20 this.notBeforeTime = notBeforeTime;
141  20 this.notAfterTime = notAfterTime;
142    }
143   
144    /**
145    * This constructor builds a AttCertValidityPeriod from a given ASN1Object.
146    *
147    * @param ao - the ASN1Object containing a sequence of two GeneralizedTimes
148    */
 
149  1859 toggle public AttCertValidityPeriod(ASN1Object ao) throws CodingException{
150  1859 decode(ao);
151    }
152   
153    /**
154    * This method returns the ASN1Object of AttCertValidityPeriod.
155    *
156    * @return a SEQUENCE of two GeneralizedTime
157    */
 
158  42 toggle public ASN1Object toASN1Object() throws CodingException{
159  42 ASN1Object result = new SEQUENCE();
160   
161  42 result.addComponent(notBeforeTime.toASN1Object());
162  42 result.addComponent(notAfterTime.toASN1Object());
163   
164  42 return result;
165    }
166   
167    /**
168    * This method decodes a given ASN1Object.
169    *
170    * @param ao - the ASN1Object to decode; must be a SEQUENCE of two
171    * GeneralizedTime
172    */
 
173  1859 toggle public void decode(ASN1Object ao) throws CodingException{
174  1859 if (!ao.isA(ASN.SEQUENCE)){
175  0 throw new CodingException("AttCertValidityPeriod SEQUENCE was expected");
176    }
177   
178  1859 if (ao.countComponents()!=2){
179  0 throw new CodingException("Illegal number of entries in AttCertValidityPeriod tag: "+Integer.toString(ao.countComponents()));
180    }
181   
182  1859 notBeforeTime = new Generalized_Time(ao.getComponentAt(0));
183  1859 notAfterTime = new Generalized_Time(ao.getComponentAt(1));
184    }
185   
 
186  0 toggle public String toString(){
187  0 return toString("");
188    }
189   
 
190  4 toggle public String toString(String ident){
191  4 return "SEQUENCE { -- AttCertValidityPeriod --\n "+ident+
192    "notBeforeTime = "+notBeforeTime.toString(ident+" ")+
193    ",\n "+ident+"notAfterTime = "+notAfterTime.toString(ident+" ")+
194    "\n"+ident+"}";
195    }
196   
 
197  0 toggle public Object clone(){
198  0 return new AttCertValidityPeriod(this);
199    }
200   
201    }