Search in sources :

Example 6 with UrlResourceStream

use of org.apache.wicket.core.util.resource.UrlResourceStream in project wicket by apache.

the class UrlResourceStreamTest method lastModifiedForResourceInJar.

/**
 * lastModified() shouldn't change the content length if the file isn't really changed.
 *
 * @throws IOException
 */
@Test
public void lastModifiedForResourceInJar() throws IOException {
    String anyClassInJarFile = "/java/lang/String.class";
    URL url = getClass().getResource(anyClassInJarFile);
    UrlResourceStream stream = new UrlResourceStream(url);
    Bytes length = stream.length();
    stream.lastModifiedTime();
    assertEquals(stream.length(), length);
    stream.close();
}
Also used : UrlResourceStream(org.apache.wicket.core.util.resource.UrlResourceStream) Bytes(org.apache.wicket.util.lang.Bytes) URL(java.net.URL) Test(org.junit.Test)

Aggregations

UrlResourceStream (org.apache.wicket.core.util.resource.UrlResourceStream)6 URL (java.net.URL)4 Test (org.junit.Test)3 File (java.io.File)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IResourceStreamLocator (org.apache.wicket.core.util.resource.locator.IResourceStreamLocator)1 CachingResourceStreamLocator (org.apache.wicket.core.util.resource.locator.caching.CachingResourceStreamLocator)1 Bytes (org.apache.wicket.util.lang.Bytes)1 FileResourceStream (org.apache.wicket.util.resource.FileResourceStream)1