Package org.apache.wicket.request.resource.caching.version

Examples of org.apache.wicket.request.resource.caching.version.StaticResourceVersion


    };
  }

  private void init(ContextRelativeResource resource, String mountPath)
  {
    final IResourceVersion resourceVersion = new StaticResourceVersion("123");
    final IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", resourceVersion);

    tester.getApplication().getSharedResources().add(SHARED_NAME, resource);
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);
View Full Code Here


        return resource;
      }
    };

    IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", new StaticResourceVersion("foobar"));

    INamedParameters params = new PageParameters();
    ResourceUrl url = new ResourceUrl("test.js", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar.js", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test.js", url.getFileName());

    url = new ResourceUrl("test", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // this behavior is o.k. since a browser could request an
    // previous version of the resource. for example we
    // could first have 'test-alpha.txt' which would be later replaced
    // by 'test-beta.txt' but in any case will point to
    // internal resource 'test.txt'
    url = new ResourceUrl("test-version-older.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version--------", params);
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-1.0.3-alpha.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

        return resource;
      }
    };

    IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", new StaticResourceVersion("foobar"));

    INamedParameters params = new PageParameters();
    ResourceUrl url = new ResourceUrl("test.js", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar.js", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test.js", url.getFileName());

    url = new ResourceUrl("test", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // this behavior is o.k. since a browser could request an
    // previous version of the resource. for example we
    // could first have 'test-alpha.txt' which would be later replaced
    // by 'test-beta.txt' but in any case will point to
    // internal resource 'test.txt'
    url = new ResourceUrl("test-version-older.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version--------", params);
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-1.0.3-alpha.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename
    // extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename
    // extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

    };
  }

  private void init(ContextRelativeResource resource, String mountPath)
  {
    final IResourceVersion resourceVersion = new StaticResourceVersion("123");
    final IResourceCachingStrategy strategy =
      new FilenameWithVersionResourceCachingStrategy("-version-", resourceVersion);

    tester.getApplication().getSharedResources().add(SHARED_NAME, resource);
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);
View Full Code Here

        return resource;
      }
    };

    IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", new StaticResourceVersion("foobar"));

    INamedParameters params = new PageParameters();
    ResourceUrl url = new ResourceUrl("test.js", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar.js", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test.js", url.getFileName());

    url = new ResourceUrl("test", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // this behavior is o.k. since a browser could request an
    // previous version of the resource. for example we
    // could first have 'test-alpha.txt' which would be later replaced
    // by 'test-beta.txt' but in any case will point to
    // internal resource 'test.txt'
    url = new ResourceUrl("test-version-older.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version--------", params);
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-1.0.3-alpha.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

        return resource;
      }
    };

    IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", new StaticResourceVersion("foobar"));

    INamedParameters params = new PageParameters();
    ResourceUrl url = new ResourceUrl("test.js", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar.js", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test.js", url.getFileName());

    url = new ResourceUrl("test", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // this behavior is o.k. since a browser could request an
    // previous version of the resource. for example we
    // could first have 'test-alpha.txt' which would be later replaced
    // by 'test-beta.txt' but in any case will point to
    // internal resource 'test.txt'
    url = new ResourceUrl("test-version-older.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version--------", params);
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-1.0.3-alpha.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

        return resource;
      }
    };

    IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", new StaticResourceVersion("foobar"));

    INamedParameters params = new PageParameters();
    ResourceUrl url = new ResourceUrl("test.js", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar.js", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test.js", url.getFileName());

    url = new ResourceUrl("test", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-foobar", url.getFileName());
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // this behavior is o.k. since a browser could request an
    // previous version of the resource. for example we
    // could first have 'test-alpha.txt' which would be later replaced
    // by 'test-beta.txt' but in any case will point to
    // internal resource 'test.txt'
    url = new ResourceUrl("test-version-older.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version--------", params);
    strategy.undecorateUrl(url);
    assertEquals("test", url.getFileName());

    // weird but valid
    url = new ResourceUrl("test-version-1.0.3-alpha.txt", params);
    strategy.undecorateUrl(url);
    assertEquals("test.txt", url.getFileName());

    // check a version that contains a dot which also marks the filename extension
    strategy = new FilenameWithVersionResourceCachingStrategy("-version-",
      new StaticResourceVersion("1.0.4-beta"));
    url = new ResourceUrl("test.txt", params);
    strategy.decorateUrl(url, resource);
    assertEquals("test-version-1.0.4-beta.txt", url.getFileName());
  }
View Full Code Here

    };
  }

  private void init(ContextRelativeResource resource, String mountPath)
  {
    final IResourceVersion resourceVersion = new StaticResourceVersion("123");
    final IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
      "-version-", resourceVersion);

    tester.getApplication().getSharedResources().add(SHARED_NAME, resource);
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.resource.caching.version.StaticResourceVersion

Copyright © 2018 www.massapicom. 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.