Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.kuali.student.common.test.spring;
This test will start a jetty server and deploy the service define in the @Client. It will also initialize a client based on the annotations in the @Client Service implementation class. Also passes the @Daos and @PersistenceFileLocation to system properties from the annotations.

Extend this class and set the

  • @PersistenceFileLocation
  • @Daos
  • @Client

@PersistenceFileLocation defines the persistence.xml location if it is named something else.

@Daos is a list of @Dao annotations. These define the Dao implementation classes, and an optional application context that contains a list of beans that should be persisted. The list bean should be called "persistList". A sql file that should be loaded can also be defined here with the testSqlFile parameter. This should be a sql file.

@Client requires the name of the service implementation class which should be annotated with the @WebService and have the targetNamespace and serviceName set.

@Client can also take the following additional settings

  • 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"
  • secure - set to true to return a secure client (default is false)



{ @Dao(value = "org.kuali.student.MyDaoImpl", testDataFile = "classpath:META-INF/pretest-data-beans.xml"),
"org.kuali.student.OtherDaoImpl") })
"classpath:META-INF/custom-persistence.xml") public class ServiceCommonTest extends AbstractServiceTest {
"org.kuali.student.MyServiceImpl") public MyService client;
public void test1() {; }
Example of application context for preloading data:
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns=""
  <bean id="persistList"
 <property name="sourceList">
   <ref bean="value1" />
   <ref bean="value2" />
  <bean id="value1"
 <property name="value" value="Value Number One" />
  <bean id="value2"
 <property name="value" value="Value Number Two" />
public abstract class AbstractServiceTest {
New to GrepCode? Check out our FAQ X