001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.ksb.server;
017    
018    import org.apache.log4j.Logger;
019    import org.eclipse.jetty.server.Server;
020    import org.eclipse.jetty.webapp.WebAppContext;
021    import org.kuali.rice.core.api.config.property.ConfigContext;
022    import org.kuali.rice.ksb.BaseTestServer;
023    
024    import java.util.HashMap;
025    import java.util.Map;
026    
027    public class TestClient2 extends BaseTestServer {
028    
029            private static final Logger LOG = Logger.getLogger(TestClient2.class);
030    
031            private static final String CONTEXT = "/TestClient2";
032            
033            /**
034             * If this property is set on the environment then it will use the keystore at the specified location as a custom keystore
035             */
036            public static final String CUSTOM_KEYSTORE = "CustomKeyStore";
037            
038            private static Map<String, Object> environment = new HashMap<String, Object>();
039            
040            @Override
041            protected Server createServer() {
042                    
043                    Server server = new Server(new Integer(ConfigContext.getCurrentContextConfig().getProperty("ksb.client2.port")));
044                    String location = ConfigContext.getCurrentContextConfig().getProperty("client2.location");
045                    LOG.debug("#####################################");
046                    LOG.debug("#");
047                    LOG.debug("#  Starting Client2 using location " + location);
048                    LOG.debug("#");
049                    LOG.debug("#####################################");
050                    WebAppContext context = new WebAppContext(location, CONTEXT);   
051                    server.setHandler(context);
052                    return server;
053            }
054            
055            public static Map<String, Object> getEnvironment() {
056                    return environment;
057            }
058    }