use of org.webpieces.router.impl.routers.FStaticRouter in project webpieces by deanhiller.
the class TestCompressionCache method testStartServerTwiceButUrlPathChanges.
@Test
public void testStartServerTwiceButUrlPathChanges() throws IOException {
File f = new File("src/test/resources/cacheTest1");
File stagingDir = FileFactory.newBaseFile("output/staging");
FileUtils.copyDirectory(f, stagingDir);
runBasicServerOnce(stagingDir);
List<FStaticRouter> routes2 = new ArrayList<>();
VirtualFile dir = VirtualFileFactory.newFile(stagingDir);
routes2.add(create(Port.BOTH, new UrlPath("", "/public1.4/"), dir, false, cacheDir));
// if server is just restarted(no file changes), we should skip reading files...
cache.setupCache(routes2);
Assert.assertEquals(2, proxy.getReadFiles().size());
Assert.assertEquals(2, proxy.getCompressedFiles().size());
}
use of org.webpieces.router.impl.routers.FStaticRouter in project webpieces by deanhiller.
the class TestCompressionCache method testCreateCacheAndUpdateTimestampButNotChangeFileContents.
@Test
public void testCreateCacheAndUpdateTimestampButNotChangeFileContents() throws IOException {
File f = new File("src/test/resources/cacheTest1");
File stagingDir = FileFactory.newBaseFile("output/staging");
FileUtils.copyDirectory(f, stagingDir);
List<FStaticRouter> routes = runBasicServerOnce(stagingDir);
// do not preserve dates here...
FileUtils.copyDirectory(f, stagingDir, false);
// if server is just restarted(no file changes), we should skip reading files...
cache.setupCache(routes);
Assert.assertEquals(2, proxy.getReadFiles().size());
Assert.assertEquals(0, proxy.getCompressedFiles().size());
}
Aggregations