From e62065fe768652b9b36f81904f0db679516f837c Mon Sep 17 00:00:00 2001 From: michael-conway Date: Mon, 2 Nov 2015 13:56:53 -0500 Subject: [PATCH] #152 fix for federated queries data objects --- README.md | 18 +- .../irods/jargon/core/pub/DataAOHelper.java | 27 ++- .../jargon/core/pub/DataObjectAOImpl.java | 10 +- .../core/pub/DataTransferOperationsImpl.java | 9 +- .../testutils/TestingPropertiesHelper.java | 38 +++++ .../pub/DataTransferOperationsImplTest.java | 62 ++++++- ...nAndDataObjectListAndSearchAOImplTest.java | 57 +++++++ .../pub/FederatedDataObjectAOImplTest.java | 159 ++++++++++++++++++ .../core/pub/RuleProcessingAOImplTest.java | 38 ++--- .../irods/jargon/core/unittest/AOTests.java | 2 +- 10 files changed, 376 insertions(+), 44 deletions(-) create mode 100644 jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedDataObjectAOImplTest.java diff --git a/README.md b/README.md index 739eba4fc..f42bbcf63 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Jargon Core API ## News -Maintenance release of Jargon work in progress, focused on bug fixes, more 4.1 compatability, and stream performance for i/o and put/get +Maintenance release of Jargon work in progress, focused on bug fixes, more 4.1.6 compatability, and stream performance for i/o and put/get Release https://github.com/DICE-UNC/jargon/milestones/Performance%20enhancements%20for%20streams%20and%20put/get%20-%204.0.2.4 @@ -46,3 +46,19 @@ Note that the following bug and feature requests are logged in GForge with relat ### move semantics error in cloud browser moving a/path/a to a/path/b with collection already exists #140 Updated semantics of move collection to avoid 'collection already exists errors' by adding the source collection as the child of the target collection name + +### across federation browsing under strict acls doesn't interpolate home/ and find subdirs viewable #39 + +More gracefully handle path guessing heuristics cross-federation browsing when drilling down and stict ACLs is on. + +### CI integration with iRODS 4 #18 + +Changes in build automation and testing to integrate Jargon testing into iRODS Consortium Continuous integration + +### copy of file to itself recursively endlessly copies until path gets too large #151 + +Added checks to not copy a collection recursively under itself. Revealed in cloud browser testing. + +### -832000 in cloud browser clicking on file in fed zone #152 + +Removed resource group name from DataObject selects when querying for domain object. That is no longer useful with new resource domain hierarchy and was causing GenQuery exceptions with later iRODS versions diff --git a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataAOHelper.java b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataAOHelper.java index 5a7b1ff4a..8238ee28a 100644 --- a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataAOHelper.java +++ b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataAOHelper.java @@ -119,8 +119,6 @@ void buildSelects(final IRODSGenQueryBuilder builder) .addSelectAsGenQueryValue( RodsGenQueryEnum.COL_DATA_TYPE_NAME) .addSelectAsGenQueryValue(RodsGenQueryEnum.COL_DATA_SIZE) - .addSelectAsGenQueryValue( - RodsGenQueryEnum.COL_D_RESC_GROUP_NAME) .addSelectAsGenQueryValue(RodsGenQueryEnum.COL_D_RESC_NAME) .addSelectAsGenQueryValue(RodsGenQueryEnum.COL_D_DATA_PATH) .addSelectAsGenQueryValue(RodsGenQueryEnum.COL_D_OWNER_NAME) @@ -167,21 +165,20 @@ public static DataObject buildDomainFromResultSetRow( .getIntOrZeroFromIRODSValue(row.getColumn(5))); dataObject.setDataTypeName(row.getColumn(6)); dataObject.setDataSize(Long.parseLong(row.getColumn(7))); - dataObject.setResourceGroupName(row.getColumn(8)); - dataObject.setResourceName(row.getColumn(9)); - dataObject.setDataPath(row.getColumn(10)); - dataObject.setDataOwnerName(row.getColumn(11)); - dataObject.setDataOwnerZone(row.getColumn(12)); - dataObject.setReplicationStatus(row.getColumn(13)); - dataObject.setDataStatus(row.getColumn(14)); - dataObject.setChecksum(row.getColumn(15)); - dataObject.setExpiry(row.getColumn(16)); - dataObject.setDataMapId(Integer.parseInt(row.getColumn(17))); - dataObject.setComments(row.getColumn(18)); + dataObject.setResourceName(row.getColumn(8)); + dataObject.setDataPath(row.getColumn(9)); + dataObject.setDataOwnerName(row.getColumn(10)); + dataObject.setDataOwnerZone(row.getColumn(11)); + dataObject.setReplicationStatus(row.getColumn(12)); + dataObject.setDataStatus(row.getColumn(13)); + dataObject.setChecksum(row.getColumn(14)); + dataObject.setExpiry(row.getColumn(15)); + dataObject.setDataMapId(Integer.parseInt(row.getColumn(16))); + dataObject.setComments(row.getColumn(17)); dataObject.setCreatedAt(IRODSDataConversionUtil - .getDateFromIRODSValue(row.getColumn(19))); + .getDateFromIRODSValue(row.getColumn(18))); dataObject.setUpdatedAt(IRODSDataConversionUtil - .getDateFromIRODSValue(row.getColumn(20))); + .getDateFromIRODSValue(row.getColumn(19))); // add info to track position in records for possible requery dataObject.setLastResult(row.isLastResult()); diff --git a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataObjectAOImpl.java b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataObjectAOImpl.java index 2e0a7b35d..7033111f1 100644 --- a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataObjectAOImpl.java +++ b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataObjectAOImpl.java @@ -627,14 +627,12 @@ private void putCommonProcessing(final File localFile, targetFile, getIRODSProtocol(), transferControlBlock, transferStatusCallbackListener); } catch (FileNotFoundException e) { - log.error( - "File not found for local file I was trying to put:{}", - localFile.getAbsolutePath()); - throw new DataNotFoundException( - "localFile not found to put to irods", e); + log.error("iRODS file missing in put operation:{}", + targetFile.getAbsolutePath()); + throw new DataNotFoundException("irodsFile not found", e); } catch (java.io.FileNotFoundException e) { throw new DataNotFoundException( - "irods destination not found in put to irods", e); + "local file not found in put to irods", e); } } else { diff --git a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataTransferOperationsImpl.java b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataTransferOperationsImpl.java index cb0737330..f8d5dcf20 100644 --- a/jargon-core/src/main/java/org/irods/jargon/core/pub/DataTransferOperationsImpl.java +++ b/jargon-core/src/main/java/org/irods/jargon/core/pub/DataTransferOperationsImpl.java @@ -1746,7 +1746,7 @@ private void processCopyWhenSourceIsDir( operativeTransferControlBlock); /* - * Don't copy to self + * Don't copy to self or parent */ if (targetFile.getAbsolutePath().equals(sourceFile.getParent())) { log.error("source file is being copied to own parent:{}", @@ -1755,6 +1755,13 @@ private void processCopyWhenSourceIsDir( "attempt to copy source file to its parent"); } + if (targetFile.getAbsolutePath().equals(sourceFile.getAbsolutePath())) { + log.error("source file is being copied to self:{}", + sourceFile.getAbsolutePath()); + throw new DuplicateDataException( + "attempt to copy source file to itself"); + } + // if the target is a file throw an exception if (targetFile.exists() && targetFile.isFile()) { targetFile = (IRODSFile) targetFile.getParentFile(); diff --git a/jargon-core/src/main/java/org/irods/jargon/testutils/TestingPropertiesHelper.java b/jargon-core/src/main/java/org/irods/jargon/testutils/TestingPropertiesHelper.java index 41c0e328c..365a3ccea 100644 --- a/jargon-core/src/main/java/org/irods/jargon/testutils/TestingPropertiesHelper.java +++ b/jargon-core/src/main/java/org/irods/jargon/testutils/TestingPropertiesHelper.java @@ -799,6 +799,44 @@ public String buildIRODSCollectionAbsolutePathFromFederatedZoneReadTestPropertie return pathBuilder.toString(); } + /** + * Handy method to give, from the root IRODS collection, a full path to a + * given user home collection in the federated zone. So if user1 in zone1 + * wants to see his home collection in federated zone zone2, the path + * returned would be /zone2/home/user1#zone1 plus the extra path info + * + * @param testingProperties + * Properties that define test behavior + * @param collectionPathBelowScratch + * String with no leading '/' that defines the + * desired path underneath the IRODS scratch directory + * @return String with trailing '/' that gives the absolute + * path for an IRODS collection + * @throws TestingUtilsException + * @throws URISyntaxException + */ + public String buildIRODSCollectionAbsolutePathFromFederatedZoneHomeDirTestProperties( + final Properties testingProperties, + final String collectionPathBelowScratch) + throws TestingUtilsException { + + if (testingProperties.get(IRODS_SCRATCH_DIR_KEY) == null) { + throw new TestingUtilsException( + "scratch path not provided in testing.properties"); + } + + StringBuilder pathBuilder = new StringBuilder(); + pathBuilder.append('/'); + pathBuilder.append(testingProperties.get(IRODS_FEDERATED_ZONE_KEY)); + pathBuilder.append("/home/"); + pathBuilder.append(testingProperties.get(IRODS_USER_KEY)); + pathBuilder.append("#"); + pathBuilder.append(testingProperties.get(IRODS_ZONE_KEY)); + pathBuilder.append('/'); + pathBuilder.append(collectionPathBelowScratch); + return pathBuilder.toString(); + } + /** * Handy method to give, from the root IRODS collection, a full path to a * given collection in the IRODS test scratch area on IRODS diff --git a/jargon-core/src/test/java/org/irods/jargon/core/pub/DataTransferOperationsImplTest.java b/jargon-core/src/test/java/org/irods/jargon/core/pub/DataTransferOperationsImplTest.java index 1b0883574..d900fdd80 100644 --- a/jargon-core/src/test/java/org/irods/jargon/core/pub/DataTransferOperationsImplTest.java +++ b/jargon-core/src/test/java/org/irods/jargon/core/pub/DataTransferOperationsImplTest.java @@ -3552,7 +3552,7 @@ public void testCopyCollectionToTarget() throws Exception { } /** - * Normal test of consilidated 'copy()' method, this time with a collection, + * Normal test of consolidated 'copy()' method, this time with a collection, * using the string path sigs * * @throws Exception @@ -3611,6 +3611,66 @@ public void testCopyCollectionToTargetCollection() throws Exception { } + /** + * Bug https://github.com/DICE-UNC/jargon/issues/151 + * + * @throws Exception + */ + @Test(expected = DuplicateDataException.class) + public void testCopyCollectionToTargetCollectionSelfBug151() + throws Exception { + + // generate a local scratch file + String testOrigDirectory = "testCopyCollectionToTargetCollectionSelfBug151"; + String testTargetDirectory = "testCopyCollectionToTargetCollectionSelfBug151"; + + String localCollectionAbsolutePath = scratchFileUtils + .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + + '/' + testOrigDirectory); + + String irodsCollectionRootAbsolutePath = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH); + + String irodsOriginalAbsolutePath = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + + testOrigDirectory); + + String irodsTargetAbsolutePath = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + + testTargetDirectory); + + FileGenerator + .generateManyFilesAndCollectionsInParentCollectionByAbsolutePath( + localCollectionAbsolutePath, "prefixForColl", 2, 3, 2, + "testFile", ".txt", 2, 2, 1, 2); + + IRODSAccount irodsAccount = testingPropertiesHelper + .buildIRODSAccountFromTestProperties(testingProperties); + + DataTransferOperations dataTransferOperations = irodsFileSystem + .getIRODSAccessObjectFactory().getDataTransferOperations( + irodsAccount); + + dataTransferOperations.putOperation(localCollectionAbsolutePath, + irodsCollectionRootAbsolutePath, "", null, null); + + dataTransferOperations.copy(irodsOriginalAbsolutePath, "", + irodsTargetAbsolutePath, null, null); + + File localFile = new File(localCollectionAbsolutePath); + IRODSFile targetFile = irodsFileSystem + .getIRODSFileFactory(irodsAccount).instanceIRODSFile( + irodsTargetAbsolutePath, testOrigDirectory); + + // compare the local source to the copied-to target + assertionHelper.assertTwoFilesAreEqualByRecursiveTreeComparison( + localFile, (File) targetFile); + + } + @Test public void testCopyCollectionToTargetCollectionWithResource() throws Exception { diff --git a/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedCollectionAndDataObjectListAndSearchAOImplTest.java b/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedCollectionAndDataObjectListAndSearchAOImplTest.java index 2892a5fc2..18930a059 100644 --- a/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedCollectionAndDataObjectListAndSearchAOImplTest.java +++ b/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedCollectionAndDataObjectListAndSearchAOImplTest.java @@ -10,6 +10,7 @@ import org.irods.jargon.core.exception.FileNotFoundException; import org.irods.jargon.core.protovalues.FilePermissionEnum; import org.irods.jargon.core.pub.domain.Collection; +import org.irods.jargon.core.pub.domain.ObjStat; import org.irods.jargon.core.pub.domain.UserFilePermission; import org.irods.jargon.core.pub.io.IRODSFile; import org.irods.jargon.core.pub.io.IRODSFileFactory; @@ -127,6 +128,62 @@ public void testListCollectionWithOneDataObject() throws Exception { } + @Test + public void testRetrieveObjStatInFederatedZone() throws Exception { + + if (!testingPropertiesHelper.isTestFederatedZone(testingProperties)) { + return; + } + + String fileName = "testRetrieveObjStatInFederatedZone.txt"; + String testSubdir = "testRetrieveObjStatInFederatedZone"; + + IRODSAccount irodsAccount = testingPropertiesHelper + .buildIRODSAccountForFederatedZoneFromTestProperties(testingProperties); + + String targetIrodsPath = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromFederatedZoneReadTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH + "/" + + testSubdir); + + String absPath = scratchFileUtils + .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); + String localFilePath = FileGenerator + .generateFileOfFixedLengthGivenName(absPath, fileName, 3); + File localFile = new File(localFilePath); + + IRODSFileFactory irodsFileFactory = irodsFileSystem + .getIRODSFileFactory(irodsAccount); + IRODSFile destFile = irodsFileFactory + .instanceIRODSFile(targetIrodsPath); + + // delete to clean up + destFile.deleteWithForceOption(); + destFile.mkdirs(); + + DataTransferOperations dataTransferOperationsAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataTransferOperations( + irodsAccount); + + dataTransferOperationsAO.putOperation(localFile, destFile, null, null); + + /* + * setup done, now connect from the first zone and try to list the coll + * with the data object + */ + + IRODSAccount fedAccount = testingPropertiesHelper + .buildIRODSAccountFromTestProperties(testingProperties); + + CollectionAndDataObjectListAndSearchAO collectionListAndSearchAO = irodsFileSystem + .getIRODSAccessObjectFactory() + .getCollectionAndDataObjectListAndSearchAO(fedAccount); + ObjStat objStat = collectionListAndSearchAO + .retrieveObjectStatForPath(targetIrodsPath + "/" + fileName); + Assert.assertNotNull("null objstat", objStat); + + } + @Test public void testListDataObjectsUnderPathInAnotherZone() throws Exception { diff --git a/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedDataObjectAOImplTest.java b/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedDataObjectAOImplTest.java new file mode 100644 index 000000000..c7a79809a --- /dev/null +++ b/jargon-core/src/test/java/org/irods/jargon/core/pub/FederatedDataObjectAOImplTest.java @@ -0,0 +1,159 @@ +package org.irods.jargon.core.pub; + +import java.io.File; +import java.util.Properties; + +import junit.framework.Assert; + +import org.irods.jargon.core.connection.IRODSAccount; +import org.irods.jargon.core.pub.domain.DataObject; +import org.irods.jargon.core.pub.io.IRODSFile; +import org.irods.jargon.core.pub.io.IRODSFileFactory; +import org.irods.jargon.testutils.IRODSTestSetupUtilities; +import org.irods.jargon.testutils.TestingPropertiesHelper; +import org.irods.jargon.testutils.filemanip.FileGenerator; +import org.irods.jargon.testutils.filemanip.ScratchFileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class FederatedDataObjectAOImplTest { + + private static Properties testingProperties = new Properties(); + private static TestingPropertiesHelper testingPropertiesHelper = new TestingPropertiesHelper(); + private static ScratchFileUtils scratchFileUtils = null; + public static final String IRODS_TEST_SUBDIR_PATH = "FederatedDataObjectAOImplTest"; + private static IRODSTestSetupUtilities irodsTestSetupUtilities = null; + private static IRODSFileSystem irodsFileSystem; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper(); + testingProperties = testingPropertiesLoader.getTestProperties(); + + if (!testingPropertiesHelper.isTestFederatedZone(testingProperties)) { + return; + } + + scratchFileUtils = new ScratchFileUtils(testingProperties); + scratchFileUtils + .clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); + irodsTestSetupUtilities = new IRODSTestSetupUtilities(); + irodsTestSetupUtilities.initializeIrodsScratchDirectory(); + irodsTestSetupUtilities + .initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); + irodsFileSystem = IRODSFileSystem.instance(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + + if (!testingPropertiesHelper.isTestFederatedZone(testingProperties)) { + return; + } + irodsFileSystem.closeAndEatExceptions(); + } + + @Test + public void testFindByCollectionPathAndDataNameCrossZone() throws Exception { + + if (!testingPropertiesHelper.isTestFederatedZone(testingProperties)) { + return; + } + // generate a local scratch file + String testFileName = "testFindByCollectionPathAndDataNameCrossZone.dat"; + String absPath = scratchFileUtils + .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); + String localFileName = FileGenerator + .generateFileOfFixedLengthGivenName(absPath, testFileName, 10); + + String targetIrodsCollection = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromFederatedZoneReadTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH); + + String targetIrodsFile = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromFederatedZoneReadTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + + testFileName); + File sourceFile = new File(localFileName); + IRODSAccount irodsAccount = testingPropertiesHelper + .buildIRODSAccountForFederatedZoneFromTestProperties(testingProperties); + IRODSFileFactory irodsFileFactory = irodsFileSystem + .getIRODSFileFactory(irodsAccount); + + DataTransferOperations dto = irodsFileSystem + .getIRODSAccessObjectFactory().getDataTransferOperations( + irodsAccount); + IRODSFile destFile = irodsFileFactory + .instanceIRODSFile(targetIrodsFile); + destFile.deleteWithForceOption(); + dto.putOperation(sourceFile, destFile, null, null); + + IRODSAccount localZoneAccount = testingPropertiesHelper + .buildIRODSAccountForFederatedZoneFromTestProperties(testingProperties); + + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory() + .getDataObjectAO(localZoneAccount); + + DataObject dataObject = dataObjectAO.findByCollectionNameAndDataName( + targetIrodsCollection, testFileName); + Assert.assertNotNull("null data object, was not found", dataObject); + + } + + /** + * Replicates bug -832000 in cloud browser clicking on file in fed zone #152 + * + * @throws Exception + */ + @Test + public void testFindByCollectionPathAndDataNameCrossZoneInForeignZoneHomeDirBug152() + throws Exception { + + if (!testingPropertiesHelper.isTestFederatedZone(testingProperties)) { + return; + } + // generate a local scratch file + String testFileName = "testFindByCollectionPathAndDataNameCrossZoneInForeignZoneHomeDirBug152.dat"; + String absPath = scratchFileUtils + .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); + String localFileName = FileGenerator + .generateFileOfFixedLengthGivenName(absPath, testFileName, 10); + + String targetIrodsCollection = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromFederatedZoneHomeDirTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH); + + String targetIrodsFile = testingPropertiesHelper + .buildIRODSCollectionAbsolutePathFromFederatedZoneHomeDirTestProperties( + testingProperties, IRODS_TEST_SUBDIR_PATH + '/' + + testFileName); + File sourceFile = new File(localFileName); + IRODSAccount irodsAccount = testingPropertiesHelper + .buildIRODSAccountFromTestProperties(testingProperties); + IRODSFileFactory irodsFileFactory = irodsFileSystem + .getIRODSFileFactory(irodsAccount); + + IRODSFile targetIrodsCollectionAsIrodsFile = irodsFileFactory + .instanceIRODSFile(targetIrodsCollection); + targetIrodsCollectionAsIrodsFile.mkdirs(); + + DataTransferOperations dto = irodsFileSystem + .getIRODSAccessObjectFactory().getDataTransferOperations( + irodsAccount); + IRODSFile destFile = irodsFileFactory + .instanceIRODSFile(targetIrodsFile); + destFile.deleteWithForceOption(); + dto.putOperation(sourceFile, destFile, null, null); + + DataObjectAO dataObjectAO = irodsFileSystem + .getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount); + + DataObject dataObject = dataObjectAO.findByCollectionNameAndDataName( + targetIrodsCollection, testFileName); + Assert.assertNotNull("null data object, was not found", dataObject); + + } + +} diff --git a/jargon-core/src/test/java/org/irods/jargon/core/pub/RuleProcessingAOImplTest.java b/jargon-core/src/test/java/org/irods/jargon/core/pub/RuleProcessingAOImplTest.java index 3440d2734..0f30646a8 100644 --- a/jargon-core/src/test/java/org/irods/jargon/core/pub/RuleProcessingAOImplTest.java +++ b/jargon-core/src/test/java/org/irods/jargon/core/pub/RuleProcessingAOImplTest.java @@ -47,11 +47,11 @@ public static void setUpBeforeClass() throws Exception { scratchFileUtils = new org.irods.jargon.testutils.filemanip.ScratchFileUtils( testingProperties); scratchFileUtils - .clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); + .clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); irodsTestSetupUtilities = new org.irods.jargon.testutils.IRODSTestSetupUtilities(); irodsTestSetupUtilities.initializeIrodsScratchDirectory(); irodsTestSetupUtilities - .initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); + .initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); assertionHelper = new org.irods.jargon.testutils.AssertionHelper(); irodsFileSystem = IRODSFileSystem.instance(); } @@ -264,7 +264,7 @@ public void testExecuteRuleFromResourceWithOverrides() throws Exception { String targetIrodsFile = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH + '/' - + testFileName); + + testFileName); File localFile = new File(localFileName); IRODSFileFactory irodsFileFactory = irodsFileSystem @@ -490,7 +490,7 @@ public void testRuleContainsConditionWithEqualsInAttrib() throws Exception { StringBuilder ruleBuilder = new StringBuilder(); ruleBuilder - .append("myTestRule||acGetIcatResults(*Action,*Condition,*B)##forEachExec(*B,msiGetValByKey(*B,RESC_LOC,*R)##remoteExec(*R,null,msiDataObjChksum(*B,*Operation,*C),nop)##msiGetValByKey(*B,DATA_NAME,*D)##msiGetValByKey(*B,COLL_NAME,*E)##writeLine(stdout,CheckSum of *E/*D at *R is *C),nop)|nop##nop\n"); + .append("myTestRule||acGetIcatResults(*Action,*Condition,*B)##forEachExec(*B,msiGetValByKey(*B,RESC_LOC,*R)##remoteExec(*R,null,msiDataObjChksum(*B,*Operation,*C),nop)##msiGetValByKey(*B,DATA_NAME,*D)##msiGetValByKey(*B,COLL_NAME,*E)##writeLine(stdout,CheckSum of *E/*D at *R is *C),nop)|nop##nop\n"); ruleBuilder.append("*Action=chksumRescLoc%*Condition=COLL_NAME = '"); ruleBuilder.append(targetIrodsCollection); @@ -533,7 +533,7 @@ public void testExecuteRequestClientActionPut() throws Exception { String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testResultFileName; + + "/" + testResultFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -583,7 +583,7 @@ public void testExecuteRequestClientActionParallelPut() throws Exception { String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testResultFileName; + + "/" + testResultFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -642,7 +642,7 @@ public void testExecuteRequestClientActionParallelPutNoThreading() String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testFileName; + + "/" + testFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -708,7 +708,7 @@ public void testExecuteRequestClientActionPutWithOverwriteFileExists() String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testFileName; + + "/" + testFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -769,7 +769,7 @@ public void testExecuteRequestClientActionPutWithNoOverwriteFileExists() String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testFileName; + + "/" + testFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -810,7 +810,7 @@ public void testExecuteRequestClientActionPutLocalFileNotExists() // put a collection out to do a checksum on String testFileName = "testClientAction.txt"; scratchFileUtils - .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); + .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); String putFileName = "/a/bogus/dir/" + testFileName; IRODSAccount irodsAccount = testingPropertiesHelper @@ -955,7 +955,7 @@ public void testExecuteRequestMultipleClientActionGetFileBug1641() File sourceFile = new File(scratchFileAbsolutePath); IRODSFile targetFile = accessObjectFactory.getIRODSFileFactory( irodsAccount).instanceIRODSFile(targetIrodsCollection, - testFileName); + testFileName); DataTransferOperations dto = accessObjectFactory .getDataTransferOperations(irodsAccount); @@ -964,7 +964,7 @@ public void testExecuteRequestMultipleClientActionGetFileBug1641() File sourceFile1 = new File(scratchFileAbsolutePath1); IRODSFile targetFile1 = accessObjectFactory.getIRODSFileFactory( irodsAccount).instanceIRODSFile(targetIrodsCollection, - testFileName1); + testFileName1); dto.putOperation(sourceFile1, targetFile1, null, tcb); @@ -1001,7 +1001,7 @@ public void testExecuteRequestMultipleClientActionGetFileBug1641() * * @throws Exception */ - @Test + @Ignore // ignore and test as possible irods bug public void testPutGetInterleavedBug1641() throws Exception { @@ -1059,7 +1059,7 @@ public void testPutGetInterleavedBug1641() throws Exception { String putTargetFile = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testPutFileName; + + "/" + testPutFileName; TransferControlBlock tcb = irodsFileSystem .getIRODSAccessObjectFactory() @@ -1069,7 +1069,7 @@ public void testPutGetInterleavedBug1641() throws Exception { File sourceFile = new File(scratchFileAbsolutePath); IRODSFile targetFile = accessObjectFactory.getIRODSFileFactory( irodsAccount).instanceIRODSFile(targetIrodsCollection, - testFileName); + testFileName); DataTransferOperations dto = accessObjectFactory .getDataTransferOperations(irodsAccount); @@ -1078,7 +1078,7 @@ public void testPutGetInterleavedBug1641() throws Exception { File sourceFile1 = new File(scratchFileAbsolutePath1); IRODSFile targetFile1 = accessObjectFactory.getIRODSFileFactory( irodsAccount).instanceIRODSFile(targetIrodsCollection, - testFileName1); + testFileName1); dto.putOperation(sourceFile1, targetFile1, null, tcb); @@ -1407,7 +1407,7 @@ public void testExecuteRequestClientActionPutBug181() throws Exception { String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + irodsFileName; + + "/" + irodsFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -1468,7 +1468,7 @@ public void testExecuteRuleBug182() throws Exception { String targetIrodsFileName = testingPropertiesHelper .buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH) - + "/" + testFileName; + + "/" + testFileName; IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); @@ -1637,7 +1637,7 @@ public void testDeleteNonExistentRuleExecution() throws Exception { IRODSFileSystem irodsFileSystem = IRODSFileSystem.instance(); IRODSAccount irodsAccount = testingPropertiesHelper - .buildIRODSAccountFromTestProperties(testingProperties); + .buildIRODSAdminAccountFromTestProperties(testingProperties); RuleProcessingAO ruleProcessingAO = irodsFileSystem .getIRODSAccessObjectFactory() .getRuleProcessingAO(irodsAccount); diff --git a/jargon-core/src/test/java/org/irods/jargon/core/unittest/AOTests.java b/jargon-core/src/test/java/org/irods/jargon/core/unittest/AOTests.java index 780449994..d80d4707e 100644 --- a/jargon-core/src/test/java/org/irods/jargon/core/unittest/AOTests.java +++ b/jargon-core/src/test/java/org/irods/jargon/core/unittest/AOTests.java @@ -84,7 +84,7 @@ MountedFilesystemCollectionAOImplTest.class, IRODSFileSystemSingletonWrapperTest.class, ResourceAOHelperTest.class, DataObjectChecksumUtilitiesAOImplTest.class, - CollectionListingUtilsTest.class }) + CollectionListingUtilsTest.class, FederatedDataObjectAOImplTest.class }) /** * Suite to run Access Object tests in org.irods.jargon.pub.* *