View Javadoc

1   /**
2    * Copyright 2010-2013 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.common.jdbc.spring;
17  
18  import java.util.Arrays;
19  
20  import org.junit.Test;
21  import org.kuali.common.jdbc.JdbcProjectContext;
22  import org.kuali.common.util.ProjectContext;
23  import org.kuali.common.util.service.DefaultSpringService;
24  import org.kuali.common.util.service.SpringContext;
25  import org.kuali.common.util.service.SpringService;
26  import org.kuali.common.util.spring.SpringUtils;
27  
28  public class OleResetTest {
29  
30  	@Test
31  	public void test() {
32  		try {
33  			// Default Spring service will do what we need
34  			SpringService ss = new DefaultSpringService();
35  
36  			// The main project who's properties need to be loaded and made available to Spring
37  			ProjectContext project = new OleTestProjectContext();
38  
39  			// Other projects who's properties we need to make available to Spring
40  			ProjectContext other = new JdbcProjectContext();
41  
42  			// The annotated java class containing the Spring configuration that does what we need it to do
43  			Class<?> annotatedClass = SqlControllerConfig.class;
44  
45  			// Prepare a Spring context
46  			SpringContext context = SpringUtils.getSpringContext(annotatedClass, project, Arrays.asList(other));
47  
48  			// Execute Spring
49  			ss.load(context);
50  		} catch (Exception e) {
51  			e.printStackTrace();
52  		}
53  
54  	}
55  
56  }