use of org.drools.compiler.compiler.io.FileSystem in project drools by kiegroup.
the class MemoryFolderTest method testFolderRemoval.
@Test
public void testFolderRemoval() throws IOException {
FileSystem fs = new MemoryFileSystem();
Folder fld = fs.getFolder("src/main/resources/org/domain");
fld.create();
fld = fs.getFolder("src/main");
File file = fld.getFile("MyClass1.java");
file.create(new ByteArrayInputStream("ABC1".getBytes()));
file = fld.getFile("MyClass2.java");
file.create(new ByteArrayInputStream("ABC2".getBytes()));
fld = fs.getFolder("src/main/resources/org");
file = fld.getFile("MyClass3.java");
file.create(new ByteArrayInputStream("ABC3".getBytes()));
file = fld.getFile("MyClass4.java");
file.create(new ByteArrayInputStream("ABC4".getBytes()));
fld = fs.getFolder("src/main/resources/org/domain");
file = fld.getFile("MyClass4.java");
file.create(new ByteArrayInputStream("ABC5".getBytes()));
assertTrue(fs.getFolder("src/main").exists());
assertTrue(fs.getFile("src/main/MyClass1.java").exists());
assertTrue(fs.getFile("src/main/MyClass2.java").exists());
assertTrue(fs.getFile("src/main/resources/org/MyClass3.java").exists());
assertTrue(fs.getFile("src/main/resources/org/MyClass4.java").exists());
assertTrue(fs.getFile("src/main/resources/org/domain/MyClass4.java").exists());
fs.remove(fs.getFolder("src/main"));
assertFalse(fs.getFolder("src/main").exists());
assertFalse(fs.getFile("src/main/MyClass1.java").exists());
assertFalse(fs.getFile("src/main/MyClass2.java").exists());
assertFalse(fs.getFile("src/main/resources/org/MyClass3.java").exists());
assertFalse(fs.getFile("src/main/resources/org/MyClass4.java").exists());
assertFalse(fs.getFile("src/main/resources/org/domain/MyClass4.java").exists());
}
use of org.drools.compiler.compiler.io.FileSystem in project drools by kiegroup.
the class MemoryFileTest method testFilePath.
@Test
public void testFilePath() {
FileSystem fs = new MemoryFileSystem();
Folder mres = fs.getFolder("src/main/java/org/domain");
File f1 = mres.getFile("MyClass.java");
assertEquals("src/main/java/org/domain/MyClass.java", f1.getPath().asString());
}
Aggregations