View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.server;
17  
18  import org.apache.log4j.Logger;
19  import org.eclipse.jetty.server.Server;
20  import org.eclipse.jetty.webapp.WebAppClassLoader;
21  import org.eclipse.jetty.webapp.WebAppContext;
22  import org.kuali.rice.core.api.config.property.ConfigContext;
23  import org.kuali.rice.core.api.util.ShadowingInstrumentableClassLoader;
24  import org.kuali.rice.ksb.BaseTestServer;
25  
26  import java.io.IOException;
27  import java.net.URL;
28  
29  public class TestClient1 extends BaseTestServer {
30  	
31  	private static final Logger LOG = Logger.getLogger(TestClient1.class);
32  
33      private static final String WEB_ROOT = "org/kuali/rice/ksb/testclient1";
34  	private static final String CONTEXT = "/TestClient1";
35  	
36  	@Override
37  	protected Server createServer() {
38  		Server server = new Server(new Integer(ConfigContext.getCurrentContextConfig().getProperty("ksb.client1.port")));
39          URL webRoot = getClass().getClassLoader().getResource(WEB_ROOT);
40          String location = webRoot.getPath();
41  
42  		LOG.debug("#####################################");
43  		LOG.debug("#");
44  		LOG.debug("#  Starting Client1 using following web root " + location);
45  		LOG.debug("#");
46  		LOG.debug("#####################################");
47  
48  
49  		WebAppContext context = new WebAppContext(location, CONTEXT);
50          context.setThrowUnavailableOnStartupException(true);
51          context.setClassLoader(new KsbTestClientClassLoader());
52  		server.setHandler(context);
53  		return server;
54  	}
55  }