use of com.questdb.store.factory.WriterFactory 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();
}
}
}
Aggregations