Search in sources :

Example 16 with RemoteSpace

use of org.ow2.proactive.scheduler.common.task.dataspaces.RemoteSpace 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)13 File (java.io.File)11 Test (org.junit.Test)11 RemoteSpace (org.ow2.proactive.scheduler.common.task.dataspaces.RemoteSpace)3 SchedulerNodeClient (org.ow2.proactive.scheduler.task.client.SchedulerNodeClient)3 VariablesMap (org.ow2.proactive.scheduler.task.utils.VariablesMap)3 ScriptHandler (org.ow2.proactive.scripting.ScriptHandler)3 Serializable (java.io.Serializable)2 HashMap (java.util.HashMap)2 Stopwatch (com.google.common.base.Stopwatch)1 URI (java.net.URI)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 LoginException (javax.security.auth.login.LoginException)1 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)1 DataSpaceNodeClient (org.ow2.proactive.scheduler.task.client.DataSpaceNodeClient)1 Decrypter (org.ow2.proactive.scheduler.task.utils.Decrypter)1 TaskLogger (org.ow2.proactive.scheduler.util.TaskLogger)1 ScriptResult (org.ow2.proactive.scripting.ScriptResult)1