initialize.stopDerbyServer();
}
@Test
public void gatewayProfileTest() throws Exception {
GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
GatewayResourceProfile gf = new GatewayResourceProfile();
gf.setGatewayName("test");
gf.setGatewayDescription("test gateway");
ComputeResource computeRs = appcatalog.getComputeResource();
ComputeResourceDescription cm1 = new ComputeResourceDescription();
cm1.setHostName("localhost");
cm1.setResourceDescription("test compute host");
String hostId1 = computeRs.addComputeResource(cm1);
ComputeResourceDescription cm2 = new ComputeResourceDescription();
cm2.setHostName("localhost");
cm2.setResourceDescription("test compute host");
String hostId2 = computeRs.addComputeResource(cm2);
ComputeResourcePreference preference1 = new ComputeResourcePreference();
preference1.setComputeResourceId(hostId1);
preference1.setOverridebyAiravata(true);
preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH.toString());
preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP.toString());
preference1.setPreferredBatchQueue("queue1");
preference1.setScratchLocation("/tmp");
preference1.setAllocationProjectNumber("project1");
ComputeResourcePreference preference2 = new ComputeResourcePreference();
preference2.setComputeResourceId(hostId2);
preference2.setOverridebyAiravata(true);
preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL.toString());
preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP.toString());
preference2.setPreferredBatchQueue("queue2");
preference2.setScratchLocation("/tmp");
preference2.setAllocationProjectNumber("project2");
List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>();
list.add(preference1);
list.add(preference2);
gf.setComputeResourcePreferences(list);
String gwId = gatewayProfile.addGatewayResourceProfile(gf);
GatewayResourceProfile retrievedProfile = null;
if (gatewayProfile.isGatewayResourceProfileExists(gwId)){
retrievedProfile = gatewayProfile.getGatewayProfile(gwId);
System.out.println("************ gateway name ************** :" + retrievedProfile.getGatewayName());
}
List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId);
System.out.println("compute preferences size : " + preferences.size());
if (preferences != null && !preferences.isEmpty()){
for (ComputeResourcePreference cm : preferences){
System.out.println("******** host id ********* : " + cm.getComputeResourceId());
System.out.println(cm.getPreferredBatchQueue());