Search in sources :

Example 1 with RouterConfig

use of org.webpieces.router.api.RouterConfig in project webpieces by deanhiller.

the class TestProdRouter method bothServers.

@SuppressWarnings("rawtypes")
@Parameterized.Parameters
public static Collection bothServers() {
    String moduleFileContents = AppModules.class.getName();
    VirtualFile f = new VirtualFileInputStream(moduleFileContents.getBytes(), "testAppModules");
    TestModule module = new TestModule();
    RouterConfig config = new RouterConfig().setMetaFile(f).setWebappOverrides(module).setSecretKey(SecretKeyInfo.generateForTest());
    RouterService prodSvc = RouterSvcFactory.create(config);
    return Arrays.asList(new Object[][] { { prodSvc, module } });
}
Also used : VirtualFile(org.webpieces.util.file.VirtualFile) VirtualFileInputStream(org.webpieces.router.api.mocks.VirtualFileInputStream) RouterService(org.webpieces.router.api.RouterService) RouterConfig(org.webpieces.router.api.RouterConfig)

Example 2 with RouterConfig

use of org.webpieces.router.api.RouterConfig in project webpieces by deanhiller.

the class TestSimpleRoutes method bothServers.

@SuppressWarnings("rawtypes")
@Parameterized.Parameters
public static Collection bothServers() {
    String moduleFileContents = AppModules.class.getName();
    VirtualFile f = new VirtualFileInputStream(moduleFileContents.getBytes(), "testAppModules");
    TestModule module = new TestModule();
    RouterConfig config = new RouterConfig().setMetaFile(f).setWebappOverrides(module).setSecretKey(SecretKeyInfo.generateForTest());
    RouterService prodSvc = RouterSvcFactory.create(config);
    //for dev must be null
    config.setWebappOverrides(null);
    String filePath = System.getProperty("user.dir");
    File myCodePath = new File(filePath + "/src/test/java");
    CompileConfig compileConfig = new CompileConfig(new VirtualFileImpl(myCodePath));
    RouterService devSvc = DevRouterFactory.create(config, compileConfig);
    return Arrays.asList(new Object[][] { { prodSvc, module }, { devSvc, module } });
}
Also used : VirtualFile(org.webpieces.util.file.VirtualFile) VirtualFileInputStream(org.webpieces.router.api.mocks.VirtualFileInputStream) RouterService(org.webpieces.router.api.RouterService) CompileConfig(org.webpieces.compiler.api.CompileConfig) VirtualFileImpl(org.webpieces.util.file.VirtualFileImpl) File(java.io.File) VirtualFile(org.webpieces.util.file.VirtualFile) RouterConfig(org.webpieces.router.api.RouterConfig)

Example 3 with RouterConfig

use of org.webpieces.router.api.RouterConfig in project webpieces by deanhiller.

the class TestCompressionCache method setUp.

@Before
public void setUp() throws IOException {
    FileUtils.deleteDirectory(cacheDir);
    log.info("deleting dir=" + cacheDir);
    File stagingDir = new File("output/staging");
    FileUtils.deleteDirectory(stagingDir);
    RouterConfig config = new RouterConfig();
    config.setSecretKey(SecretKeyInfo.generateForTest());
    config.setCachedCompressedDirectory(cacheDir);
    Module allMods = Modules.override(new ProdRouterModule(config)).with(new TestModule());
    Injector injector = Guice.createInjector(allMods);
    cache = injector.getInstance(CompressionCacheSetup.class);
}
Also used : Injector(com.google.inject.Injector) ProdRouterModule(org.webpieces.router.api.ProdRouterModule) Module(com.google.inject.Module) ProdRouterModule(org.webpieces.router.api.ProdRouterModule) File(java.io.File) RouterConfig(org.webpieces.router.api.RouterConfig) Before(org.junit.Before)

Aggregations

RouterConfig (org.webpieces.router.api.RouterConfig)3 File (java.io.File)2 RouterService (org.webpieces.router.api.RouterService)2 VirtualFileInputStream (org.webpieces.router.api.mocks.VirtualFileInputStream)2 VirtualFile (org.webpieces.util.file.VirtualFile)2 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 Before (org.junit.Before)1 CompileConfig (org.webpieces.compiler.api.CompileConfig)1 ProdRouterModule (org.webpieces.router.api.ProdRouterModule)1 VirtualFileImpl (org.webpieces.util.file.VirtualFileImpl)1