Search in sources :

Example 6 with HttpServer

use of org.apache.samza.coordinator.server.HttpServer in project samza by apache.

the class TestHttpFileSystem method testHttpFileSystemReadTimeouts.

@Test
public void testHttpFileSystemReadTimeouts() throws Exception {
    HttpServer server = new HttpServer("/", 0, null, new ServletHolder(DefaultServlet.class));
    try {
        server.addServlet("/download", new PartialFileFetchServlet());
        server.start();
        String serverUrl = server.getUrl().toString() + "download";
        FileSystemClientThread fileSystemClientThread = new FileSystemClientThread(new URI(serverUrl));
        fileSystemClientThread.start();
        fileSystemClientThread.join();
        Assert.assertEquals(fileSystemClientThread.getTotalBytesRead(), THRESHOLD_BYTES);
        Assert.assertNull(clientException);
        Assert.assertNull(serverException);
    } finally {
        server.stop();
    }
}
Also used : ServletHolder(org.eclipse.jetty.servlet.ServletHolder) HttpServer(org.apache.samza.coordinator.server.HttpServer) DefaultServlet(org.eclipse.jetty.servlet.DefaultServlet) URI(java.net.URI) Test(org.junit.Test)

Aggregations

HttpServer (org.apache.samza.coordinator.server.HttpServer)6 DefaultServlet (org.eclipse.jetty.servlet.DefaultServlet)6 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)6 HashMap (java.util.HashMap)2 TaskName (org.apache.samza.container.TaskName)2 JobModelManager (org.apache.samza.coordinator.JobModelManager)2 ContainerModel (org.apache.samza.job.model.ContainerModel)2 JobModel (org.apache.samza.job.model.JobModel)2 TaskModel (org.apache.samza.job.model.TaskModel)2 Before (org.junit.Before)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 URI (java.net.URI)1 ClusterManagerConfig (org.apache.samza.config.ClusterManagerConfig)1 LocalityManager (org.apache.samza.container.LocalityManager)1 LocalityServlet (org.apache.samza.coordinator.server.LocalityServlet)1 LocalityModel (org.apache.samza.job.model.LocalityModel)1 YarnAppState (org.apache.samza.job.yarn.YarnAppState)1 YarnContainer (org.apache.samza.job.yarn.YarnContainer)1 MetricsRegistryMap (org.apache.samza.metrics.MetricsRegistryMap)1 ReadableMetricsRegistry (org.apache.samza.metrics.ReadableMetricsRegistry)1