use of com.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class SqlLexerOptimiserTest method testTableNameCannotOpen.
@Test
public void testTableNameCannotOpen() {
final FilesFacade ff = new FilesFacadeImpl() {
@Override
public long openRO(LPSZ name) {
if (Chars.endsWith(name, TableUtils.META_FILE_NAME)) {
return -1;
}
return super.openRO(name);
}
};
CairoConfiguration configuration = new DefaultCairoConfiguration(root) {
@Override
public FilesFacade getFilesFacade() {
return ff;
}
};
CairoEngine engine = new Engine(configuration);
SqlLexerOptimiser lexer = new SqlLexerOptimiser(engine, configuration);
assertSyntaxError(lexer, engine, "select * from tab", 14, "Cannot open file", modelOf("tab").col("x", ColumnType.INT));
}
use of com.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class TableReadFailTest method testTxnFileCannotOpenConstructor.
@Test
public void testTxnFileCannotOpenConstructor() throws Exception {
FilesFacade ff = new FilesFacadeImpl() {
@Override
public long openRO(LPSZ name) {
if (Chars.endsWith(name, TableUtils.TXN_FILE_NAME)) {
return -1;
}
return super.openRO(name);
}
};
assertConstructorFail(ff);
}
use of com.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class TableReadFailTest method testTxnFileMissingConstructor.
@Test
public void testTxnFileMissingConstructor() throws Exception {
FilesFacade ff = new FilesFacadeImpl() {
@Override
public boolean exists(LPSZ path) {
return !Chars.endsWith(path, TableUtils.TXN_FILE_NAME) && super.exists(path);
}
};
assertConstructorFail(ff);
}
use of com.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class TableUtilsTest method testCreateFailure.
@Test
public void testCreateFailure() throws Exception {
TestUtils.assertMemoryLeak(() -> {
class X extends FilesFacadeImpl {
@Override
public int mkdirs(LPSZ path, int mode) {
return -1;
}
}
X ff = new X();
JournalMetadata metadata = getJournalStructure().build();
try (AppendMemory appendMemory = new AppendMemory()) {
try (Path path = new Path()) {
TableUtils.create(ff, path, appendMemory, temp.getRoot().getAbsolutePath(), metadata, 509);
Assert.fail();
} catch (CairoException e) {
Assert.assertNotNull(e.getMessage());
}
}
});
}
use of com.questdb.std.FilesFacadeImpl in project questdb by bluestreak01.
the class TableReadFailTest method testTodoPresentConstructor.
@Test
public void testTodoPresentConstructor() throws Exception {
FilesFacade ff = new FilesFacadeImpl() {
@Override
public boolean exists(LPSZ path) {
return Chars.endsWith(path, TableUtils.TODO_FILE_NAME) || super.exists(path);
}
};
assertConstructorFail(ff);
}
Aggregations