@Test public void shouldScanWEBINFClasses() { when(classPathResolver.findBasePackages()).thenReturn(Arrays.asList("")); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); when(classPathResolver.getClassLoader()).thenReturn(classLoader); when(classPathResolver.findWebInfClassesLocation()).thenReturn(classLoader.getResource("br/com/caelum/vraptor/ioc/")); ScannotationComponentScanner scanner = new ScannotationComponentScanner(); assertThat(scanner.scan(classPathResolver), hasItem(ResourceInTheClasspath.class.getName())); }
public Collection<String> scan(ClasspathResolver resolver) { final URL webInfClasses = resolver.findWebInfClassesLocation(); final List<String> basePackages = resolver.findBasePackages(); HashSet<String> results = new HashSet<String>(); Map<String, Set<String>> webInfClassesAnnotationMap = scanWebInfClasses(webInfClasses); Map<String, Set<String>> basePackagesAnnotationMap = scanBasePackages(basePackages, resolver); Set<String> stereotypeNames = findStereotypes(webInfClassesAnnotationMap, basePackagesAnnotationMap, basePackages); findComponentsFromWebInfClasses(webInfClassesAnnotationMap, stereotypeNames, results); findComponentsFromBasePackages(basePackagesAnnotationMap, basePackages, results); return results; }
ScannotationComponentScanner implements ComponentScanner { public Collection<String> scan(ClasspathResolver resolver) { final URL webInfClasses = resolver.findWebInfClassesLocation(); final List<String> basePackages = resolver.findBasePackages(); HashSet<String> results = new HashSet<String>(); Map<String, Set<String>> webInfClassesAnnotationMap = scanWebInfClasses(webInfClasses); Map<String, Set<String>> basePackagesAnnotationMap = scanBasePackages(basePackages, resolver); Set<String> stereotypeNames = findStereotypes(webInfClassesAnnotationMap, basePackagesAnnotationMap, basePackages); findComponentsFromWebInfClasses(webInfClassesAnnotationMap, stereotypeNames, results); findComponentsFromBasePackages(basePackagesAnnotationMap, basePackages, results); return results; } }
ScannotationComponentScanner implements ComponentScanner { public Collection<String> scan(ClasspathResolver resolver) { final URL webInfClasses = resolver.findWebInfClassesLocation(); final List<String> basePackages = resolver.findBasePackages(); HashSet<String> results = new HashSet<String>(); Map<String, Set<String>> webInfClassesAnnotationMap = scanWebInfClasses(webInfClasses); Map<String, Set<String>> basePackagesAnnotationMap = scanBasePackages(basePackages, resolver); Set<String> stereotypeNames = findStereotypes(webInfClassesAnnotationMap, basePackagesAnnotationMap, basePackages); findComponentsFromWebInfClasses(webInfClassesAnnotationMap, stereotypeNames, results); findComponentsFromBasePackages(basePackagesAnnotationMap, basePackages, results); return results; }  }
ScannotationComponentScanner implements ComponentScanner { public Collection<String> scan(ClasspathResolver resolver) { final URL webInfClasses = resolver.findWebInfClassesLocation(); final List<String> basePackages = resolver.findBasePackages(); HashSet<String> results = new HashSet<String>(); Map<String, Set<String>> webInfClassesAnnotationMap = scanWebInfClasses(webInfClasses); Map<String, Set<String>> basePackagesAnnotationMap = scanBasePackages(basePackages, resolver); Set<String> stereotypeNames = findStereotypes(webInfClassesAnnotationMap, basePackagesAnnotationMap, basePackages); findComponentsFromWebInfClasses(webInfClassesAnnotationMap, stereotypeNames, results); findComponentsFromBasePackages(basePackagesAnnotationMap, basePackages, results); return results; }  Collection<String> scan(ClasspathResolver resolver); }
ScannotationComponentScanner implements ComponentScanner { public Collection<String> scan(ClasspathResolver resolver) { final URL webInfClasses = resolver.findWebInfClassesLocation(); final List<String> basePackages = resolver.findBasePackages(); HashSet<String> results = new HashSet<String>(); Map<String, Set<String>> webInfClassesAnnotationMap = scanWebInfClasses(webInfClasses); Map<String, Set<String>> basePackagesAnnotationMap = scanBasePackages(basePackages, resolver); Set<String> stereotypeNames = findStereotypes(webInfClassesAnnotationMap, basePackagesAnnotationMap, basePackages); findComponentsFromWebInfClasses(webInfClassesAnnotationMap, stereotypeNames, results); findComponentsFromBasePackages(basePackagesAnnotationMap, basePackages, results); return results; }  Collection<String> scan(ClasspathResolver resolver);  }