use of com.questdb.std.str.Path in project questdb by bluestreak01.
the class SymbolMapTest method testReadEmptySymbolMap.
@Test
public void testReadEmptySymbolMap() throws Exception {
TestUtils.assertMemoryLeak(() -> {
int N = 10000;
try (Path path = new Path().of(configuration.getRoot())) {
create(path, "x", N, true);
try (SymbolMapReaderImpl reader = new SymbolMapReaderImpl(configuration, path, "x", 0)) {
Assert.assertNull(reader.value(-1));
Assert.assertEquals(SymbolTable.VALUE_IS_NULL, reader.getQuick(null));
}
}
});
}
use of com.questdb.std.str.Path in project questdb by bluestreak01.
the class SymbolMapTest method testReaderWhenMapDoesNotExist.
@Test
public void testReaderWhenMapDoesNotExist() throws Exception {
TestUtils.assertMemoryLeak(() -> {
try (Path path = new Path().of(configuration.getRoot())) {
try {
new SymbolMapReaderImpl(configuration, path, "x", 0);
Assert.fail();
} catch (CairoException e) {
Assert.assertTrue(Chars.contains(e.getMessage(), "does not exist"));
}
}
});
}
use of com.questdb.std.str.Path in project questdb by bluestreak01.
the class TableReaderTest method rmDir.
private static void rmDir(CharSequence partitionName) {
try (Path path = new Path()) {
path.of(root).concat("w").concat(partitionName).$();
Assert.assertTrue(configuration.getFilesFacade().exists(path));
Assert.assertTrue(configuration.getFilesFacade().rmdir(path));
}
}
use of com.questdb.std.str.Path 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.str.Path in project questdb by bluestreak01.
the class TableWriterTest method testOpenWriterMissingTxFile.
@Test
public void testOpenWriterMissingTxFile() throws Exception {
TestUtils.assertMemoryLeak(() -> {
CairoTestUtils.createAllTable(configuration, PartitionBy.NONE);
try (Path path = new Path()) {
Assert.assertTrue(FF.remove(path.of(root).concat("all").concat(TableUtils.TXN_FILE_NAME).$()));
try {
new TableWriter(configuration, "all");
Assert.fail();
} catch (CairoException ignore) {
}
}
});
}
Aggregations