Package org.apache.woden.wsdl20.xml

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


  }
 
  // Test that the assertion returns true when there is one binding fault reference defined.
  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);
      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);
      BindingFaultReferenceElement bindingFaultReference = bindingOperation.addBindingFaultReferenceElement();
      bindingFaultReference.setMessageLabel(MessageLabel.IN);
      bindingFaultReference.setRef(name3QN);
      BindingFaultReferenceElement bindingFaultReference2 = bindingOperation.addBindingFaultReferenceElement();
      bindingFaultReference2.setMessageLabel(MessageLabel.IN);
      bindingFaultReference2.setRef(name3QN);
         
    if(val.testAssertionBindingFaultReference1055(descEl.toComponent().getBindings()[0].getBindingOperations()[0].getBindingFaultReferences(), reporter))
    {
      fail("The testAssertionBindingFaultReference1055 method returned true with two binding fault references defined with the same interface fault reference.");
    }
  }
  catch(WSDLException e)
View Full Code Here


      }
    // Test that the assertion returns true when the binding fault reference defines a valid
  // interface fault reference.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      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);
      BindingFaultReferenceElement bindingFaultReference = bindingOperation.addBindingFaultReferenceElement();
    bindingFaultReference.setRef(name2QN);
      bindingFaultReference.setMessageLabel(MessageLabel.IN);
     
      descEl.toComponent().getBindings(); //init Binding's ref to its Description
     
    if(!val.testAssertionBindingFaultReference1059((BindingFaultReferenceImpl)bindingFaultReference, reporter))
    {
      fail("The testAssertionBindingFaultReference1059 method returned false with a binding fault reference with a valid interface fault reference defined.");
    }
View Full Code Here

  }
 
    // Test that the assertion returns true for a list of binding faults that only contains one binding.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name2);
     
      BindingElement binding = descEl.addBindingElement();
      binding.setInterfaceName(name1QN);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
    bindingFault.setRef(name2QN);
     
      descEl.toComponent().getBindings(); //init Binding's ref to its Description
     
      if(!val.testAssertionBindingFault1050(new BindingFault[]{(BindingFaultImpl)bindingFault}, reporter))
    {
      fail("The testAssertionBindingFault1050 method returned false for an list of binding faults 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 binding faults that contains no duplicate interface fault references.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      InterfaceElement interfac = descEl.addInterfaceElement();
      interfac.setName(name1);
      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name1);
      InterfaceFaultElement interfaceFault2 = interfac.addInterfaceFaultElement();
      interfaceFault2.setName(name2);
      InterfaceFaultElement interfaceFault3 = interfac.addInterfaceFaultElement();
      interfaceFault.setName(name3);
     
      BindingElement binding = descEl.addBindingElement();
      binding.setInterfaceName(name1QN);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
    bindingFault.setRef(name1QN);
      BindingFaultElement bindingFault2 = binding.addBindingFaultElement();
    bindingFault2.setRef(name2QN);
      BindingFaultElement bindingFault3 = binding.addBindingFaultElement();
    bindingFault3.setRef(name3QN);
   
      descEl.toComponent().getBindings(); //init Binding's ref to its Description
     
    BindingFault[] bindingFaults = new BindingFault[]{(BindingFaultImpl)bindingFault, (BindingFaultImpl)bindingFault2, (BindingFaultImpl)bindingFault3};
   
    if(!val.testAssertionBindingFault1050(bindingFaults, reporter))
    {
      fail("The testAssertionBindingFault1050 method returned false for a list of binding faults that contains no duplicate interface fault references.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two binding faults that are defined 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(name1);
      InterfaceFaultElement interfaceFault2 = interfac.addInterfaceFaultElement();
      interfaceFault2.setName(name2);
     
      BindingElement binding = descEl.addBindingElement();
      binding.setInterfaceName(name1QN);
      BindingFaultElement bindingFault = binding.addBindingFaultElement();
      bindingFault.setRef(name1QN);
      BindingFaultElement bindingFault2 = binding.addBindingFaultElement();
      bindingFault2.setRef(name2QN);
      BindingFaultElement bindingFault3 = binding.addBindingFaultElement();
      bindingFault3.setRef(name1QN);
     
      descEl.toComponent().getBindings(); //init Binding's ref to its Description
     
    BindingFault[] bindingFaults = new BindingFault[]{(BindingFaultImpl)bindingFault, (BindingFaultImpl)bindingFault2, (BindingFaultImpl)bindingFault3};
   
    if(val.testAssertionBindingFault1050(bindingFaults, reporter))
    {
View Full Code Here

  }
 
    // Test that the assertion returns true for a service that is the only service defined.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
    service.setName(name1);
    if(!val.testAssertionService1060(new Service[]{service}, reporter))
    {
      fail("The testAssertionService1060 method returned false for a service that is the only service defined.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns true for a list of services that contains no duplicate names.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
    service.setName(name1);
    ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
      service2.setName(name2);
    ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
      service3.setName(name3);
   
    Service[] services = new Service[]{service, service2, service3};
   
    if(!val.testAssertionService1060(services, reporter))
    {
      fail("The testAssertionService1060 method returned false for a list of services that contains no duplicate names.");
    }
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that the assertion returns false for two services that are defined with the same QName object.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
      service.setName(name1);
      ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
      service2.setName(name2);
      ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
    service3.setName(name1);
   
    Service[] services = new Service[]{service, service2, service3};
   
    if(val.testAssertionService1060(services, reporter))
    {
      fail("The testAssertionService1060 method returned true for a list of services that contains two services 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 services that are defined with the same name and
  // different QName objects.
  try
  {
      DescriptionElement descEl = factory.newDescription();
      descEl.setTargetNamespace(namespace1);
      ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
      service.setName(name1);
      ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
      service2.setName(name2);
      ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
      service3.setName(new NCName("name1"));
   
    Service[] services = new Service[]{service, service2, service3};
   
    if(val.testAssertionService1060(services, reporter))
View Full Code Here

    */

  // 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.");
    }
  }
  catch(WSDLException e)
View Full Code Here

            factory = WSDLFactory.newInstance();
        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }

        DescriptionElement desc = factory.newDescription();
        desc.addServiceElement();
      fEmptyService = desc.toComponent().getServices()[0];
    }
View Full Code Here

        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }

        // Description...
      DescriptionElement fDescElement = factory.newDescription();
     
      // 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

      /* Test assertions:
       * (Object equivalence is fine here - we check both refer to same Object)
       */
 
View Full Code Here

        } catch (WSDLException e) {
            fail("Can't instantiate the WSDLFactory object.");
        }
     
      // Description...
      DescriptionElement fDescElement = factory.newDescription();
     
      // Binding...
        fBindingQName = new QName("binding1");
      BindingElement fBindingElement = fDescElement.addBindingElement();
        fBindingNCName = new NCName("binding1");
        NCName fServiceNCName = new NCName("service1");
        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();
        Endpoint fDerivedEndpoint = fDesc.getService(fServiceQName).getEndpoint(fEndpointNCname);
       
      assertEquals(fDerivedEndpoint.getBinding().getName(), fBindingQName); // just compare QNames
  }
View Full Code Here

        namespace6 = new URI("http://apache.org/namespaceURIf");
        nonExistantNamespace = new URI("http://apache.org/nonExistantNamespace");
    }
   
    public void testAddGetNamespace() {
        DescriptionElement descriptionElement = factory.newDescription();
        descriptionElement.addNamespace(prefix1,namespace1);
        descriptionElement.addNamespace(null, namespace2);
       
            //Get namespace and prefix on description
            URI uri = descriptionElement.getNamespaceURI(prefix1);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace1, uri);
   
            String prefix = descriptionElement.getNamespacePrefix(namespace1);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix1, prefix);
           
            //Get default namespace
            uri = descriptionElement.getNamespaceURI("");
            assertEquals("Default NamespaceURI does not match that set", namespace2, uri);
   
            //Get undefined namespace and prefix.
            assertNull("Null was not returned when a non-existent namespace prefix was given", descriptionElement.getNamespaceURI(nonExistantPrefix));
            assertNull("Null was not returned when a non-existent namespace URI was given", descriptionElement.getNamespacePrefix(nonExistantNamespace));
   
        InterfaceElement interfaceElement = descriptionElement.addInterfaceElement();
        interfaceElement.addNamespace(prefix3, namespace3);
       
            //Get namespace and prefix on description
            uri = interfaceElement.getNamespaceURI(prefix1);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace1, uri);
   
            prefix = interfaceElement.getNamespacePrefix(namespace1);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix1, prefix);
           
            //Get default namespace on description
            uri = interfaceElement.getNamespaceURI("");
            assertEquals("Default NamespaceURI does not match that set", namespace2, uri);
           
            //Get namespace and prefix on interface
            uri = interfaceElement.getNamespaceURI(prefix3);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace3, uri);
   
            prefix = interfaceElement.getNamespacePrefix(namespace3);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix3, prefix);
   
            //Get undefined namespace and prefix.
            assertNull("Null was not returned when a non-existent namespace prefix was given", interfaceElement.getNamespaceURI(nonExistantPrefix));
            assertNull("Null was not returned when a non-existent namespace URI was given", interfaceElement.getNamespacePrefix(nonExistantNamespace));
       
        InterfaceFaultElement interfaceFaultElement = interfaceElement.addInterfaceFaultElement();
        interfaceFaultElement.addNamespace(prefix4, namespace4);
       
            //Get namespace and prefix on description
            uri = interfaceFaultElement.getNamespaceURI(prefix1);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace1, uri);
   
            prefix = interfaceFaultElement.getNamespacePrefix(namespace1);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix1, prefix);
           
            //Get default namespace on description
            uri = interfaceFaultElement.getNamespaceURI("");
            assertEquals("Default NamespaceURI does not match that set", namespace2, uri);
           
            //Get namespace and prefix on interface
            uri = interfaceFaultElement.getNamespaceURI(prefix3);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace3, uri);
   
            prefix = interfaceFaultElement.getNamespacePrefix(namespace3);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix3, prefix);
           
            //Get namespace and prefix on interface fault
            uri = interfaceFaultElement.getNamespaceURI(prefix4);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace4, uri);
   
            prefix = interfaceFaultElement.getNamespacePrefix(namespace4);
            assertEquals("Retrieved NamespacePrefix does not match that set", prefix4, prefix);
   
            //Get undefined namespace and prefix.
            assertNull("Null was not returned when a non-existent namespace prefix was given", interfaceFaultElement.getNamespaceURI(nonExistantPrefix));
            assertNull("Null was not returned when a non-existent namespace URI was given", interfaceFaultElement.getNamespacePrefix(nonExistantNamespace));
       
        BindingElement bindingElement = descriptionElement.addBindingElement();
        bindingElement.addNamespace(prefix5, namespace5);
       
            //Get namespace and prefix on description
            uri = bindingElement.getNamespaceURI(prefix1);
            assertEquals("Retrieved NamespaceURI does not match that set", namespace1, uri);
