Package org.apache.woden

Examples of org.apache.woden.WSDLFactory


     */
    protected void setUp() throws Exception
    {
        super.setUp();
       
        WSDLFactory factory = null;
        try {
            factory = WSDLFactory.newInstance();
        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }

        fDescriptionElement = factory.newDescription();
        fBindingElement = fDescriptionElement.addBindingElement();
        fBindingOperationElement = fBindingElement.addBindingOperationElement();
        fBindingOperation = (BindingOperation) fBindingOperationElement;
    }
View Full Code Here


   * TODO: Implement tests for specific elements that contain invalid references.
   *       These tests should probably be contained in a test method for validateInterfaces, validateBindings, etc.
   */
  public void testTestAssertionSchema1066()
  {
    WSDLFactory factory = null;
    try {
        factory = WSDLFactory.newInstance();
    } catch (WSDLException e) {
        fail("Can't instantiate the WSDLFactory object.");
    }

  // Create a schema for use in the tests and add it to a types section.
    InlinedSchema schema = new InlinedSchemaImpl();
    XmlSchema xs1 = null;
    URI schemaNS = null;
  try
  {
      String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.sample.org\">"
              + "<complexType name=\"myType\">"    
              + "<sequence>"    
              + "<element  name=\"element\" type=\"string\"/>"     
              + "</sequence>"    
              + "</complexType>"
              + "<element name=\"myElement\" type=\"string\"/>"
              + "</schema>";
      DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      xs1 = xsc.read(schemaDoc1.getDocumentElement());
      schemaNS = new URI("http://www.sample.org");
      schema.setSchemaDefinition(xs1);
      schema.setNamespace(schemaNS);
      TypesElement types = factory.newDescription().addTypesElement();
      types.addSchema(schema);
  }
  catch(Exception e)
  {
    fail("An error occurred while creating the sample types section.");
  }
   
    // Test that a null namespace returns true.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement types = descElem.addTypesElement();
      types.addSchema(schema);
     
    if(!val.testAssertionSchema1066(descElem, null, reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a null namespace.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that a reference to a namespace that is defined inline
  // does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement types = descElem.addTypesElement();
      types.addSchema(schema);
     
    if(!val.testAssertionSchema1066(descElem, new QName("http://www.sample.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a namespace that has been defined inline.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to a namespace that is imported
  // does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement typesImported = descElem.addTypesElement();
      ImportedSchema importedSchema = new ImportedSchemaImpl();
      importedSchema.setSchemaDefinition(xs1);
      importedSchema.setNamespace(schemaNS);
      typesImported.addSchema(importedSchema);
     
    if(!val.testAssertionSchema1066(descElem, new QName("http://www.sample.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a namespace that has been imported.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to the XML Schema namespace does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      //descElem.setTypesElement(types);
     
    if(!val.testAssertionSchema1066(descElem, new QName(Constants.TYPE_XSD_2001, "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for the XML Schema namespace.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to a namespace that has not been defined inline or imported returns an error.
  // This test also checks that the method functions correctly with no defined types element.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      //descElem.setTypesElement(types);
     
    if(val.testAssertionSchema1066(descElem, new QName("http://www.sample2.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned true for a namespace that is not available..");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that a reference to an inline schema that does not define a
  // target namespace (the targetNamespace is null) does not return an
  // error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement typesImported = descElem.addTypesElement();
      InlinedSchema inlinedSchema = new InlinedSchemaImpl();
      typesImported.addSchema(inlinedSchema);
      InlinedSchema inlinedSchema2 = new InlinedSchemaImpl();
      inlinedSchema2.setNamespace(schemaNS);
View Full Code Here

   * true if the interface does not appear in the list of its
   * extended interfaces, false otherwise.
   */
  public void testTestAssertionInterface1009()
  {
    WSDLFactory factory = null;
    try {
        factory = WSDLFactory.newInstance();
    } catch (WSDLException e) {
        fail("Can't instanciate the WSDLFactory object.");
    }
   
    // Test that the assertion returns true for an interace that extends no other interfaces.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      Description descComp = descEl.toComponent();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
    if(!val.testAssertionInterface1009(interfac, reporter))
    {
      fail("The testAssertionInterface1009 method returned false for an interface that extends no other interfaces.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true if the interface is not in the direct or indirect list.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      Description descComp = descEl.toComponent();
      descEl.setTargetNamespace(namespace1);
     
      // Create an interface element, name it and add to the description element
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
     
      // Create another interface element, name it and add to the description element
      InterfaceElement interfac2 = descEl.addInterfaceElement();
      interfac2.setName(name2);

      interfac.addExtendedInterfaceName(interfac2.getName());
     
      InterfaceElement interfac3 = descEl.addInterfaceElement();
      interfac3.setName(name3);
     
      interfac.addExtendedInterfaceName(interfac3.getName());
     
      InterfaceElement interfac4 = descEl.addInterfaceElement();
      interfac4.setName(name4);
     
      interfac2.addExtendedInterfaceName(interfac4.getName());
       
      descComp.getInterfaces(); //init Interface's ref to its Description, needed for interface extension
   
    if(!val.testAssertionInterface1009((Interface)interfac, reporter))
    {
      fail("The testAssertionInterface1009 method returned false for an interface that is not in the list of exteneded interfaces.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false if the interface is in the direct list.
  try
  {
    DescriptionElement descEl = factory.newDescription();
    Description descComp = descEl.toComponent();
      descEl.setTargetNamespace(namespace1);
    InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
      interfac2.setName(name2);
      InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
      interfac3.setName(name3);
      interfac.addExtendedInterfaceName(interfac.getName());
      interfac.addExtendedInterfaceName(interfac2.getName());
      interfac.addExtendedInterfaceName(interfac3.getName());
     
      descComp.getInterfaces(); //init Interface's ref to its Description, needed for interface extension
   
    if(val.testAssertionInterface1009(interfac, reporter))
    {
      fail("The testAssertionInterface1009 method returned true for an interface that is in the direct extended interface list.");
    }
  }
  catch(Exception e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false if the interface is in the indirect list.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      Description descComp = descEl.toComponent();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
      interfac2.setName(name2);
View Full Code Here

   * true if the interface name is unique in the description,
   * false otherwise.
   */
  public void testTestAssertionInterface1010()
  {
      WSDLFactory factory = null;
      try {
          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instanciate the WSDLFactory object.");
      }
     
    // Test that the assertion returns true for an empty list of interfaces.
  try
  {
    if(!val.testAssertionInterface1010(new Interface[]{}, reporter))
    {
      fail("The testAssertionInterface1010 method returned false for an empty list of interfaces.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that the assertion returns true for an interface that is the only interface defined.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
    interfac.setName(name1);
    if(!val.testAssertionInterface1010(new Interface[]{interfac}, reporter))
    {
      fail("The testAssertionInterface1010 method returned false for an list of interfaces that contains only one interface.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for a list of interfaces that contains no duplicate names.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
    interfac2.setName(name2);
      InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
    interfac3.setName(name3);
   
    Interface[] interfaces = new Interface[]{interfac, interfac2, interfac3};
   
    if(!val.testAssertionInterface1010(interfaces, reporter))
    {
      fail("The testAssertionInterface1010 method returned false for a list of interfaces that contains no duplicates.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two interfaces that are defined with the same QName object.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
    interfac.setName(name1);
      InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
    interfac2.setName(name2);
      InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
    interfac3.setName(name1);
   
    Interface[] interfaces = new Interface[]{interfac, interfac2, interfac3};
   
    if(val.testAssertionInterface1010(interfaces, reporter))
    {
      fail("The testAssertionInterface1010 method returned true for a list of interfaces that contains two interfaces defined with the same QName object.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two interfaces that are defined with the same name and
  // different QName objects.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
      interfac2.setName(name2);
      InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
View Full Code Here

   * true if the message content model is #any or #none and the element
   * declaration is empty, false otherwise.
   */
  public void testTestAssertionInterfaceMessageReference1028()
  {
    WSDLFactory factory = null;
    try {
        factory = WSDLFactory.newInstance();
    } catch (WSDLException e) {
        fail("Can't instanciate the WSDLFactory object.");
    }
   
    // Test that the method returns true if the message content model is #any and the element declaration is empty.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
    InterfaceMessageReferenceElement interfaceMessageReference = oper.addInterfaceMessageReferenceElement();
    interfaceMessageReference.setElement(QNameTokenUnion.ANY);

      Description descComp = descEl.toComponent(); //initialise Interface's ref to its Description
      InterfaceMessageReference msgRefComp =
        descComp.getInterfaces()[0].getInterfaceOperations()[0].getInterfaceMessageReferences()[0];
     
      if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)msgRefComp, reporter))
    {
      fail("The testAssertionInterfaceMessageReference1028 method returned false for an interface message reference with the message content model #any and an empty element declaration.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
   
    // Test that the method returns true if the message content model is #none and the element declaration is empty.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
      InterfaceMessageReferenceElement interfaceMessageReference = oper.addInterfaceMessageReferenceElement();
      interfaceMessageReference.setElement(QNameTokenUnion.NONE);

View Full Code Here

   * true if the list of interface fault references contains no duplicate
   * fault/message label pairs, false otherwise.
   */
  public void testTestAssertionInterfaceFaultReference1039()
  {
      WSDLFactory factory = null;
      try {
          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instanciate the WSDLFactory object.");
      }
    // Test that the assertion returns true for an interface fault reference list that is empty.
  try
  {
    if(!val.testAssertionInterfaceFaultReference1039(new InterfaceFaultReference[]{}, reporter))
    {
      fail("The testAssertionInterfaceFaultReference1039 method returned false for an interface fault reference list that is empty.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for an interface fault reference list with one entry.
  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);

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

   */
  public void testTestAssertionBinding1044()
  {
    NCName name1 = new NCName("name1");
    NCName name2 = new NCName("name2");
    WSDLFactory factory = null;
    try {
        factory = WSDLFactory.newInstance();
    } catch (WSDLException e) {
        fail("Can't instantiate the WSDLFactory object.");
    }

   
    // Test that the assertion returns true when no operation or fault is specified
  // and an interface is not specified.
  try
  {
      DescriptionElement desc = factory.newDescription();
      BindingElement bindingEl = desc.addBindingElement();
      bindingEl.setName(name1);
    if(!val.testAssertionBinding1044(desc.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned false for a binding with no interface, operation, or faults specified.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when no operation or fault is specified
  // and an interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
    BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
    if(!val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned false for a binding with an interface and no operation or faults specified.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an operation is specified
  // and an interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    if(!val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned false for a binding with an interface and an operation specified.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when a fault is specified
  // and an interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
    if(!val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned false for a binding with an interface and a fault specified.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an operation and a fault are specified
  // and an interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    if(!val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned false for a binding with an interface and an operation and a fault specified.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an operation is specified
  // and no interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name1);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    if(val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned true for a binding with an operation and no interface.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when a fault is specified
  // and no interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name1);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
    if(val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1044 method returned true for a binding with a fault and no interface.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an operation and a fault are specified
  // and no interface is specified.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name1);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    if(val.testAssertionBinding1044(descEl.toComponent().getBindings()[0], reporter))
View Full Code Here

   * Test that the testAssertionBinding1048 method returns
   * true if the binding type is absolute, false otherwise.
   */
  public void testTestAssertionBinding1048()
  {
      WSDLFactory factory = null;
      try {
          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instantiate the WSDLFactory object.");
      }
    // Test that the assertion returns true for a binding with an absolute type.
  try
  {
      DescriptionElement descEl = factory.newDescription();
    BindingElement binding = descEl.addBindingElement();
    binding.setType(new URI("http://www.sample.org"));
    if(!val.testAssertionBinding1048(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1048 method returned false for a binding with an absolute type.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem creating the type URI for the test method " + e);
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that the assertion returns false for a binding with a relative type.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
    BindingElement binding = descEl.addBindingElement();
    binding.setType(new URI("sample.org"));
    if(val.testAssertionBinding1048(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1048 method returned true for a binding with a relative type.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem creating the type URI for the test method " + e);
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that the assertion returns true for a binding with a null type. This will be
  // caught be schema validation.
  try
  {
      DescriptionElement descEl = factory.newDescription();
    BindingElement binding = descEl.addBindingElement();
    if(!val.testAssertionBinding1048(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1048 method returned false for a binding with a null type.");
    }
View Full Code Here

   * true if all the binding names are unique in the description,
   * false otherwise.
   */
  public void testTestAssertionBinding1049()
  {
      WSDLFactory factory = null;
      try {
          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instanciate the WSDLFactory object.");
      }

    // Test that the assertion returns true for an empty list of bindings.
  try
  {
    if(!val.testAssertionBinding1049(new Binding[]{}, reporter))
    {
      fail("The testAssertionBinding1049 method returned false for an empty list of bindings.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that the assertion returns true for a list of bindings that only contains one binding.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
    BindingElement binding = descEl.addBindingElement();
    binding.setName(name1);
    if(!val.testAssertionBinding1049(descEl.toComponent().getBindings(), reporter))
    {
      fail("The testAssertionBinding1049 method returned false for an list of bindings that contains only one binding.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for a list of bindings that contains no duplicate names.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
    BindingElement binding = descEl.addBindingElement();
    binding.setName(name1);
      BindingElement binding2 = descEl.addBindingElement();
    binding2.setName(name2);
      BindingElement binding3 = descEl.addBindingElement();
    binding3.setName(name3);
   
    Binding[] bindings = descEl.toComponent().getBindings();
   
    if(!val.testAssertionBinding1049(bindings, reporter))
    {
      fail("The testAssertionBinding1049 method returned false for a list of bindings that contains no duplicates.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two bindings that are defined with the same QName object.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name1);
      BindingElement binding2 = descEl.addBindingElement();
      binding2.setName(name2);
      BindingElement binding3 = descEl.addBindingElement();
    binding3.setName(name1);
   
    Binding[] bindings = descEl.toComponent().getBindings();
   
    if(val.testAssertionBinding1049(bindings, reporter))
    {
      fail("The testAssertionBinding1049 method returned true for a list of binginds that contains two bindings defined with the same QName object.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two bindings that are defined with the same name and
  // different QName objects.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      BindingElement binding = descEl.addBindingElement();
    binding.setName(name1);
      BindingElement binding2 = descEl.addBindingElement();
      binding2.setName(name2);
View Full Code Here

   * true if all the interface operations have bindings defined,
   * false otherwise.
   */
  public void testTestAssertionBinding1045()
  {
      WSDLFactory factory = null;
      try {
          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instanciate the WSDLFactory object.");
      }
    // Test that the assertion returns true when the binding does not specify an interface.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name1);
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with no defined interface.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that the assertion returns true when an interface is specified with no operations and
    // the binding has no operations defined.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with an interface with no operations.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an interface is specified with no operations and
  // the binding has an operation defined.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with an interface with no operations and one binding operation defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an interface is specified with one operation and
  // the binding defines a binding operation for the interface operation.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name2);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    bindingOperation.setRef(name2QN);
     
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with an interface with one operation and one binding operation defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an interface is specified with one operation and
  // the binding defines no operations.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name2);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
     
    if(val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned true for a binding with an interface with one operation and no binding operation defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an interface is specified with one operation through
  // an extended interface and the binding defines a binding operation for the operation.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceElement interfac2 = descEl.addInterfaceElement();
      interfac2.setName(name2);
      InterfaceOperationElement interfaceOperation = interfac2.addInterfaceOperationElement();
      interfaceOperation.setName(name3);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
    binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
    bindingOperation.setRef(name3QN);
     
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with an interface with one extended operation and one binding operation defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an interface is specified with one operation through
  // an extended interface and the binding defines no operations.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceElement interfac2 = descEl.addInterfaceElement();
      interfac2.setName(name2);
      InterfaceOperationElement interfaceOperation = interfac2.addInterfaceOperationElement();
      interfaceOperation.setName(name3);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
     
    if(val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned true for a binding with an interface with one extended operation and no binding operation defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true when an interface is specified with two operations, one
  // explicit and one inherited, and the binding defines operations for both.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name3);
      InterfaceImpl interfac2 = new InterfaceImpl();
      interfac2.setName(name2);
      InterfaceOperationElement interfaceOperation2 = interfac2.addInterfaceOperationElement();
      interfaceOperation2.setName(name4);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name3QN);
      BindingOperationElement bindingOperation2 = binding.addBindingOperationElement();
      bindingOperation2.setRef(name4QN);
     
    if(!val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned false for a binding with an interface with one defined operation and one extended operation and two binding operations defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an interface is specified with two operations, one
  // explicit and one inherited, and the binding defines an operation only for the explicit operation.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name3);
      InterfaceElement interfac2 = descEl.addInterfaceElement();
      interfac2.setName(name2);
      InterfaceOperationElement interfaceOperation2 = interfac2.addInterfaceOperationElement();
      interfaceOperation2.setName(name4);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name3QN);
     
    if(val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned true for a binding with an interface with one defined operation and one extended operation and one binding operation defined for the defined operation.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false when an interface is specified with two operations, one
  // explicit and one inherited, and the binding defines an operation only for the inherited operation.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
      interfaceOperation.setName(name3);
      InterfaceImpl interfac2 = new InterfaceImpl();
      interfac2.setName(name2);
      InterfaceOperationElement interfaceOperation2 = interfac2.addInterfaceOperationElement();
      interfaceOperation2.setName(name4);
      BindingElement binding = descEl.addBindingElement();
      binding.setName(name2);
      binding.setInterfaceName(name1QN);
      BindingOperationElement bindingOperation = binding.addBindingOperationElement();
      bindingOperation.setRef(name4QN);
     
    if(val.testAssertionBinding1045(descEl.toComponent().getBindings()[0], reporter))
    {
      fail("The testAssertionBinding1045 method returned true for a binding with an interface with one defined operation and one inherited operation and one binding operation defined for the inherited operation.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  handler.reset();
 
  // Test that two messages are returned when an interface with two operations, one explicit and one
  // inherited, is specified and the binding defines no operations.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      interfac.addExtendedInterfaceName(name2QN);
      InterfaceOperationElement interfaceOperation = interfac.addInterfaceOperationElement();
View Full Code Here

TOP

Related Classes of org.apache.woden.WSDLFactory

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.