Package org.apache.airavata.client.api.builder

Examples of org.apache.airavata.client.api.builder.DescriptorBuilder


    }

    @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 (DescriptorAlreadyExistsException 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 (DescriptorAlreadyExistsException e) {

            log("Updating service description ....");
            airavataAPI.getApplicationManager().updateServiceDescription(serviceDescription);
        }

        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", OsUtils.getEchoExecutable(), OsUtils.getTempFolderPath());

        log("Adding deployment description ...");
        try {
            airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
View Full Code Here


        executeExperiment("src/test/resources/ForEachEchoWorkflow.xwf", Arrays.asList("10,20", "30,40"), Arrays.asList("10,30", "20,40"));
    }

    private void setupDescriptors() throws AiravataAPIInvocationException,
            DescriptorAlreadyExistsException, IOException {
        DescriptorBuilder descriptorBuilder = airavataAPI.getDescriptorBuilder();
        HostDescription hostDescription = descriptorBuilder.buildHostDescription(HostDescriptionType.type, "localhost2",
                "127.0.0.1");

        log("Adding host description ....");
        addHostDescriptor(hostDescription);
        Assert.assertTrue(airavataAPI.getApplicationManager().isHostDescriptorExists(hostDescription.getType().getHostName()));

        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        inputParameters.add(descriptorBuilder.buildInputParameterType("data1", "data1", DataType.STRING));
        inputParameters.add(descriptorBuilder.buildInputParameterType("data2", "data2", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("out", "out", DataType.STD_OUT));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("comma_app", "comma_app",
                inputParameters, outputParameters);

        ServiceDescription serviceDescription2 = descriptorBuilder.buildServiceDescription("echo_app", "echo_app",
                inputParameters, outputParameters);

        log("Adding service description ...");
        addServiceDescriptor(serviceDescription, "comma_app");
        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        addServiceDescriptor(serviceDescription2, "echo_app");
        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription2.getType().getName()));

        // Deployment descriptor
        File executable;
        if (OsUtils.isWindows()) {
            executable = getFile("src/test/resources/comma_data.bat");
        } else {
            executable = getFile("src/test/resources/comma_data.sh");
            Runtime.getRuntime().exec("chmod +x " + executable.getAbsolutePath());
        }

        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("comma_app_localhost", executable.getAbsolutePath(), OsUtils.getTempFolderPath());
        ApplicationDescription applicationDeploymentDescription2 = descriptorBuilder
                .buildApplicationDeploymentDescription("echo_app_localhost", OsUtils.getEchoExecutable(), OsUtils.getTempFolderPath());

        log("Adding deployment description ...");
        addApplicationDescriptor(applicationDeploymentDescription, serviceDescription, hostDescription, "comma_app_localhost");
View Full Code Here

        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getAiravataServerUrl()), getGatewayName(),
                getAiravataServerUser(),
                getPasswordCallback());

        // Initialize descriptor builder
        DescriptorBuilder descriptorBuilder = airavataAPI.getDescriptorBuilder();

        // Create host description
        HostDescription hostDescription = descriptorBuilder.buildHostDescription(GlobusHostType.type,
                executionParameters.getHostName(), executionParameters.getHostAddress());

        ((GlobusHostType)hostDescription.getType()).
                setGlobusGateKeeperEndPointArray(new String[]{executionParameters.getGateKeeperAddress()});
        ((GlobusHostType)hostDescription.getType()).
                setGridFTPEndPointArray(new String[]{executionParameters.getGridftpAddress()}); //TODO do we really need this ?

        log("Adding host description ....");

        try {
            airavataAPI.getApplicationManager().addHostDescription(hostDescription);
        } catch (DescriptorAlreadyExistsException e) {
            airavataAPI.getApplicationManager().updateHostDescription(hostDescription);
        }


        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 {
View Full Code Here

TOP

Related Classes of org.apache.airavata.client.api.builder.DescriptorBuilder

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.