use of org.webpieces.router.impl.StaticRoute 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 = new File("output/staging");
FileUtils.copyDirectory(f, stagingDir);
runBasicServerOnce(stagingDir);
List<StaticRoute> routes2 = new ArrayList<>();
routes2.add(new StaticRoute(new UrlPath("", "/public1.4/"), stagingDir.getAbsolutePath() + "/", 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.StaticRoute 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 = new File("output/staging");
FileUtils.copyDirectory(f, stagingDir);
List<StaticRoute> 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());
}