use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class O3FailureTest method testPartitionedDataAppendOOData.
@Test
public void testPartitionedDataAppendOOData() throws Exception {
counter.set(4);
executeWithoutPool(O3FailureTest::testPartitionedDataAppendOODataFailRetry0, new FilesFacadeImpl() {
private final AtomicInteger mapCounter = new AtomicInteger(2);
private long theFd = 0;
@Override
public long mmap(long fd, long len, long offset, int flags, int memoryTag) {
if (theFd == fd && mapCounter.decrementAndGet() == 0) {
theFd = 0;
return -1;
}
return super.mmap(fd, len, offset, flags, memoryTag);
}
@Override
public long openRW(LPSZ name) {
long fd = super.openRW(name);
if (Chars.endsWith(name, "ts.d") && counter.decrementAndGet() == 0) {
theFd = fd;
}
return fd;
}
});
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class LineTcpConnectionContextTest method testCairoExceptionOnAddColumn.
@Test
public void testCairoExceptionOnAddColumn() throws Exception {
String table = "columnEx";
runInContext(new FilesFacadeImpl() {
@Override
public long openRW(LPSZ name) {
if (Chars.endsWith(name, "broken.d")) {
return -1;
}
return super.openRW(name);
}
}, () -> {
recvBuffer = table + ",location=us-midwest temperature=82 1465839830100400200\n" + table + ",location=us-midwest temperature=83 1465839830100500200\n" + table + ",location=us-eastcoast temperature=81,broken=23 1465839830101400200\n" + table + ",location=us-midwest temperature=85 1465839830102300200\n" + table + ",location=us-eastcoast temperature=89 1465839830102400200\n" + table + ",location=us-eastcoast temperature=80 1465839830102400200\n" + table + ",location=us-westcost temperature=82 1465839830102500200\n";
do {
handleContextIO();
Assert.assertFalse(disconnected);
} while (recvBuffer.length() > 0);
closeContext();
String expected = "location\ttemperature\ttimestamp\n" + "us-midwest\t82.0\t2016-06-13T17:43:50.100400Z\n" + "us-midwest\t83.0\t2016-06-13T17:43:50.100500Z\n" + "us-midwest\t85.0\t2016-06-13T17:43:50.102300Z\n" + "us-eastcoast\t89.0\t2016-06-13T17:43:50.102400Z\n" + "us-eastcoast\t80.0\t2016-06-13T17:43:50.102400Z\n" + "us-westcost\t82.0\t2016-06-13T17:43:50.102500Z\n";
assertTable(expected, table);
}, null, null);
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class MimeTypesCacheTest method testCannotRead1.
@Test()
public void testCannotRead1() throws Exception {
AtomicInteger closeCount = new AtomicInteger(0);
testFailure(new FilesFacadeImpl() {
@Override
public boolean close(long fd) {
closeCount.incrementAndGet();
return true;
}
@Override
public long length(long fd) {
return 1024;
}
@Override
public long openRO(LPSZ name) {
return 123L;
}
@Override
public long read(long fd, long buf, long len, long offset) {
return -1;
}
}, "could not read");
Assert.assertEquals(1, closeCount.get());
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class MimeTypesCacheTest method testWrongFileSize4.
@Test()
public void testWrongFileSize4() throws Exception {
AtomicInteger closeCount = new AtomicInteger();
testFailure(new FilesFacadeImpl() {
@Override
public long length(long fd) {
return 1024 * 1024 * 2;
}
@Override
public long openRO(LPSZ name) {
return 123L;
}
@Override
public boolean close(long fd) {
closeCount.incrementAndGet();
return true;
}
}, "wrong file size");
Assert.assertEquals(1, closeCount.get());
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class MimeTypesCacheTest method testWrongFileSize.
@Test()
public void testWrongFileSize() throws Exception {
AtomicInteger closeCount = new AtomicInteger();
testFailure(new FilesFacadeImpl() {
@Override
public long length(long fd) {
return 0;
}
@Override
public long openRO(LPSZ name) {
return 123L;
}
@Override
public boolean close(long fd) {
closeCount.incrementAndGet();
return true;
}
}, "wrong file size");
Assert.assertEquals(1, closeCount.get());
}
Aggregations