@Test(expected = CollectionNotMountedException.class) public void testCreateAMountedFileSystemPhyPathMissing() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { throw new CollectionNotMountedException("thrown to honor contracts"); } String targetCollectionName = "testCreateAMountedFileSystemPhyPathMissing"; String localCollectionAbsolutePath = "/i/dont/exist"; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); 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()); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, irodsAccount.getDefaultStorageResource()); }
@Test(expected = IllegalArgumentException.class) public void testCreateAndRemoveMountedFileSystemNullResource() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { throw new IllegalArgumentException("thrown to honor contracts"); } String targetCollectionName = "testCreateAndRemoveMountedFileSystem"; String localMountDir = "testCreateAndRemoveMountedFileSystemLocal"; String localCollectionAbsolutePath = scratchFileUtils.createAndReturnAbsoluteScratchPath( IRODS_TEST_SUBDIR_PATH + '/' + localMountDir); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); String targetIrodsCollection = testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + targetCollectionName); MountedCollectionAO mountedCollectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, null); }
@Test(expected = CollectionNotMountedException.class) public void testCreateMountedFileSystemTwice() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { throw new CollectionNotMountedException("thrown to honor contracts"); } String targetCollectionName = "testCreateMountedFileSystemTwice"; String localMountDir = "testCreateMountedFileSystemTwiceLocal"; String localCollectionAbsolutePath = scratchFileUtils.createAndReturnAbsoluteScratchPath( IRODS_TEST_SUBDIR_PATH + '/' + localMountDir); FileGenerator.generateManyFilesInParentCollectionByAbsolutePath( localCollectionAbsolutePath, "testCreateMountedFileSystemTwice", ".txt", 10, 1, 2); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); 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()); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, irodsAccount.getDefaultStorageResource()); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, irodsAccount.getDefaultStorageResource()); // no errors means success. will test further in // listing methods }
@Test(expected = IllegalArgumentException.class) public void testCreateAndRemoveMountedFileSystemNullTarget() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { throw new IllegalArgumentException("thrown to honor contracts"); } IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); MountedCollectionAO mountedCollectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount); mountedCollectionAO.createMountedFileSystemCollection("source", null, "resc"); }
@Test public void testCreateAMountedFileSystemPhyPathMissingButUnderConfiguredPath() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { return; } String targetCollectionName = "testCreateAMountedFileSystemPhyPathMissingButUnderConfiguredPath"; String localMountDir = "testCreateAMountedFileSystemPhyPathMissingButUnderConfiguredPathLocal"; String localCollectionAbsolutePath = testingProperties.getProperty(TestingPropertiesHelper.IRODS_REG_BASEDIR) + "/" + localMountDir; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); 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()); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, irodsAccount.getDefaultStorageResource()); // now get an objstat it should exist CollectionAndDataObjectListAndSearchAO searchAO = irodsFileSystem .getIRODSAccessObjectFactory() .getCollectionAndDataObjectListAndSearchAO(irodsAccount); ObjStat objStat = searchAO.retrieveObjectStatForPath(targetIrodsCollection); Assert.assertEquals( "did not get spec col in objStat", SpecColType.MOUNTED_COLL, objStat.getSpecColType()); }
@Test(expected = IllegalArgumentException.class) public void testCreateAndRemoveMountedFileSystemBlankSource() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { throw new IllegalArgumentException("thrown to honor contracts"); } String targetCollectionName = "testCreateAndRemoveMountedFileSystem"; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); String targetIrodsCollection = testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + targetCollectionName); MountedCollectionAO mountedCollectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getMountedCollectionAO(irodsAccount); mountedCollectionAO.createMountedFileSystemCollection("", targetIrodsCollection, ""); }
@Test public void testCreateAndRemoveMountedFileSystem() throws Exception { if (!testingPropertiesHelper.isTestFileSystemMount(testingProperties)) { return; } String targetCollectionName = "testCreateAndRemoveMountedFileSystem"; String localMountDir = "testCreateAndRemoveMountedFileSystemLocal"; String localCollectionAbsolutePath = testingProperties.getProperty(TestingPropertiesHelper.IRODS_REG_BASEDIR) + "/" + localMountDir; File localFile = new File(localCollectionAbsolutePath); localFile.mkdirs(); FileGenerator.generateManyFilesInParentCollectionByAbsolutePath( localCollectionAbsolutePath, "testCreateAndRemoveMountedFileSystem", ".txt", 10, 1, 2); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); 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()); mountedCollectionAO.createMountedFileSystemCollection( localCollectionAbsolutePath, targetIrodsCollection, irodsAccount.getDefaultStorageResource()); }