All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.sitebricks.acceptance.util.JettyAcceptanceTest Maven / Gradle / Ivy

package com.google.sitebricks.acceptance.util;

import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;

import java.io.File;

/**
 * @author Tom Wilson ([email protected])
 */
public class JettyAcceptanceTest { 
  private static final String BUILDR_RESOURCE_DIR = "sitebricks-acceptance-tests/src/main/resources";
  private static final String STD_RESOURCE_DIR = "src/main/resources";

  private Jetty server;

  public JettyAcceptanceTest() {
    this(0);
  }

  public JettyAcceptanceTest(int port) {
      File standardDir = new File(STD_RESOURCE_DIR);

      if (standardDir.exists()) {
        server = new Jetty(STD_RESOURCE_DIR, port);
      } else {
        server = new Jetty(BUILDR_RESOURCE_DIR, port);
      }
    }

    @BeforeSuite
    public void start() throws Exception {
        server.start();
    }

    public void join() throws Exception {
        server.join();
    }

    @AfterSuite
    public void stop() throws Exception {
        server.stop();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy