@Test(groups = { "echoGroup" }/* , dependsOnMethods = { "testEchoService" } */)
public void testUpdateEchoService() throws Exception {
DescriptorBuilder descriptorBuilder = airavataAPI.getDescriptorBuilder();
HostDescription hostDescription = descriptorBuilder.buildHostDescription(HostDescriptionType.type, "localhost",
"127.0.0.1");
log("Trying to add host description ....");
try {
airavataAPI.getApplicationManager().addHostDescription(hostDescription);
Assert.fail("Host Descriptor should already exists and should go to update.");
} catch (DescriptorRecordAlreadyExistsException e) {
log("Updating host description ....");
airavataAPI.getApplicationManager().updateHostDescription(hostDescription);
}
Assert.assertTrue(airavataAPI.getApplicationManager().isHostDescriptorExists(
hostDescription.getType().getHostName()));
List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
inputParameters.add(descriptorBuilder.buildInputParameterType("echo_input", "echo input", DataType.STRING));
List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
outputParameters.add(descriptorBuilder.buildOutputParameterType("echo_output", "Echo output", DataType.STRING));
ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("Echo", "Echo service",
inputParameters, outputParameters);
log("Adding service description ...");
try {
airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
Assert.fail("Service Descriptor should already exists and should go to update.");
} catch (DescriptorRecordAlreadyExistsException e) {
log("Updating service description ....");
airavataAPI.getApplicationManager().updateServiceDescription(serviceDescription);
}
Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
serviceDescription.getType().getName()));
// Deployment descriptor
ApplicationDescription applicationDeploymentDescription = descriptorBuilder
.buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");
log("Adding deployment description ...");
try {
airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
applicationDeploymentDescription);
Assert.fail("Application Descriptor should already exists and should go to update.");
} catch (DescriptorRecordAlreadyExistsException e) {
log("Updating application description ....");
airavataAPI.getApplicationManager().updateApplicationDescription(serviceDescription, hostDescription,
applicationDeploymentDescription);
}
Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
serviceDescription.getType().getName(), hostDescription.getType().getHostName(),
applicationDeploymentDescription.getType().getApplicationName().getStringValue()));
log("Saving workflow ...");
Workflow workflow = new Workflow(getWorkflowComposeContent("src/test/resources/EchoWorkflow.xwf"));