Search in sources :

Example 1 with GreenApp

use of com.ociweb.gl.api.GreenApp in project GreenLightning by oci-pronghorn.

the class GreenLightningTest method testStaticServer.

@Test
public void testStaticServer() {
    // for maven how to get this path?
    String path = "demoSite/index.html";
    URL url = getClass().getResource("/NetRequest.xml");
    System.out.println(url);
    boolean isTLS = false;
    // "0.0.0.0";
    String bindHost = "127.0.0.1";
    int bindPort = (int) (2000 + (System.nanoTime() % 12000));
    boolean isClientAuthRequired = false;
    ;
    String identityStoreResourceName = null;
    String keyPassword = null;
    String keyStorePassword = null;
    boolean trustAll = true;
    int telemetryPort = -1;
    GreenApp app = new GreenLightning.StaticFileServer(isTLS, bindHost, bindPort, path, isClientAuthRequired, identityStoreResourceName, keyPassword, keyStorePassword, trustAll, telemetryPort);
    GreenRuntime.run(app);
    hitServer(bindPort, null, 200, "/favicon.ico");
    hitServer(bindPort, "Green Lightning demo page", 200, "");
    hitServer(bindPort, "Green Lightning demo page", 200, "/");
    hitServer(bindPort, "Green Lightning demo page", 200, "/index.html");
    hitServer(bindPort, null, 404, "/notAFile.nothing");
}
Also used : GreenApp(com.ociweb.gl.api.GreenApp) URL(java.net.URL) Test(org.junit.Test)

Aggregations

GreenApp (com.ociweb.gl.api.GreenApp)1 URL (java.net.URL)1 Test (org.junit.Test)1