Clover Coverage Report - Kuali Student 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 05:03:32 EDT
../../../../../img/srcFileCovDistChart0.png 2% of files have more coverage
25   65   7   12.5
6   39   0.28   2
2     3.5  
1    
 
  UnitTestDataUtils       Line # 27 25 0% 7 33 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007-2008 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.rice.test.data;
17   
18    import org.apache.commons.lang.StringUtils;
19    import org.kuali.rice.test.SQLDataLoader;
20   
21    /**
22    * Utilities for unit test data annotations.
23    *
24    * @author Kuali Rice Team (rice.collab@kuali.org)
25    *
26    */
 
27    public class UnitTestDataUtils {
28   
 
29  0 toggle public static void executeDataLoader(UnitTestData[] data) throws Exception {
30  0 for (UnitTestData d: data) {
31  0 executeDataLoader(d);
32    }
33    }
34   
 
35  0 toggle public static void executeDataLoader(UnitTestData data) throws Exception {
36  0 SQLDataLoader sqlDataLoader;
37  0 for (UnitTestData.Type type : data.order()) {
38  0 switch (type) {
39  0 case SQL_FILES :
40  0 for (UnitTestFile file : data.sqlFiles()) {
41  0 sqlDataLoader = new SQLDataLoader(file.filename(), file.delimiter());
42  0 sqlDataLoader.runSql();
43    }
44  0 break;
45  0 case SQL_STATEMENTS :
46  0 for (UnitTestSql statement : data.sqlStatements()) {
47  0 sqlDataLoader = new SQLDataLoader(statement.value());
48  0 sqlDataLoader.runSql();
49    }
50  0 break;
51  0 default: break;
52    }
53    }
54   
55  0 if (!StringUtils.isEmpty(data.filename())) {
56  0 if (!StringUtils.isEmpty(data.value()))
57  0 throw new RuntimeException("UnitTestDataArtifact may not specify both SQL file and content");
58  0 sqlDataLoader = new SQLDataLoader(data.filename(), data.delimiter());
59  0 sqlDataLoader.runSql();
60  0 } else if (!StringUtils.isEmpty(data.value())) {
61  0 sqlDataLoader = new SQLDataLoader(data.value());
62  0 sqlDataLoader.runSql();
63    }
64    }
65    }