@Test void testScopeRegistration() { final ScopeResolver scopeResolver = new ScopeResolver(); scopeResolver.madpc = new PetiteContainer(); scopeResolver.madpc.addBean("madvocEncoding", new MadvocEncoding()); final MadvocScope requestScope = scopeResolver.defaultOrScopeType(RequestScope.class); final MadvocScope requestScope2 = scopeResolver.defaultOrScopeType(RequestScope.class); assertEquals(requestScope2, requestScope); final MyScope myScope = scopeResolver.defaultOrScopeType(MyScope.class); assertEquals(2, scopeResolver.allScopes.size()); }
@Test void testScopeClassLookup() { final ScopeResolver scopeResolver = new ScopeResolver(); scopeResolver.madpc = new PetiteContainer(); scopeResolver.madpc.addBean("madvocEncoding", new MadvocEncoding()); final MadvocScope madvocScope = scopeResolver.defaultOrScopeType(MyScope.class); assertNotNull(madvocScope); assertTrue(madvocScope instanceof MyScope); final MadvocScope madvocScope2 = scopeResolver.defaultOrScopeType(MyScope.class); assertEquals(madvocScope2, madvocScope); } }
private InterceptorsManager createInterceptorManager() { PetiteContainer madpc = new PetiteContainer(); madpc.addSelf("madpc"); madpc.addBean("madvocEncoding", new MadvocEncoding()); InterceptorsManager im = new InterceptorsManager(); im.contextInjectorComponent = new ContextInjectorComponent(); im.contextInjectorComponent.madvocController = new MadvocController(); im.contextInjectorComponent.madvocController.servletContextProvider = new ServletContextProvider(null); im.contextInjectorComponent.scopeDataInspector = new ScopeDataInspector(); im.contextInjectorComponent.scopeResolver = new ScopeResolver(); im.contextInjectorComponent.scopeResolver.madpc = madpc; return im; }
@Test void testInAnnotations() { ScopeDataInspector scopeDataInspector = new ScopeDataInspector(); PetiteContainer madpc = new PetiteContainer(); scopeDataInspector.scopeResolver = new ScopeResolver(); scopeDataInspector.scopeResolver.madpc = madpc; madpc.addBean("madvocEncoding", new MadvocEncoding()); ScopeData scopeData = scopeDataInspector.inspectClassScopes(Action.class); InjectionPoint[] in1 = scopeData.in(); InjectionPoint in = in1[0]; assertEquals("input", in.name()); assertEquals(String.class, in.type()); }
@Test void testGenericAction() { ScopeDataInspector scopeDataInspector = new ScopeDataInspector(); PetiteContainer madpc = new PetiteContainer(); scopeDataInspector.scopeResolver = new ScopeResolver(); scopeDataInspector.scopeResolver.madpc = madpc; madpc.addBean("madvocEncoding", new MadvocEncoding()); ScopeData scopeData = scopeDataInspector.inspectClassScopes(GenAction.class); InjectionPoint[] in1 = scopeData.in(); InjectionPoint[] out1 = scopeData.out(); InjectionPoint in = in1[0]; InjectionPoint out = out1[0]; assertEquals("input", in.name()); assertEquals(String.class, in.type()); assertEquals("output", out.name()); assertEquals(Integer.class, out.type()); }