Search in sources :

Example 31 with BootstrapEnv

use of com.questdb.BootstrapEnv in project questdb by bluestreak01.

the class HttpServerTest method testImportIntoBusyJournal2.

@Test
public void testImportIntoBusyJournal2() throws Exception {
    WriterFactory f = getFactory();
    try (JournalWriter w = f.writer(new JournalStructure("small.csv").$int("X").$int("Y").$())) {
        JournalEntryWriter ew = w.entryWriter();
        ew.putInt(0, 3);
        ew.putInt(1, 30);
        ew.append();
        w.commit();
        BootstrapEnv env = new BootstrapEnv();
        env.configuration = new ServerConfiguration();
        env.factory = getFactory();
        env.typeProbeCollection = TYPE_PROBE_COLLECTION;
        env.matcher = new SimpleUrlMatcher() {

            {
                put("/imp", new ImportHandler(env));
            }
        };
        HttpServer server = new HttpServer(env);
        server.start();
        StringBuilder response = new StringBuilder();
        try {
            Assert.assertEquals(200, HttpTestUtils.upload("/csv/small.csv", "http://localhost:9000/imp?fmt=json", null, response));
            Assert.assertTrue(Chars.startsWith(response, "{\"status\":\"com.questdb.ex.WriterBusyException\"}"));
        } catch (IOException e) {
            Assert.assertTrue(e.getMessage().contains("Connection reset"));
        } finally {
            server.halt();
        }
    }
}
Also used : JournalWriter(com.questdb.store.JournalWriter) BootstrapEnv(com.questdb.BootstrapEnv) WriterFactory(com.questdb.store.factory.WriterFactory) JournalStructure(com.questdb.store.factory.configuration.JournalStructure) ServerConfiguration(com.questdb.ServerConfiguration) ImportHandler(com.questdb.net.http.handlers.ImportHandler) JournalEntryWriter(com.questdb.store.JournalEntryWriter) AbstractJournalTest(com.questdb.net.ha.AbstractJournalTest) Test(org.junit.Test)

Example 32 with BootstrapEnv

use of com.questdb.BootstrapEnv in project questdb by bluestreak01.

the class HttpServerTest method testNativeConcurrentDownload.

@Test
public void testNativeConcurrentDownload() throws Exception {
    final ServerConfiguration configuration = new ServerConfiguration(new File(resourceFile("/site"), "conf/questdb.conf"));
    BootstrapEnv env = new BootstrapEnv();
    env.configuration = configuration;
    env.configuration.getSslConfig().setSecure(false);
    env.matcher = new SimpleUrlMatcher() {

        {
            setDefaultHandler(new StaticContentHandler(env));
        }
    };
    final MimeTypes mimeTypes = new MimeTypes(env.configuration.getMimeTypes());
    HttpServer server = new HttpServer(env);
    server.start();
    assertConcurrentDownload(mimeTypes, server, "http");
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) StaticContentHandler(com.questdb.net.http.handlers.StaticContentHandler) ServerConfiguration(com.questdb.ServerConfiguration) AbstractJournalTest(com.questdb.net.ha.AbstractJournalTest) Test(org.junit.Test)

Example 33 with BootstrapEnv

use of com.questdb.BootstrapEnv in project questdb by bluestreak01.

the class QueryHandlerConsistencyTest method testQueryHandlerConsistency.

@Test
public void testQueryHandlerConsistency() throws Exception {
    BootstrapEnv env = new BootstrapEnv();
    env.configuration = new ServerConfiguration();
    env.factory = FACTORY_CONTAINER.getFactory();
    testHandler(new QueryHandler(env));
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) ServerConfiguration(com.questdb.ServerConfiguration) Test(org.junit.Test) AbstractOptimiserTest(com.questdb.parser.sql.AbstractOptimiserTest)

Example 34 with BootstrapEnv

use of com.questdb.BootstrapEnv in project questdb by bluestreak01.

the class QueryHandlerSmallBufferTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    BootstrapEnv env = new BootstrapEnv();
    env.configuration = new ServerConfiguration();
    env.configuration.setHttpBufRespContent(128);
    env.factory = FACTORY_CONTAINER.getFactory();
    handler = new QueryHandler(env);
    env.matcher = new SimpleUrlMatcher() {

        {
            put("/js", handler);
        }
    };
    server = new HttpServer(env);
    server.start();
    QueryHandlerTest.generateJournal("large", RECORD_COUNT);
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) ServerConfiguration(com.questdb.ServerConfiguration) HttpServer(com.questdb.net.http.HttpServer) SimpleUrlMatcher(com.questdb.net.http.SimpleUrlMatcher)

Example 35 with BootstrapEnv

use of com.questdb.BootstrapEnv in project questdb by bluestreak01.

the class JsonSchemaParserTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    BootstrapEnv env = new BootstrapEnv();
    env.dateFormatFactory = new DateFormatFactory();
    env.dateLocaleFactory = new DateLocaleFactory(new TimeZoneRuleFactory());
    defaultLocaleId = env.dateLocaleFactory.getDefaultDateLocale().getId();
    jsonSchemaParser = new JsonSchemaParser(env);
}
Also used : BootstrapEnv(com.questdb.BootstrapEnv) DateFormatFactory(com.questdb.std.time.DateFormatFactory) DateLocaleFactory(com.questdb.std.time.DateLocaleFactory) TimeZoneRuleFactory(com.questdb.std.time.TimeZoneRuleFactory)

Aggregations

BootstrapEnv (com.questdb.BootstrapEnv)36 ServerConfiguration (com.questdb.ServerConfiguration)33 Test (org.junit.Test)30 AbstractJournalTest (com.questdb.net.ha.AbstractJournalTest)25 ImportHandler (com.questdb.net.http.handlers.ImportHandler)13 StringSink (com.questdb.std.str.StringSink)11 StaticContentHandler (com.questdb.net.http.handlers.StaticContentHandler)9 QueryCompiler (com.questdb.parser.sql.QueryCompiler)9 RecordSourcePrinter (com.questdb.ql.RecordSourcePrinter)9 JournalWriter (com.questdb.store.JournalWriter)4 JournalStructure (com.questdb.store.factory.configuration.JournalStructure)4 ResponseContentBufferTooSmallException (com.questdb.ex.ResponseContentBufferTooSmallException)3 AbstractOptimiserTest (com.questdb.parser.sql.AbstractOptimiserTest)3 RecordSource (com.questdb.ql.RecordSource)3 JournalEntryWriter (com.questdb.store.JournalEntryWriter)3 SocketException (java.net.SocketException)3 HttpServer (com.questdb.net.http.HttpServer)2 SimpleUrlMatcher (com.questdb.net.http.SimpleUrlMatcher)2 UploadHandler (com.questdb.net.http.handlers.UploadHandler)2 DoubleRecordSourceColumn (com.questdb.ql.ops.col.DoubleRecordSourceColumn)2