Search in sources :

Example 1 with IRODSTestSetupUtilities

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);
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) IRODSTestSetupUtilities(org.irods.jargon.testutils.IRODSTestSetupUtilities) CollectionAO(org.irods.jargon.core.pub.CollectionAO) DataTransferOperations(org.irods.jargon.core.pub.DataTransferOperations) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataObjectAO(org.irods.jargon.core.pub.DataObjectAO) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile) File(java.io.File) TestingPropertiesHelper(org.irods.jargon.testutils.TestingPropertiesHelper) ScratchFileUtils(org.irods.jargon.testutils.filemanip.ScratchFileUtils) BeforeClass(org.junit.BeforeClass)

Example 2 with IRODSTestSetupUtilities

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);
}
Also used : IRODSFileFactory(org.irods.jargon.core.pub.io.IRODSFileFactory) IRODSTestSetupUtilities(org.irods.jargon.testutils.IRODSTestSetupUtilities) DataTransferOperations(org.irods.jargon.core.pub.DataTransferOperations) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile) IRODSFile(org.irods.jargon.core.pub.io.IRODSFile) File(java.io.File) TestingPropertiesHelper(org.irods.jargon.testutils.TestingPropertiesHelper) ScratchFileUtils(org.irods.jargon.testutils.filemanip.ScratchFileUtils) BeforeClass(org.junit.BeforeClass)

Aggregations

File (java.io.File)2 IRODSAccount (org.irods.jargon.core.connection.IRODSAccount)2 DataTransferOperations (org.irods.jargon.core.pub.DataTransferOperations)2 IRODSFile (org.irods.jargon.core.pub.io.IRODSFile)2 IRODSFileFactory (org.irods.jargon.core.pub.io.IRODSFileFactory)2 IRODSTestSetupUtilities (org.irods.jargon.testutils.IRODSTestSetupUtilities)2 TestingPropertiesHelper (org.irods.jargon.testutils.TestingPropertiesHelper)2 ScratchFileUtils (org.irods.jargon.testutils.filemanip.ScratchFileUtils)2 BeforeClass (org.junit.BeforeClass)2 CollectionAO (org.irods.jargon.core.pub.CollectionAO)1 DataObjectAO (org.irods.jargon.core.pub.DataObjectAO)1