diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/include-inline.wsdl b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/include-inline.wsdl index e39fb6f0..02e49b7e 100644 --- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/include-inline.wsdl +++ b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/include-inline.wsdl @@ -11,11 +11,14 @@ xmlns="http://www.springframework.org/spring-ws/include/schema" elementFormDefault="qualified" attributeFormDefault="unqualified"> + + + diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/including.xsd b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/including.xsd index 78dd1daf..2ad8e52f 100644 --- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/including.xsd +++ b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/including.xsd @@ -5,12 +5,14 @@ attributeFormDefault="unqualified"> + + diff --git a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/provider/B.xsd b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/provider/B.xsd index cb797af5..e890a9b4 100644 --- a/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/provider/B.xsd +++ b/core/src/test/resources/org/springframework/ws/wsdl/wsdl11/provider/B.xsd @@ -3,6 +3,7 @@ targetNamespace="urn:1" xmlns="urn:1" xmlns:imported="urn:2" elementFormDefault="qualified"> + @@ -10,5 +11,6 @@ + \ No newline at end of file diff --git a/samples/airline/src/main/java/org/springframework/ws/samples/airline/security/AcegiFrequentFlyerSecurityService.java b/samples/airline/src/main/java/org/springframework/ws/samples/airline/security/AcegiFrequentFlyerSecurityService.java deleted file mode 100644 index c09c794a..00000000 --- a/samples/airline/src/main/java/org/springframework/ws/samples/airline/security/AcegiFrequentFlyerSecurityService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2006 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.ws.samples.airline.security; - -import org.acegisecurity.Authentication; -import org.acegisecurity.context.SecurityContext; -import org.acegisecurity.context.SecurityContextHolder; -import org.acegisecurity.userdetails.UserDetails; -import org.acegisecurity.userdetails.UserDetailsService; -import org.acegisecurity.userdetails.UsernameNotFoundException; -import org.springframework.dao.DataAccessException; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.ws.samples.airline.dao.FrequentFlyerDao; -import org.springframework.ws.samples.airline.domain.FrequentFlyer; -import org.springframework.ws.samples.airline.service.NoSuchFrequentFlyerException; - -/** - * Implementation of the FrequentFlyerSecurityService that uses Acegi. - * - * @author Arjen Poutsma - */ -public class AcegiFrequentFlyerSecurityService implements FrequentFlyerSecurityService, UserDetailsService { - - private FrequentFlyerDao frequentFlyerDao; - - public AcegiFrequentFlyerSecurityService(FrequentFlyerDao frequentFlyerDao) { - this.frequentFlyerDao = frequentFlyerDao; - } - - @Transactional - public FrequentFlyer getCurrentlyAuthenticatedFrequentFlyer() { - SecurityContext context = SecurityContextHolder.getContext(); - Authentication authentication = context.getAuthentication(); - if (authentication != null) { - if (authentication.getPrincipal() instanceof FrequentFlyerDetails) { - FrequentFlyerDetails details = (FrequentFlyerDetails) authentication.getPrincipal(); - return details.getFrequentFlyer(); - } - else { - return (FrequentFlyer) authentication.getPrincipal(); - } - } - else { - return null; - } - } - - @Transactional - public FrequentFlyer getFrequentFlyer(String username) throws NoSuchFrequentFlyerException { - FrequentFlyer frequentFlyer = frequentFlyerDao.get(username); - if (frequentFlyer != null) { - return frequentFlyer; - } - else { - throw new NoSuchFrequentFlyerException(username); - } - } - - @Transactional - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { - FrequentFlyer frequentFlyer = frequentFlyerDao.get(username); - if (frequentFlyer != null) { - return new FrequentFlyerDetails(frequentFlyer); - } - else { - throw new UsernameNotFoundException("Frequent flyer '" + username + "' not found"); - } - } - -} diff --git a/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java b/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java index acc350fc..c1c1338d 100644 --- a/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java +++ b/xml/src/main/java/org/springframework/xml/xsd/commons/CommonsXsdSchemaCollection.java @@ -159,12 +159,12 @@ public class CommonsXsdSchemaCollection implements XsdSchemaCollection, Initiali private void findImports(XmlSchema schema, List processedSchemas) { processedSchemas.add(schema); - XmlSchemaObjectCollection includes = schema.getIncludes(); - for (int i = 0; i < includes.getCount(); i++) { - XmlSchemaExternal external = (XmlSchemaExternal) includes.getItem(i); + XmlSchemaObjectCollection imports = schema.getIncludes(); + for (int i = 0; i < imports.getCount(); i++) { + XmlSchemaExternal external = (XmlSchemaExternal) imports.getItem(i); if (external instanceof XmlSchemaImport) { XmlSchema importedSchema = external.getSchema(); - if (!processedSchemas.contains(importedSchema)) { + if (importedSchema != null && !processedSchemas.contains(importedSchema)) { inlineIncludes(importedSchema, processedSchemas); findImports(importedSchema, processedSchemas); xmlSchemas.add(importedSchema); diff --git a/xml/src/test/java/org/springframework/xml/xsd/AbstractXsdSchemaTestCase.java b/xml/src/test/java/org/springframework/xml/xsd/AbstractXsdSchemaTestCase.java index 2ae97150..65fc3e79 100644 --- a/xml/src/test/java/org/springframework/xml/xsd/AbstractXsdSchemaTestCase.java +++ b/xml/src/test/java/org/springframework/xml/xsd/AbstractXsdSchemaTestCase.java @@ -85,6 +85,19 @@ public abstract class AbstractXsdSchemaTestCase extends XMLTestCase { assertXMLEqual("Invalid Source returned", expected, result); } + public void testXmlNamespace() throws Exception { + Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class); + XsdSchema importing = createSchema(resource); + String namespace = "http://www.springframework.org/spring-ws/xmlNamespace"; + assertEquals("Invalid target namespace", namespace, importing.getTargetNamespace()); + resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class); + Document expected = documentBuilder.parse(SaxUtils.createInputSource(resource)); + DOMResult domResult = new DOMResult(); + transformer.transform(importing.getSource(), domResult); + Document result = (Document) domResult.getNode(); + assertXMLEqual("Invalid Source returned", expected, result); + } + public void testCreateValidator() throws Exception { Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTestCase.class); XsdSchema single = createSchema(resource); diff --git a/xml/src/test/resources/org/springframework/xml/xsd/xmlNamespace.xsd b/xml/src/test/resources/org/springframework/xml/xsd/xmlNamespace.xsd new file mode 100644 index 00000000..398b0ccd --- /dev/null +++ b/xml/src/test/resources/org/springframework/xml/xsd/xmlNamespace.xsd @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file