boolean ns6;
NamespaceDeclaration[] namespaces;
//Description with two namespaces.
DescriptionElement descriptionElement = factory.newDescription();
descriptionElement.addNamespace(prefix1,namespace1);
descriptionElement.addNamespace(prefix2,namespace2);
//Service on description with two name spaces.
ServiceElement serviceElement = descriptionElement.addServiceElement();
serviceElement.addNamespace(prefix3, namespace3);
serviceElement.addNamespace(prefix4, namespace4);
//Endpoint on description with two namespaces
EndpointElement endpointElement = serviceElement.addEndpointElement();
endpointElement.addNamespace(prefix5, namespace5);
endpointElement.addNamespace(prefix6, namespace6);
//Get description declared name spaces.
namespaces = descriptionElement.getDeclaredNamespaces();
assertEquals("Expected 2 namespaces", namespaces.length, 2);
ns1 = false;
ns2 = false;
for(int i=0; i<namespaces.length; i++) {
if (namespaces[i].getNamespaceURI().equals(namespace1) && namespaces[i].getPrefix().equals(prefix1))
ns1 = true;
if (namespaces[i].getNamespaceURI().equals(namespace2) && namespaces[i].getPrefix().equals(prefix2))
ns2 = true;
}
assertTrue("Expected NamespaceURI not found", ns1);
assertTrue("Expected NamespaceURI not found", ns2);
//Get description in scope namespaces.
namespaces = descriptionElement.getInScopeNamespaces();
assertEquals("Expected 2 namespaces", namespaces.length, 2);
ns1 = false;
ns2 = false;
for(int i=0; i<namespaces.length; i++) {