Repository: cxf Updated Branches: refs/heads/master 326fa2ae9 -> ab8818b7c
[CXF-5704] Correctly collecting the data between multiple package checks Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ab8818b7 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ab8818b7 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ab8818b7 Branch: refs/heads/master Commit: ab8818b7c15adb227e9e4bfb7ed4293bffcfa3eb Parents: 326fa2a Author: Sergey Beryozkin <[email protected]> Authored: Wed Apr 23 14:18:29 2014 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Apr 23 14:18:29 2014 +0100 ---------------------------------------------------------------------- .../cxf/common/util/SpringClasspathScanner.java | 17 +++++++------ .../cxf/systest/jaxrs/discovery/BookStore.java | 1 + .../jaxrs/discovery/BookStoreInterface.java | 26 -------------------- .../jaxrs/discovery/sub/BookStoreInterface.java | 26 ++++++++++++++++++++ .../jaxrs_spring_discovery/WEB-INF/beans.xml | 3 ++- .../jaxrs/discovery/jaxrs-http-client.xml | 3 ++- 6 files changed, 40 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/core/src/main/java/org/apache/cxf/common/util/SpringClasspathScanner.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/common/util/SpringClasspathScanner.java b/core/src/main/java/org/apache/cxf/common/util/SpringClasspathScanner.java index a3c0676..8daab5d 100644 --- a/core/src/main/java/org/apache/cxf/common/util/SpringClasspathScanner.java +++ b/core/src/main/java/org/apache/cxf/common/util/SpringClasspathScanner.java @@ -56,6 +56,7 @@ class SpringClasspathScanner extends ClasspathScanner { new HashMap< Class< ? extends Annotation >, Collection< Class< ? > > >(); final Map< Class< ? extends Annotation >, Collection< String > > matchingInterfaces = new HashMap< Class< ? extends Annotation >, Collection< String > >(); + final Map<String, String[]> nonMatchingClasses = new HashMap<String, String[]>(); for (Class< ? extends Annotation > annotation: annotations) { classes.put(annotation, new HashSet< Class < ? > >()); @@ -74,7 +75,7 @@ class SpringClasspathScanner extends ClasspathScanner { + ALL_CLASS_FILES; final Resource[] resources = resolver.getResources(packageSearchPath); - final Map<String, String[]> nonMatchingClasses = new HashMap<String, String[]>(); + for (final Resource resource: resources) { final MetadataReader reader = factory.getMetadataReader(resource); @@ -98,13 +99,13 @@ class SpringClasspathScanner extends ClasspathScanner { } } } - for (Map.Entry<Class<? extends Annotation>, Collection<String>> e1 : matchingInterfaces.entrySet()) { - for (Map.Entry<String, String[]> e2 : nonMatchingClasses.entrySet()) { - for (String intName : e2.getValue()) { - if (e1.getValue().contains(intName)) { - classes.get(e1.getKey()).add(ClassLoaderUtils.loadClass(e2.getKey(), getClass())); - break; - } + } + for (Map.Entry<Class<? extends Annotation>, Collection<String>> e1 : matchingInterfaces.entrySet()) { + for (Map.Entry<String, String[]> e2 : nonMatchingClasses.entrySet()) { + for (String intName : e2.getValue()) { + if (e1.getValue().contains(intName)) { + classes.get(e1.getKey()).add(ClassLoaderUtils.loadClass(e2.getKey(), getClass())); + break; } } } http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStore.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStore.java index a980736..72f4b97 100644 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStore.java +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStore.java @@ -26,6 +26,7 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import org.apache.cxf.systest.jaxrs.discovery.sub.BookStoreInterface; import org.apache.cxf.systest.jaxrs.validation.BookWithValidation; public class BookStore implements BookStoreInterface { http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStoreInterface.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStoreInterface.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStoreInterface.java deleted file mode 100644 index 298310d..0000000 --- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/BookStoreInterface.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.cxf.systest.jaxrs.discovery; - -import javax.ws.rs.Path; - -@Path("/bookstore/") -public interface BookStoreInterface { - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/sub/BookStoreInterface.java ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/sub/BookStoreInterface.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/sub/BookStoreInterface.java new file mode 100644 index 0000000..3bffa53 --- /dev/null +++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/discovery/sub/BookStoreInterface.java @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.cxf.systest.jaxrs.discovery.sub; + +import javax.ws.rs.Path; + +@Path("/bookstore/") +public interface BookStoreInterface { + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/systests/jaxrs/src/test/resources/jaxrs_spring_discovery/WEB-INF/beans.xml ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/resources/jaxrs_spring_discovery/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_spring_discovery/WEB-INF/beans.xml index 2fbed1a..74b67f8 100644 --- a/systests/jaxrs/src/test/resources/jaxrs_spring_discovery/WEB-INF/beans.xml +++ b/systests/jaxrs/src/test/resources/jaxrs_spring_discovery/WEB-INF/beans.xml @@ -28,5 +28,6 @@ http://cxf.apache.org/schemas/jaxrs.xsd"> <import resource="classpath:/META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> - <jaxrs:server address="/" basePackages="org.apache.cxf.jaxrs.validation, org.apache.cxf.systest.jaxrs.discovery" /> + <jaxrs:server address="/" + basePackages="org.apache.cxf.jaxrs.validation, org.apache.cxf.systest.jaxrs.discovery, org.apache.cxf.systest.jaxrs.discovery.sub" /> </beans> http://git-wip-us.apache.org/repos/asf/cxf/blob/ab8818b7/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/discovery/jaxrs-http-client.xml ---------------------------------------------------------------------- diff --git a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/discovery/jaxrs-http-client.xml b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/discovery/jaxrs-http-client.xml index c6956c3..53815ba 100644 --- a/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/discovery/jaxrs-http-client.xml +++ b/systests/jaxrs/src/test/resources/org/apache/cxf/systest/jaxrs/discovery/jaxrs-http-client.xml @@ -26,7 +26,8 @@ under the License. http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <jaxrs:client id="bookService" address="http://localhost:${testutil.ports.jaxrs-http}" basePackages="org.apache.cxf.systest.jaxrs.discovery"/> + <jaxrs:client id="bookService" address="http://localhost:${testutil.ports.jaxrs-http}" + basePackages="org.apache.cxf.systest.jaxrs.discovery,org.apache.cxf.systest.jaxrs.discovery.sub"/> </beans>
