private StoreService() { super("store"); // TODO Work out why this has to be in the constructor or it fails CacheBuilderSpec cacheBuilderSpec = (System.getenv("FILE_CACHE_ENABLED") == null) ? CacheBuilderSpec.parse("maximumSize=0") : AssetsBundle.DEFAULT_CACHE_SPEC; addBundle(new AssetsBundle("/assets/css", cacheBuilderSpec, "/css")); addBundle(new AssetsBundle("/assets/js", cacheBuilderSpec, "/js")); addBundle(new AssetsBundle("/assets/images", cacheBuilderSpec, "/images")); }
@Test public void canSerializeCacheBuilderSpecs() throws Exception { assertThat(mapper.writeValueAsString(CacheBuilderSpec.disableCaching())) .isEqualTo("\"maximumSize=0\""); }
@Test public void canDeserializeCacheBuilderSpecs() throws Exception { assertThat(mapper.readValue("\"maximumSize=30\"", CacheBuilderSpec.class)) .isEqualTo(CacheBuilderSpec.parse("maximumSize=30")); }