View Javadoc

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  
16  package org.kuali.student.common.test.spring;
17  
18  import org.junit.runner.RunWith;
19  
20  /**
21   * This test will start a jetty server and deploy the service define in the
22   * @Client. It will also initialize a client based on the annotations in
23   * the @Client Service implementation class. Also passes the @Daos and
24   * @PersistenceFileLocation to system properties from the annotations.
25   * <p>
26   * Extend this class and set the
27   * <ul>
28   * <li>&#064;PersistenceFileLocation
29   * <li>&#064;Daos
30   * <li>&#064;Client
31   * </ul>
32   * <p>
33   * &#064;PersistenceFileLocation defines the persistence.xml location if it is
34   * named something else.
35   * <p>
36   * &#064;Daos is a list of &#064;Dao annotations. These define the Dao
37   * implementation classes, and an optional application context that contains a
38   * list of beans that should be persisted. The list bean should be called
39   * "persistList". A sql file that should be loaded can also be defined here with the
40   * testSqlFile parameter.  This should be a sql file.
41   * <p>
42   * &#064;Client requires the name of the service implementation class which
43   * should be annotated with the &#064;WebService and have the targetNamespace
44   * and serviceName set.
45   * <p>
46   * &#064;Client can also take the following additional settings
47   * <ul>
48   * <li>port - use to set port if the default port 9191 is not available. The default port can be changed by the system property "ks.test.default.port"
49   * <li>secure - set to true to return a secure client (default is false)
50   * </ul>
51   * 
52   * 
53   * <p>
54   * Example:
55   * <p>
56   * 
57   * <pre>
58   *  @Daos( {   @Dao(value = &quot;org.kuali.student.MyDaoImpl&quot;, 
59   *               testDataFile = &quot;classpath:META-INF/pretest-data-beans.xml&quot;),
60   *            @Dao(&quot;org.kuali.student.OtherDaoImpl&quot;) })
61   *  @PersistenceFileLocation(&quot;classpath:META-INF/custom-persistence.xml&quot;)
62   * public class ServiceCommonTest extends AbstractServiceTest {
63   * 
64   *  @Client(&quot;org.kuali.student.MyServiceImpl&quot;)
65   * public MyService client;
66   * 
67   *  @Test
68   * public void test1() {
69   * 	client.foo();
70   * }
71   * </pre>
72   * 
73   * Example of application context for preloading data:
74   * 
75   * <pre>
76   * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
77   * &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
78   *  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
79   *  xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd&quot;&gt;
80   *  
81   *  &lt;bean id=&quot;persistList&quot;
82   *  class=&quot;org.springframework.beans.factory.config.ListFactoryBean&quot;&gt;
83   * &lt;property name=&quot;sourceList&quot;&gt;
84   * 	&lt;list&gt;
85   * 		&lt;ref bean=&quot;value1&quot; /&gt;
86   * 		&lt;ref bean=&quot;value2&quot; /&gt;
87   * 	&lt;/list&gt;
88   * &lt;/property&gt;
89   *  &lt;/bean&gt;
90   *  
91   *  &lt;bean id=&quot;value1&quot;
92   *  class=&quot;org.kuali.student.Value&quot;&gt;
93   * &lt;property name=&quot;value&quot; value=&quot;Value Number One&quot; /&gt;
94   *  &lt;/bean&gt;
95   *  
96   *  &lt;bean id=&quot;value2&quot;
97   *  class=&quot;org.kuali.student.Value&quot;&gt;
98   * &lt;property name=&quot;value&quot; value=&quot;Value Number Two&quot; /&gt;
99   *  &lt;/bean&gt;
100  * 
101  * &lt;/beans&gt;
102  * </pre>
103  * 
104  */
105 @RunWith(ServiceTestClassRunner.class)
106 public abstract class AbstractServiceTest {
107 
108 }