org.kuali.student.common.test.spring
Class AbstractIntegrationServiceTest

java.lang.Object
  extended by org.kuali.student.common.test.spring.AbstractIntegrationServiceTest

public abstract class AbstractIntegrationServiceTest
extends Object

This class will start a Jetty server and deploy an exploded war file defined in @IntegrationServer annotation.

@IntegrationServer annotation takes the following parameters:

The @SystemProperties and @Property annotation is used to set System properties before starting the Jetty server. For instance, if you want to set the catalina.base path or the URL or port of a service that is different from what is specified in the file CXF configuration in the war file.

@SystemProperties takes the following parameter:

@Property takes the following parameter:

Example 1: Setup an integration test on port 8080 which is the same port as specified in the application.properties file in the war file.

 @IntegrationServer(
     port=8080, 
     webAppPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", 
     contextPath="/brms-ws-0.1.0-SNAPSHOT")
 
Example 2: Setup an integration test on port 9090 which is different from what is specified in the application.properties file in the war file.

 @IntegrationServer(
     port=9090, 
     webAppPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", 
     contextPath="/brms-ws-0.1.0-SNAPSHOT")
     
 @SystemProperties(properties={
     @Property(
         key="ks.servicelocation.RuleManagementService", 
         value="http://localhost:9090/brms-ws-0.1.0-SNAPSHOT/services/RuleManagementService")
  })
 
Example 3: Integration test.
 package org.kuali.student.rules.integration;
 // The following system properties are only needed if you want to specify a
 // server port (port 9000) other than 8080 as defined in
 // brms-ws/src/main/resources/application.properties, 
 // application-ruleexecution.properties and application-rulerepository.properties
 @IntegrationServer(port=9000, webappPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", contextPath="/brms-ws-0.1.0-SNAPSHOT")
 @SystemProperties(properties={
     @Property(key="ks.servicelocation.RuleManagementService", value="http://localhost:9000/brms-ws-0.1.0-SNAPSHOT/services/RuleManagementService"),
 })
 public class IntegrationTest extends AbstractIntegrationServiceTest {
     private final static String HOST = "http://localhost:9000/brms-ws-0.1.0-SNAPSHOT";
 
     private static String ruleManagementServiceURL = HOST+"/services/RuleManagementService";
     private static String ruleManagementNamespace = "http://student.kuali.org/wsdl/brms/RuleManagement";
     private static String ruleManagementServiceName = "RuleManagementService";
     private static String ruleManagementServiceInterface = RuleManagementService.class.getName();
 
     private static RuleManagementService ruleManagementService;
 
     @BeforeClass
     public static void setUpOnce() throws Exception {
         ruleManagementService = (RuleManagementService) ServiceFactory.getPort(
             ruleManagementServiceURL + "?wsdl", 
             ruleManagementNamespace, 
             ruleManagementServiceName, 
             ruleManagementServiceInterface, 
             ruleManagementServiceURL);

     }
        
     @AfterClass
     public static void tearDownOnce() throws Exception { }

     @Before
     public void setUp() throws Exception { }
        
     @After
     public void tearDown() throws Exception { }
     
     @Test
     public void testFindBusinessRuleTypesFromTestBeans() throws Exception {
         List businessRuleIdList1 = ruleManagementService.findBusinessRuleIdsByBusinessRuleType("KUALI_PRE_REQ");
         Assert.assertNotNull(businessRuleIdList1);
         List businessRuleIdList2 = ruleManagementService.findBusinessRuleIdsByBusinessRuleType("KUALI_CO_REQ");
         Assert.assertNotNull(businessRuleIdList2);
     }
 }
 


Constructor Summary
AbstractIntegrationServiceTest()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIntegrationServiceTest

public AbstractIntegrationServiceTest()


Copyright © 2010 The Kuali Foundation. All rights reserved.