Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
tModels.addAll(portTypeTModels);
Assert.assertEquals(1, tModels.size());
TModel tModel = tModels.iterator().next();
System.out.println("UDDI PortType TModel " + tModel.getName().getValue());
if (serialize) {
System.out.println(pTModel.print(tModel));
}
//now compare to the spec example
String porttypeXml = "wsdl/uddiv3-xml/3_2_1_porttype.xml";
TModel specTModel = (org.uddi.api_v3.TModel) EntityCreator.buildFromDoc(porttypeXml, EntityCreator.UDDIv3_Package);
//making sure the names are the same
Assert.assertEquals(specTModel.getName().getValue(), tModel.getName().getValue());
//We should have a overviewDoc with one overviewURL which should end with "/sample.wsdl"
Assert.assertNotNull(tModel.getOverviewDoc());
Assert.assertEquals(1, tModel.getOverviewDoc().size());
Assert.assertNotNull(tModel.getOverviewDoc().get(0).getOverviewURL());
Assert.assertTrue(specTModel.getOverviewDoc().get(0).getOverviewURL().getValue().endsWith("/sample.wsdl"));
Assert.assertTrue(tModel.getOverviewDoc().get(0).getOverviewURL().getValue().endsWith("/sample.wsdl"));
//We should have a categoryBag with 2 keyedReferences
Assert.assertNotNull(tModel.getCategoryBag());
Assert.assertNotNull(tModel.getCategoryBag().getKeyedReference());
Assert.assertEquals(2, tModel.getCategoryBag().getKeyedReference().size());
for (KeyedReference keyedReference : tModel.getCategoryBag().getKeyedReference()) {
boolean match = false;
Iterator<KeyedReference> iter = specTModel.getCategoryBag().getKeyedReference().iterator();
while (iter.hasNext() && match == false) {
KeyedReference specKeyedRef = iter.next();
if (specKeyedRef.getTModelKey().equals(keyedReference.getTModelKey())) {
match = true;
Assert.assertEquals(specKeyedRef.getKeyName(), keyedReference.getKeyName());