diff --git a/src/main/java/org/bladerunnerjs/contrib/contentplugin/appcache/AppcacheManifestBuilder.java b/src/main/java/org/bladerunnerjs/contrib/contentplugin/appcache/AppcacheManifestBuilder.java index e82bf69..c4e56d9 100644 --- a/src/main/java/org/bladerunnerjs/contrib/contentplugin/appcache/AppcacheManifestBuilder.java +++ b/src/main/java/org/bladerunnerjs/contrib/contentplugin/appcache/AppcacheManifestBuilder.java @@ -61,7 +61,7 @@ public String getManifest(RequestMode requestMode) throws PropertiesException, C private void appendManifestHeader(StringBuilder manifest) throws PropertiesException { manifest.append("CACHE MANIFEST\n"); - manifest.append("# v" + version + "\n\n"); + manifest.append("# version " + version + "\n\n"); } private void appendManifestCacheFiles(StringBuilder manifest, RequestMode requestMode) throws ContentProcessingException, ConfigException, MalformedTokenException, PropertiesException { diff --git a/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheContentPluginTests.java b/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheContentPluginTests.java index 2bf9e33..56c692c 100644 --- a/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheContentPluginTests.java +++ b/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheContentPluginTests.java @@ -40,7 +40,7 @@ public void testManifestUsesVersionFromConfig() throws Exception given(app).hasBeenCreated().and(aspect).hasBeenCreated() .and(brjs).hasVersion("1234"); when(app).requestReceived("appcache/dev.appcache", pageResponse); - then(pageResponse).containsText("# v1234\n"); + then(pageResponse).containsText("# version 1234\n"); } @Test @@ -49,7 +49,7 @@ public void testManifestUsesBlankVersionWhenBlankConfig() throws Exception given(app).hasBeenCreated().and(aspect).hasBeenCreated() .and(brjs).hasVersion(""); when(app).requestReceived("appcache/dev.appcache", pageResponse); - then(pageResponse).containsText("# v\n"); + then(pageResponse).containsText("# version \n"); } @Test @@ -122,5 +122,15 @@ public void manifestIsEmptyIfTheCacheIsDisabled() throws Exception when(app).requestReceived("appcache/dev.appcache", pageResponse); then(pageResponse).doesNotContainText("../v/"); } + + @Test + public void prodManifestContainsProdRequests() throws Exception + { + given(app).hasBeenCreated().and(aspect).hasBeenCreated() + .and(brjs).hasVersion("1234"); + when(app).requestReceived("appcache/prod.appcache", pageResponse); + then(pageResponse).containsLines("../v/1234/prodMock") + .and(pageResponse).doesNotContainText("../v/1234/compositeDev"); + } } diff --git a/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheTagHandlerPluginTests.java b/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheTagHandlerPluginTests.java index 56d198e..dddd2ba 100644 --- a/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheTagHandlerPluginTests.java +++ b/src/test/java/org/bladerunnerjs/contrib/contentplugin/appcache/tests/AppcacheTagHandlerPluginTests.java @@ -30,7 +30,7 @@ public void tearDown() } @Test - public void tagHasContentWithVersionGiven() throws Exception + public void tagHasDevContentWithVersionGiven() throws Exception { given(aspect).indexPageHasContent("manifest='<@appcache.url@/>'") .and(brjs).hasVersion("1234"); @@ -38,6 +38,15 @@ public void tagHasContentWithVersionGiven() throws Exception then(pageResponse).containsText("manifest='appcache/dev.appcache'"); } + @Test + public void tagHasProdContentWithVersionGiven() throws Exception + { + given(aspect).indexPageHasContent("manifest='<@appcache.url@/>'") + .and(brjs).hasVersion("1234"); + when(aspect).indexPageLoadedInProd(pageResponse, "en"); + then(pageResponse).containsText("manifest='appcache/prod.appcache'"); + } + @Test public void tagHas404FileWhenVersionRemovedAfterPreviouslyHavingVersion() throws Exception {