use of act.inject.param.ParamValueLoaderManager in project actframework by actframework.
the class ReflectedJobInvoker method init.
private synchronized void init() {
if (null != jobClass) {
return;
}
disabled = false;
jobClass = $.classForName(classInfo.className(), cl);
disabled = disabled || !Env.matches(jobClass);
method = methodInfo.method();
disabled = disabled || !Env.matches(method);
if (disabled) {
return;
}
isStatic = methodInfo.isStatic();
if (!isStatic) {
singleton = ReflectedInvokerHelper.tryGetSingleton(jobClass, app);
}
ParamValueLoaderManager paramValueLoaderManager = app.service(ParamValueLoaderManager.class);
if (null != paramValueLoaderManager) {
paramValueLoaderService = paramValueLoaderManager.get(JobContext.class);
} else {
// this job is scheduled to run before ParamValueLoaderManager initialized
}
if (!Modifier.isStatic(method.getModifiers())) {
Class[] paramTypes = paramTypes();
// constructorAccess = ConstructorAccess.get(controllerClass);
methodAccess = MethodAccess.get(jobClass);
methodIndex = methodAccess.getIndex(methodInfo.name(), paramTypes);
} else {
method.setAccessible(true);
}
}
use of act.inject.param.ParamValueLoaderManager 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");
}
Aggregations