Examples of ServiceElement


Examples of org.apache.woden.wsdl20.xml.ServiceElement

    private ServiceElement parseService(
            XMLElement serviceEl,
            DescriptionElement desc)
            throws WSDLException {

        ServiceElement service = desc.addServiceElement();

        String name = serviceEl.getAttributeValue(Constants.ATTR_NAME);
        if(name != null)
        {
            service.setName(new NCName(name));
        }

        QName intfaceQN = null;
        String intface = serviceEl.getAttributeValue(Constants.ATTR_INTERFACE);
        if(intface != null)
        {
            try {
                intfaceQN = serviceEl.getQName(intface);
                service.setInterfaceName(intfaceQN);
            } catch (WSDLException e) {
                getErrorReporter().reportError(
                        new ErrorLocatorImpl()//TODO line&col nos.
                        "WSDL505",
                        new Object[] {intface, serviceEl.getQName()},
                        ErrorReporter.SEVERITY_ERROR);
            }
        }

    parseExtensionAttributes(serviceEl, ServiceElement.class, service, desc);

    /* Parse the child elements of <service>.
     * As per WSDL 2.0 spec, they must be in the following order if present:
     * <documentation>
     * <endpoint>
     * extension elements in any order
     * TODO validate that the elements are in correct order
     */

        XMLElement[] children = serviceEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

      if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
      {
        parseDocumentation(tempEl, desc, service);
      }
      else if (Constants.Q_ELEM_ENDPOINT.equals(tempElQN))
      {
        parseEndpoint(tempEl, desc, service);
      }
      else
      {
        service.addExtensionElement(
            parseExtensionElement(ServiceElement.class, service, tempEl, desc) );
      }
    }

    return service;
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

  // Test that the assertion returns true for an endpoint with no binding defined.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      ServiceElement service = descEl.addServiceElement();
    EndpointElement endpoint = service.addEndpointElement();
    if(!val.testAssertionEndpoint1062(descEl.toComponent().getServices()[0].getEndpoints()[0], reporter))
    {
      fail("The testAssertionEndpoint1062 method returned false for an endpoint with no binding defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    /* (jkaputin) ditto the comment above for the first test case (NPE on getParent)
  // Test that the assertion returns true for an endpoint with no parent defined.
  try
  {
    EndpointImpl endpoint = new EndpointImpl();
    BindingElement binding = descEl.createBindingElement();
      binding.setName(name1);
    endpoint.setBindingName(name1);
    if(!val.testAssertionEndpoint0066(endpoint, reporter))
    {
      fail("The testAssertionEndpoint0066 method returned false for an endpoint with no parent defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
    */
 
  // Test that the assertion returns true for an endpoint that specifies a binding with no interface specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      ServiceElement service = descEl.addServiceElement();
      service.setInterfaceName(name1QN);
      EndpointElement endpoint = service.addEndpointElement();
      endpoint.setBindingName(name2QN);
    if(!val.testAssertionEndpoint1062(descEl.toComponent().getServices()[0].getEndpoints()[0], reporter))
    {
      fail("The testAssertionEndpoint1062 method returned false for an endpoint that specifies a binding with no specified interface.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for an endpoint that specifies a binding with the same interface
  // as the parent service specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      ServiceElement service = descEl.addServiceElement();
      service.setInterfaceName(name1QN);
      EndpointElement endpoint = service.addEndpointElement();
      endpoint.setBindingName(name2QN);
    if(!val.testAssertionEndpoint1062(descEl.toComponent().getServices()[0].getEndpoints()[0], reporter))
    {
      fail("The testAssertionEndpoint1062 method returned false for an endpoint that specifies a binding with the same interface specified as the parent service specifies.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for an endpoint that specifies a binding with a different interface
  // than the parent service specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
    InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceElement interfac2 = descEl.addInterfaceElement();
      interfac2.setName(name2);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name3);
      binding.setInterfaceName(name2QN);
      ServiceElement service = descEl.addServiceElement();
      service.setInterfaceName(name1QN);
      EndpointElement endpoint = service.addEndpointElement();
      endpoint.setBindingName(name3QN);
    if(val.testAssertionEndpoint1062(descEl.toComponent().getServices()[0].getEndpoints()[0], reporter))
    {
      fail("The testAssertionEndpoint1062 method returned true for an endpoint that specifies a binding with a different interface specified than the parent service specifies.");
    }
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

  public void testGetEndpointGetEndpoints()
  {
    /* Set up prereqs:
     * - Service with > 1 endpoints created.
     */
    ServiceElement fServiceElement = new ServiceImpl();
    EndpointElement fEndpointElement1 = fServiceElement.addEndpointElement();
    fEndpointElement1.setName(new NCName("endpoint1"));
    EndpointElement fEndpointElement2 = fServiceElement.addEndpointElement();
    fEndpointElement2.setName(new NCName("endpoint2"));   
    Service fService = (Service) fServiceElement;
   
    // test getEndpoint()
    Endpoint e1 = fService.getEndpoint(new NCName("endpoint1"));
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

      // Interface
      InterfaceElement fInterfaceElement = fDescElement.addInterfaceElement();
    fInterfaceElement.setName(new NCName("interface1"));
   
       // Service...
      ServiceElement fServiceElement = fDescElement.addServiceElement();
      fServiceElement.setName(new NCName("service1"));
      fServiceElement.setInterfaceName(new QName("interface1"));
     
      // "create" the component model to complete the woden object hierachy references
      Description fDesc = fDescElement.toComponent();
      fDesc.getServices(); // necessary to set the reference to Description in Service
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

        QName fServiceQName = new QName("service1");
        NCName fEndpointNCname = new NCName("endpoint1");
      fBindingElement.setName(fBindingNCName);
     
      // Service... (attach our Endpoint to a Service parented by our Description)
      ServiceElement fServiceElement = fDescElement.addServiceElement();
      fServiceElement.setName(fServiceNCName);
     
      // Endpoint...
      EndpointElement fEndpointElement = fServiceElement.addEndpointElement();
      fEndpointElement.setName(fEndpointNCname);
        fEndpointElement.setBindingName(fBindingQName);
     
      // Component model creation
        Description fDesc = fDescElement.toComponent();
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

            OMUtils.getQualifiedValue(Constants.NS_URI_WSDL20,
                        Constants.ELEM_SERVICE,
                        des);
        for(int ind=0;ind<services.length;ind++){

            ServiceElement service=services[ind];
            if(service!=null){
                pw.print("  <" + tagName);
                QName name = service.getName();
                if (name != null){
                    OMUtils.printAttribute(Constants.ATTR_NAME,
                            name.getLocalPart(),
                            pw);
                }
                QName interfaceName = service.getInterfaceName();
                if (name != null){

                    OMUtils.printQualifiedAttribute(Constants.ATTR_INTERFACE,
                            interfaceName,des, pw);
                }
                printExtensibilityAttributes(service.getExtensionAttributes(), service, pw);
                pw.println('>');
                printEndpoints(service.getEndpointElements(), des, pw);
                printDocumentation(service.getDocumentationElements(), des, pw);
                printExtensibilityElements(service.getClass(),service.getExtensionElements(), des, pw);
                pw.println("    </" + tagName + '>');
            }
        }
      
     }
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

    private ServiceElement parseService(
            XMLElement serviceEl,
            DescriptionElement desc)
            throws WSDLException {

        ServiceElement service = desc.addServiceElement();

        String name = serviceEl.getAttributeValue(Constants.ATTR_NAME);
        if(name != null)
        {
            service.setName(new NCName(name));
        }

        QName intfaceQN = null;
        String intface = serviceEl.getAttributeValue(Constants.ATTR_INTERFACE);
        if(intface != null)
        {
            try {
                intfaceQN = serviceEl.getQName(intface);
                service.setInterfaceName(intfaceQN);
            } catch (WSDLException e) {
                getErrorReporter().reportError(
                        new ErrorLocatorImpl()//TODO line&col nos.
                        "WSDL505",
                        new Object[] {intface, serviceEl.getQName()},
                        ErrorReporter.SEVERITY_ERROR);
            }
        }

    parseExtensionAttributes(serviceEl, ServiceElement.class, service, desc);

    /* Parse the child elements of <service>.
     * As per WSDL 2.0 spec, they must be in the following order if present:
     * <documentation>
     * <endpoint>
     * extension elements in any order
     * TODO validate that the elements are in correct order
     */

        XMLElement[] children = serviceEl.getChildElements();
        XMLElement tempEl = null;
        QName tempElQN = null;

        for(int i=0; i<children.length; i++)
        {
            tempEl = children[i];
            tempElQN = tempEl.getQName();

      if (Constants.Q_ELEM_DOCUMENTATION.equals(tempElQN))
      {
        parseDocumentation(tempEl, desc, service);
      }
      else if (Constants.Q_ELEM_ENDPOINT.equals(tempElQN))
      {
        parseEndpoint(tempEl, desc, service);
      }
      else
      {
        service.addExtensionElement(
            parseExtensionElement(ServiceElement.class, service, tempEl, desc) );
      }
    }

    return service;
View Full Code Here

Examples of org.apache.woden.wsdl20.xml.ServiceElement

            DOMUtils.getQualifiedValue(Constants.NS_URI_WSDL20,
                        Constants.ELEM_SERVICE,
                        des);
        for(int ind=0;ind<services.length;ind++){

            ServiceElement service=services[ind];
            if(service!=null){

                pw.print("  <" + tagName);
                QName name = service.getName();
                if (name != null){
                    DOMUtils.printAttribute(Constants.ATTR_NAME,
                            name.getLocalPart(),
                            pw);
                }
                QName interfaceName = service.getInterfaceName();
                if (name != null){

                    DOMUtils.printQualifiedAttribute(Constants.ATTR_INTERFACE,
                            interfaceName,des, pw);
                }
                printExtensibilityAttributes(service.getExtensionAttributes(), service, pw);
                pw.println('>');
                printEndpoints(service.getEndpointElements(), des, pw);
                printDocumentation(service.getDocumentationElements(), des, pw);
                printExtensibilityElements(service.getClass(),service.getExtensionElements(), des, pw);
                pw.println("    </" + tagName + '>');
            }
        }
     }
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

    private final Uuid recordingUuid = UuidFactory.generate();

    @Test
    public void testAddingServiceRecords() {
        List<ServiceRecord> list = new ArrayList<ServiceRecord>();
        ServiceElement element = makeServiceElement("Foo");
        int recordCount = 200;
        for(int i=0; i<recordCount; i++) {
            Uuid uuid = UuidFactory.generate();
            list.add(new ServiceRecord(uuid, element, "hostname"));
View Full Code Here

Examples of org.rioproject.opstring.ServiceElement

    }

    @Test
    public void testUpdatingServiceRecords() {
        List<ServiceRecord> list = new ArrayList<ServiceRecord>();
        ServiceElement element = makeServiceElement("Foo");
        int recordCount = 200;
        for(int i=0; i<recordCount; i++) {
            Uuid uuid = UuidFactory.generate();
            list.add(new ServiceRecord(uuid, element, "hostname"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.