Package org.apache.wicket.util.file

Examples of org.apache.wicket.util.file.Path


public class ResourceStreamLocatorTest
{
  @Test
  public void defaultPath() throws Exception
  {
    IResourceStream stream = new ResourceStreamLocator(new Path()).locate(
      ResourceStreamLocatorTest.class,
      Packages.absolutePath(ResourceStreamLocatorTest.class, "foo.txt"));
    assertEquals("no prefix",
      new BufferedReader(new InputStreamReader(stream.getInputStream())).readLine());
  }
View Full Code Here


  }

  @Test
  public void addedPath() throws Exception
  {
    final ResourceStreamLocator rsl = new ResourceStreamLocator(new Path());
    rsl.getClasspathLocationPrefixes().add("some/invalid/path");
    IResourceStream stream = rsl.locate(ResourceStreamLocatorTest.class,
      Packages.absolutePath(ResourceStreamLocatorTest.class, "foo.txt"));
    assertEquals("default path is first and should have had priority!", "no prefix",
      new BufferedReader(new InputStreamReader(stream.getInputStream())).readLine());
View Full Code Here

  }

  @Test
  public void replacedPathWithTrailingSlash() throws Exception
  {
    final ResourceStreamLocator rsl = new ResourceStreamLocator(new Path());
    rsl.getClasspathLocationPrefixes().clear();
    rsl.getClasspathLocationPrefixes().add("ResourceStreamLocatorTest/some/path/");
    IResourceStream stream = rsl.locate(ResourceStreamLocatorTest.class,
      Packages.absolutePath(ResourceStreamLocatorTest.class, "foo.txt"));
    assertEquals("should have found the version with prefix!", "with prefix",
View Full Code Here

  }

  @Test
  public void replacedPathWithoutTrailingSlash() throws Exception
  {
    final ResourceStreamLocator rsl = new ResourceStreamLocator(new Path());
    rsl.getClasspathLocationPrefixes().clear();
    rsl.getClasspathLocationPrefixes().add("ResourceStreamLocatorTest/some/path");
    IResourceStream stream = rsl.locate(ResourceStreamLocatorTest.class,
      Packages.absolutePath(ResourceStreamLocatorTest.class, "foo.txt"));
    assertEquals("should have found the version with prefix!", "with prefix",
View Full Code Here

   */
  @Test
  public void locate()
  {
    // Execute without source path
    executeMultiple(new Path());

    // Determine source path
    IResourceStreamLocator locator = new ResourceStreamLocator();
    IResourceStream resource = locator.locate(getClass(),
      this.getClass().getName().replace('.', '/'), null, null, null, "txt", false);
    String path = getPath(resource);
    path = Strings.beforeLastPathComponent(path, '/') + "/sourcePath";

    // and execute
    executeMultiple(new Path(new Folder(path)));
  }
View Full Code Here

    {
      // Add optional sourceFolder for resources.
      String resourceFolder = getInitParameter("sourceFolder");
      if (resourceFolder != null)
      {
        getResourceSettings().getResourceFinders().add(new Path(resourceFolder));
      }
    }
    setPageRendererProvider(new WebPageRendererProvider());
    setSessionStoreProvider(new WebSessionStoreProvider());
    setAjaxRequestTargetProvider(new DefaultAjaxRequestTargetProvider());
View Full Code Here

   * Test locating a resource.
   */
  public void testLocate()
  {
    // Execute without source path
    executeMultiple(new Path());

    // Determine source path
    IResourceStreamLocator locator = new ResourceStreamLocator();
    IResourceStream resource = locator.locate(getClass(),this.getClass().getName().replace('.', '/'), null, null, "txt");
    String path = getPath(resource);
    path = Strings.beforeLastPathComponent(path, '/') + "/sourcePath";

    // and execute
    executeMultiple(new Path(new Folder(path)));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.file.Path

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.