Search in sources :

Example 1 with TestDirectory

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"));
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestFile(org.pentaho.di.plugins.fileopensave.providers.model.TestFile) Test(org.junit.Test)

Example 2 with TestDirectory

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"));
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) Test(org.junit.Test)

Example 3 with TestDirectory

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());
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestFile(org.pentaho.di.plugins.fileopensave.providers.model.TestFile) File(org.pentaho.di.plugins.fileopensave.api.providers.File) Test(org.junit.Test)

Example 4 with TestDirectory

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"));
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestFile(org.pentaho.di.plugins.fileopensave.providers.model.TestFile) Test(org.junit.Test)

Example 5 with TestDirectory

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"));
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestFile(org.pentaho.di.plugins.fileopensave.providers.model.TestFile) Test(org.junit.Test)

Aggregations

TestDirectory (org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory)8 Test (org.junit.Test)6 TestFile (org.pentaho.di.plugins.fileopensave.providers.model.TestFile)5 File (org.pentaho.di.plugins.fileopensave.api.providers.File)1 TestTree (org.pentaho.di.plugins.fileopensave.providers.model.TestTree)1