Clover Coverage Report - KS LUM Impl 1.2-M5-SNAPSHOT
Coverage timestamp: Mon Aug 29 2011 07:16:38 EDT
93   508   53   1.75
0   399   0.57   26.5
53     1  
2    
 
  AtpContextImplTest       Line # 40 39 0% 6 0 100% 1.0
  AtpContextImplTest.AtpServiceMock       Line # 111 54 0% 47 90 10.9% 0.10891089
 
  (3)
 
1    package org.kuali.student.lum.statement.config.context;
2   
3    import java.util.ArrayList;
4    import java.util.Date;
5    import java.util.HashMap;
6    import java.util.List;
7    import java.util.Map;
8   
9    import org.junit.Assert;
10    import org.junit.Before;
11    import org.junit.Test;
12    import org.kuali.student.common.dictionary.dto.ObjectStructureDefinition;
13    import org.kuali.student.common.dto.StatusInfo;
14    import org.kuali.student.common.exceptions.AlreadyExistsException;
15    import org.kuali.student.common.exceptions.DataValidationErrorException;
16    import org.kuali.student.common.exceptions.DoesNotExistException;
17    import org.kuali.student.common.exceptions.InvalidParameterException;
18    import org.kuali.student.common.exceptions.MissingParameterException;
19    import org.kuali.student.common.exceptions.OperationFailedException;
20    import org.kuali.student.common.exceptions.PermissionDeniedException;
21    import org.kuali.student.common.exceptions.VersionMismatchException;
22    import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo;
23    import org.kuali.student.common.search.dto.SearchRequest;
24    import org.kuali.student.common.search.dto.SearchResult;
25    import org.kuali.student.common.search.dto.SearchResultTypeInfo;
26    import org.kuali.student.common.search.dto.SearchTypeInfo;
27    import org.kuali.student.common.validation.dto.ValidationResultInfo;
28    import org.kuali.student.core.atp.dto.AtpDurationTypeInfo;
29    import org.kuali.student.core.atp.dto.AtpInfo;
30    import org.kuali.student.core.atp.dto.AtpSeasonalTypeInfo;
31    import org.kuali.student.core.atp.dto.AtpTypeInfo;
32    import org.kuali.student.core.atp.dto.DateRangeInfo;
33    import org.kuali.student.core.atp.dto.DateRangeTypeInfo;
34    import org.kuali.student.core.atp.dto.MilestoneInfo;
35    import org.kuali.student.core.atp.dto.MilestoneTypeInfo;
36    import org.kuali.student.core.atp.service.AtpService;
37    import org.kuali.student.core.statement.dto.ReqCompFieldInfo;
38    import org.kuali.student.core.statement.dto.ReqComponentInfo;
39   
 
40    public class AtpContextImplTest {
41    private AtpService atpService = new AtpServiceMock();
42    private AtpContextImpl atpContext = new AtpContextImpl();
43    private ReqComponentInfo reqComponent1;
44    private ReqComponentInfo reqComponent2;
45   
 
46  3 toggle private void setupReqComponent1() {
47  3 reqComponent1 = new ReqComponentInfo();
48  3 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
49  3 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
50  3 reqCompField1.setType("kuali.reqComponent.field.type.duration");
51  3 reqCompField1.setValue("2");
52  3 reqCompFieldList.add(reqCompField1);
53  3 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
54  3 reqCompField2.setType("kuali.reqComponent.field.type.durationType.id");
55  3 reqCompField2.setValue("kuali.atp.duration.Year");
56  3 reqCompFieldList.add(reqCompField2);
57   
58  3 reqComponent1.setReqCompFields(reqCompFieldList);
59    }
60   
 
61  3 toggle private void setupReqComponent2() {
62  3 reqComponent2 = new ReqComponentInfo();
63  3 List<ReqCompFieldInfo> reqCompFieldList = new ArrayList<ReqCompFieldInfo>();
64  3 ReqCompFieldInfo reqCompField1 = new ReqCompFieldInfo();
65  3 reqCompField1.setType("kuali.reqComponent.field.type.duration");
66  3 reqCompField1.setValue(null);
67  3 reqCompFieldList.add(reqCompField1);
68  3 ReqCompFieldInfo reqCompField2 = new ReqCompFieldInfo();
69  3 reqCompField2.setType("kuali.reqComponent.field.type.durationType.id");
70  3 reqCompField2.setValue(null);
71  3 reqCompFieldList.add(reqCompField2);
72   
73  3 reqComponent2.setReqCompFields(reqCompFieldList);
74    }
75   
 
76  3 toggle @Before
77    public void beforeMethod() {
78  3 atpContext.setAtpService(atpService);
79  3 setupReqComponent1();
80  3 setupReqComponent2();
81    }
82   
 
83  1 toggle @Test
84    public void testCreateContextMap_ContainsTokens() throws OperationFailedException {
85  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent1);
86  1 Assert.assertNotNull(contextMap);
87  1 Assert.assertTrue(contextMap.containsKey(AtpContextImpl.DURATION_TOKEN));
88  1 Assert.assertTrue(contextMap.containsKey(AtpContextImpl.DURATION_TYPE_TOKEN));
89    }
90   
 
