/** Tests reading a reference via web services. */
  public void testRead() throws Exception {
    ReadResult result =
        client.read(auth, new Identifier(referenceId, null, EntityTypeString.reference, null));
    assertOperationSuccess(result, EntityTypeString.reference);

    Asset asset = result.getAsset();
    assertNotNull(asset);

    Reference fetchedReference = asset.getReference();
    assertNotNull(fetchedReference);
    assertEquals(reference.getName(), fetchedReference.getName());
    assertEquals(referenceId, fetchedReference.getId());
    assertEquals(reference.getReferencedAssetId(), fetchedReference.getReferencedAssetId());
    assertEquals(reference.getReferencedAssetType(), fetchedReference.getReferencedAssetType());
    assertEquals(reference.getParentFolderId(), fetchedReference.getParentFolderId());
    assertEquals(reference.getSiteId(), fetchedReference.getSiteId());
  }
  /* (non-Javadoc)
   * @see com.cms.webservices.CascadeWebServicesTestCase#onSetUp()
   */
  @Override
  protected void onSetUp() throws Exception {
    Site site = generateSite("site");
    String siteId = site.getId();
    String siteRootFolderId = site.getRootFolderId();

    Folder folder1 = new Folder();
    folder1.setMetadataSetId(generateMetadataSet("ms1", siteId).getId());
    folder1.setName("folder1");
    folder1.setParentFolderId(siteRootFolderId);
    folder1.setSiteId(siteId);

    Asset asset = new Asset();
    asset.setFolder(folder1);

    folder1Id = create(asset, EntityTypeString.folder);

    Folder folder2 = new Folder();
    folder2.setMetadataSetId(generateMetadataSet("ms2", siteId).getId());
    folder2.setName("folder2");
    folder2.setParentFolderId(siteRootFolderId);
    folder2.setSiteId(siteId);

    asset = new Asset();
    asset.setFolder(folder2);

    folder2Id = create(asset, EntityTypeString.folder);

    reference = new Reference();
    reference.setName("a_reference");
    reference.setParentFolderId(siteRootFolderId);
    reference.setReferencedAssetId(folder1Id);
    reference.setReferencedAssetType(EntityTypeString.folder);
    reference.setSiteId(siteId);

    asset = new Asset();
    asset.setReference(reference);

    referenceId = create(asset, EntityTypeString.reference);
  }