Package jodd.madvoc

Source Code of jodd.madvoc.MadvocSuiteBase

// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.madvoc;

import jodd.exception.UncheckedException;

public abstract class MadvocSuiteBase {

  public static boolean isSuite;

  // ---------------------------------------------------------------- tomcat

  protected static TomcatTestServer server;

  /**
   * Starts Tomcat.
   */
  protected static void startTomcat(String webXmlFileName) {
    if (server != null) {
      return;
    }
    server = new TomcatTestServer(webXmlFileName);
    try {
      server.start();
      System.out.println("Tomcat test server started");
    } catch (Exception e) {
      throw new UncheckedException(e);
    }
  }

  /**
   * Stops Tomcat if not in the suite.
   */
  public static void stopTomcat() {
    if (server == null) {
      return;
    }
    if (isSuite) {  // don't stop tomcat if it we are still running in the suite!
      return;
    }
    try {
      server.stop();
    } catch (Exception ignore) {
    } finally {
      System.out.println("Tomcat test server stopped");
      server = null;
    }
  }

}
TOP

Related Classes of jodd.madvoc.MadvocSuiteBase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.