/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. package com.hazelcast.wm.test;
  17. import org.eclipse.jetty.server.Server;
  18. import org.eclipse.jetty.server.nio.SelectChannelConnector;
  19. import org.eclipse.jetty.webapp.WebAppContext;
  20. /**
  21. * @mdogan 5/11/12
  22. */
  23. public class TestServer {
  24. public static void main(String[] args) throws Exception {
  25. final String baseDir = "/java/projects";
  26. final String sourceDir = baseDir + "/hazelcast/hazelcast-wm/src/test/webapp";
  27. Server server = new Server();
  28. SelectChannelConnector connector = new SelectChannelConnector();
  29. connector.setPort(8080);
  30. server.addConnector(connector);
  31. WebAppContext context = new WebAppContext();
  32. context.setResourceBase(sourceDir);
  33. context.setDescriptor(sourceDir + "/WEB-INF/web.xml");
  34. context.setLogUrlOnStart(true);
  35. context.setContextPath("/");
  36. context.setParentLoaderPriority(true);
  37. server.setHandler(context);
  38. server.start();
  39. server.join();
  40. }
  41. }