Search in sources :

Example 1 with NullTemplateApi

use of org.webpieces.router.api.simplesvr.NullTemplateApi in project webpieces by deanhiller.

the class ErrorCommonTest method createServer.

public static RouterService createServer(boolean isProdTest, String moduleFileContents) {
    VirtualFile f = new VirtualFileInputStream(moduleFileContents.getBytes(), "testAppModules");
    SimpleMeterRegistry metrics = new SimpleMeterRegistry();
    TemplateApi nullApi = new NullTemplateApi();
    if (isProdTest)
        return RouterServiceFactory.create("ErrorCommonTest", metrics, f, nullApi);
    // otherwise create the development server
    String filePath = System.getProperty("user.dir");
    File myCodePath = new File(filePath + "/src/test/java");
    VirtualFile cacheLocation = new VirtualFileImpl(FileFactory.newCacheLocation("webpieces/" + ErrorCommonTest.class.getSimpleName() + "/bytecode"));
    CompileConfig compileConfig = new CompileConfig(new VirtualFileImpl(myCodePath), cacheLocation);
    log.info("bytecode dir=" + compileConfig.getByteCodeCacheDir());
    RouterService server = DevRouterFactory.create("ErrorCommonTest", metrics, f, compileConfig, nullApi);
    return server;
}
Also used : VirtualFile(org.webpieces.util.file.VirtualFile) VirtualFileInputStream(org.webpieces.router.api.mocks.VirtualFileInputStream) RouterService(org.webpieces.router.api.RouterService) TemplateApi(org.webpieces.router.api.TemplateApi) NullTemplateApi(org.webpieces.router.api.simplesvr.NullTemplateApi) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) CompileConfig(org.webpieces.compiler.api.CompileConfig) NullTemplateApi(org.webpieces.router.api.simplesvr.NullTemplateApi) VirtualFileImpl(org.webpieces.util.file.VirtualFileImpl) File(java.io.File) VirtualFile(org.webpieces.util.file.VirtualFile)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 File (java.io.File)1 CompileConfig (org.webpieces.compiler.api.CompileConfig)1 RouterService (org.webpieces.router.api.RouterService)1 TemplateApi (org.webpieces.router.api.TemplateApi)1 VirtualFileInputStream (org.webpieces.router.api.mocks.VirtualFileInputStream)1 NullTemplateApi (org.webpieces.router.api.simplesvr.NullTemplateApi)1 VirtualFile (org.webpieces.util.file.VirtualFile)1 VirtualFileImpl (org.webpieces.util.file.VirtualFileImpl)1