use of act.util.ClassInfoRepository 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");
}
use of act.util.ClassInfoRepository in project actframework by actframework.
the class ActionMethodMetaInfo method mergeFromWithList.
private void mergeFromWithList(final ControllerClassMetaInfoManager infoBase, final App app) {
C.Set<String> withClasses = this.withList;
if (withClasses.isEmpty()) {
return;
}
ClassInfoRepository repo = app.classLoader().classInfoRepository();
for (final String withClass : withClasses) {
String curWithClass = withClass;
ControllerClassMetaInfo withClassInfo = infoBase.controllerMetaInfo(curWithClass);
while (null == withClassInfo && !"java.lang.Object".equals(curWithClass)) {
ClassNode node = repo.node(curWithClass);
if (null != node) {
node = node.parent();
}
if (null == node) {
break;
}
curWithClass = node.name();
withClassInfo = infoBase.controllerMetaInfo(curWithClass);
}
if (null != withClassInfo) {
withClassInfo.merge(infoBase, app);
interceptors.mergeFrom(withClassInfo.interceptors);
}
}
}
use of act.util.ClassInfoRepository in project actframework by actframework.
the class ControllerClassMetaInfo method mergeFromWithList.
private void mergeFromWithList(final ControllerClassMetaInfoManager infoBase, final App app) {
C.Set<String> withClasses = C.newSet();
getAllWithList(withClasses, infoBase);
final ControllerClassMetaInfo me = this;
ClassInfoRepository repo = app.classLoader().classInfoRepository();
for (final String withClass : withClasses) {
String curWithClass = withClass;
ControllerClassMetaInfo withClassInfo = infoBase.controllerMetaInfo(curWithClass);
while (null == withClassInfo && !"java.lang.Object".equals(curWithClass)) {
ClassNode node = repo.node(curWithClass);
if (null != node) {
node = node.parent();
}
if (null == node) {
break;
}
curWithClass = node.name();
withClassInfo = infoBase.controllerMetaInfo(curWithClass);
}
if (null != withClassInfo) {
withClassInfo.merge(infoBase, app);
if (isMyAncestor(withClassInfo)) {
interceptors.mergeFrom(withClassInfo.interceptors, me);
} else {
interceptors.mergeFrom(withClassInfo.interceptors);
}
}
}
}
use of act.util.ClassInfoRepository in project actframework by actframework.
the class ControllerClassMetaInfoManager method buildControllerHierarchies.
public void buildControllerHierarchies() {
AppClassLoader cl = Act.app().classLoader();
ControllerClassMetaInfoManager manager = cl.controllerClassMetaInfoManager();
ClassInfoRepository repo = cl.classInfoRepository();
for (ControllerClassMetaInfo info : manager.controllers.values()) {
buildSuperClassMetaInfo(info, manager, repo);
}
}
Aggregations