| 
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AbstractIntegrationServiceTest | Line # 130 | 0 | - | 0 | 0 | - | -1.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 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 class will start a Jetty server and deploy an exploded war file | |
| 22 | * defined in @IntegrationServer annotation. | |
| 23 | * <p> | |
| 24 | * <b>@IntegrationServer</b> annotation takes the following parameters: | |
| 25 | * </p> | |
| 26 | * <ul> | |
| 27 | * <li><b>port</b> - Server port to deploy web application on e.g. 9090</li> | |
| 28 | * <li><b>webAppPath</b> - Webapp path of exploded war file e.g. brms-ws-1.0.0.war</li> | |
| 29 | * <li><b>contextPath</b> - Servlet context path e.g. brms-ws-1.0.0</li> | |
| 30 | * </ul> | |
| 31 | * <p> | |
| 32 | * The @SystemProperties and @Property annotation is used to set | |
| 33 | * System properties before starting the Jetty server. For instance, if you | |
| 34 | * want to set the catalina.base path or the URL or port of a service that is | |
| 35 | * different from what is specified in the file CXF configuration in the war | |
| 36 | * file. | |
| 37 | * </p> | |
| 38 | * <p> | |
| 39 | * <b>@SystemProperties</b> takes the following parameter: | |
| 40 | * </p> | |
| 41 | * <ul> | |
| 42 | * <li><b>properties</b> - List of <code>Property</code> to set</li> | |
| 43 | * </ul> | |
| 44 | * <p> | |
| 45 | * <b>@Property</b> takes the following parameter: | |
| 46 | * </p> | |
| 47 | * <ul> | |
| 48 | * <li><b>key</b> - Property key</li> | |
| 49 | * <li><b>value</b> - Property value</li> | |
| 50 | * </ul> | |
| 51 | * <p> | |
| 52 | * <b>Example 1:</b> Setup an integration test on port 8080 which is the same | |
| 53 | * port as specified in the application.properties file in the war file. | |
| 54 | * </p> | |
| 55 | * <pre> | |
| 56 | * @IntegrationServer( | |
| 57 | * port=8080, | |
| 58 | * webAppPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", | |
| 59 | * contextPath="/brms-ws-0.1.0-SNAPSHOT") | |
| 60 | * </pre> | |
| 61 | * | |
| 62 | * <b>Example 2:</b> Setup an integration test on port 9090 which is different | |
| 63 | * from what is specified in the application.properties file in the war file. | |
| 64 | * </p> | |
| 65 | * <pre> | |
| 66 | * @IntegrationServer( | |
| 67 | * port=9090, | |
| 68 | * webAppPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", | |
| 69 | * contextPath="/brms-ws-0.1.0-SNAPSHOT") | |
| 70 | * | |
| 71 | * @SystemProperties(properties={ | |
| 72 | * @Property( | |
| 73 | * key="ks.servicelocation.RuleManagementService", | |
| 74 | * value="http://localhost:9090/brms-ws-0.1.0-SNAPSHOT/services/RuleManagementService") | |
| 75 | * }) | |
| 76 | * </pre> | |
| 77 | * | |
| 78 | * <b>Example 3:</b> Integration test. | |
| 79 | * <pre> | |
| 80 | * <b>package</b> org.kuali.student.rules.integration; | |
| 81 | * // The following system properties are only needed if you want to specify a | |
| 82 | * // server port (port 9000) other than 8080 as defined in | |
| 83 | * // brms-ws/src/main/resources/application.properties, | |
| 84 | * // application-ruleexecution.properties and application-rulerepository.properties | |
| 85 | * <b>@IntegrationServer</b>(port=9000, webappPath="../../../brms-ws/target/brms-ws-0.1.0-SNAPSHOT", contextPath="/brms-ws-0.1.0-SNAPSHOT") | |
| 86 | * <b>@SystemProperties</b>(properties={ | |
| 87 | * <b>@Property</b>(key="ks.servicelocation.RuleManagementService", value="http://localhost:9000/brms-ws-0.1.0-SNAPSHOT/services/RuleManagementService"), | |
| 88 | * }) | |
| 89 | * <b>public class</b> IntegrationTest <b>extends</b> AbstractIntegrationServiceTest { | |
| 90 | * private final static String HOST = "http://localhost:9000/brms-ws-0.1.0-SNAPSHOT"; | |
| 91 | * | |
| 92 | * private static String ruleManagementServiceURL = HOST+"/services/RuleManagementService"; | |
| 93 | * private static String ruleManagementNamespace = "http://student.kuali.org/wsdl/brms/RuleManagement"; | |
| 94 | * private static String ruleManagementServiceName = "RuleManagementService"; | |
| 95 | * private static String ruleManagementServiceInterface = RuleManagementService.class.getName(); | |
| 96 | * | |
| 97 | * private static RuleManagementService ruleManagementService; | |
| 98 | * | |
| 99 | * <b>@BeforeClass</b> | |
| 100 | * public static void setUpOnce() throws Exception { | |
| 101 | * ruleManagementService = (RuleManagementService) ServiceFactory.getPort( | |
| 102 | * ruleManagementServiceURL + "?wsdl", | |
| 103 | * ruleManagementNamespace, | |
| 104 | * ruleManagementServiceName, | |
| 105 | * ruleManagementServiceInterface, | |
| 106 | * ruleManagementServiceURL); | |
| 107 | * | |
| 108 | * } | |
| 109 | * | |
| 110 | * <b>@AfterClass</b> | |
| 111 | * public static void tearDownOnce() throws Exception { } | |
| 112 | * | |
| 113 | * <b>@Before</b> | |
| 114 | * public void setUp() throws Exception { } | |
| 115 | * | |
| 116 | * <b>@After</b> | |
| 117 | * public void tearDown() throws Exception { } | |
| 118 | * | |
| 119 | * <b>@Test</b> | |
| 120 | * public void testFindBusinessRuleTypesFromTestBeans() throws Exception { | |
| 121 | * List<String> businessRuleIdList1 = ruleManagementService.findBusinessRuleIdsByBusinessRuleType("KUALI_PRE_REQ"); | |
| 122 | * Assert.assertNotNull(businessRuleIdList1); | |
| 123 | * List<String> businessRuleIdList2 = ruleManagementService.findBusinessRuleIdsByBusinessRuleType("KUALI_CO_REQ"); | |
| 124 | * Assert.assertNotNull(businessRuleIdList2); | |
| 125 | * } | |
| 126 | * } | |
| 127 | * </pre> | |
| 128 | */ | |
| 129 | @RunWith(IntegrationServiceTestClassRunner.class) | |
| 130 | public abstract class AbstractIntegrationServiceTest { | |
| 131 | ||
| 132 | } | |
| 
 | ||||||||||||