Examples of AssetStorageUnit


Examples of com.github.dandelion.core.storage.AssetStorageUnit

    locations.put("remote", "remoteURL2");
    locations.put("local", "localPath2");

    return newArrayList(
        new BundleStorageUnit("default", new HashSet<AssetStorageUnit>()),
        new BundleStorageUnit("fake", newLinkedHashSet(new AssetStorageUnit("name", "version", AssetType.js, locations), new AssetStorageUnit("name2", "version2", AssetType.js, locations2))));
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

  public void should_throw_an_exception_when_using_an_empty_location() {
    exception.expect(DandelionException.class);
    exception
        .expectMessage("The asset 'my.js' (js, v1.0.0) configured with a 'classpath' location key has a blank location. Please correct this location in the corresponding JSON file.");

    AssetStorageUnit asu = new AssetStorageUnit("my.js", "1.0.0", AssetType.js, singletonMap("classpath", ""));
    locator.getLocation(asu, null);
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

    locator.getLocation(asu, null);
  }

  @Test
  public void should_return_the_same_internal_url() {
    AssetStorageUnit asu = new AssetStorageUnit("my.js", singletonMap("classpath", "sub/folder/my.js"));
    String location = locator.getLocation(asu, null);
    assertThat(location).isEqualTo("sub/folder/my.js");
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

    assertThat(location).isEqualTo("sub/folder/my.js");
  }

  @Test
  public void should_return_the_content() {
    AssetStorageUnit asu = new AssetStorageUnit("my.js", singletonMap("classpath", "locator/asset.js"));
    String content = locator.getContent(asu, request);
    assertThat(content).isEqualTo("/* content */");
  }
 
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

  public void should_throw_an_exception_when_using_an_empty_location(){
    exception.expect(DandelionException.class);
    exception
        .expectMessage("The asset 'my.js' (js, v1.0.0) configured with a 'delegate' location key has a blank location. Please correct this location in the corresponding JSON file.");
   
    AssetStorageUnit asu = new AssetStorageUnit("my.js", "1.0.0", AssetType.js, singletonMap("delegate", ""));
    locator.getLocation(asu, null);
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

    locator.getLocation(asu, null);
  }
 
  @Test
  public void should_return_the_same_absolute_url() {
    AssetStorageUnit asu = new AssetStorageUnit("my-js", singletonMap("delegate", "my.js"));
    String location = locator.getLocation(asu, request);
    assertThat(location).isNull();
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

          public String getContent(HttpServletRequest request) {
            return "/* delegated content */";
          }
        });

    AssetStorageUnit asset = new AssetStorageUnit("my-js", "1.0", AssetType.js, singletonMap(
        locator.getLocationKey(), "my.js"));
    String content = locator.getContent(asset, request);
    assertThat(content).isEqualTo("/* delegated content */");
  }
 
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

  public ExpectedException exception = ExpectedException.none();

  @Test
  public void should_map_an_AssetStorageUnit_to_an_Asset() {

    AssetStorageUnit asu = new AssetStorageUnit();
    asu.setName("asset-name");
    asu.setType(AssetType.js);
    asu.setVersion("1.0.0");
    asu.setLocations(singletonMap("webapp", "/assets/js/asset-name.js"));
    Asset asset = assetMapper.mapToAsset(asu);
    assertThat(asset.getName()).isEqualTo("asset-name");
    assertThat(asset.getType()).isEqualTo(AssetType.js);
    assertThat(asset.getVersion()).isEqualTo("1.0.0");
    assertThat(asset.getConfigLocation()).isEqualTo("/assets/js/asset-name.js");
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

  public void should_throw_an_exception_when_using_an_empty_location() {
    exception.expect(DandelionException.class);
    exception
        .expectMessage("The asset 'my.js' (js, v1.0.0) configured with a 'webapp' location key has a blank location. Please correct this location in the corresponding JSON file.");

    AssetStorageUnit asu = new AssetStorageUnit("my.js", "1.0.0", AssetType.js, singletonMap("webapp", ""));
    locator.getLocation(asu, null);
  }
View Full Code Here

Examples of com.github.dandelion.core.storage.AssetStorageUnit

    locator.getLocation(asu, null);
  }

  @Test
  public void should_return_the_processed_context_absolute_url() {
    AssetStorageUnit asu = new AssetStorageUnit("my.js", singletonMap("webapp", CONTEXT_RELATIVE_URL));
    String location = locator.getLocation(asu, request);
    assertThat(location).isEqualTo("/context" + CONTEXT_RELATIVE_URL);
  }
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.