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);