Search in sources :

Example 1 with PluginCollection

use of play.plugins.PluginCollection 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)

Aggregations

RequestHandlerResolver (act.handler.RequestHandlerResolver)1 GenericPluginManager (act.plugin.GenericPluginManager)1 File (java.io.File)1 InputStream (java.io.InputStream)1 Field (java.lang.reflect.Field)1 URL (java.net.URL)1 BeforeClass (org.junit.BeforeClass)1 PluginCollection (play.plugins.PluginCollection)1 VirtualFile (play.vfs.VirtualFile)1