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]));
}
Aggregations