Search in sources :

Example 6 with DefaultClasspathScanner

use of com.canoo.dp.impl.server.scanner.DefaultClasspathScanner in project dolphin-platform by canoo.

the class ControllerRepositoryTest method testExistingControllers.

@Test
public void testExistingControllers() throws Exception {
    ControllerRepository controllerRepository = new ControllerRepository(new DefaultClasspathScanner(ControllerRepositoryTest.class.getPackage().getName()));
    Class<?> controllerClass = controllerRepository.getControllerClassForName(TestController.class.getName());
    assertNotNull(controllerClass);
    assertEquals(controllerClass, TestController.class);
}
Also used : DefaultClasspathScanner(com.canoo.dp.impl.server.scanner.DefaultClasspathScanner) ControllerRepository(com.canoo.dp.impl.server.controller.ControllerRepository) Test(org.testng.annotations.Test)

Example 7 with DefaultClasspathScanner

use of com.canoo.dp.impl.server.scanner.DefaultClasspathScanner in project dolphin-platform by canoo.

the class ClasspathScannerTest method testInMultiplePackages.

@Test
public void testInMultiplePackages() {
    // There can't be a class that is annotated with Inject
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan.documented", "com.canoo.impl.server.classpathscan.resource");
    assertForAnnotation(scanner);
}
Also used : DefaultClasspathScanner(com.canoo.dp.impl.server.scanner.DefaultClasspathScanner) Test(org.testng.annotations.Test) AnnotationForClasspathScanTest(com.canoo.impl.server.util.AnnotationForClasspathScanTest)

Example 8 with DefaultClasspathScanner

use of com.canoo.dp.impl.server.scanner.DefaultClasspathScanner in project dolphin-platform by canoo.

the class ClasspathScannerTest method testScanOtherPackage.

@Test
public void testScanOtherPackage() {
    // There can't be a class that is annotated with Inject
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN);
    Set<Class<?>> classes = scanner.getTypesAnnotatedWith(Resources.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);
    classes = scanner.getTypesAnnotatedWith(AnnotationForClasspathScanTest.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 0);
    classes = scanner.getTypesAnnotatedWith(Documented.class);
    assertNotNull(classes);
    assertEquals(classes.size(), 1);
    assertTrue(classes.contains(DocumentAnnotatedClass.class));
}
Also used : Documented(java.lang.annotation.Documented) DefaultClasspathScanner(com.canoo.dp.impl.server.scanner.DefaultClasspathScanner) DocumentAnnotatedClass(com.canoo.impl.server.classpathscan.documented.DocumentAnnotatedClass) DocumentAnnotatedClass(com.canoo.impl.server.classpathscan.documented.DocumentAnnotatedClass) AnnotationForClasspathScanTest(com.canoo.impl.server.util.AnnotationForClasspathScanTest) Test(org.testng.annotations.Test) AnnotationForClasspathScanTest(com.canoo.impl.server.util.AnnotationForClasspathScanTest)

Example 9 with DefaultClasspathScanner

use of com.canoo.dp.impl.server.scanner.DefaultClasspathScanner in project dolphin-platform by canoo.

the class ClasspathScannerTest method testNullArgument.

@Test(expectedExceptions = NullPointerException.class)
public void testNullArgument() {
    final DefaultClasspathScanner scanner = new DefaultClasspathScanner(CLASSPATH_SCAN);
    Set<Class<?>> classes = scanner.getTypesAnnotatedWith(null);
}
Also used : DefaultClasspathScanner(com.canoo.dp.impl.server.scanner.DefaultClasspathScanner) DocumentAnnotatedClass(com.canoo.impl.server.classpathscan.documented.DocumentAnnotatedClass) Test(org.testng.annotations.Test) AnnotationForClasspathScanTest(com.canoo.impl.server.util.AnnotationForClasspathScanTest)

Aggregations

DefaultClasspathScanner (com.canoo.dp.impl.server.scanner.DefaultClasspathScanner)9 Test (org.testng.annotations.Test)8 AnnotationForClasspathScanTest (com.canoo.impl.server.util.AnnotationForClasspathScanTest)6 DocumentAnnotatedClass (com.canoo.impl.server.classpathscan.documented.DocumentAnnotatedClass)3 ControllerRepository (com.canoo.dp.impl.server.controller.ControllerRepository)2 SimpleDolphinPlatformThreadFactory (com.canoo.dp.impl.platform.core.SimpleDolphinPlatformThreadFactory)1 ServerConfiguration (com.canoo.dp.impl.server.config.ServerConfiguration)1 AnnotatedClassForClasspathScan (com.canoo.impl.server.util.AnnotatedClassForClasspathScan)1 DolphinRuntimeException (com.canoo.platform.core.DolphinRuntimeException)1 PlatformThreadFactory (com.canoo.platform.core.PlatformThreadFactory)1 ModuleDefinition (com.canoo.platform.server.spi.ModuleDefinition)1 ModuleInitializationException (com.canoo.platform.server.spi.ModuleInitializationException)1 ServerModule (com.canoo.platform.server.spi.ServerModule)1 ManagedBeanFactory (com.canoo.platform.server.spi.components.ManagedBeanFactory)1 Documented (java.lang.annotation.Documented)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1