/**
   * create a soft link where the source file is a data object
   *
   * @throws Exception
   */
  @Test(expected = JargonException.class)
  public final void testCreateASoftLinkSourceIsIRODSFile() throws Exception {

    String sourceCollectionName = "testCreateASoftLinkSourceIsIRODSFile.txt";
    String targetCollectionName = "testCreateASoftLinkSourceNotExistsTarget";

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    String sourceIrodsFile =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + sourceCollectionName);

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + targetCollectionName);

    IRODSFile sourceAsFile =
        irodsFileSystem.getIRODSFileFactory(irodsAccount).instanceIRODSFile(sourceIrodsFile);
    sourceAsFile.createNewFile();

    // create the soft link

    MountedCollectionAO mountedCollectionAO =
        irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount);
    mountedCollectionAO.createASoftLink(sourceIrodsFile, targetIrodsCollection);
  }
  /**
   * create a soft link where the target file is blank
   *
   * @throws Exception
   */
  @Test(expected = IllegalArgumentException.class)
  public final void testCreateASoftLinkTargetIsBlank() throws Exception {

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    MountedCollectionAO mountedCollectionAO =
        irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount);
    mountedCollectionAO.createASoftLink("hello", "");
  }
  /**
   * Create a soft link to an iRODS collection in nominal mode, target does not exist and will be
   * created
   *
   * @throws Exception
   */
  @Test
  public final void testCreateASoftLink() throws Exception {

    String sourceCollectionName = "testCreateASoftLinkSource";
    String targetCollectionName = "testCreateASoftLinkTarget";
    String subfileName = "testCreateASoftLink.txt";

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    String sourceIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + sourceCollectionName);

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + targetCollectionName);

    // do an initial unmount
    MountedCollectionAO mountedCollectionAO =
        irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount);

    mountedCollectionAO.unmountACollection(
        targetIrodsCollection, irodsAccount.getDefaultStorageResource());

    // set up source collection
    IRODSFile sourceFile =
        irodsFileSystem.getIRODSFileFactory(irodsAccount).instanceIRODSFile(sourceIrodsCollection);
    sourceFile.mkdirs();
    IRODSFile subFile =
        irodsFileSystem
            .getIRODSFileFactory(irodsAccount)
            .instanceIRODSFile(sourceIrodsCollection, subfileName);
    subFile.createNewFile();

    // add a subfile to this collection

    // create the soft link

    mountedCollectionAO.createASoftLink(sourceIrodsCollection, targetIrodsCollection);

    IRODSFile mountedCollectionTargetFile =
        irodsFileSystem.getIRODSFileFactory(irodsAccount).instanceIRODSFile(targetIrodsCollection);
    Assert.assertTrue("target collection does not exist", mountedCollectionTargetFile.exists());
    String softLinkedSourceFileName =
        mountedCollectionTargetFile.getAbsolutePath() + "/" + subFile.getName();

    CollectionAndDataObjectListAndSearchAO listAndSearchAO =
        irodsFileSystem
            .getIRODSAccessObjectFactory()
            .getCollectionAndDataObjectListAndSearchAO(irodsAccount);

    ObjStat statForSoftLinkedFile =
        listAndSearchAO.retrieveObjectStatForPath(softLinkedSourceFileName);

    Assert.assertEquals(
        "did not set the objPath",
        targetIrodsCollection,
        statForSoftLinkedFile.getCollectionPath());
    Assert.assertEquals(
        "did not identify as a linked coll",
        ObjStat.SpecColType.LINKED_COLL,
        statForSoftLinkedFile.getSpecColType());

    Assert.assertTrue(
        "did not get the soft linked file",
        statForSoftLinkedFile.getObjectType() == ObjectType.DATA_OBJECT);
  }