public void testAccepableSchema() {
   assertFalse(
       "We should not accept the test by default!", resolver.isAcceptableScheme("test://test"));
   resolver.setAcceptableSchemes("test:;test2:");
   assertTrue("We should accept the test:!", resolver.isAcceptableScheme("test://test"));
   assertTrue("We should accept the test2:!", resolver.isAcceptableScheme("test2://test"));
 }
  public void testFindByFilterPackageInJarUrlWithPlusChars() throws Exception {
    ClassLoader savedClassLoader = null;
    try {
      savedClassLoader = Thread.currentThread().getContextClassLoader();
      URL url = getClass().getResource("/package+scan+test.jar");

      URL urls[] = {new URL("jar:" + url.toString() + "!/")};
      URLClassLoader classLoader = new URLClassLoader(urls, savedClassLoader);

      Thread.currentThread().setContextClassLoader(classLoader);

      // recreate resolver since we mess with context class loader
      resolver = new DefaultPackageScanClassResolver();

      filter.addIncludePattern("a.*.c.*");
      resolver.addFilter(filter);
      Set<Class<?>> scanned = resolver.findByFilter(filter, "a.b.c");
      assertEquals(1, scanned.size());
      assertEquals("class a.b.c.Test", scanned.iterator().next().toString());
    } finally {
      if (savedClassLoader != null) {
        Thread.currentThread().setContextClassLoader(savedClassLoader);
      }
    }
  }
  public void testFindImplementationsWithExcludePackageFilter() {
    filter.addExcludePattern(scanPackage + ".a.*");
    resolver.addFilter(filter);

    Set<Class<?>> scanned = resolver.findImplementations(ScanTargetOne.class, scanPackage);
    validateMatchingSetContains(scanned, ScanTargetTwo.class);
  }
  public void testFindByAnnotationsWithIncludePackageFilter() {
    filter.addIncludePattern(scanPackage + ".b.*");
    filter.addIncludePattern(scanPackage + ".c.*");
    resolver.addFilter(filter);

    Set<Class<?>> scanned = resolver.findAnnotated(annotations, "org.apache.camel.spring.scan");
    validateMatchingSetContains(scanned, ScanTargetTwo.class, ScanTargetThree.class);
  }
  public void testFindByAnnotationWithoutExtraFilters() {
    Set<Class<?>> scanned =
        resolver.findAnnotated(org.apache.camel.spring.scan.ScannableOne.class, scanPackage);
    validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class);

    scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableTwo.class, scanPackage);
    validateMatchingSetContains(scanned, ScanTargetThree.class);
  }
  public void testFindByAnnotationWithExcludePackageFilter() {
    filter.addExcludePattern(scanPackage + ".b.*");
    filter.addExcludePattern(scanPackage + ".c.*");
    resolver.addFilter(filter);

    Set<Class<?>> scanned = resolver.findAnnotated(ScannableOne.class, scanPackage);
    validateMatchingSetContains(scanned, ScanTargetOne.class);

    scanned = resolver.findAnnotated(org.apache.camel.spring.scan.ScannableTwo.class, scanPackage);
    validateMatchingSetContains(scanned);
  }
 public void testFindImplementationsWithoutExtraFilters() {
   Set<Class<?>> scanned = resolver.findImplementations(ScanTargetOne.class, scanPackage);
   validateMatchingSetContains(scanned, ScanTargetOne.class, ScanTargetTwo.class);
 }