Search in sources :

Example 1 with AppByteCodeScanner

use of act.app.AppByteCodeScanner in project actframework by actframework.

the class ControllerByteCodeScannerTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    controllerScanner = new ControllerByteCodeScanner();
    jobScanner = new JobByteCodeScanner();
    scannerManager = mock(AppCodeScannerManager.class);
    classInfoRepository = mock(ClassInfoRepository.class);
    eventBus = mock(EventBus.class);
    when(mockApp.eventBus()).thenReturn(eventBus);
    jobManager = new JobManager(mockApp);
    classLoader = new TestingAppClassLoader(mockApp);
    $.setProperty(classLoader, classInfoRepository, "classInfoRepository");
    when(mockApp.classLoader()).thenReturn(classLoader);
    infoSrc = classLoader.controllerClassMetaInfoManager();
    when(mockApp.classLoader()).thenReturn(classLoader);
    when(mockApp.scannerManager()).thenReturn(scannerManager);
    when(mockApp.jobManager()).thenReturn(jobManager);
    when(mockAppConfig.possibleControllerClass(anyString())).thenReturn(true);
    when(mockRouter.isActionMethod(anyString(), anyString())).thenReturn(false);
    C.List<AppByteCodeScanner> scanners = $.cast(C.listOf(controllerScanner, jobScanner));
    // C.List<AppByteCodeScanner> scanners = C.list(controllerScanner);
    when(scannerManager.byteCodeScanners()).thenReturn(scanners);
    paramValueLoaderManager = mock(ParamValueLoaderManager.class);
    when(mockApp.service(ParamValueLoaderManager.class)).thenReturn(paramValueLoaderManager);
    controllerScanner.setApp(mockApp);
    jobScanner.setApp(mockApp);
    base = new File("./target/test-classes");
}
Also used : AppCodeScannerManager(act.app.AppCodeScannerManager) C(org.osgl.util.C) AppByteCodeScanner(act.app.AppByteCodeScanner) JobByteCodeScanner(act.job.bytecode.JobByteCodeScanner) ParamValueLoaderManager(act.inject.param.ParamValueLoaderManager) TestingAppClassLoader(act.app.TestingAppClassLoader) EventBus(act.event.EventBus) JobManager(act.job.JobManager) ClassInfoRepository(act.util.ClassInfoRepository) File(java.io.File) Before(org.junit.Before)

Example 2 with AppByteCodeScanner

use of act.app.AppByteCodeScanner in project actframework by actframework.

the class ControllerEnhancerTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    invokeLog = mock(InvokeLog.class);
    scanner = new ControllerByteCodeScanner();
    scanner.setApp(mockApp);
    eventBus = mock(EventBus.class);
    classLoader = new TestingAppClassLoader(mockApp);
    classInfoRepository = mock(ClassInfoRepository.class);
    $.setProperty(classLoader, classInfoRepository, "classInfoRepository");
    infoSrc = classLoader.controllerClassMetaInfoManager();
    scannerManager = mock(AppCodeScannerManager.class);
    when(mockApp.classLoader()).thenReturn(classLoader);
    when(mockApp.scannerManager()).thenReturn(scannerManager);
    when(mockApp.eventBus()).thenReturn(eventBus);
    when(mockAppConfig.possibleControllerClass(anyString())).thenReturn(true);
    when(mockRouter.isActionMethod(anyString(), anyString())).thenReturn(false);
    C.List<AppByteCodeScanner> scanners = C.list(scanner);
    when(scannerManager.byteCodeScanners()).thenReturn(scanners);
    InvokeLogFactory.set(invokeLog);
    ActionContext.clearCurrent();
    ctx = ActionContext.create(mockApp, mockReq, mockResp);
    ctx.saveLocal();
    base = new File("./target/test-classes");
}
Also used : AppCodeScannerManager(act.app.AppCodeScannerManager) C(org.osgl.util.C) AppByteCodeScanner(act.app.AppByteCodeScanner) TestingAppClassLoader(act.app.TestingAppClassLoader) EventBus(act.event.EventBus) ClassInfoRepository(act.util.ClassInfoRepository) InvokeLog(testapp.util.InvokeLog) Before(org.junit.Before)

Example 3 with AppByteCodeScanner

use of act.app.AppByteCodeScanner in project actframework by actframework.

