Skip to content

Commit

Permalink
#1 align with new jargon
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Jan 8, 2018
1 parent d153360 commit 97e7ed8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 5 deletions.
2 changes: 1 addition & 1 deletion irodsext-data-profiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jargon-irods-ext</artifactId>
<groupId>org.irods.jargon</groupId>
<version>4.2.1.0-SNAPSHOT</version>
<version>4.3.0.0-SNAPSHOT</version>
</parent>
<artifactId>irodsext-data-profiler</artifactId>
<name>irodsext-data-profiler</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
*/
package org.irodsext.dataprofiler;

import java.io.File;
import java.util.Properties;

import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.connection.JargonProperties;
import org.irods.jargon.core.connection.SettableJargonProperties;
import org.irods.jargon.core.pub.DataTransferOperations;
import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
import org.irods.jargon.core.pub.IRODSFileSystem;
import org.irods.jargon.core.pub.io.IRODSFile;
import org.irods.jargon.core.pub.io.IRODSFileFactory;
import org.irods.jargon.extensions.dataprofiler.DataProfile;
import org.irods.jargon.extensions.dataprofiler.DataProfilerService;
import org.irods.jargon.extensions.dataprofiler.DataProfilerSettings;
import org.irods.jargon.extensions.datatyper.DataTypeResolutionService;
import org.irods.jargon.extensions.datatyper.DataTyperSettings;
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.irodsext.datatyper.IrodsextDataTypeResolutionService;
import org.junit.After;
Expand Down Expand Up @@ -102,6 +107,62 @@ public void testBasicDataProfileWithCollection() throws Exception {
@SuppressWarnings("rawtypes")
DataProfile dataProfile = dataProfilerService.retrieveDataProfile(targetIrodsCollection);
Assert.assertNotNull("null data profile returned", dataProfile);
Assert.assertFalse("no acls", dataProfile.getAcls().isEmpty());
Assert.assertFalse("no child name", dataProfile.getChildName().isEmpty());
Assert.assertFalse("no parent path", dataProfile.getParentPath().isEmpty());
Assert.assertFalse("no path components", dataProfile.getPathComponents().isEmpty());
Assert.assertNotNull("no domain object", dataProfile.getDomainObject());

}

@Test
public void testBasicDataProfileWithTextFileAndFileExtensionTyping() throws Exception {
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory();

String testFileName = "testBasicDataProfileWithTextFileAndFileExtensionTyping.txt";
String absPath = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH);
String localFileName = FileGenerator.generateFileOfFixedLengthGivenName(absPath, testFileName, 1);

File localFile = new File(localFileName);

// now put the file
String targetIrodsFile = testingPropertiesHelper
.buildIRODSCollectionAbsolutePathFromTestProperties(testingProperties, IRODS_TEST_SUBDIR_PATH);

IRODSFileFactory irodsFileFactory = accessObjectFactory.getIRODSFileFactory(irodsAccount);
IRODSFile destFile = irodsFileFactory.instanceIRODSFile(targetIrodsFile);
DataTransferOperations dataTransferOperations = accessObjectFactory.getDataTransferOperations(irodsAccount);
dataTransferOperations.putOperation(localFile, destFile, null, null);
String dataName = destFile.getAbsolutePath() + "/" + testFileName;

DataProfilerSettings dataProfilerSettings = new DataProfilerSettings();
dataProfilerSettings.setDetectMimeAndInfoType(true);
dataProfilerSettings.setRetrieveAcls(true);
dataProfilerSettings.setRetrieveMetadata(true);
dataProfilerSettings.setRetrieveReplicas(false);
dataProfilerSettings.setRetrieveShared(false);
dataProfilerSettings.setRetrieveStarred(false);
dataProfilerSettings.setRetrieveTickets(false);
DataTyperSettings dataTyperSettings = new DataTyperSettings();
dataTyperSettings.setDetailedDetermination(false);
dataTyperSettings.setPersistDataTypes(false);
DataTypeResolutionService dataTyperService = new IrodsextDataTypeResolutionService(accessObjectFactory,
irodsAccount, dataTyperSettings);

DataProfilerService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings,
accessObjectFactory, irodsAccount);
dataProfilerService.setDataTypeResolutionService(dataTyperService);
@SuppressWarnings("rawtypes")
DataProfile dataProfile = dataProfilerService.retrieveDataProfile(dataName);
Assert.assertNotNull("null data profile returned", dataProfile);
Assert.assertFalse("no acls", dataProfile.getAcls().isEmpty());
Assert.assertFalse("no child name", dataProfile.getChildName().isEmpty());
Assert.assertFalse("no parent path", dataProfile.getParentPath().isEmpty());
Assert.assertFalse("no path components", dataProfile.getPathComponents().isEmpty());
Assert.assertNotNull("no domain object", dataProfile.getDomainObject());
Assert.assertTrue("is not a file", dataProfile.isFile());
Assert.assertNotNull("null data type", dataProfile.getDataType());

}

Expand Down
2 changes: 1 addition & 1 deletion irodsext-data-typer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jargon-irods-ext</artifactId>
<groupId>org.irods.jargon</groupId>
<version>4.2.1.0-SNAPSHOT</version>
<version>4.3.0.0-SNAPSHOT</version>
</parent>
<groupId>org.irods.jargon</groupId>
<artifactId>irodsext-data-typer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.irods</groupId>
<artifactId>jargon-pom</artifactId>
<version>4.2.1.0-SNAPSHOT</version>
<version>4.3.0.0-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<name>jargon-extensions</name>
Expand Down
4 changes: 2 additions & 2 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven
#Thu Dec 21 09:42:11 EST 2017
version=4.2.1.0-SNAPSHOT
#Mon Jan 08 16:52:53 EST 2018
version=4.3.0.0-SNAPSHOT
groupId=org.irods.jargon
artifactId=jargon-irods-ext

0 comments on commit 97e7ed8

Please sign in to comment.