Skip to content

Instantly share code, notes, and snippets.

@voutilad
Created May 9, 2015 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voutilad/8f4e4ebe230aa9aaecfe to your computer and use it in GitHub Desktop.
Save voutilad/8f4e4ebe230aa9aaecfe to your computer and use it in GitHub Desktop.
Real-time SAIL development in Attivio Designer using Embedded Jetty
package com.attivio.testproject2;
import java.io.IOException;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.BeforeClass;
import org.junit.Test;
import com.attivio.TestUtils;
import com.attivio.bus.PsbProperties;
public class WebAppTest {
private final static int PORT = 8080;
private final static String PROJECT = "TestProject2"; // <-- Set me to your project name
@BeforeClass
public static void initialize() {
PsbProperties.setProperty("log.printStackTraces", true);
PsbProperties.setProperty("log.level", "INFO");
PsbProperties.setProperty("attivio.project", System.getProperty("user.dir"));
PsbProperties.setProperty("log.directory", System.getProperty("user.dir") + "/build/logs");
PsbProperties.setProperty("data.directory", System.getProperty("user.dir") + "/build/data");
TestUtils.initializeEnvironment();
}
@Test
public void testWebApp() throws Exception {
final String workingDir = System.getProperty("user.dir");
Server server = new Server(PORT);
WebAppContext webapp = new WebAppContext();
webapp.setDescriptor(workingDir + "/webapps/" + PROJECT + "/WEB-INF/web.xml");
webapp.setResourceBase(workingDir + "/webapps/" + PROJECT);
webapp.setContextPath("/");
webapp.setParentLoaderPriority(true);
server.setHandler(webapp);
System.out.println("Starting Server on port " + PORT);
server.start();
try {
System.out.println("<HIT ENTER TO SHUTDOWN SERVER>");
System.in.read();
} catch (IOException e) {
//nop
}finally {
System.out.println("Shutting down.");
server.stop();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment