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