Package org.exist.http

Source Code of org.exist.http.RESTTest

package org.exist.http;

import org.apache.commons.httpclient.HttpClient;
import org.exist.jetty.JettyStart;
import org.exist.xmldb.XmldbURI;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import static org.junit.Assert.fail;

public abstract class RESTTest {

    // jetty.port.standalone
    protected final static String REST_URL = "http://localhost:" + System.getProperty("jetty.port");
    protected final static String COLLECTION_ROOT_URL = REST_URL + XmldbURI.ROOT_COLLECTION;
    protected static JettyStart server = null;
    protected static HttpClient client = new HttpClient();

    @BeforeClass
    public static void startupServer() {
        try {
            if(server == null) {
                server = new JettyStart();
                System.out.println("Starting standalone server...");
                server.run();
            }
        } catch(Exception e) {
            fail(e.getMessage());
        }
    }

    @AfterClass
    public static void shutdownServer() {
        server.shutdown();
    }
}
TOP

Related Classes of org.exist.http.RESTTest

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.