use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class MimeTypesCacheTest method testCannotRead2.
@Test()
public void testCannotRead2() 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 128;
}
}, "could not read");
Assert.assertEquals(1, closeCount.get());
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class AlterTableAttachPartitionTest method testCannotRenameDetachedFolderOnAttach.
@Test
public void testCannotRenameDetachedFolderOnAttach() throws Exception {
AtomicInteger counter = new AtomicInteger(1);
FilesFacadeImpl ff = new FilesFacadeImpl() {
@Override
public boolean rename(LPSZ from, LPSZ to) {
if (Chars.endsWith(to, "2020-01-01") && counter.decrementAndGet() == 0) {
return false;
}
return super.rename(from, to);
}
};
testSqlFailedOnFsOperation(ff, "table 'dst' could not be altered: [", "]: File system error on trying to rename [from=");
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class AlterTableAttachPartitionTest method testCannotReadTimestampColumnFileDoesNotExist.
@Test
public void testCannotReadTimestampColumnFileDoesNotExist() throws Exception {
AtomicInteger counter = new AtomicInteger(1);
FilesFacadeImpl ff = new FilesFacadeImpl() {
@Override
public boolean exists(LPSZ name) {
if (Chars.endsWith(name, "ts.d") && counter.decrementAndGet() == 0) {
return false;
}
return super.exists(name);
}
};
testSqlFailedOnFsOperation(ff, "table 'dst' could not be altered: [0]: Doesn't exist:");
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class LineUdpParserImplTest method testCannotCreateTable.
@Test
public void testCannotCreateTable() throws Exception {
TestFilesFacade ff = new TestFilesFacade() {
boolean called = false;
@Override
public int mkdirs(LPSZ path, int mode) {
if (Chars.endsWith(path, "x" + Files.SEPARATOR)) {
called = true;
return -1;
}
return super.mkdirs(path, mode);
}
@Override
public boolean wasCalled() {
return called;
}
};
final String expected = "sym\tdouble\tint\tbool\tstr\ttimestamp\n" + "zzz\t1.3\t11\tfalse\tnice\t2017-10-03T10:00:00.000000Z\n";
String lines = "x,sym2=xyz double=1.6,int=15i,bool=true,str=\"string1\"\n" + "x,sym1=abc double=1.3,int=11i,bool=false,str=\"string2\"\n" + "y,sym=zzz double=1.3,int=11i,bool=false,str=\"nice\"\n";
CairoConfiguration configuration = new DefaultCairoConfiguration(root) {
@Override
public FilesFacade getFilesFacade() {
return ff;
}
@Override
public MicrosecondClock getMicrosecondClock() {
try {
return new TestMicroClock(TimestampFormatUtils.parseTimestamp("2017-10-03T10:00:00.000Z"), 10);
} catch (NumericException e) {
throw new RuntimeException(e);
}
}
};
assertThat(expected, lines, "y", configuration);
Assert.assertTrue(ff.wasCalled());
try (Path path = new Path()) {
Assert.assertEquals(TableUtils.TABLE_DOES_NOT_EXIST, TableUtils.exists(ff, path, root, "all"));
}
}
use of io.questdb.std.str.LPSZ in project questdb by bluestreak01.
the class MimeTypesCacheTest method testWrongFileSize2.
@Test()
public void testWrongFileSize2() throws Exception {
AtomicInteger closeCount = new AtomicInteger(0);
testFailure(new FilesFacadeImpl() {
@Override
public long length(long fd) {
return -1;
}
@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