提交 888407d5 authored 作者: Thomas Mueller's avatar Thomas Mueller

The compressed in-memory file systems (memLZF:) could not be used in the MVStore.

上级 9dfec247
...@@ -202,7 +202,7 @@ public class FilePathMem extends FilePath { ...@@ -202,7 +202,7 @@ public class FilePathMem extends FilePath {
return name.equals(getScheme() + ":"); return name.equals(getScheme() + ":");
} }
private static String getCanonicalPath(String fileName) { protected static String getCanonicalPath(String fileName) {
fileName = fileName.replace('\\', '/'); fileName = fileName.replace('\\', '/');
int idx = fileName.indexOf(':') + 1; int idx = fileName.indexOf(':') + 1;
if (fileName.length() > idx && fileName.charAt(idx) != '/') { if (fileName.length() > idx && fileName.charAt(idx) != '/') {
...@@ -232,6 +232,13 @@ public class FilePathMem extends FilePath { ...@@ -232,6 +232,13 @@ public class FilePathMem extends FilePath {
*/ */
class FilePathMemLZF extends FilePathMem { class FilePathMemLZF extends FilePathMem {
@Override
public FilePathMem getPath(String path) {
FilePathMemLZF p = new FilePathMemLZF();
p.name = getCanonicalPath(path);
return p;
}
@Override @Override
boolean compressed() { boolean compressed() {
return true; return true;
......
...@@ -393,6 +393,7 @@ public class TestFileSystem extends TestBase { ...@@ -393,6 +393,7 @@ public class TestFileSystem extends TestBase {
} }
private void testFileSystem(String fsBase) throws Exception { private void testFileSystem(String fsBase) throws Exception {
testRootExists(fsBase);
testPositionedReadWrite(fsBase); testPositionedReadWrite(fsBase);
testSetReadOnly(fsBase); testSetReadOnly(fsBase);
testParentEventuallyReturnsNull(fsBase); testParentEventuallyReturnsNull(fsBase);
...@@ -401,6 +402,15 @@ public class TestFileSystem extends TestBase { ...@@ -401,6 +402,15 @@ public class TestFileSystem extends TestBase {
testRandomAccess(fsBase); testRandomAccess(fsBase);
} }
private void testRootExists(String fsBase) {
String fileName = fsBase + "/testFile";
FilePath p = FilePath.get(fileName);
while (p.getParent() != null) {
p = p.getParent();
}
assertTrue(p.exists());
}
private void testSetReadOnly(String fsBase) { private void testSetReadOnly(String fsBase) {
String fileName = fsBase + "/testFile"; String fileName = fsBase + "/testFile";
if (FileUtils.exists(fileName)) { if (FileUtils.exists(fileName)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论