}
@Test
public void testXSD() throws Exception {
URL url = getClass().getResource("/xsd/greeting.xsd");
XSDefinition definition = processor.read(null, URI.create("xsd/greeting.xsd"), url);
Assert.assertNull(definition.getSchema());
Assert.assertEquals("http://greeting", definition.getNamespace());
URL url1 = getClass().getResource("/xsd/name.xsd");
XSDefinition definition1 = processor.read(null, URI.create("xsd/name.xsd"), url1);
Assert.assertNull(definition1.getSchema());
Assert.assertEquals("http://greeting", definition1.getNamespace());
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"));