コード例 #1
0
  @Test(expected = JargonException.class)
  public void testCreateBundleNoOverwriteCollectionDoesNotExist() throws Exception {
    String tarName = "testCreateBundleNoOverwriteCollectionDoesNotExist.tar";
    String testSubdir = "testCreateBundleNoOverwriteCollectionDoesNotExist";
    String bunSubdir = "testCreateBundleNoOverwriteCollectionDoesNotExistBunSubdir";

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());

    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();
    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
        targetBunFileAbsPath, targetIrodsCollection, "");
  }
コード例 #2
0
  @Test(expected = JargonException.class)
  public void testExtractBundleNoOverwriteNoBulkWhenTargetCollectionAlreadyExists()
      throws Exception {
    // gets a SYS_COPY_ALREADY_IN_RESC -46000
    String tarName = "testExtractBundleNoOverwriteNoBulkWhenTargetCollectionAlreadyExists.tar";
    String testSubdir = "testExtractBundleNoOverwriteNoBulkWhenTargetCollectionAlreadyExists";
    String bunSubdir =
        "testExtractBundleNoOverwriteNoBulkWhenTargetCollectionAlreadyExistsBunSubdir";
    String testExtractTargetSubdir =
        "testExtractBundleNoOverwriteNoBulkWhenTargetCollectionAlreadyExistsTargetCollection";

    String fileName = "fileName.txt";
    int count = 5;

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());
    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();

    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
        targetBunFileAbsPath, targetIrodsCollection, "");

    // extract the bun file now to a different subdir
    targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testExtractTargetSubdir);

    bulkFileOperationsAO.extractABundleIntoAnIrodsCollection(
        targetBunFileAbsPath, targetIrodsCollection, "");
    // repeat the same operation, causing an overwrite situation, should get
    // an error
    bulkFileOperationsAO.extractABundleIntoAnIrodsCollection(
        targetBunFileAbsPath, targetIrodsCollection, "");
  }
コード例 #3
0
  @Test
  public void testCreateBundleNoOverwriteCollectionExists() throws Exception {
    String tarName = "testCreateBundleNoOverwriteCollectionExists.tar";
    String testSubdir = "testCreateBundleNoOverwriteCollectionExists";
    String bunSubdir = "testCreateBundleNoOverwriteCollectionExistsBunSubdir";
    String fileName = "fileName";
    int count = 200;

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());

    IRODSServerProperties props = irodsFileSystem.getCommands().getIrodsServerProperties();
    if (!props.isTheIrodsServerAtLeastAtTheGivenReleaseVersion(
        RemoteExecuteServiceImpl.STREAMING_API_CUTOFF)) {
      return;
    }

    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();

    boolean didFail = false;
    try {
      bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
          targetBunFileAbsPath, targetIrodsCollection, "");
      bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
          targetBunFileAbsPath, targetIrodsCollection, "");
    } catch (JargonException je) {
      didFail = true;
    }

    TestCase.assertTrue("expected this to fail with JargonException", didFail);
  }
コード例 #4
0
  @Test
  public void testCreateBundleWhenTarFileAlreadyExistsForceSpecified() throws Exception {

    String tarName = "testCreateBundleWhenTarFileAlreadyExistsForceSpecified.tar";
    String testSubdir = "testCreateBundleWhenTarFileAlreadyExistsForceSpecified";
    String bunSubdir = "testCreateBundleWhenTarFileAlreadyExistsForceSpecifiedBunSubdir";
    String fileName = "fileName";
    int count = 20;

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSServerProperties props = irodsFileSystem.getCommands().getIrodsServerProperties();
    if (!props.isTheIrodsServerAtLeastAtTheGivenReleaseVersion(
        RemoteExecuteServiceImpl.STREAMING_API_CUTOFF)) {
      return;
    }

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    // create the tar file with the same name as the one I will want to
    // create later
    irodsFile = new IRODSFile(irodsFileSystem, targetBunFileAbsPath);
    irodsFile.createNewFile();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());

    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();
    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrodsWithForceOption(
        targetBunFileAbsPath, targetIrodsCollection, "");
    assertionHelper.assertIrodsFileOrCollectionExists(targetBunFileAbsPath);
  }
コード例 #5
0
  @Test(expected = JargonException.class)
  public void testCreateBundleWhenTarFileAlreadyExists() throws Exception {

    String tarName = "testCreateBundleWhenTarFileAlreadyExists.tar";
    String testSubdir = "testCreateBundleWhenTarFileAlreadyExists";
    String bunSubdir = "testCreateBundleWhenTarFileAlreadyExistsBunSubdir";
    String fileName = "fileName";
    int count = 20;

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    // create the tar file with the same name as the one I will want to
    // create later
    irodsFile = new IRODSFile(irodsFileSystem, targetBunFileAbsPath);
    irodsFile.createNewFile();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());
    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();

    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
        targetBunFileAbsPath, targetIrodsCollection, "");
  }
