Clover Coverage Report - Kuali Student 1.2-M4-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Jul 20 2011 11:14:35 EDT
43   121   3   43
2   93   0.07   1
1     3  
1    
 
  TestOldMetadataServiceDictionary       Line # 37 43 0% 3 8 82.6% 0.82608694
 
  (1)
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15    package org.kuali.student.lum.ui;
16   
17    import java.io.File;
18    import java.io.FileNotFoundException;
19    import java.io.FileOutputStream;
20    import java.io.OutputStream;
21    import java.io.PrintStream;
22    import java.util.Date;
23    import java.util.HashSet;
24    import java.util.LinkedHashMap;
25    import java.util.LinkedHashSet;
26    import java.util.Map;
27    import java.util.Set;
28   
29    import org.junit.Test;
30    import static org.junit.Assert.*;
31   
32    import org.kuali.student.common.assembly.data.Metadata;
33    import org.kuali.student.common.assembly.dictionary.MetadataFormatter;
34    import org.kuali.student.common.assembly.dictionary.old.MetadataServiceImpl;
35    import org.kuali.student.lum.lu.assembly.OldMetadataLoaderTest;
36   
 
37    public class TestOldMetadataServiceDictionary
38    {
39   
 
40  1 toggle @Test
41    public void testMetadataService ()
42    {
43  1 Set<String> startingClasses = new LinkedHashSet ();
44  1 Map<String, Set<String>> types = new LinkedHashMap ();
45  1 startingClasses.add ("course");
46  1 startingClasses.add ("proposal");
47  1 startingClasses.add ("BrowseCourseCatalog");
48  1 startingClasses.add ("search");
49  1 startingClasses.add ("cluset");
50   
51    // startingClasses.add (StatementTreeViewInfo.class);
52   
53  1 Set<String> typesForClass = new LinkedHashSet ();
54   
55  1 MetadataServiceImpl metadataService =
56    new MetadataServiceImpl (OldMetadataLoaderTest.ORCH_DICTIONARY_CONFIG_LOCATION);
57   
58  1 Metadata metadata =
59    metadataService.getMetadata ("CreditCourseProposal", "default", "default");
60  1 Map<String, Metadata> properties = metadata.getProperties ();
61  1 assertTrue (properties.containsKey ("course"));
62  1 metadata = properties.get ("course");
63   
64  1 String outFile = "target/oldmetadata.txt";
65  1 File file = new File (outFile);
66  1 OutputStream outputStream = null;
67  1 try
68    {
69  1 outputStream = new FileOutputStream (file, false);
70    }
71    catch (FileNotFoundException ex)
72    {
73  0 throw new RuntimeException (ex);
74    }
75  1 PrintStream out = new PrintStream (outputStream);
76  1 out.println ("(!) This page was automatically generated on "
77    + new Date ());
78  1 out.println ("DO NOT UPDATE MANUALLY!");
79  1 out.println ("");
80  1 out.print (
81    "This page represents a formatted view of the lum ui dictionary");
82  1 for (String className: startingClasses)
83    {
84  5 out.println ("# " + className);
85    }
86  1 out.println ("");
87  1 out.println ("----");
88  1 out.println ("{toc}");
89  1 out.println ("----");
90   
91  1 for (String className: startingClasses)
92    {
93    // out.println ("getting meta data for " + className);
94  5 metadata =
95    metadataService.getMetadata (className, "default", "default");
96  5 assertNotNull (metadata);
97  5 MetadataFormatter formatter = new MetadataFormatter (className,
98    metadata, null,
99    null, new HashSet (),
100    1);
101  5 out.println (formatter.formatForWiki ());
102  5 if (types.get (className) == null)
103    {
104  5 continue;
105    }
106  0 for (String type: types.get (className))
107    {
108  0 System.out.println ("*** Generating formatted version for " + type);
109  0 metadata =
110    metadataService.getMetadata (className, type, (String) "default");
111  0 assertNotNull (metadata);
112  0 formatter = new MetadataFormatter (className,
113    metadata, type,
114    null, new HashSet (),
115    1);
116  0 out.println (formatter.formatForWiki ());
117    }
118    }
119    }
120   
121    }