88 lines
2.2 KiB
Java
88 lines
2.2 KiB
Java
/**
|
|
*
|
|
*/
|
|
package org.gcube.common.workspacetaskexecutor;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
|
|
import org.gcube.common.workspacetaskexecutor.shared.ItemNotExecutableException;
|
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.AlgorithmConfiguration;
|
|
|
|
|
|
/**
|
|
*
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
* Apr 26, 2018
|
|
*/
|
|
public class TestDataMinerTaskExecutor {
|
|
|
|
|
|
public static String USERNAME = "francesco.mangiacrapa";
|
|
public static String SCOPE = "/gcube/devsec";
|
|
|
|
public static String WORKSPACE_FOLDER_ID = "f5c2f5ab-5c35-4418-8e60-d48d173538ed";
|
|
|
|
public static void main(String[] args) {
|
|
|
|
ScopeProvider.instance.set(SCOPE);
|
|
WorkspaceDataMinerTaskExecutor exec = WorkspaceDataMinerTaskExecutor.getInstance();
|
|
exec.withOwner(USERNAME);
|
|
|
|
try {
|
|
exec.removeTaskConfig(WORKSPACE_FOLDER_ID);
|
|
exec.checkItemExecutable(WORKSPACE_FOLDER_ID);
|
|
}
|
|
catch (ItemNotExecutableException e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
|
|
System.out.println("The item is not executable...");
|
|
}
|
|
catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
AlgorithmConfiguration config = createDummyConfiguration();
|
|
exec.setTaskConfig(config);
|
|
}
|
|
catch (ItemNotExecutableException e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
|
|
|
|
try {
|
|
AlgorithmConfiguration conf = exec.checkItemExecutable(WORKSPACE_FOLDER_ID);
|
|
|
|
System.out.println("The conf is: "+conf);
|
|
}
|
|
catch (ItemNotExecutableException e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
public static AlgorithmConfiguration createDummyConfiguration(){
|
|
Map<String, String> mapParameters = new HashMap<String, String>();
|
|
mapParameters.put("publiclink", "this is the public link");
|
|
return new AlgorithmConfiguration("this is the task id", "this is the task description", "my token", WORKSPACE_FOLDER_ID, mapParameters);
|
|
}
|
|
}
|
|
|