Update for code split out of tapestry-ioc
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7e8fc835 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7e8fc835 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7e8fc835 Branch: refs/heads/master Commit: 7e8fc8352d204456266eb670e53dfc29245462ab Parents: 0449609 Author: Howard M. Lewis Ship <hls...@apache.org> Authored: Tue Dec 23 15:16:35 2014 -0800 Committer: Howard M. Lewis Ship <hls...@apache.org> Committed: Tue Dec 23 15:16:35 2014 -0800 ---------------------------------------------------------------------- .../ioc/specs/ClasspathScannerImplSpec.groovy | 38 ++++++++------------ 1 file changed, 15 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7e8fc835/tapestry-ioc/src/test/groovy/ioc/specs/ClasspathScannerImplSpec.groovy ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/ClasspathScannerImplSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/ClasspathScannerImplSpec.groovy index 72e6eaf..4ddd6df 100644 --- a/tapestry-ioc/src/test/groovy/ioc/specs/ClasspathScannerImplSpec.groovy +++ b/tapestry-ioc/src/test/groovy/ioc/specs/ClasspathScannerImplSpec.groovy @@ -1,44 +1,36 @@ package ioc.specs -import java.io.File; -import java.net.URL; - -import org.apache.tapestry5.ioc.Locatable; -import org.apache.tapestry5.ioc.internal.services.ClasspathScannerImpl; +import org.apache.tapestry5.ioc.Locatable +import org.apache.tapestry5.ioc.internal.BasicTypeCoercions +import org.apache.tapestry5.ioc.internal.services.ClasspathScannerImpl import org.apache.tapestry5.ioc.internal.services.ClasspathURLConverterImpl -import org.apache.tapestry5.ioc.internal.util.InternalUtils; -import org.apache.tapestry5.ioc.services.ClasspathMatcher; -import org.apache.tapestry5.ioc.services.ClasspathURLConverter; - -import spock.lang.Specification; +import org.apache.tapestry5.ioc.services.ClasspathMatcher +import spock.lang.Specification class ClasspathScannerImplSpec extends Specification { - + // TAP5-2096 def "can locate classes inside a subpackage, inside an extracted JAR file"() { setup: - ClasspathMatcher matchAll = new ClasspathMatcher(){ - boolean matches(String arg0, String arg1) { - true - }; - } + ClasspathMatcher matchAll = { packagePage, fileName -> true } as ClasspathMatcher + def scannerJob = new ClasspathScannerImpl.Job(matchAll, Thread.currentThread().getContextClassLoader(), new ClasspathURLConverterImpl()) - + when: URL url = Locatable.class.getResource('Locatable.class'); scannerJob.scanDir("org/apache/tapestry5/ioc/", new File(url.getPath()).parentFile) - while (!scannerJob.queue.isEmpty()) - { + while (!scannerJob.queue.isEmpty()) { def queued = scannerJob.queue.pop(); queued.run(); } + def classes = scannerJob.matches - + then: - classes.contains(InternalUtils.class.getName().replaceAll(/\./, "/")+'.class') + classes.contains(BasicTypeCoercions.name.replaceAll(/\./, "/") + '.class') } - - + + }