Search in sources :

Example 36 with ServerConfiguration

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

the class QueryHandlerConsistencyTest method testHandler.

private void testHandler(ContextHandler handler) throws Exception {
    TestChannel channel = new TestChannel(QUERY1);
    String expected = null;
    handler.setupThread();
    try {
        ServerConfiguration configuration = new ServerConfiguration();
        for (int i = 128; i < 7500; i++) {
            channel.reset();
            configuration.setHttpBufRespContent(i);
            try (IOContext context = new IOContext(channel, configuration, MillisecondClockImpl.INSTANCE)) {
                context.request.read();
                handler.handle(context);
                if (expected != null) {
                    TestUtils.assertEquals(expected, channel.getOutput());
                } else {
                    expected = channel.getOutput().toString();
                }
            }
        }
    } finally {
        channel.free();
    }
}
Also used : ServerConfiguration(com.questdb.ServerConfiguration) IOContext(com.questdb.net.http.IOContext) TestChannel(com.questdb.test.tools.TestChannel)

Example 37 with ServerConfiguration

use of com.questdb.ServerConfiguration 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 38 with ServerConfiguration

use of com.questdb.ServerConfiguration 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)

Aggregations

ServerConfiguration (com.questdb.ServerConfiguration)38 Test (org.junit.Test)34 BootstrapEnv (com.questdb.BootstrapEnv)33 AbstractJournalTest (com.questdb.net.ha.AbstractJournalTest)29 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 AbstractOptimiserTest (com.questdb.parser.sql.AbstractOptimiserTest)3 RecordSource (com.questdb.ql.RecordSource)3 JournalEntryWriter (com.questdb.store.JournalEntryWriter)3 SocketException (java.net.SocketException)3 ResponseContentBufferTooSmallException (com.questdb.ex.ResponseContentBufferTooSmallException)2 HttpServer (com.questdb.net.http.HttpServer)2 IOContext (com.questdb.net.http.IOContext)2 SimpleUrlMatcher (com.questdb.net.http.SimpleUrlMatcher)2 UploadHandler (com.questdb.net.http.handlers.UploadHandler)2