Package org.apache.airavata.commons.gfac.type

Examples of org.apache.airavata.commons.gfac.type.HostDescription


    @Test(groups = { "echoGroup" }, dependsOnGroups = { "setupTests" })
    public void testEchoService() throws Exception {

        DescriptorBuilder descriptorBuilder = airavataAPI.getDescriptorBuilder();

        HostDescription hostDescription = descriptorBuilder.buildHostDescription(HostDescriptionType.type, "localhost",
                "127.0.0.1");

        log("Adding host description ....");
        airavataAPI.getApplicationManager().addHostDescription(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 ...");
        airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");

        log("Adding deployment description ...");
        airavataAPI.getApplicationManager().addApplicationDescription(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"));
        airavataAPI.getWorkflowManager().addWorkflow(workflow);
View Full Code Here


    @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"));

View Full Code Here

            if(contextHeader != null){
                hostName = contextHeader.getSoaServiceEprs().getHostDescriptor();
            }
            //todo This is the basic scheduling, have to do proper scheduling implementation
            ServiceDescription serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(serviceName);
            HostDescription registeredHost = getRegisteredHost(airavataAPI, this.serviceName);
            // if user specify a host, no matter what we pick that host for all the nodes, todo: allow users to specifi node specific host
            if(hostName != null) {
                registeredHost = airavataAPI.getApplicationManager().getHostDescription(hostName);
            }
            ApplicationDescription applicationDescription = airavataAPI.getApplicationManager().getApplicationDescription(serviceName, registeredHost.getType().getHostName());

            // When we run getInParameters we set the actualParameter object, this has to be fixed
            URL resource = EmbeddedGFacInvoker.class.getClassLoader().getResource("gfac-config.xml");
            OMElement inputMessage = getInParameters();
            Object wsifMessageElement = new WSIFMessageElement(XMLUtil.stringToXmlElement3(inputMessage.toStringWithConsume()));
View Full Code Here

        }
        return invoke_inputParams;
    }

    private HostDescription getRegisteredHost(AiravataAPI regService, String serviceName) {
        HostDescription result = null;
        try {
            Map<String, ApplicationDescription> applicationDescriptors = regService.getApplicationManager().getApplicationDescriptors(serviceName);
            for (String hostDescName : applicationDescriptors.keySet()) {
                HostDescription hostDescriptor = regService.getApplicationManager().getHostDescription(hostDescName);
                result = hostDescriptor;
                logger.info("Found service on: " + result.getType().getHostAddress());
            }
        } catch (AiravataAPIInvocationException e) {
            e.printStackTrace();
View Full Code Here

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response addHostDescriptor(HostDescriptor host) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            HostDescription hostDescription = DescriptorUtil.createHostDescription(host);
            airavataRegistry.addHostDescriptor(hostDescription);
            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
            builder.entity("Host descriptor saved successfully...");
            return builder.build();
        } catch (DescriptorAlreadyExistsException e) {
View Full Code Here

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response updateHostDescriptor(HostDescriptor host) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            HostDescription hostDescription = DescriptorUtil.createHostDescription(host);
            airavataRegistry.updateHostDescriptor(hostDescription);
            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
            builder.entity("Host descriptor updated successfully...");
            return builder.build();
        } catch (DescriptorDoesNotExistsException e) {
View Full Code Here

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response getHostDescriptor(@QueryParam("hostName") String hostName) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            HostDescription hostDescription = airavataRegistry.getHostDescriptor(hostName);
            if (hostDescription != null) {
                HostDescriptor hostDescriptor = DescriptorUtil.createHostDescriptor(hostDescription);
                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
                builder.entity(hostDescriptor);
                return builder.build();
View Full Code Here

    applicationContext.setHostDescription(getHostDesc());
    return applicationContext;
  }

  protected HostDescription getHostDesc() {
    HostDescription host = new HostDescription(UnicoreHostType.type);
    host.getType().setHostAddress("zam1161v01.zam.kfa-juelich.de");
    host.getType().setHostName("DEMO-INTEROP-SITE");
    ((UnicoreHostType) host.getType())
        .setUnicoreHostAddressArray(hostArray);
    ((UnicoreHostType) host.getType())
        .setGridFTPEndPointArray(new String[] { gridftpAddress });
    return host;
  }
View Full Code Here

        gFacConfiguration.setOutHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GridFTPOutputHandler"}));
        /*
        * Host
        */
        String serviceName = "Prepare_Model_Reference_Data";
        HostDescription host = new HostDescription(GlobusHostType.type);
        host.getType().setHostName("trestles");
        host.getType().setHostAddress("trestles.sdsc.edu");
        ((GlobusHostType) host.getType()).addGridFTPEndPoint("gsiftp://trestles-dm.sdsc.edu:2811");
        ((GlobusHostType) host.getType()).addGlobusGateKeeperEndPoint("trestles-login2.sdsc.edu:2119/jobmanager-pbstest2");

        /*
        * App
        */
        ApplicationDescription appDesc =
View Full Code Here

      URL resource = GramProviderTest.class.getClassLoader().getResource("gfac-config.xml");
        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
//        gFacConfiguration.s
        //have to set InFlwo Handlers and outFlowHandlers
        ApplicationContext applicationContext = new ApplicationContext();
        HostDescription host = new HostDescription(SSHHostType.type);
        host.getType().setHostName("gw85.iu.xsede.org");
        host.getType().setHostAddress("gw85.iu.xsede.org");
        applicationContext.setHostDescription(host);
        /*
           * App
           */
        ApplicationDescription appDesc = new ApplicationDescription();
View Full Code Here

TOP

Related Classes of org.apache.airavata.commons.gfac.type.HostDescription

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.