Package org.airavata.appcatalog.cpi

Examples of org.airavata.appcatalog.cpi.ApplicationDeployment


     */
    @Override
    public Map<String, String> getAvailableAppInterfaceComputeResources(String appInterfaceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
        try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ApplicationDeployment applicationDeployment = appCatalog.getApplicationDeployment();
            Map<String, String> allComputeResources = appCatalog.getComputeResource().getAllComputeResourceIdList();
            Map<String, String> availableComputeResources = new HashMap<String, String>();
            ApplicationInterfaceDescription applicationInterface =
                    appCatalog.getApplicationInterface().getApplicationInterface(appInterfaceId);
            HashMap<String, String> filters = new HashMap<String,String>();
            List<String> applicationModules = applicationInterface.getApplicationModules();
            if (applicationModules != null && !applicationModules.isEmpty()){
                for (String moduleId : applicationModules) {
                    filters.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, moduleId);
                    List<ApplicationDeploymentDescription> applicationDeployments =
                            applicationDeployment.getApplicationDeployements(filters);
                    for (ApplicationDeploymentDescription deploymentDescription : applicationDeployments) {
                        availableComputeResources.put(deploymentDescription.getComputeHostId(),
                                allComputeResources.get(deploymentDescription.getComputeHostId()));
                    }
                }
View Full Code Here


        initialize.stopDerbyServer();
    }

    @Test
    public void testAppDeployment () throws Exception {
        ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
        ApplicationInterface appInt = appcatalog.getApplicationInterface();
        ComputeResource computeRs = appcatalog.getComputeResource();
        ComputeResourceDescription cm = new ComputeResourceDescription();
        cm.setHostName("localhost");
        cm.setResourceDescription("test compute host");
        String hostId = computeRs.addComputeResource(cm);

        ApplicationModule module = new ApplicationModule();
        module.setAppModuleName("WRF");
        module.setAppModuleVersion("1.0.0");
        String wrfModuleId = appInt.addApplicationModule(module);

        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
        description.setAppModuleId(wrfModuleId);
        description.setComputeHostId(hostId);
        description.setExecutablePath("/home/a/b/c");
        description.setAppDeploymentDescription("test app deployment");
        description.addToModuleLoadCmds("cmd1");
        description.addToModuleLoadCmds("cmd2");

        List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();
        libPrepandPaths.add(createSetEnvPath("name1", "val1"));
        libPrepandPaths.add(createSetEnvPath("name2", "val2"));
        description.setLibPrependPaths(libPrepandPaths);
        List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>();
        libApendPaths.add(createSetEnvPath("name3", "val3"));
        libApendPaths.add(createSetEnvPath("name4", "val4"));
        description.setLibAppendPaths(libApendPaths);
        List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>();
        appEvns.add(createSetEnvPath("name5", "val5"));
        appEvns.add(createSetEnvPath("name6", "val6"));
        description.setSetEnvironment(appEvns);

        String appDepId = appDep.addApplicationDeployment(description);
        ApplicationDeploymentDescription app = null;
        if (appDep.isAppDeploymentExists(appDepId)){
            app = appDep.getApplicationDeployement(appDepId);
            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
        }

        description.setAppDeploymentDescription("test app deployment2");
        appDep.updateApplicationDeployment(appDepId, description);

        if (appDep.isAppDeploymentExists(appDepId)){
            app = appDep.getApplicationDeployement(appDepId);
            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
        }

        Map<String, String> moduleIdFilter = new HashMap<String, String>();
        moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId);
        List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter);
        System.out.println("******** Size of App deployments for module *********** : " + applicationDeployements.size());
        Map<String, String> hostFilter = new HashMap<String, String>();
        hostFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, hostId);
        List<ApplicationDeploymentDescription> applicationDeployementsForHost = appDep.getApplicationDeployements(hostFilter);
        System.out.println("******** Size of App deployments for host *********** : " + applicationDeployementsForHost.size());

        List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds();
        System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size());

        List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements();
        System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size());

        assertTrue("App interface saved successfully", app != null);
    }
View Full Code Here

TOP

Related Classes of org.airavata.appcatalog.cpi.ApplicationDeployment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.