Search in sources :

Example 1 with FilesFacadeImpl

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));
}
Also used : FilesFacade(com.questdb.std.FilesFacade) LPSZ(com.questdb.std.str.LPSZ) FilesFacadeImpl(com.questdb.std.FilesFacadeImpl) CairoEngine(com.questdb.cairo.sql.CairoEngine) CairoEngine(com.questdb.cairo.sql.CairoEngine) Test(org.junit.Test)

Example 2 with FilesFacadeImpl

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);
}
Also used : FilesFacade(com.questdb.std.FilesFacade) LPSZ(com.questdb.std.str.LPSZ) FilesFacadeImpl(com.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 3 with FilesFacadeImpl

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);
}
Also used : FilesFacade(com.questdb.std.FilesFacade) LPSZ(com.questdb.std.str.LPSZ) FilesFacadeImpl(com.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 4 with FilesFacadeImpl

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());
            }
        }
    });
}
Also used : Path(com.questdb.std.str.Path) JournalMetadata(com.questdb.store.factory.configuration.JournalMetadata) LPSZ(com.questdb.std.str.LPSZ) FilesFacadeImpl(com.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Example 5 with FilesFacadeImpl

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);
}
Also used : FilesFacade(com.questdb.std.FilesFacade) LPSZ(com.questdb.std.str.LPSZ) FilesFacadeImpl(com.questdb.std.FilesFacadeImpl) Test(org.junit.Test)

Aggregations

FilesFacadeImpl (com.questdb.std.FilesFacadeImpl)7 LPSZ (com.questdb.std.str.LPSZ)7 Test (org.junit.Test)7 FilesFacade (com.questdb.std.FilesFacade)6 CairoEngine (com.questdb.cairo.sql.CairoEngine)1 Path (com.questdb.std.str.Path)1 JournalMetadata (com.questdb.store.factory.configuration.JournalMetadata)1