Package ro.isdc.wro.model.resource.locator

Examples of ro.isdc.wro.model.resource.locator.UriLocator


  public void setUp() {
    initMocks(this);
    Context.set(Context.webContext(request, response, filterConfig));
    // spy the interface instead of WroTestUtils.createResourceMockingLocator() because of mockito bug which was
    // reported on their mailing list.
    mockLocator = Mockito.spy(new UriLocator() {
      public InputStream locate(final String uri)
          throws IOException {
        return new ByteArrayInputStream(uri.getBytes());
      }
View Full Code Here


  public void shouldNotFailWhenEmptyResourceIsFound()
      throws Exception {
    final WroConfiguration config = Context.get().getConfig();
    config.setIgnoreMissingResources(false);

    final UriLocator emptyStreamLocator = new UriLocator() {
      public boolean accept(final String uri) {
        return true;
      }

      public InputStream locate(final String uri)
View Full Code Here

 
  @Test
  public void shouldFindNoResourcesWhenNoneExist()
      throws IOException {
    final ThreadLocal<Collection<String>> filenameListHolder = new ThreadLocal<Collection<String>>();
    final UriLocator uriLocator = createJarLocator(filenameListHolder);
    // there are no js resources in the jar
    uriLocator.locate("classpath:com/**.js");
    final Collection<String> filenameList = filenameListHolder.get();
    Assert.assertNotNull(filenameList);
    Assert.assertTrue(filenameList.isEmpty());
  }
View Full Code Here

 
  @Test
  public void shouldOrderedAlphabeticallyWildcardResources()
      throws IOException {
    final ThreadLocal<Collection<String>> filenameListHolder = new ThreadLocal<Collection<String>>();
    final UriLocator uriLocator = createJarLocator(filenameListHolder);
    uriLocator.locate("classpath:com/app/**.css");
    final Collection<String> filenameList = filenameListHolder.get();
    Assert.assertNotNull(filenameList);
    Assert.assertEquals(Arrays.toString(new String[] {
      "com/app/level1/level2/styles/style.css", "com/app/level1/level2/level2.css", "com/app/level1/level1.css"
    }), Arrays.toString(filenameList.toArray()));
View Full Code Here

 
  @Test
  public void shouldFindAllChildFoldersAndFiles()
      throws IOException {
    final ThreadLocal<Collection<String>> filenameListHolder = new ThreadLocal<Collection<String>>();
    final UriLocator uriLocator = createJarLocator(filenameListHolder);
    uriLocator.locate("classpath:com/app/**");
    final Collection<String> filenameList = filenameListHolder.get();
    Assert.assertNotNull(filenameList);
    Assert.assertEquals(
        Arrays.toString(new String[] {
          "com/app/level1", "com/app/level1/level2", "com/app/level1/level2/styles",
View Full Code Here

          filenameList.add(entry.getPath().replace("\\", "/"));
        }
        filenameListHolder.set(filenameList);
      }
    };
    final UriLocator uriLocator = new ClasspathUriLocator() {
      @Override
      public WildcardStreamLocator newWildcardStreamLocator() {
        return jarStreamLocator;
      }
    };
View Full Code Here

TOP

Related Classes of ro.isdc.wro.model.resource.locator.UriLocator

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.