use of org.irods.jargon.testutils.IRODSTestSetupUtilities in project metalnx-web by irods-contrib.
the class SpecQueryServiceImplTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper();
testingProperties = testingPropertiesLoader.getTestProperties();
scratchFileUtils = new ScratchFileUtils(testingProperties);
scratchFileUtils.clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH);
irodsTestSetupUtilities = new IRODSTestSetupUtilities();
irodsTestSetupUtilities.initializeIrodsScratchDirectory();
irodsTestSetupUtilities.initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH);
irodsFileSystem = IRODSFileSystem.instance();
// set up test structure
String rootCollection = "SpecQueryServiceImplTestRoot";
String localCollectionAbsolutePath = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
String irodsCollectionRootAbsolutePath = (MiscIRODSUtils.computeHomeDirectoryForIRODSAccount(irodsAccount) + '/' + rootCollection);
rootCollPathInIrods = irodsCollectionRootAbsolutePath;
FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, "specQueryTset", 1, 2, 3, "testFile", ".txt", 4, 3, 2, 30000);
IRODSFileFactory irodsFileFactory = irodsFileSystem.getIRODSFileFactory(irodsAccount);
IRODSFile destFile = irodsFileFactory.instanceIRODSFile(irodsCollectionRootAbsolutePath);
destFile.deleteWithForceOption();
destFile.mkdirs();
DataTransferOperations dataTransferOperationsAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(irodsAccount);
DataObjectAO dataObjectAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataObjectAO(irodsAccount);
CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount);
File localFile = new File(localCollectionAbsolutePath);
dataTransferOperationsAO.putOperation(localFile, destFile, null, null);
// Decorate with various AVUs to use in tests
decorateChildren(destFile, collectionAO, dataObjectAO);
}
use of org.irods.jargon.testutils.IRODSTestSetupUtilities in project metalnx-web by irods-contrib.
the class CollectionServiceImplTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper();
testingProperties = testingPropertiesLoader.getTestProperties();
scratchFileUtils = new ScratchFileUtils(testingProperties);
scratchFileUtils.clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH);
irodsTestSetupUtilities = new IRODSTestSetupUtilities();
irodsTestSetupUtilities.initializeIrodsScratchDirectory();
irodsTestSetupUtilities.initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH);
irodsFileSystem = IRODSFileSystem.instance();
// set up test structure
String rootCollection = "CollectionServiceImplTestTestRoot";
String localCollectionAbsolutePath = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
String irodsCollectionRootAbsolutePath = (MiscIRODSUtils.computeHomeDirectoryForIRODSAccount(irodsAccount) + '/' + rootCollection);
rootCollPathInIrods = irodsCollectionRootAbsolutePath;
FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, "textSearchQueryTest", 1, 2, 3, "textSearchService", ".txt", 4, 3, 2, 30);
IRODSFileFactory irodsFileFactory = irodsFileSystem.getIRODSFileFactory(irodsAccount);
IRODSFile destFile = irodsFileFactory.instanceIRODSFile(irodsCollectionRootAbsolutePath);
destFile.deleteWithForceOption();
destFile.mkdirs();
DataTransferOperations dataTransferOperationsAO = irodsFileSystem.getIRODSAccessObjectFactory().getDataTransferOperations(irodsAccount);
File localFile = new File(localCollectionAbsolutePath);
dataTransferOperationsAO.putOperation(localFile, destFile, null, null);
}
Aggregations