Search in sources :

Example 16 with IDataSpaceClient

use of org.ow2.proactive.scheduler.rest.ds.IDataSpaceClient in project scheduling by ow2-proactive.

the class DataTransferTest method testListFilesRecursiveWithPattern.

@Test
public void testListFilesRecursiveWithPattern() throws Exception {
    System.out.println("testListFilesRecursiveWithPattern");
    createFilesInUserSpace("testListFilesRecursiveWithPattern");
    // use standard client
    IDataSpaceClient client = clientInstance();
    RemoteSource source = new RemoteSource(USER, "testListFilesRecursiveWithPattern");
    source.setIncludes("**/*.tmp");
    ListFile listFile = client.list(source);
    List<String> directories = listFile.getDirectoryListing();
    System.out.println("Directories : " + directories);
    assertEquals(0, directories.size());
    List<String> files = listFile.getFileListing();
    System.out.println("Files : " + files);
    assertEquals(1, files.size());
    assertEquals(TEMP_FILE_TMP_PATH, files.get(0));
    // use RemoteSpace API
    List<String> foundFiles = client.getUserSpace().listFiles("testListFilesRecursiveWithPattern", "**/*.tmp");
    System.out.println("Full : " + foundFiles);
    assertEquals(1, foundFiles.size());
    assertArrayEquals(new String[] { TEMP_FILE_TMP_PATH }, foundFiles.toArray(new String[0]));
}
Also used : ListFile(org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile) Test(org.junit.Test)

Aggregations

ListFile (org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile)15 Test (org.junit.Test)13 File (java.io.File)12 URI (java.net.URI)3 ConnectionInfo (org.ow2.proactive.authentication.ConnectionInfo)1