コード例 #1
0
  @Test
  public void testLoadAssetFromPath() throws NoSuchFileException {

    Repository repository = new VFSRepository(producer.getIoService());
    ((VFSRepository) repository).setDescriptor(descriptor);
    Asset<String> asset = repository.loadAssetFromPath("/processes/BPMN2-ScriptTask.bpmn2");

    assertEquals("bpmn2", asset.getAssetType());
    assertEquals("BPMN2-ScriptTask", asset.getName());
    assertEquals("BPMN2-ScriptTask.bpmn2", asset.getFullName());
    assertEquals("/processes", asset.getAssetLocation());
    assertNotNull(asset.getAssetContent());
    System.out.print(asset.getUniqueId());
  }
コード例 #2
0
  @Test
  public void testListNestedSingleTextAsset() {

    Repository repository = new VFSRepository(producer.getIoService());
    ((VFSRepository) repository).setDescriptor(descriptor);
    boolean rootFolderExists = repository.directoryExists("/processes/nested");
    assertTrue(rootFolderExists);

    Collection<Asset> assets = repository.listAssets("/processes/nested");
    assertNotNull(assets);
    assertEquals(1, assets.size());
    Asset<String> asset = assets.iterator().next();

    assertEquals("bpmn2", asset.getAssetType());
    assertEquals("BPMN2-UserTask.bpmn2", asset.getFullName());
    assertEquals("BPMN2-UserTask", asset.getName());
    assertEquals("/processes/nested", asset.getAssetLocation());
  }
コード例 #3
0
  @Test
  public void testListSingleBinaryAsset() {

    Repository repository = new VFSRepository(producer.getIoService());
    ((VFSRepository) repository).setDescriptor(descriptor);
    boolean rootFolderExists = repository.directoryExists("/images");
    assertTrue(rootFolderExists);

    Collection<Asset> assets = repository.listAssets("/images");
    assertNotNull(assets);
    assertEquals(1, assets.size());
    Asset<String> asset = assets.iterator().next();

    assertEquals("png", asset.getAssetType());
    assertEquals("release-process.png", asset.getFullName());
    assertEquals("release-process", asset.getName());
    assertEquals("/images", asset.getAssetLocation());
  }
コード例 #4
0
  @Test
  public void testStoreSingleTextAsset() throws NoSuchFileException {

    Repository repository = new VFSRepository(producer.getIoService());
    ((VFSRepository) repository).setDescriptor(descriptor);
    Collection<Asset> assets = repository.listAssets("/");
    assertNotNull(assets);
    assertEquals(0, assets.size());

    AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Text);
    builder.content("simple content").type("txt").name("test").location("/");

    String id = repository.createAsset(builder.getAsset());

    assertNotNull(id);

    Asset<String> asset = repository.loadAsset(id);

    assertEquals("txt", asset.getAssetType());
    assertEquals("test", asset.getName());
    assertEquals("test.txt", asset.getFullName());
    assertEquals("/", asset.getAssetLocation());
    assertEquals("simple content", asset.getAssetContent());
  }
コード例 #5
0
  @Test
  public void testStoreSingleBinaryAssetSpaceInName() throws NoSuchFileException {

    Repository repository = new VFSRepository(producer.getIoService());
    ((VFSRepository) repository).setDescriptor(descriptor);
    Collection<Asset> assets = repository.listAssets("/");
    assertNotNull(assets);
    assertEquals(0, assets.size());

    AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
    builder.content("simple content".getBytes()).type("png").name("test asset").location("/");

    String id = repository.createAsset(builder.getAsset());

    assertNotNull(id);

    Asset<byte[]> asset = repository.loadAsset(id);

    assertEquals("png", asset.getAssetType());
    assertEquals("test asset", asset.getName());
    assertEquals("test asset.png", asset.getFullName());
    assertEquals("/", asset.getAssetLocation());
    assertFalse(asset.getAssetContent().length == 0);
  }