Search in sources :

Example 1 with UploadHandler

use of com.questdb.net.http.handlers.UploadHandler in project questdb by bluestreak01.

the class HttpServerTest method testUpload.

@Test
public void testUpload() throws Exception {
    final File dir = temp.newFolder();
    BootstrapEnv env = new BootstrapEnv();
    env.configuration = new ServerConfiguration();
    env.matcher = new SimpleUrlMatcher() {

        {
            put("/upload", new UploadHandler(dir));
        }
    };
    HttpServer server = new HttpServer(env);
    server.start();
    File expected = resourceFile("/csv/test-import.csv");
    File actual = new File(dir, "test-import.csv");
    upload(expected);
    TestUtils.assertEquals(expected, actual);
    server.halt();
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) ServerConfiguration(com.questdb.ServerConfiguration) UploadHandler(com.questdb.net.http.handlers.UploadHandler) AbstractJournalTest(com.questdb.net.ha.AbstractJournalTest) Test(org.junit.Test)

Example 2 with UploadHandler

use of com.questdb.net.http.handlers.UploadHandler in project questdb by bluestreak01.

the class HttpServerTest method testRangesNative.

@Test
// fix is in server, which would allow limited number of this iterations after which connection is closed.
@Ignore
public void testRangesNative() throws Exception {
    BootstrapEnv env = new BootstrapEnv();
    env.configuration = new ServerConfiguration(new File(HttpServerTest.class.getResource("/site").getPath(), "conf/questdb.conf")) {

        @Override
        public File getHttpPublic() {
            return temp.getRoot();
        }
    };
    env.configuration.setHttpThreads(1);
    env.configuration.setHttpSoRetries(10);
    env.configuration.getSslConfig().setSecure(false);
    env.matcher = new SimpleUrlMatcher() {

        {
            put("/upload", new UploadHandler(env.configuration.getHttpPublic()));
            setDefaultHandler(new StaticContentHandler(env));
        }
    };
    assertRanges(new HttpServer(env));
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) StaticContentHandler(com.questdb.net.http.handlers.StaticContentHandler) ServerConfiguration(com.questdb.ServerConfiguration) UploadHandler(com.questdb.net.http.handlers.UploadHandler) Ignore(org.junit.Ignore) AbstractJournalTest(com.questdb.net.ha.AbstractJournalTest) Test(org.junit.Test)

Aggregations

BootstrapEnv (com.questdb.BootstrapEnv)2 ServerConfiguration (com.questdb.ServerConfiguration)2 AbstractJournalTest (com.questdb.net.ha.AbstractJournalTest)2 UploadHandler (com.questdb.net.http.handlers.UploadHandler)2 Test (org.junit.Test)2 StaticContentHandler (com.questdb.net.http.handlers.StaticContentHandler)1 Ignore (org.junit.Ignore)1