Search in sources :

Example 6 with TestDirectory

use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.

the class FileControllerTest method testGetNewName.

@Test
public void testGetNewName() {
    TestDirectory testDirectory = new TestDirectory();
    testDirectory.setPath("/directory1");
    String newName = (String) fileController.getNewName(testDirectory, "/directory1/file1").getData();
    Assert.assertEquals("/directory1/file1 1", newName);
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) Test(org.junit.Test)

Example 7 with TestDirectory

use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.

the class TestFileProvider method copy.

@Override
public TestFile copy(TestFile file, String toPath, boolean overwrite) throws FileException {
    TestFile findFile = findFile(file);
    if (findFile != null) {
        String parent = toPath.substring(0, toPath.lastIndexOf("/"));
        if (findFile instanceof TestDirectory) {
            TestDirectory newDirectory = TestDirectory.create(findFile.getName(), toPath, parent);
            testFileSystem.get(newDirectory.getParent()).add(newDirectory);
            return newDirectory;
        } else {
            TestFile newFile = TestFile.create(findFile.getName(), toPath, parent);
            testFileSystem.get(newFile.getParent()).add(newFile);
            return newFile;
        }
    }
    return null;
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestFile(org.pentaho.di.plugins.fileopensave.providers.model.TestFile)

Example 8 with TestDirectory

use of org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory in project pentaho-kettle by pentaho.

the class TestFileProvider method getTree.

@Override
public Tree getTree() {
    TestTree testTree = new TestTree(NAME);
    TestDirectory testDirectory = new TestDirectory();
    testDirectory.setPath("/");
    testTree.setFiles(getFiles(testDirectory, null));
    return testTree;
}
Also used : TestDirectory(org.pentaho.di.plugins.fileopensave.providers.model.TestDirectory) TestTree(org.pentaho.di.plugins.fileopensave.providers.model.TestTree)

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