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
6   68   6   1
0   31   1   6
6     1  
1    
 
  TestHarnessServiceLocator       Line # 37 6 0% 6 12 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007 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;
17   
18    import javax.sql.DataSource;
19    import javax.transaction.UserTransaction;
20   
21    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
22    import org.kuali.rice.core.impl.resourceloader.SpringResourceLoader;
23    import org.springframework.context.ConfigurableApplicationContext;
24    import org.springframework.transaction.jta.JtaTransactionManager;
25   
26    /**
27    * Locator that sits on the testharness SpringContext.
28    *
29    * This doesn't defer to the {@link GlobalResourceLoader} because I'm not sure
30    * the test harness justifies the extra setup at the moment. If/when the
31    * testharness {@link SpringResourceLoader} is placed in the {@link GlobalResourceLoader}
32    * this can delegate to that {@link GlobalResourceLoader}.
33    *
34    * @author Kuali Rice Team (rice.collab@kuali.org)
35    *
36    */
 
37    public class TestHarnessServiceLocator {
38   
39    private static ConfigurableApplicationContext context;
40   
41    public static final String USER_TRANSACTION = "userTransaction";
42    public static final String TRANSACTON_MANAGER = "transactionManager";
43    public static final String DATA_SOURCE = "dataSource";
44   
 
45  0 toggle public static Object getService(String serviceName) {
46  0 return getContext().getBean(serviceName);
47    }
48   
 
49  0 toggle public static DataSource getDataSource() {
50  0 return (DataSource)getService(DATA_SOURCE);
51    }
52   
 
53  0 toggle public static JtaTransactionManager getJtaTransactionManager() {
54  0 return (JtaTransactionManager)getService(TRANSACTON_MANAGER);
55    }
56   
 
57  0 toggle public static UserTransaction getUserTransaction() {
58  0 return (UserTransaction)getService(USER_TRANSACTION);
59    }
60   
 
61  0 toggle public static ConfigurableApplicationContext getContext() {
62  0 return context;
63    }
64   
 
65  0 toggle public static void setContext(ConfigurableApplicationContext context) {
66  0 TestHarnessServiceLocator.context = context;
67    }
68    }