Package org.apache.woden.wsdl20.xml

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


     */
    public InterfaceFaultElement getInterfaceFaultElement()
    {
        InterfaceFaultElement fault = null;
        InterfaceOperationElement oper = (InterfaceOperationElement)getParentElement();
        InterfaceElement interfac = (InterfaceElement)oper.getParentElement();
        if (interfac != null) {
            InterfaceFault faultComp = ((Interface)interfac).getFromAllInterfaceFaults(fRef);
            if (faultComp != null) {
                fault = faultComp.toElement();
            }
View Full Code Here


    /* (non-Javadoc)
     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getInterfaceFaultElement()
     */
    public InterfaceFaultElement getInterfaceFaultElement()
    {
        InterfaceFaultElement fault = null;
        InterfaceOperationElement oper = (InterfaceOperationElement)getParentElement();
        InterfaceElement interfac = (InterfaceElement)oper.getParentElement();
        if (interfac != null) {
            InterfaceFault faultComp = ((Interface)interfac).getFromAllInterfaceFaults(fRef);
            if (faultComp != null) {
View Full Code Here

            XMLElement faultRefEl,
            DescriptionElement desc,
            InterfaceOperationElement parent)
            throws WSDLException {

        InterfaceFaultReferenceElement faultRef = parent.addInterfaceFaultReferenceElement();

        if(Constants.ELEM_INFAULT.equals(faultRefEl.getLocalName())) {
            faultRef.setDirection(Direction.IN);
        }
        else if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName())){
            faultRef.setDirection(Direction.OUT);
        }

        String ref = faultRefEl.getAttributeValue(Constants.ATTR_REF);
        if(ref != null)
        {
            try {
                QName qname = faultRefEl.getQName(ref);
                faultRef.setRef(qname);
            } catch (WSDLException e) {
                getErrorReporter().reportError(
                        new ErrorLocatorImpl()//TODO line&col nos.
                        "WSDL505",
                        new Object[] {ref, faultRefEl.getQName()},
                        ErrorReporter.SEVERITY_ERROR);
            }
        }

        String msgLabel = faultRefEl.getAttributeValue(Constants.ATTR_MESSAGE_LABEL);
        if(msgLabel != null)
        {
            faultRef.setMessageLabel(new NCName(msgLabel));
        }
        else
        {
            //This is a limited solution supporting the 3 MEPs in the Part 2 spec.
            //TODO generic support for user-defined, extensible MEPs.
           
            InterfaceOperationElement iop = (InterfaceOperationElement)faultRef.getParentElement();
            URI mep = iop.getPattern();
           
            if(Constants.MEP_URI_IN_OUT.equals(mep))
            {
                //Ruleset is fault-replaces-message, so fault is in same direction as msg.
                //The <output> is replaced by an <outfault>.
                //The <input> is replaced by an <infault>.
                //The <outfault> msg label should match the <output> msg label.
                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
                {
                    faultRef.setMessageLabel(MessageLabel.OUT);
                }
                else
                {
                    faultRef.setMessageLabel(MessageLabel.IN);
                }
            }
            else if(Constants.MEP_URI_ROBUST_IN_ONLY.equals(mep)) 
            {
                //Ruleset is message-triggers-fault, so fault is opposite direction to msg.
                //The <input> can trigger an <outfault>.
                //The <outfault> msg label should match the <input> msg label.
                if(Constants.ELEM_OUTFAULT.equals(faultRefEl.getLocalName()))
                {
                    faultRef.setMessageLabel(MessageLabel.IN); //the <outfault> is triggered by the <input>
                }
                else
                {
                    //TODO this MEP may have only <outfault>s, not <infault>s, so treat this as an error.
                    faultRef.setMessageLabel(MessageLabel.OUT);
                }
            }
            else if(Constants.MEP_URI_IN_ONLY.equals(mep))
            {
                //TODO Ruleset is no-faults, so treat this as an error.
            }
        }

        parseExtensionAttributes(faultRefEl, InterfaceFaultReferenceElement.class, faultRef, desc);

        XMLElement[] children = faultRefEl.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, faultRef);
            }
            else
            {
                faultRef.addExtensionElement(
                        parseExtensionElement(InterfaceFaultReferenceElement.class, faultRef, tempEl, desc) );
            }
        }

        return faultRef;
