use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.
the class FileControllerTest method testRename.
@Test
public void testRename() throws FileException {
TestDirectory testDirectory = new TestDirectory();
testDirectory.setParent("/");
testDirectory.setPath("/directory1");
testDirectory.setName("directory1");
fileController.getFiles(testDirectory, "", true);
TestFile testFile = new TestFile();
testFile.setParent("/directory1");
testFile.setName("file1");
testFile.setPath("/directory1/file1");
TestFile newFile = (TestFile) fileController.rename(testFile, "/directory1/file1new", true).getData();
Assert.assertEquals("file1new", newFile.getName());
Assert.assertEquals("/directory1/file1new", newFile.getPath());
Assert.assertTrue(fileController.fileCache.fileExists(testDirectory, "/directory1/file1new"));
Assert.assertFalse(fileController.fileCache.fileExists(testDirectory, "/directory1/file1"));
}
use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.
the class FileControllerTest method testFileExists.
@Test
public void testFileExists() {
TestDirectory testDirectory = new TestDirectory();
testDirectory.setPath("/directory1");
Assert.assertTrue(fileController.fileExists(testDirectory, "/directory1/file1"));
Assert.assertFalse(fileController.fileExists(testDirectory, "/directory1/file5"));
}
use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.
the class FileControllerTest method testGetFilesCache.
@Test
public void testGetFilesCache() throws FileException {
TestDirectory testDirectory = new TestDirectory();
testDirectory.setPath("/");
List<File> files = fileController.getFiles(testDirectory, "", true);
Assert.assertEquals(8, files.size());
Assert.assertTrue(fileController.fileCache.containsKey(testDirectory));
Assert.assertEquals(8, fileController.fileCache.getFiles(testDirectory).size());
}
use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.
the class FileControllerTest method testCopy.
@Test
public void testCopy() throws FileException {
TestDirectory testDirectory = new TestDirectory();
testDirectory.setParent("/");
testDirectory.setPath("/directory1");
testDirectory.setName("directory1");
fileController.getFiles(testDirectory, "", true);
TestDirectory testDirectory4 = new TestDirectory();
testDirectory4.setParent("/");
testDirectory4.setPath("/directory4");
testDirectory4.setName("directory4");
fileController.getFiles(testDirectory4, "", true);
TestFile testFile = new TestFile();
testFile.setParent("/directory1");
testFile.setName("file1");
testFile.setPath("/directory1/file1");
TestFile newFile = (TestFile) fileController.copyFile(testFile, testDirectory4, "/directory4/file1", true).getData();
Assert.assertEquals("file1", newFile.getName());
Assert.assertEquals("/directory4/file1", newFile.getPath());
Assert.assertTrue(fileController.fileCache.fileExists(testDirectory, "/directory1/file1"));
Assert.assertTrue(fileController.fileCache.fileExists(testDirectory4, "/directory4/file1"));
}
use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.
the class FileControllerTest method testMove.
@Test
public void testMove() throws FileException {
TestDirectory testDirectory = new TestDirectory();
testDirectory.setParent("/");
testDirectory.setPath("/directory1");
testDirectory.setName("directory1");
fileController.getFiles(testDirectory, "", true);
TestDirectory testDirectory4 = new TestDirectory();
testDirectory4.setParent("/");
testDirectory4.setPath("/directory4");
testDirectory4.setName("directory4");
fileController.getFiles(testDirectory4, "", true);
TestFile testFile = new TestFile();
testFile.setParent("/directory1");
testFile.setName("file1");
testFile.setPath("/directory1/file1");
TestFile newFile = (TestFile) fileController.moveFile(testFile, testDirectory4, "/directory4/file1", true).getData();
Assert.assertEquals("file1", newFile.getName());
Assert.assertEquals("/directory4/file1", newFile.getPath());
Assert.assertFalse(fileController.fileCache.fileExists(testDirectory, "/directory1/file1"));
Assert.assertTrue(fileController.fileCache.fileExists(testDirectory4, "/directory4/file1"));
}
Aggregations