91  1 toggle @Test
92    public void testCreateContextMap_TokenValues() throws OperationFailedException {
93  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent1);
94  1 String duration = (String) contextMap.get(AtpContextImpl.DURATION_TOKEN);
95  1 AtpDurationTypeInfo type = (AtpDurationTypeInfo) contextMap.get(AtpContextImpl.DURATION_TYPE_TOKEN);
96   
97  1 Assert.assertEquals("2", duration);
98  1 Assert.assertEquals("kuali.atp.duration.Year", type.getId());
99    }
100   
 
101  1 toggle @Test
102    public void testCreateContextMap_NullTokenValues() throws OperationFailedException {
103  1 Map<String, Object> contextMap = atpContext.createContextMap(reqComponent2);
104  1 String duration = (String) contextMap.get(AtpContextImpl.DURATION_TOKEN);
105  1 AtpDurationTypeInfo type = (AtpDurationTypeInfo) contextMap.get(AtpContextImpl.DURATION_TYPE_TOKEN);
106   
107  1 Assert.assertEquals(null, duration);
108  1 Assert.assertEquals(null, type);
109    }
110   
 
111    private static class AtpServiceMock implements AtpService {
112   
113    private Map<String, AtpDurationTypeInfo> durationTypeMap = new HashMap<String, AtpDurationTypeInfo>();
114   
 
115  3 toggle public AtpServiceMock() {
116  3 AtpDurationTypeInfo type1 = new AtpDurationTypeInfo();
117  3 type1.setId("kuali.atp.duration.Year");
118  3 type1.setName("Year");
119  3 durationTypeMap.put("kuali.atp.duration.Year", type1);
120   
121  3 AtpDurationTypeInfo type2 = new AtpDurationTypeInfo();
122  3 type2.setId("kuali.atp.duration.Term");
123  3 type2.setName("Term");
124  3 durationTypeMap.put("kuali.atp.duration.Term", type2);
125    }
126   
 
127  0 toggle @Override
128    public DateRangeInfo addDateRange(String atpKey, String dateRangeKey,
129    DateRangeInfo dateRangeInfo) throws AlreadyExistsException,
130    DataValidationErrorException, InvalidParameterException,
131    MissingParameterException, OperationFailedException,
132    PermissionDeniedException {
133    // TODO Auto-generated method stub
134  0 return null;
135    }
136   
 
137  0 toggle @Override
138    public MilestoneInfo addMilestone(String atpKey, String milestoneKey,
139    MilestoneInfo milestoneInfo) throws AlreadyExistsException,
140    DataValidationErrorException, InvalidParameterException,
141    MissingParameterException, OperationFailedException,
142    PermissionDeniedException {
143    // TODO Auto-generated method stub
144  0 return null;
145    }
146   
 
147  0 toggle @Override
148    public AtpInfo createAtp(String atpTypeKey, String atpKey,
149    AtpInfo atpInfo) throws AlreadyExistsException,
150    DataValidationErrorException, InvalidParameterException,
151    MissingParameterException, OperationFailedException,
152    PermissionDeniedException {
153    // TODO Auto-generated method stub
154  0 return null;
155    }
156   
 
157  0 toggle @Override
158    public StatusInfo deleteAtp(String atpKey)
159    throws DoesNotExistException, InvalidParameterException,
160    MissingParameterException, OperationFailedException,
161    PermissionDeniedException {
162    // TODO Auto-generated method stub
163  0 return null;
164    }
165   
 
166  0 toggle @Override
167    public AtpInfo getAtp(String atpKey) throws DoesNotExistException,
168    InvalidParameterException, MissingParameterException,
169    OperationFailedException {
170    // TODO Auto-generated method stub
171  0 return null;
172    }
173   
 
174  2 toggle @Override
175    public AtpDurationTypeInfo getAtpDurationType(String atpDurationTypeKey)
176    throws DoesNotExistException, InvalidParameterException,
177    MissingParameterException, OperationFailedException {
178  2 return durationTypeMap.get(atpDurationTypeKey);
179    }
180   
 
181  0 toggle @Override
182    public List<AtpDurationTypeInfo> getAtpDurationTypes()
183    throws OperationFailedException {
184    // TODO Auto-generated method stub
185  0 return null;
186    }
187   
 
188  0 toggle @Override
189    public AtpSeasonalTypeInfo getAtpSeasonalType(String atpSeasonalTypeKey)
190    throws DoesNotExistException, InvalidParameterException,
191    MissingParameterException, OperationFailedException {
192    // TODO Auto-generated method stub
193  0 return null;
194    }
195   
 
196  0 toggle @Override
197    public List<AtpSeasonalTypeInfo> getAtpSeasonalTypes()
198    throws OperationFailedException {
199    // TODO Auto-generated method stub
200  0 return null;
201    }
202   
 
203  0 toggle @Override
204    public AtpTypeInfo getAtpType(String atpTypeKey)
205    throws DoesNotExistException, InvalidParameterException,
206    MissingParameterException, OperationFailedException {
207    // TODO Auto-generated method stub
208  0 return null;
209    }
210   
 
211  0 toggle @Override
212    public List<AtpTypeInfo> getAtpTypes() throws OperationFailedException {
213    // TODO Auto-generated method stub
214  0 return null;
215    }
216   
 
217  0 toggle @Override
218    public List<AtpInfo> getAtpsByAtpType(String atpTypeKey)
219    throws InvalidParameterException, MissingParameterException,
220    OperationFailedException {
221    // TODO Auto-generated method stub
222  0 return null;
223    }
224   
 
225  0 toggle @Override
226    public List<AtpInfo> getAtpsByDate(Date searchDate)
227    throws InvalidParameterException, MissingParameterException,
228    OperationFailedException {
229    // TODO Auto-generated method stub
230  0 return null;
231    }
232   
 
233  0 toggle @Override
234    public List<AtpInfo> getAtpsByDates(Date startDate, Date endDate)
235    throws InvalidParameterException, MissingParameterException,
236    OperationFailedException {
237    // TODO Auto-generated method stub
238  0 return null;
239    }
240   
 
241  0 toggle @Override
242    public DateRangeInfo getDateRange(String dateRangeKey)
243    throws DoesNotExistException, InvalidParameterException,
244    MissingParameterException, OperationFailedException {
245    // TODO Auto-generated method stub
246  0 return null;
247    }
248   
 
249  0 toggle @Override
250    public DateRangeTypeInfo getDateRangeType(String dateRangeTypeKey)
251    throws DoesNotExistException, InvalidParameterException,
252    MissingParameterException, OperationFailedException {
253    // TODO Auto-generated method stub
254  0 return null;
255    }
256   
 
257  0 toggle @Override
258    public List<DateRangeTypeInfo> getDateRangeTypes()
259    throws OperationFailedException {
260    // TODO Auto-generated method stub
261  0 return null;
262    }
263   
 
264  0 toggle @Override
265    public List<DateRangeTypeInfo> getDateRangeTypesForAtpType(
266    String atpTypeKey) throws DoesNotExistException,
267    InvalidParameterException, MissingParameterException,
268    OperationFailedException {
269    // TODO Auto-generated method stub
270  0 return null;
271    }
272   
 
273  0 toggle @Override
274    public List<DateRangeInfo> getDateRangesByAtp(String atpKey)
275    throws InvalidParameterException, MissingParameterException,
276    OperationFailedException {
277    // TODO Auto-generated method stub
278  0 return null;
279    }
280   
 
281  0 toggle @Override
282    public List<DateRangeInfo> getDateRangesByDate(Date searchDate)
283    throws InvalidParameterException, MissingParameterException,
284    OperationFailedException {
285    // TODO Auto-generated method stub
286  0 return null;
287    }
288   
 
289  0 toggle @Override
290    public MilestoneInfo getMilestone(String milestoneKey)
291    throws DoesNotExistException, InvalidParameterException,
292    MissingParameterException, OperationFailedException {
293    // TODO Auto-generated method stub
294  0 return null;
295    }
296   
 
297  0 toggle @Override
298    public MilestoneTypeInfo getMilestoneType(String milestoneTypeKey)
299    throws DoesNotExistException, InvalidParameterException,
300    MissingParameterException, OperationFailedException {
301    // TODO Auto-generated method stub
302  0 return null;
303    }
304   
 
305  0 toggle @Override
306    public List<MilestoneTypeInfo> getMilestoneTypes()
307    throws OperationFailedException {
308    // TODO Auto-generated method stub
309  0 return null;
310    }
311   
 
312  0 toggle @Override
313    public List<MilestoneTypeInfo> getMilestoneTypesForAtpType(
314    String atpTypeKey) throws DoesNotExistException,
315    InvalidParameterException, MissingParameterException,
316    OperationFailedException {
317    // TODO Auto-generated method stub
318  0 return null;
319    }
320   
 
321  0 toggle @Override
322    public List<MilestoneInfo> getMilestonesByAtp(String atpKey)
323    throws InvalidParameterException, MissingParameterException,
324    OperationFailedException {
325    // TODO Auto-generated method stub
326  0 return null;
327    }
328   
 
329  0 toggle @Override
330    public List<MilestoneInfo> getMilestonesByDates(Date startDate,
331    Date endDate) throws InvalidParameterException,
332    MissingParameterException, OperationFailedException {
333    // TODO Auto-generated method stub
334  0 return null;
335    }
336   
 
337  0 toggle @Override
338    public List<MilestoneInfo> getMilestonesByDatesAndType(
339    String milestoneTypeKey, Date startDate, Date endDate)
340    throws InvalidParameterException, MissingParameterException,
341    OperationFailedException {
342    // TODO Auto-generated method stub
343  0 return null;
344    }
345   
 
346  0 toggle @Override
347    public StatusInfo removeDateRange(String dateRangeKey)
348    throws DoesNotExistException, InvalidParameterException,
349    MissingParameterException, OperationFailedException,
350    PermissionDeniedException {
351    // TODO Auto-generated method stub
352  0 return null;
353    }
354   
 
355  0 toggle @Override
356    public StatusInfo removeMilestone(String milestoneKey)
357    throws DoesNotExistException, InvalidParameterException,
358    MissingParameterException, OperationFailedException,
359    PermissionDeniedException {
360    // TODO Auto-generated method stub
361  0 return null;
362    }
363   
 
364  0 toggle @Override
365    public AtpInfo updateAtp(String atpKey, AtpInfo atpInfo)
366    throws DataValidationErrorException, DoesNotExistException,
367    InvalidParameterException, MissingParameterException,
368    OperationFailedException, PermissionDeniedException,
369    VersionMismatchException {
370    // TODO Auto-generated method stub
371  0 return null;
372    }
373   
 
374  0 toggle @Override
375    public DateRangeInfo updateDateRange(String dateRangeKey,
376    DateRangeInfo dateRangeInfo)
377    throws DataValidationErrorException, DoesNotExistException,
378    InvalidParameterException, MissingParameterException,
379    OperationFailedException, PermissionDeniedException,
380    VersionMismatchException {
381    // TODO Auto-generated method stub
382  0 return null;
383    }
384   
 
385  0 toggle @Override
386    public MilestoneInfo updateMilestone(String milestoneKey,
387    MilestoneInfo milestoneInfo)
388    throws DataValidationErrorException, DoesNotExistException,
389    InvalidParameterException, MissingParameterException,
390    OperationFailedException, PermissionDeniedException,
391    VersionMismatchException {
392    // TODO Auto-generated method stub
393  0 return null;
394    }
395   
 
396  0 toggle @Override
397    public List<ValidationResultInfo> validateAtp(String validationType,
398    AtpInfo atpInfo) throws DoesNotExistException,
399    InvalidParameterException, MissingParameterException,
400    OperationFailedException {
401    // TODO Auto-generated method stub
402  0 return null;
403    }
404   
 
405  0 toggle @Override
406    public List<ValidationResultInfo> validateDateRange(
407    String validationType, DateRangeInfo dateRangeInfo)
408    throws DoesNotExistException, InvalidParameterException,
409    MissingParameterException, OperationFailedException {
410    // TODO Auto-generated method stub
411  0 return null;
412    }
413   
 
414  0 toggle @Override
415    public List<ValidationResultInfo> validateMilestone(
416    String validationType, MilestoneInfo milestoneInfo)
417    throws DoesNotExistException, InvalidParameterException,
418    MissingParameterException, OperationFailedException {
419    // TODO Auto-generated method stub
420  0 return null;
421    }
422   
 
423  0 toggle @Override
424    public SearchCriteriaTypeInfo getSearchCriteriaType(
425    String searchCriteriaTypeKey) throws DoesNotExistException,
426    InvalidParameterException, MissingParameterException,
427    OperationFailedException {
428    // TODO Auto-generated method stub
429  0 return null;
430    }
431   
 
432  0 toggle @Override
433    public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes()
434    throws OperationFailedException {
435    // TODO Auto-generated method stub
436  0 return null;
437    }
438   
 
439  0 toggle @Override
440    public SearchResultTypeInfo getSearchResultType(
441    String searchResultTypeKey) throws DoesNotExistException,
442    InvalidParameterException, MissingParameterException,
443    OperationFailedException {
444    // TODO Auto-generated method stub
445  0 return null;
446    }
447   
 
448  0 toggle @Override
449    public List<SearchResultTypeInfo> getSearchResultTypes()
450    throws OperationFailedException {
451    // TODO Auto-generated method stub
452  0 return null;
453    }
454   
 
455  0 toggle @Override
456    public SearchTypeInfo getSearchType(String searchTypeKey)
457    throws DoesNotExistException, InvalidParameterException,
458    MissingParameterException, OperationFailedException {
459    // TODO Auto-generated method stub
460  0 return null;
461    }
462   
 
463  0 toggle @Override
464    public List<SearchTypeInfo> getSearchTypes()
465    throws OperationFailedException {
466    // TODO Auto-generated method stub
467  0 return null;
468    }
469   
 
470  0 toggle @Override
471    public List<SearchTypeInfo> getSearchTypesByCriteria(
472    String searchCriteriaTypeKey) throws DoesNotExistException,
473    InvalidParameterException, MissingParameterException,
474    OperationFailedException {
475    // TODO Auto-generated method stub
476  0 return null;
477    }
478   
 
479  0 toggle @Override
480    public List<SearchTypeInfo> getSearchTypesByResult(
481    String searchResultTypeKey) throws DoesNotExistException,
482    InvalidParameterException, MissingParameterException,
483    OperationFailedException {
484    // TODO Auto-generated method stub
485  0 return null;
486    }
487   
 
488  0 toggle @Override
489    public SearchResult search(SearchRequest searchRequest)
490    throws MissingParameterException {
491    // TODO Auto-generated method stub
492  0 return null;
493    }
494   
 
495  0 toggle @Override
496    public ObjectStructureDefinition getObjectStructure(String objectTypeKey) {
497    // TODO Kamal - THIS METHOD NEEDS JAVADOCS
498  0 return null;
499    }
500   
 
501  0 toggle @Override
502    public List<String> getObjectTypes() {
503    // TODO Kamal - THIS METHOD NEEDS JAVADOCS
504  0 return null;
505    }
506   
507    }
508    }