Search in sources :

Example 1 with GwyResourceProfile

use of org.apache.airavata.registry.cpi.GwyResourceProfile in project airavata by apache.

the class GatewayProfileTest method gatewayProfileTest.

@Test
public void gatewayProfileTest() throws Exception {
    GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
    GatewayResourceProfile gf = new GatewayResourceProfile();
    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);
    preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP);
    preference1.setPreferredBatchQueue("queue1");
    preference1.setScratchLocation("/tmp");
    preference1.setAllocationProjectNumber("project1");
    ComputeResourcePreference preference2 = new ComputeResourcePreference();
    preference2.setComputeResourceId(hostId2);
    preference2.setOverridebyAiravata(true);
    preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL);
    preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP);
    preference2.setPreferredBatchQueue("queue2");
    preference2.setScratchLocation("/tmp");
    preference2.setAllocationProjectNumber("project2");
    List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>();
    list.add(preference1);
    list.add(preference2);
    gf.setComputeResourcePreferences(list);
    gf.setGatewayID("testGateway");
    String gwId = gatewayProfile.addGatewayResourceProfile(gf);
    GatewayResourceProfile retrievedProfile = null;
    if (gatewayProfile.isGatewayResourceProfileExists(gwId)) {
        retrievedProfile = gatewayProfile.getGatewayProfile(gwId);
        System.out.println("************ gateway id ************** :" + retrievedProfile.getGatewayID());
    }
    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());
            System.out.println(cm.getPreferredDataMovementProtocol());
            System.out.println(cm.getPreferredJobSubmissionProtocol());
        }
    }
    assertTrue("App interface saved successfully", retrievedProfile != null);
}
Also used : ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GwyResourceProfile(org.apache.airavata.registry.cpi.GwyResourceProfile) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) ComputeResourceDescription(org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription) ArrayList(java.util.ArrayList) ComputeResource(org.apache.airavata.registry.cpi.ComputeResource) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)1 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)1 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)1 ComputeResource (org.apache.airavata.registry.cpi.ComputeResource)1 GwyResourceProfile (org.apache.airavata.registry.cpi.GwyResourceProfile)1 Test (org.junit.Test)1