the class MailerEnhancerTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    invokeLog = mock(InvokeLog.class);
    scanner = new MailerByteCodeScanner();
    scanner.setApp(mockApp);
    classLoader = new TestingAppClassLoader(mockApp);
    infoSrc = classLoader.mailerClassMetaInfoManager();
    scannerManager = mock(AppCodeScannerManager.class);
    when(mockApp.classLoader()).thenReturn(classLoader);
    when(mockApp.scannerManager()).thenReturn(scannerManager);
    C.List<AppByteCodeScanner> scanners = C.list(scanner);
    when(scannerManager.byteCodeScanners()).thenReturn(scanners);
    InvokeLogFactory.set(invokeLog);
    base = new File("./target/test-classes");
}
Also used : AppCodeScannerManager(act.app.AppCodeScannerManager) C(org.osgl.util.C) AppByteCodeScanner(act.app.AppByteCodeScanner) TestingAppClassLoader(act.app.TestingAppClassLoader) InvokeLog(testapp.util.InvokeLog) MailerByteCodeScanner(act.mail.bytecode.MailerByteCodeScanner) Before(org.junit.Before)

Example 4 with AppByteCodeScanner

use of act.app.AppByteCodeScanner in project actframework by actframework.

the class CommanderByteCodeScannerTest method setup.

@Before
public void setup() throws Exception {
    super.setup();
    scanner = new CommanderByteCodeScanner();
    scannerManager = mock(AppCodeScannerManager.class);
    jobManager = mock(JobManager.class);
    classLoader = new TestingAppClassLoader(mockApp);
    dispatcher = new CliDispatcher(mockApp);
    when(mockApp.classLoader()).thenReturn(classLoader);
    infoSrc = classLoader.commanderClassMetaInfoManager();
    when(mockApp.classLoader()).thenReturn(classLoader);
    when(mockApp.cliDispatcher()).thenReturn(dispatcher);
    when(mockApp.scannerManager()).thenReturn(scannerManager);
    when(mockApp.jobManager()).thenReturn(jobManager);
    when(mockAppConfig.possibleControllerClass(anyString())).thenReturn(true);
    when(mockRouter.isActionMethod(anyString(), anyString())).thenReturn(false);
    C.List<AppByteCodeScanner> scanners = $.cast(C.listOf(scanner));
    when(scannerManager.byteCodeScanners()).thenReturn(scanners);
    scanner.setApp(mockApp);
    base = new File("./target/test-classes");
}
Also used : CliDispatcher(act.cli.CliDispatcher) AppCodeScannerManager(act.app.AppCodeScannerManager) C(org.osgl.util.C) AppByteCodeScanner(act.app.AppByteCodeScanner) TestingAppClassLoader(act.app.TestingAppClassLoader) JobManager(act.job.JobManager) File(java.io.File) Before(org.junit.Before)

Example 5 with AppByteCodeScanner

use of act.app.AppByteCodeScanner in project actframework by actframework.

the class AppCodeScannerPluginManager method initApp.

public void initApp(App app) {
    AppCodeScannerManager manager = app.scannerManager();
    for (AppCodeScannerPluginBase plugin : registry.values()) {
        AppSourceCodeScanner sourceCodeScanner = plugin.createAppSourceCodeScanner(app);
        if (null != sourceCodeScanner) {
            manager.register(sourceCodeScanner);
        }
        AppByteCodeScanner byteCodeScanner = plugin.createAppByteCodeScanner(app);
        if (null != byteCodeScanner) {
            manager.register(byteCodeScanner);
        }
    }
}
Also used : AppCodeScannerManager(act.app.AppCodeScannerManager) AppByteCodeScanner(act.app.AppByteCodeScanner) AppSourceCodeScanner(act.app.AppSourceCodeScanner)

Aggregations

AppByteCodeScanner (act.app.AppByteCodeScanner)5 AppCodeScannerManager (act.app.AppCodeScannerManager)5 TestingAppClassLoader (act.app.TestingAppClassLoader)4 Before (org.junit.Before)4 C (org.osgl.util.C)4 EventBus (act.event.EventBus)2 JobManager (act.job.JobManager)2 ClassInfoRepository (act.util.ClassInfoRepository)2 File (java.io.File)2 InvokeLog (testapp.util.InvokeLog)2 AppSourceCodeScanner (act.app.AppSourceCodeScanner)1 CliDispatcher (act.cli.CliDispatcher)1 ParamValueLoaderManager (act.inject.param.ParamValueLoaderManager)1 JobByteCodeScanner (act.job.bytecode.JobByteCodeScanner)1 MailerByteCodeScanner (act.mail.bytecode.MailerByteCodeScanner)1