View Full Code Here

            assertNull("Null was not returned when a non-existent namespace URI was given", bindingFaultElement.getNamespacePrefix(nonExistantNamespace));
    }
   
    public void testRemoveNamespace() {
        //Build up wsdl20 element model.
        DescriptionElement descriptionElement = factory.newDescription();
        descriptionElement.addNamespace(prefix1,namespace1);
        assertNotNull(descriptionElement.getNamespaceURI(prefix1));
        assertNotNull(descriptionElement.getNamespacePrefix(namespace1));
       
        TypesElement typesElement = null;
        try {
            typesElement = descriptionElement.addTypesElement();
        } catch (WSDLException e) {
            //This will never happen as I've only added one types element to the description in since creating it 8 lines above.
            fail("Unexpected exception was thrown: " + e.getMessage()); //But in case...
        }
        typesElement.addNamespace(prefix2, namespace2);
        assertNotNull(typesElement.getNamespaceURI(prefix2));
        assertNotNull(typesElement.getNamespacePrefix(namespace2));
        assertNotNull(typesElement.getNamespaceURI(prefix1));
        assertNotNull(typesElement.getNamespacePrefix(namespace1));
       
        DocumentationElement documentationElement = typesElement.addDocumentationElement();
        documentationElement.addNamespace(prefix3, namespace3);
        assertNotNull(documentationElement.getNamespaceURI(prefix3));
        assertNotNull(documentationElement.getNamespacePrefix(namespace3));
        assertNotNull(documentationElement.getNamespaceURI(prefix2));
        assertNotNull(documentationElement.getNamespacePrefix(namespace2));
        assertNotNull(documentationElement.getNamespaceURI(prefix1));
        assertNotNull(documentationElement.getNamespacePrefix(namespace1));

        //Remove non existant namespace.
        typesElement.removeNamespace(nonExistantPrefix);
        assertNotNull(documentationElement.getNamespaceURI(prefix3));
        assertNotNull(documentationElement.getNamespacePrefix(namespace3));
        assertNotNull(documentationElement.getNamespaceURI(prefix2));
        assertNotNull(documentationElement.getNamespacePrefix(namespace2));
        assertNotNull(documentationElement.getNamespaceURI(prefix1));
        assertNotNull(documentationElement.getNamespacePrefix(namespace1));
       
        descriptionElement.removeNamespace(nonExistantPrefix);
        assertNotNull(documentationElement.getNamespaceURI(prefix3));
        assertNotNull(documentationElement.getNamespacePrefix(namespace3));
        assertNotNull(documentationElement.getNamespaceURI(prefix2));
        assertNotNull(documentationElement.getNamespacePrefix(namespace2));
        assertNotNull(documentationElement.getNamespaceURI(prefix1));
        assertNotNull(documentationElement.getNamespacePrefix(namespace1));
       
        documentationElement.removeNamespace(nonExistantPrefix);
        assertNotNull(documentationElement.getNamespaceURI(prefix3));
        assertNotNull(documentationElement.getNamespacePrefix(namespace3));
        assertNotNull(documentationElement.getNamespaceURI(prefix2));
        assertNotNull(documentationElement.getNamespacePrefix(namespace2));
        assertNotNull(documentationElement.getNamespaceURI(prefix1));
        assertNotNull(documentationElement.getNamespacePrefix(namespace1));
       
        //Remove namespaces one at a time.
        descriptionElement.removeNamespace(prefix1);
        descriptionElement.removeNamespace(prefix2);
        descriptionElement.removeNamespace(prefix3);
        assertNotNull(documentationElement.getNamespaceURI(prefix3));
        assertNotNull(documentationElement.getNamespacePrefix(namespace3));
        assertNotNull(documentationElement.getNamespaceURI(prefix2));
        assertNotNull(documentationElement.getNamespacePrefix(namespace2));
        assertNull(documentationElement.getNamespaceURI(prefix1));
View Full Code Here

TOP

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

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.