コード例 #6
0
  /*
   * the semantics of how 'data not found' is treated in this version of
   * jargon is different than how it is treated in jargon-core at the
   * connection level, that makes detection of this error difficult. For the
   * time being, semantic changes in the interpretation of this condition are
   * to be avoided.
   */
  @Ignore
  public void testExtractBundleNoOverwriteWithBulkSpecifyWrongResource() throws Exception {
    String tarName = "testExtractBundleNoOverwriteWithBulkSpecifyWrongResource.tar";
    String testSubdir = "testExtractBundleNoOverwriteWithBulkSpecifyWrongResource";
    String bunSubdir = "testExtractBundleNoOverwriteWithBulkSpecifyWrongResourceBunSubdir";
    String testExtractTargetSubdir =
        "testExtractBundleNoOverwriteWithBulkSpecifyWrongResourceTargetCollection";
    String testResource = testingProperties.getProperty(TestingPropertiesHelper.IRODS_RESOURCE_KEY);

    String fileName = "fileName.txt";
    int count = 5;

    IRODSAccount irodsAccount =
        testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);

    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());

    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();
    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
        targetBunFileAbsPath, targetIrodsCollection, testResource);

    // extract the bun file now to a different subdir
    targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testExtractTargetSubdir);

    IRODSFile extractSubdir = new IRODSFile(irodsFileSystem, targetIrodsCollection);

    extractSubdir.mkdirs();

    bulkFileOperationsAO.extractABundleIntoAnIrodsCollectionWithBulkOperationOptimization(
        targetBunFileAbsPath,
        targetIrodsCollection,
        testingProperties.getProperty(TestingPropertiesHelper.IRODS_SECONDARY_RESOURCE_KEY));

    IRODSFile targetColl = new IRODSFile(irodsFileSystem, targetIrodsCollection);

    targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    IRODSFile sourceColl = new IRODSFile(irodsFileSystem, targetIrodsCollection);

    // assertionHelper.assertTwoFilesAreEqualByRecursiveTreeComparison(
    // sourceColl, targetColl);

  }
コード例 #7
0
  @Test
  public void testExtractBundleNoOverwriteWithBulk() throws Exception {
    String tarName = "testExtractBundleNoOverwriteWithBulk.tar";
    String testSubdir = "testExtractBundleNoOverwriteWithBulk";
    String bunSubdir = "testExtractBundleNoOverwriteWithBulkBunSubdir";
    String testExtractTargetSubdir = "testExtractBundleNoOverwriteWithBulkTargetCollection";

    String fileName = "fileName.txt";
    int count = 5;

    IRODSServerProperties props = irodsFileSystem.getCommands().getIrodsServerProperties();
    if (!props.isTheIrodsServerAtLeastAtTheGivenReleaseVersion(
        RemoteExecuteServiceImpl.STREAMING_API_CUTOFF)) {
      return;
    }
    IRODSFile irodsFile = null;

    String targetBunIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + bunSubdir);
    String targetBunFileAbsPath = targetBunIrodsCollection + "/" + tarName;
    irodsFile = new IRODSFile(irodsFileSystem, targetBunIrodsCollection);
    irodsFile.mkdir();

    String targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    irodsFile = new IRODSFile(irodsFileSystem, targetIrodsCollection);
    irodsFile.mkdir();

    String myTarget = "";

    for (int i = 0; i < count; i++) {
      myTarget = targetIrodsCollection + "/c" + (10000 + i) + fileName;
      irodsFile = new IRODSFile(irodsFileSystem, myTarget);
      irodsFile.createNewFile();
    }

    IRODSAccessObjectFactory accessObjectFactory =
        IRODSAccessObjectFactoryImpl.instance(irodsFileSystem.getCommands());

    BulkFileOperationsAO bulkFileOperationsAO = accessObjectFactory.getBulkFileOperationsAO();
    bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(
        targetBunFileAbsPath, targetIrodsCollection, "");

    // extract the bun file now to a different subdir
    targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testExtractTargetSubdir);

    bulkFileOperationsAO.extractABundleIntoAnIrodsCollectionWithBulkOperationOptimization(
        targetBunFileAbsPath, targetIrodsCollection, "");

    IRODSFile targetColl = new IRODSFile(irodsFileSystem, targetIrodsCollection);

    targetIrodsCollection =
        testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties(
            testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + testSubdir);
    IRODSFile sourceColl = new IRODSFile(irodsFileSystem, targetIrodsCollection);

    // assertionHelper.assertTwoFilesAreEqualByRecursiveTreeComparison(
    // sourceColl, targetColl);

  }