Search in sources :

Example 6 with RemoteDestination

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

the class DataTransferTest method testUploadSelectedFilesUsingGlobPattern.

@Test
public void testUploadSelectedFilesUsingGlobPattern() throws Exception {
    TestFilesToUploadCreator testFiles = new TestFilesToUploadCreator().invoke();
    File tempTextFile = testFiles.getTempTextFile();
    File tempFile = testFiles.getTempFile();
    // use standard client
    IDataSpaceClient client = clientInstance();
    LocalDirSource source = new LocalDirSource(tmpDir.getRoot());
    source.setIncludes("*.txt");
    RemoteDestination dest = new RemoteDestination(USER, "testUploadSelectedFilesUsingGlobPattern");
    assertTrue(client.upload(source, dest));
    String destRootUri = URI.create(getScheduler().getUserSpaceURIs().get(0)).getPath();
    File[] destRootFiles = new File(destRootUri, "testUploadSelectedFilesUsingGlobPattern").listFiles();
    assertEquals(1, destRootFiles.length);
    assertTrue(Files.equal(tempTextFile, destRootFiles[0]));
    // use RemoteSpace API
    FileUtils.deleteDirectory(new File(destRootUri, "testUploadSelectedFilesUsingGlobPattern"));
    client.getUserSpace().pushFiles(tmpDir.getRoot(), "*.txt", "testUploadSelectedFilesUsingGlobPattern");
    destRootFiles = new File(destRootUri, "testUploadSelectedFilesUsingGlobPattern").listFiles();
    assertEquals(1, destRootFiles.length);
    assertTrue(Files.equal(tempTextFile, destRootFiles[0]));
}
Also used : ListFile(org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)5 ListFile (org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile)5 Test (org.junit.Test)4 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)1 Task (org.ow2.proactive.scheduler.common.task.Task)1 InputSelector (org.ow2.proactive.scheduler.common.task.dataspaces.InputSelector)1 LocalDirSource (org.ow2.proactive.scheduler.rest.ds.LocalDirSource)1 RemoteDestination (org.ow2.proactive.scheduler.rest.ds.RemoteDestination)1 AwaitedTask (org.ow2.proactive.scheduler.smartproxy.common.AwaitedTask)1