View Full Code Here

     *
     * TODO added 'effective msg label' matching, as per the component model method getInterfFaultRef.
     */
    public InterfaceFaultReferenceElement getInterfaceFaultReferenceElement()
    {
        InterfaceFaultReferenceElement intFaultRef = null;
       
        if(fRef != null && fMessageLabel != null)
        {
            BindingOperationElement bindOp = (BindingOperationElement)getParentElement();
            InterfaceOperationElement intOp = bindOp.getInterfaceOperationElement();
            if(intOp != null)
            {
                InterfaceFaultReferenceElement[] intFaultRefs = intOp.getInterfaceFaultReferenceElements();
                for(int i=0; i<intFaultRefs.length; i++)
                {
                    InterfaceFaultReferenceElement temp = intFaultRefs[i];
                    if(fRef.equals(temp.getRef()) &&
                       fMessageLabel.equals(temp.getMessageLabel()))
                    {
                        intFaultRef = temp;
                        break;
                    }
                }
View Full Code Here

     boolean isValid = true;
    
     int numFaultReferences = faultReferences.length;
     for(int k = 0; k < numFaultReferences; k++)
     {
        InterfaceFaultReferenceElement faultReference = faultReferences[k];
        if(!testAssertionQNameResolution1064ForInterfaceFaultReference(faultReference, errorReporter))
          isValid = false;
     }
    
     return isValid;
View Full Code Here

      InterfaceElement interfac = descEl.addInterfaceElement();
    InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
     
    InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
    faultReference.setRef(name1QN);
    faultReference.setMessageLabel(MessageLabel.IN);

     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for an interface fault reference that is the only interface fault reference defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for two interface fault references that have both different
  // faults and different message labels.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceFaultElement fault2 = interfac.addInterfaceFaultElement();
      fault2.setName(name2);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
         
    InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
    faultReference.setRef(name1QN);
    faultReference.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference2 = oper.addInterfaceFaultReferenceElement();
    faultReference2.setRef(name2QN);
    faultReference2.setMessageLabel(MessageLabel.OUT);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference2}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for two interface fault references that have different faults and message labels.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for two interface fault references that have the same fault
  // but different message labels
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
         
      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setRef(name1QN);
      faultReference.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference2 = oper.addInterfaceFaultReferenceElement();
      faultReference2.setRef(name1QN);
      faultReference2.setMessageLabel(MessageLabel.OUT);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference2}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for two interface fault references that have the same fault but different message labels.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for two interface fault references that have the same
  // message label but different faults.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceFaultElement fault2 = interfac.addInterfaceFaultElement();
      fault2.setName(name2);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
             
      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setRef(name1QN);
      faultReference.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference2 = oper.addInterfaceFaultReferenceElement();
      faultReference2.setRef(name2QN);
      faultReference2.setMessageLabel(MessageLabel.IN);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference2}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for two interface fault references that have different faults but the same message labels.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two interface fault references that have the same
  // fault and message label.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
         
      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setRef(name1QN);
      faultReference.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference2 = oper.addInterfaceFaultReferenceElement();
      faultReference2.setRef(name1QN);
      faultReference2.setMessageLabel(MessageLabel.IN);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference2}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned true for two interface fault references that have the same fault and message label.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the method returns true for an interface fault reference with a null message label.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();

      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setRef(name1QN);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for an interface fault references with a null message labels.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the method returns true for an interface fault reference with a null fault.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
     
      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setMessageLabel(MessageLabel.IN);
     
      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for ano interface fault reference that has a null fault.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the method returns false for two interface fault references that have the same
  // fault/message label and a third interface fault reference that has a null fault and is
  // defined second.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement fault = interfac.addInterfaceFaultElement();
      fault.setName(name1);
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
         
      InterfaceFaultReferenceElement faultReference = oper.addInterfaceFaultReferenceElement();
      faultReference.setRef(name1QN);
      faultReference.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference2 = oper.addInterfaceFaultReferenceElement();
      faultReference2.setRef(name1QN);
      faultReference2.setMessageLabel(MessageLabel.IN);
      InterfaceFaultReferenceElement faultReference3 = oper.addInterfaceFaultReferenceElement();
      faultReference3.setMessageLabel(MessageLabel.OUT);

      descEl.toComponent().getInterfaces(); //init Interface's ref to its Description
     
    if(val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference3, (InterfaceFaultReferenceImpl)faultReference2}, reporter))
    {
View Full Code Here

      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name3);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name4);
      InterfaceFaultReferenceElement interfaceFaultReference = interfaceOperation.addInterfaceFaultReferenceElement();
      interfaceFaultReference.setMessageLabel(MessageLabel.IN);
      interfaceFaultReference.setRef(name3QN);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name4QN);
      BindingFaultReferenceElement bindingFaultReference = bindingOperation.addBindingFaultReferenceElement();

      bindingFaultReference.setMessageLabel(MessageLabel.IN);
      bindingFaultReference.setRef(name3QN);
         
    if(!val.testAssertionBindingFaultReference1055(descEl.toComponent().getBindings()[0].getBindingOperations()[0].getBindingFaultReferences(), reporter))
    {
      fail("The testAssertionBindingFaultReference1055 method returned false with one valid binding fault reference defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when there are two binding fault references defined with
  // unique interface fault references.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name3);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name4);
      InterfaceFaultReferenceElement interfaceFaultReference = interfaceOperation.addInterfaceFaultReferenceElement();
      interfaceFaultReference.setMessageLabel(MessageLabel.IN);
      interfaceFaultReference.setRef(name3QN);
      InterfaceFaultReferenceElement interfaceFaultReference2 = interfaceOperation.addInterfaceFaultReferenceElement();
      interfaceFaultReference2.setMessageLabel(MessageLabel.OUT);
      interfaceFaultReference2.setRef(name3QN);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name4QN);
      BindingFaultReferenceElement bindingFaultReference = bindingOperation.addBindingFaultReferenceElement();
      bindingFaultReference.setMessageLabel(MessageLabel.IN);
      bindingFaultReference.setRef(name3QN);
      BindingFaultReferenceElement bindingFaultReference2 = bindingOperation.addBindingFaultReferenceElement();
      bindingFaultReference2.setMessageLabel(MessageLabel.OUT);
      bindingFaultReference2.setRef(name3QN);
         
    if(!val.testAssertionBindingFaultReference1055(descEl.toComponent().getBindings()[0].getBindingOperations()[0].getBindingFaultReferences(), reporter))
    {
      fail("The testAssertionBindingFaultReference1055 method returned false with two valid binding fault references defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
 
  // Test that the assertion returns false when there are two binding fault references define with
  // the same interface fault reference.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name3);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name4);
      InterfaceFaultReferenceElement interfaceFaultReference = interfaceOperation.addInterfaceFaultReferenceElement();
      interfaceFaultReference.setMessageLabel(MessageLabel.IN);
      interfaceFaultReference.setRef(name3QN);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name4QN);
View Full Code Here

      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name2);
      InterfaceOperationElement interfaceOper = interfac.addInterfaceOperationElement();
      interfaceOper.setName(name1);
      InterfaceFaultReferenceElement interfaceFaultReference = interfaceOper.addInterfaceFaultReferenceElement();
      interfaceFaultReference.setRef(name2QN);
      interfaceFaultReference.setMessageLabel(MessageLabel.IN);
     
      BindingElement binding = descEl.addBindingElement();
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name1QN);
View Full Code Here

    // Add an InterfaceFault to the InterfaceElement
    InterfaceFaultElement faultElement = interfaceElement.addInterfaceFaultElement();
    faultElement.setName(new NCName("Fault1"));
   
    // create the InterfaceFaultReference to test
    InterfaceFaultReferenceElement faultReference = interfaceOperationElement.addInterfaceFaultReferenceElement();
    faultReference.setRef(new QName("Fault1"));
   
    // An alternative here would be to create a Description element on with to hang the
    // hierarchy, call toComponent() on this and extract the InterfaceFaultReference from this.
    // However this inadvertently tests the Description class which is out of scope for this unit test.
    InterfaceFault retrievedFault = ((InterfaceFaultReference)faultReference).getInterfaceFault();
View Full Code Here

    InterfaceFaultElement ife = interfaceElement.addInterfaceFaultElement();
    ife.setName(new NCName("Fault1Ref"));
   
    InterfaceOperationElement ifopElement = interfaceElement.addInterfaceOperationElement();
    ifopElement.setName(new NCName("operation1"));
    InterfaceFaultReferenceElement iffrElement = ifopElement.addInterfaceFaultReferenceElement();
    iffrElement.setMessageLabel(new NCName("Fault1MessageLabel"));
    iffrElement.setRef(new QName("Fault1Ref"));
       
    // Create the BindingOperationElement->BindingFaultReferenceElement hierarchy
    BindingOperationElement bopElement = bindingElement.addBindingOperationElement();
    bopElement.setRef(new QName("operation1"));
    fFaultRefElement = bopElement.addBindingFaultReferenceElement();
View Full Code Here

TOP

Related Classes of org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement

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.