Search in sources :

Example 1 with GenericPluginManager

use of act.plugin.GenericPluginManager in project actframework by actframework.

the class AutoConfigPluginTest method before.

@Before
public void before() throws Exception {
    setup();
    resolverManager = new StringValueResolverManager(mockApp);
    when(mockApp.resolverManager()).thenReturn(resolverManager);
    injector = new GenieInjector(mockApp);
    when(mockApp.injector()).thenReturn(injector);
    GenericPluginManager pluginManager = mock(GenericPluginManager.class);
    Field field = Act.class.getDeclaredField("pluginManager");
    field.setAccessible(true);
    field.set(null, pluginManager);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".int")))).thenReturn(intVal);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".long")))).thenReturn(longVal);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".bool")))).thenReturn(boolVal);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".str")))).thenReturn(stringVal);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".method")))).thenReturn(enumVal);
    when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".list")))).thenReturn(intListVal);
}
Also used : Field(java.lang.reflect.Field) GenericPluginManager(act.plugin.GenericPluginManager) GenieInjector(act.inject.genie.GenieInjector) StringValueResolverManager(act.app.data.StringValueResolverManager) Before(org.junit.Before)

Example 2 with GenericPluginManager

use of act.plugin.GenericPluginManager in project actframework by actframework.

the class RouterBenchmark method prepare.

@BeforeClass
public static void prepare() {
    try {
        Field f = Act.class.getDeclaredField("pluginManager");
        f.setAccessible(true);
        f.set(null, new GenericPluginManager());
    } catch (Exception e) {
        throw E.unexpected(e);
    }
    app = App.testInstance();
    config = app.config();
    RequestHandlerResolver controllerLookup = new MockRequestHandlerResolver();
    router = new Router(controllerLookup, app);
    InputStream is = TestBase.class.getResourceAsStream("/routes");
    String fc = IO.readContentAsString(is);
    builder = new RouteTableRouterBuilder(fc.split("[\r\n]+"));
    builder.build(router);
    Play.pluginCollection = new PluginCollection();
    URL url = TestBase.class.getResource("/routes");
    Play.applicationPath = new File(FastStr.of(url.getPath()).beforeLast('/').toString());
    Play.routes = VirtualFile.fromRelativePath("routes");
    play.mvc.Router.load("");
}
Also used : Field(java.lang.reflect.Field) GenericPluginManager(act.plugin.GenericPluginManager) RequestHandlerResolver(act.handler.RequestHandlerResolver) PluginCollection(play.plugins.PluginCollection) InputStream(java.io.InputStream) VirtualFile(play.vfs.VirtualFile) File(java.io.File) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 3 with GenericPluginManager

use of act.plugin.GenericPluginManager in project actframework by actframework.

the class Act method initPluginManager.

private static void initPluginManager() {
    LOGGER.debug("initializing generic plugin manager ...");
    pluginManager = new GenericPluginManager();
}
Also used : GenericPluginManager(act.plugin.GenericPluginManager)

Aggregations

GenericPluginManager (act.plugin.GenericPluginManager)3 Field (java.lang.reflect.Field)2 StringValueResolverManager (act.app.data.StringValueResolverManager)1 RequestHandlerResolver (act.handler.RequestHandlerResolver)1 GenieInjector (act.inject.genie.GenieInjector)1 File (java.io.File)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 PluginCollection (play.plugins.PluginCollection)1 VirtualFile (play.vfs.VirtualFile)1