PageRenderTime 38ms CodeModel.GetById 26ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/hazelcast-wm/src/test/java/com/hazelcast/wm/test/TestServer.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 50 lines | 23 code | 9 blank | 18 comment | 0 complexity | 66765c9c43644a6afa7805254d1a7619 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 3 *
 4 * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
 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
17package com.hazelcast.wm.test;
18
19import org.eclipse.jetty.server.Server;
20import org.eclipse.jetty.server.nio.SelectChannelConnector;
21import org.eclipse.jetty.webapp.WebAppContext;
22
23/**
24 * @mdogan 5/11/12
25 */
26public class TestServer {
27
28    public static void main(String[] args) throws Exception {
29        final String baseDir = "/java/projects";
30        final String sourceDir = baseDir + "/hazelcast/hazelcast-wm/src/test/webapp";
31
32        Server server = new Server();
33
34        SelectChannelConnector connector = new SelectChannelConnector();
35        connector.setPort(8080);
36        server.addConnector(connector);
37
38        WebAppContext context = new WebAppContext();
39        context.setResourceBase(sourceDir);
40        context.setDescriptor(sourceDir + "/WEB-INF/web.xml");
41        context.setLogUrlOnStart(true);
42        context.setContextPath("/");
43        context.setParentLoaderPriority(true);
44
45        server.setHandler(context);
46
47        server.start();
48        server.join();
49    }
50}