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

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


        registry.removeHostDescriptor("testHost");
    }


    public void testIsServiceDescriptorExists() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        serviceDescription.getType().setDescription("testDescription");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addServiceDescriptor(serviceDescription);
        assertTrue("Service desc exists", registry.isServiceDescriptorExists("testServiceDesc"));

        registry.removeServiceDescriptor("testServiceDesc");
View Full Code Here


        registry.removeServiceDescriptor("testServiceDesc");
    }


    public void testAddServiceDescriptor() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        serviceDescription.getType().setDescription("testDescription");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addServiceDescriptor(serviceDescription);
        assertTrue("Service desc saved successfully", registry.isServiceDescriptorExists("testServiceDesc"));
        ServiceDescription serviceDescriptor = registry.getServiceDescriptor("testServiceDesc");
        registry.removeServiceDescriptor("testServiceDesc");
    }
View Full Code Here

        registry.removeServiceDescriptor("testServiceDesc");
    }


    public void testUpdateServiceDescriptor() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        serviceDescription.getType().setDescription("testDescription1");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addServiceDescriptor(serviceDescription);
        ServiceDescription testServiceDesc = registry.getServiceDescriptor("testServiceDesc");
        testServiceDesc.getType().setDescription("testDescription2");

        parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input2");
        parameter.setParameterDescription("testDesc2");
        parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType2"));
        parameterType.setName("testParamtype2");
        inputParameters.add(parameter);

        outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input2");
        outputParameter.setParameterDescription("testDesc2");
        outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType2"));
        outputParaType.setName("testParamtype2");
        outputParameters.add(outputParameter);

        testServiceDesc.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        testServiceDesc.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.updateServiceDescriptor(testServiceDesc);
        assertTrue("Service updated successfully", registry.getServiceDescriptor("testServiceDesc").getType().getDescription().equals("testDescription2"));
        registry.removeServiceDescriptor("testServiceDesc");
    }
View Full Code Here

        registry.removeServiceDescriptor("testServiceDesc");
    }


    public void testGetServiceDescriptor() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        serviceDescription.getType().setDescription("testDescription1");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addServiceDescriptor(serviceDescription);
        ServiceDescription testServiceDesc = registry.getServiceDescriptor("testServiceDesc");

        assertNotNull("service descriptor retrieved successfully", testServiceDesc);
        registry.removeServiceDescriptor("testServiceDesc");
    }
View Full Code Here

        registry.removeServiceDescriptor("testServiceDesc");
    }


    public void testRemoveServiceDescriptor() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addServiceDescriptor(serviceDescription);
        registry.removeServiceDescriptor("testServiceDesc");
        assertFalse("Service desc removed successfully", registry.isServiceDescriptorExists("testServiceDesc"));
    }
View Full Code Here

        assertFalse("Service desc removed successfully", registry.isServiceDescriptorExists("testServiceDesc"));
    }


    public void testGetServiceDescriptors() throws Exception {
        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
        registry.addServiceDescriptor(serviceDescription);
        List<ServiceDescription> serviceDescriptors = registry.getServiceDescriptors();

        assertTrue("Service desc retrieved successfully", serviceDescriptors.size() == 1);
        registry.removeServiceDescriptor("testServiceDesc");
View Full Code Here

        HostDescription hostDescription = new HostDescription(GlobusHostType.type);
        hostDescription.getType().setHostName("testHost");
        hostDescription.getType().setHostAddress("testHostAddress");

        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addApplicationDescriptor(serviceDescription, hostDescription, applicationDeploymentDescription);
        assertTrue("application hostDescription added successfully", registry.isApplicationDescriptorExists("testServiceDesc", "testHost", "testApplication"));
        registry.removeApplicationDescriptor("testServiceDesc", "testHost", "testApplication");
    }
View Full Code Here

        HostDescription hostDescription = new HostDescription(GlobusHostType.type);
        hostDescription.getType().setHostName("testHost");
        hostDescription.getType().setHostAddress("testHostAddress");

        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
        InputParameterType parameter = InputParameterType.Factory.newInstance();
        parameter.setParameterName("input1");
        parameter.setParameterDescription("testDesc");
        ParameterType parameterType = parameter.addNewParameterType();
        parameterType.setType(DataType.Enum.forString("testType"));
        parameterType.setName("testParamtype");
        inputParameters.add(parameter);

        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        outputParameter.setParameterName("input1");
        outputParameter.setParameterDescription("testDesc");
        ParameterType outputParaType = outputParameter.addNewParameterType();
        outputParaType.setType(DataType.Enum.forString("testType"));
        outputParaType.setName("testParamtype");
        outputParameters.add(outputParameter);

        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));

        registry.addApplicationDescriptor(serviceDescription, hostDescription, applicationDeploymentDescription);

        ApplicationDeploymentDescription applicationDescriptor = registry.getApplicationDescriptor("testServiceDesc", "testHost", "testApplication");
        applicationDescriptor.getType().setExecutableLocation("/bin/echo1");
View Full Code Here

            if (value instanceof XmlElement) {
                logger.info("value: " + XMLUtil.xmlElementToString((XmlElement) value));
            }
            this.inputNames.add(name);
            this.inputValues.add(value);
            ServiceDescription serviceDescription = registry.getServiceDescriptor(this.serviceName);
            if(serviceDescription==null){
              throw new RegistryException(new Exception("Service Description not found in registry."));
            }
            ServiceDescriptionType serviceDescriptionType = serviceDescription.getType();
            for (Parameter parameter : serviceDescriptionType.getInputParametersArray()) {
                //todo this implementation doesn't work when there are n number of nodes connecting .. need to fix
                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(XMLUtil.xmlElementToString((XmlElement) value)));
                StAXOMBuilder builder = new StAXOMBuilder(reader);
                OMElement input = builder.getDocumentElement();
View Full Code Here

            throw new RuntimeException("Failed : HTTP error code : "
                    + status);
        }

        ServiceDescriptor serviceDescriptor = response.getEntity(ServiceDescriptor.class);
        ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(serviceDescriptor);
        return serviceDescription;
    }
View Full Code Here

TOP

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

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.