ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
factories.addFactory(wsdlFactory);
XSDModelResolver resolver = new XSDModelResolver(null, factories);
resolver.addModel(definition);
XSDefinition resolved = resolver.resolveModel(XSDefinition.class, definition);
XmlSchemaObjectCollection collection = resolved.getSchema().getIncludes();
Assert.assertTrue(collection.getCount() == 1);
XmlSchemaType type =
((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
Assert.assertNotNull(type);
resolver.addModel(definition1);
resolved = resolver.resolveModel(XSDefinition.class, definition);
collection = resolved.getSchema().getIncludes();
Assert.assertTrue(collection.getCount() == 2);
XmlSchemaType type1 =
((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
XmlSchemaType type2 =
((XmlSchemaInclude)collection.getItem(1)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
Assert.assertTrue(type1 != null || type2 != null);
}