use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class DataRetrievalIT method setUp.
@BeforeTest
public void setUp() throws Exception {
init();
authzToken = new AuthzToken("empty token");
experimentDataList = new ArrayList<String[]>();
addApplications();
addProjects();
log.info("Setup Experiments");
log.info("=================");
for (int i = 1; i <= NUM_OF_EXPERIMENTS; i++) {
// we are using the last user or project to test data empty scenarios
String user = users[(new Random()).nextInt(users.length)];
String project = projectIds.get((new Random()).nextInt(projectIds.size() - 1));
String experimentId = runExperiment(user, project);
experimentDataList.add(new String[] { experimentId, user, project });
log.info("Running experiment " + i + " of " + NUM_OF_EXPERIMENTS + " - " + experimentId);
}
}
use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class SimpleEchoIT method setUp.
@BeforeTest
public void setUp() throws Exception {
// Thread.sleep(20000);
init();
authzToken = new AuthzToken("empty token");
}
use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class WorkflowIntegrationTestBase method setUpEnvironment.
public void setUpEnvironment() throws Exception {
log("..................Validating myproxy username, password set properly .............................");
System.setProperty("myproxy.user", "ogce");
System.setProperty("myproxy.password", "/Users/chathuri/dev/airavata/cert/certificates");
System.setProperty("trusted.cert.location", "/Users/chathuri/dev/airavata/cert/certificates");
String myProxyUserName = System.getProperty("myproxy.user");
String myProxyPassword = System.getProperty("myproxy.password");
String certLocation = System.getProperty("trusted.cert.location");
authzToken = new AuthzToken("empty token");
if (myProxyUserName == null || myProxyPassword == null || certLocation == null) {
log.error(">>>>>> Please run tests with my proxy user name, password and grid cert location. " + "E.g :- mvn clean install -Duser=xxx -Dpwd=xxx -Dcert=/path<<<<<<<");
throw new Exception("Need my proxy user name password to run tests.");
} else {
ServerSettings.setSetting(MYPROXY_USER_NAME, myProxyUserName);
ServerSettings.setSetting(MYPROXY_PWD, myProxyPassword);
ServerSettings.setSetting(CERT_LOCATION, certLocation);
ServerSettings.setSetting(Constants.IS_API_SECURED, "false");
}
}
use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class CreateLaunchExperiment method createEchoExperimentForStampede.
// public static String createExperimentForSSHHost(Airavata.Client client) throws TException {
// try {
// List<OutputDataObjectType> exInputs = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType input = new OutputDataObjectType();
// input.setName("echo_input");
// input.setType(DataType.STRING);
// input.setValue("Echoed_Output=Hello World");
// exInputs.add(input);
//
// List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType output = new OutputDataObjectType();
// output.setName("Echoed_Output");
// output.setType(DataType.STRING);
// output.setValue("");
// exOut.add(output);
//
// Project project = ProjectModelUtil.createProject("default", "admin", "test project");
// String projectId = client.createProject(project);
//
// ExperimentModel simpleExperiment =
// ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SSHEcho1", sshHostAppId.split(",")[1], exInputs);
// simpleExperiment.setExperimentOutputs(exOut);
//
// ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(sshHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128");
// scheduling.setResourceHostId("gw111.iu.xsede.org");
// UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
// userConfigurationData.setAiravataAutoSchedule(false);
// userConfigurationData.setOverrideManualScheduledParams(false);
// userConfigurationData.setComputationalResourceScheduling(scheduling);
// simpleExperiment.setUserConfigurationData(userConfigurationData);
// return client.createExperiment(simpleExperiment);
// } catch (AiravataSystemException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new AiravataSystemException(e);
// } catch (InvalidRequestException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new InvalidRequestException(e);
// } catch (AiravataClientException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new AiravataClientException(e);
// } catch (TException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new TException(e);
// }
// }
public static String createEchoExperimentForStampede(Airavata.Client client) throws TException {
try {
List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), echoAppId);
// for (InputDataObjectType inputDataObjectType : exInputs) {
// if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo")) {
// inputDataObjectType.setValue("Hello World");
// }
// }
// List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
Project project = ProjectModelUtil.createProject("default", "admin", "test project");
String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "echoExperiment", "SimpleEcho3", echoAppId, exInputs);
// simpleExperiment.setExperimentOutputs(exOut);
Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), echoAppId);
if (computeResources != null && computeResources.size() != 0) {
for (String id : computeResources.keySet()) {
String resourceName = computeResources.get(id);
if (resourceName.equals(stampedeHostName)) {
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 30, 1);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
}
}
}
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
return null;
}
use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.
the class CreateLaunchExperiment method getExperiment.
public static void getExperiment(Airavata.Client client, String expId) throws Exception {
try {
ExperimentModel experiment = client.getExperiment(new AuthzToken(""), expId);
List<ErrorModel> errors = experiment.getErrors();
if (errors != null && !errors.isEmpty()) {
for (ErrorModel error : errors) {
System.out.println("ERROR MESSAGE : " + error.getActualErrorMessage());
}
}
} catch (ExperimentNotFoundException e) {
logger.error("Experiment does not exist", e);
throw new ExperimentNotFoundException("Experiment does not exist");
} catch (AiravataSystemException e) {
logger.error("Error while retrieving experiment", e);
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
} catch (InvalidRequestException e) {
logger.error("Error while retrieving experiment", e);
throw new InvalidRequestException("Error while retrieving experiment");
} catch (AiravataClientException e) {
logger.error("Error while retrieving experiment", e);
throw new AiravataClientException(AiravataErrorType.INTERNAL_ERROR);
}
}
Aggregations