Skip to content
Snippets Groups Projects
Commit abcc786f authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

fix filename

parent 0687d174
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ import cz.it4i.fiji.haas_java_client.proxy.UserAndLimitationManagementWsSoap; ...@@ -39,7 +39,7 @@ import cz.it4i.fiji.haas_java_client.proxy.UserAndLimitationManagementWsSoap;
import cz.it4i.fiji.scpclient.ScpClient; import cz.it4i.fiji.scpclient.ScpClient;
public class HaaSClient { public class HaaSClient {
static public class SynchronizableFiles { static public class SynchronizableFiles {
private Collection<TaskFileOffsetExt> files = new LinkedList<>(); private Collection<TaskFileOffsetExt> files = new LinkedList<>();
...@@ -110,7 +110,7 @@ public class HaaSClient { ...@@ -110,7 +110,7 @@ public class HaaSClient {
WS_STATE2STATE = Collections.unmodifiableMap(map); WS_STATE2STATE = Collections.unmodifiableMap(map);
} }
public HaaSClient(Long templateId, Integer timeOut,Long clusterNodeType, String projectId) { public HaaSClient(Long templateId, Integer timeOut, Long clusterNodeType, String projectId) {
super(); super();
this.templateId = templateId; this.templateId = templateId;
this.timeOut = timeOut; this.timeOut = timeOut;
...@@ -131,10 +131,10 @@ public class HaaSClient { ...@@ -131,10 +131,10 @@ public class HaaSClient {
for (Path file : files) { for (Path file : files) {
System.out.println("Uploading file: " + file.getFileName()); System.out.println("Uploading file: " + file.getFileName());
String destFile = fileTransfer.getSharedBasepath() + "/" ; String destFile = "'" + fileTransfer.getSharedBasepath() + "/" + file.getFileName() + "'";
boolean result = scpClient.upload(file, destFile); boolean result = scpClient.upload(file, destFile);
System.out.println(result?"File uploaded.":"File not uploaded"); System.out.println(result ? "File uploaded." : "File not uploaded");
if(!result) { if (!result) {
throw new HaaSClientException("Uploading of " + file + " to " + destFile + " failed"); throw new HaaSClientException("Uploading of " + file + " to " + destFile + " failed");
} }
} }
...@@ -191,16 +191,16 @@ public class HaaSClient { ...@@ -191,16 +191,16 @@ public class HaaSClient {
for (String fileName : getFileTransfer().listChangedFilesForJob(jobId, getSessionID())) { for (String fileName : getFileTransfer().listChangedFilesForJob(jobId, getSessionID())) {
fileName = fileName.replaceFirst("/", ""); fileName = fileName.replaceFirst("/", "");
Path rFile = workDirectory.resolve(fileName); Path rFile = workDirectory.resolve(fileName);
if(!Files.exists(rFile.getParent())) { if (!Files.exists(rFile.getParent())) {
Files.createDirectories(rFile.getParent()); Files.createDirectories(rFile.getParent());
} }
String fileToDownload = ft.getSharedBasepath() + "/" + fileName; String fileToDownload = "'" + ft.getSharedBasepath() + "/" + fileName + "'";
scpClient.download(fileToDownload, rFile); scpClient.download(fileToDownload, rFile);
} }
} }
getFileTransfer().endFileTransfer(jobId, ft, getSessionID()); getFileTransfer().endFileTransfer(jobId, ft, getSessionID());
} catch (IOException | JSchException | ServiceException e) { } catch (IOException | JSchException | ServiceException e) {
throw new HaaSClientException(e); throw new HaaSClientException(e);
} }
......
...@@ -17,8 +17,8 @@ public class TestHaaSJavaClientWithSPIM { ...@@ -17,8 +17,8 @@ public class TestHaaSJavaClientWithSPIM {
HaaSClient client = new HaaSClient(2l, 9600, 6l, "DD-17-31"); HaaSClient client = new HaaSClient(2l, 9600, 6l, "DD-17-31");
Path baseDir = Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa"); Path baseDir = Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa");
long jobId = client.start(getAllFiles(baseDir.resolve("spim-data")), "TestOutRedirect", long jobId = client.start(getAllFiles(baseDir.resolve("spim-data")), "TestOutRedirect",
Collections.emptyList()); Collections.emptyList());
Path workDir = baseDir.resolve("" + jobId); Path workDir = baseDir.resolve("" + jobId);
if (!Files.isDirectory(workDir)) { if (!Files.isDirectory(workDir)) {
Files.createDirectories(workDir); Files.createDirectories(workDir);
...@@ -49,7 +49,7 @@ public class TestHaaSJavaClientWithSPIM { ...@@ -49,7 +49,7 @@ public class TestHaaSJavaClientWithSPIM {
} }
private static Iterable<Path> getAllFiles(Path resolve) { private static Iterable<Path> getAllFiles(Path resolve) {
return () -> { return () -> {
try { try {
return Files.newDirectoryStream(resolve).iterator(); return Files.newDirectoryStream(resolve).iterator();
......
import java.io.IOException;
import java.nio.file.Paths;
import com.jcraft.jsch.JSchException;
import cz.it4i.fiji.scpclient.ScpClient;
public class TestSCP {
public TestSCP() {
}
public static void main(String[] args) throws JSchException, IOException {
try(ScpClient scp = new ScpClient("salomon.it4i.cz", "koz01", "/home/koz01/.ssh/it4i_rsa-np", null)) {
System.out.println( scp.upload(Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa/spim-data/exampleSingleChannel(9).czi"), "'/home/koz01/exampleSingleChannel(9).czi'"));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment