Examples of CRC32HashStrategy


Examples of ro.isdc.wro.model.resource.support.hash.CRC32HashStrategy

  }
 
  @Test
  public void testCache()
      throws IOException {
    final HashStrategy builder = new CRC32HashStrategy();
    final CacheKey key = new CacheKey("testGroup", ResourceType.JS, false);
   
    final String content = "var foo = 'Hello World';";
    final String hash = builder.getHash(new ByteArrayInputStream(content.getBytes()));
   
    Assert.assertNull(cache.get(key));
   
    cache.put(key, CacheValue.valueOf(content, hash));
   
View Full Code Here

Examples of ro.isdc.wro.model.resource.support.hash.CRC32HashStrategy

    cache = new LruMemoryCacheStrategy<CacheKey, CacheValue>(3);
  }

  @Test
  public void testLruCache() throws IOException {
    final HashStrategy builder = new CRC32HashStrategy();
    final CacheKey key1 = new CacheKey("testGroup01", ResourceType.JS, false);
    final CacheKey key2 = new CacheKey("testGroup02", ResourceType.CSS, false);
    final CacheKey key3 = new CacheKey("testGroup03", ResourceType.JS, false);
    final CacheKey key4 = new CacheKey("testGroup04", ResourceType.CSS, false);

    final String content = "var foo = 'Hello World';";
    final String hash = builder.getHash(new ByteArrayInputStream(content.getBytes()));

    cache.put(key1, CacheValue.valueOf(content, hash));
    cache.put(key2, CacheValue.valueOf(content, hash));
    cache.put(key3, CacheValue.valueOf(content, hash));
    assertNotNull(cache.get(key1));
View Full Code Here

Examples of ro.isdc.wro.model.resource.support.hash.CRC32HashStrategy

  @Test
  public void testCRC32Fingerprint()
      throws Exception {
    final WroManagerFactory factory = new BaseWroManagerFactory().setModelFactory(getValidModelFactory()).setHashStrategy(
        new CRC32HashStrategy());
    final WroManager manager = factory.create();
    final String path = manager.encodeVersionIntoGroupPath("g3", ResourceType.CSS, true);
    assertEquals("1d62dbaf/g3.css?minimize=true", path);
  }
View Full Code Here

Examples of ro.isdc.wro.model.resource.support.hash.CRC32HashStrategy

  public void setUp() {
    Context.set(Context.standaloneContext());
    namingStrategy = new DefaultHashEncoderNamingStrategy() {
      @Override
      protected HashStrategy getHashStrategy() {
        return new CRC32HashStrategy();
      }
    };
    WroTestUtils.createInjector().inject(namingStrategy);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.