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>@PersistenceFileLocation
29 * <li>@Daos
30 * <li>@Client
31 * </ul>
32 * <p>
33 * @PersistenceFileLocation defines the persistence.xml location if it is
34 * named something else.
35 * <p>
36 * @Daos is a list of @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 * @Client requires the name of the service implementation class which
43 * should be annotated with the @WebService and have the targetNamespace
44 * and serviceName set.
45 * <p>
46 * @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 = "org.kuali.student.MyDaoImpl",
59 * testDataFile = "classpath:META-INF/pretest-data-beans.xml"),
60 * @Dao("org.kuali.student.OtherDaoImpl") })
61 * @PersistenceFileLocation("classpath:META-INF/custom-persistence.xml")
62 * public class ServiceCommonTest extends AbstractServiceTest {
63 *
64 * @Client("org.kuali.student.MyServiceImpl")
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 * <?xml version="1.0" encoding="UTF-8"?>
77 * <beans xmlns="http://www.springframework.org/schema/beans"
78 * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
79 * xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
80 *
81 * <bean id="persistList"
82 * class="org.springframework.beans.factory.config.ListFactoryBean">
83 * <property name="sourceList">
84 * <list>
85 * <ref bean="value1" />
86 * <ref bean="value2" />
87 * </list>
88 * </property>
89 * </bean>
90 *
91 * <bean id="value1"
92 * class="org.kuali.student.Value">
93 * <property name="value" value="Value Number One" />
94 * </bean>
95 *
96 * <bean id="value2"
97 * class="org.kuali.student.Value">
98 * <property name="value" value="Value Number Two" />
99 * </bean>
100 *
101 * </beans>
102 * </pre>
103 *
104 */
105 @RunWith(ServiceTestClassRunner.class)
106 public abstract class AbstractServiceTest {
107
108 }