Skip to content

Commit

Permalink
#1 adding datagrid user resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Jan 10, 2018
1 parent 2f9b749 commit 09014a9
Show file tree
Hide file tree
Showing 5 changed files with 217 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ JargonVersion.java
**/*.*~
*.*~
.dbeaver*
test.metalnx.properties
89 changes: 89 additions & 0 deletions irodsext-data-profiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,95 @@
<goal>run</goal>
</goals>
</execution>
<execution>
<!-- generate metalnx test properties as standard -->
<id>2</id>
<phase>validate</phase>
<configuration>
<tasks>
<delete file="${basedir}/src/test/resources/test.metalnx.properties" />
<touch file="${basedir}/src/test/resources/test.metalnx.properties"
mkdirs="true" />
<echo file="${basedir}/src/test/resources/test.metalnx.properties"
append="true">
irods.host=${jargon.test.irods.host}
irods.port=${jargon.test.irods.port}
irods.zoneName=${jargon.test.irods.zone}
irods.admin.user=${jargon.test.irods.admin}
irods.admin.password=${jargon.test.irods.admin.password}


irods.auth.scheme=${metalnx.auth.scheme}
default.storage.resource=${jargon.test.irods.resource}
ssl.negotiation.policy=${metalnx.ssl.policy}

##########################################################

utilize.packing.streams=${metalnx.packing.streams}


compute.checksum=${metalnx.compute.checksum}

##########################################################

db.driverClassName=${metalnx.jdbc.driver}
db.url=${metalnx.jdbc.url}
db.username=${metalnx.jdbc.user}
db.password=${metalnx.jdbc.password}
hibernate.dialect=${metalnx.jdbc.dialect}


hibernate.show_sql=true
hibernate.format_sql=false


hibernate.hbm2ddl.auto=update


connection.pool_size=5

######################################

jobs.irods.username=${jargon.test.irods.admin}
jobs.irods.password=${jargon.test.irods.admin.password}
jobs.irods.auth.scheme=${metalnx.auth.scheme}
runSyncJobs=true


rmd.connection.timeout=500
rmd.connection.port=8000

reverse.dns.lookup=false

######################################

populate.msi.enabled=false
illumina.msi.enabled=true

msi.api.version=1.X.X

msi.metalnx.list=libmsiget_illumina_meta.so,libmsiobjget_microservices.so,libmsiobjget_version.so,libmsiobjjpeg_extract.so,libmsiobjput_mdbam.so,libmsiobjput_mdbam.so,libmsiobjput_mdmanifest.so,libmsiobjput_mdvcf.so,libmsiobjput_populate.so

msi.irods.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so,libmsiobjput_http.so,libmsiobjput_irods.so,libmsiobjget_irods.so,libmsiobjget_http.so,libmsiobjput_slink.so,libmsiobjget_slink.so

msi.irods.42.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so

msi.other.list=

resource.location.images=/images/,classpath:static/images/
resource.location.fonts=/fonts/,classpath:static/fonts/
resource.location.css=/css/,classpath:static/css/
resource.location.js=/js/,classpath:static/js/
resource.location.i18=classpath:i18n/messages
resource.location.i18-users=classpath:i18n-users/messages

</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.irods.jargon.extensions.dataprofiler.DataProfilerService;
import org.irods.jargon.extensions.dataprofiler.DataProfilerSettings;
import org.irods.jargon.extensions.datatyper.DataTypeResolutionServiceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.emc.metalnx.core.domain.entity.DataGridUser;
Expand All @@ -24,6 +26,10 @@
*/
public class IrodsextDataProfilerFactoryImpl implements DataProfilerFactory {

public static final Logger log = LoggerFactory.getLogger(IrodsextDataProfilerFactoryImpl.class);

public static final String DATA_GRID_USER_KEY = "DataGridUser";

@Autowired
private IRODSAccessObjectFactory irodsAccessObjectFactory;

Expand Down Expand Up @@ -62,6 +68,7 @@ public DataProfilerService instanceDataProfilerService(final IRODSAccount irodsA
dataProfilerService.setDataTypeResolutionService(
dataTypeResolutionServiceFactory.instanceDataTypeResolutionService(irodsAccount));
dataProfilerService.setFavoritesService(getFavoritesService());
dataProfilerService.setDataGridUser(resolveDataGridUser(irodsAccount));
return dataProfilerService;
}

Expand Down Expand Up @@ -126,4 +133,9 @@ public void setUserService(UserService userService) {
this.userService = userService;
}

private DataGridUser resolveDataGridUser(final IRODSAccount irodsAccount) {
log.info("resolveDataGridUser");
return userService.findByUsernameAndAdditionalInfo(irodsAccount.getUserName(), irodsAccount.getZone());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;

import com.emc.metalnx.core.domain.entity.DataGridUser;
import com.emc.metalnx.services.interfaces.FavoritesService;

/**
* @author Mike Conway - NIEHS
Expand Down Expand Up @@ -76,6 +80,47 @@ public void afterEach() throws Exception {
irodsFileSystem.closeAndEatExceptions();
}

/**
* Test method for
* {@link org.irodsext.dataprofiler.IrodsextDataProfilerService#retrieveDataProfile(java.lang.String, org.irods.jargon.extensions.dataprofiler.DataProfilerSettings)}.
*/
@Test
public void testProfileWithCollectionWithStar() throws Exception {
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory();
String targetIrodsCollection = testingPropertiesHelper
.buildIRODSCollectionAbsolutePathFromTestProperties(testingProperties, IRODS_TEST_SUBDIR_PATH);

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

FavoritesService favoritesService = Mockito.mock(FavoritesService.class);
Mockito.when(favoritesService.isPathFavoriteForUser(dataGridUser, targetIrodsCollection)).thenReturn(true);

IrodsextDataProfilerService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings,
accessObjectFactory, irodsAccount);
dataProfilerService.setFavoritesService(favoritesService);
dataProfilerService.setDataTypeResolutionService(dataTyperService);
@SuppressWarnings("rawtypes")
DataProfile dataProfile = dataProfilerService.retrieveDataProfile(targetIrodsCollection);

Assert.assertTrue("should be starred", dataProfile.isStarred());

}

/**
* Test method for
* {@link org.irodsext.dataprofiler.IrodsextDataProfilerService#retrieveDataProfile(java.lang.String, org.irods.jargon.extensions.dataprofiler.DataProfilerSettings)}.
Expand Down
70 changes: 70 additions & 0 deletions irodsext-data-profiler/src/test/resources/test.metalnx.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
irods.host=server4.local
irods.port=1247
irods.zoneName=zone1
irods.admin.user=rods
irods.admin.password=rods


irods.auth.scheme=STANDARD
default.storage.resource=test1-resc
ssl.negotiation.policy=CS_NEG_REFUSE

##########################################################

utilize.packing.streams=true


compute.checksum=true

##########################################################

db.driverClassName=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/IRODS-EXT
db.username=irodsext
db.password=password
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect


hibernate.show_sql=true
hibernate.format_sql=false


hibernate.hbm2ddl.auto=update


connection.pool_size=5

######################################

jobs.irods.username=rods
jobs.irods.password=rods
jobs.irods.auth.scheme=STANDARD
runSyncJobs=true


rmd.connection.timeout=500
rmd.connection.port=8000

reverse.dns.lookup=false

######################################

populate.msi.enabled=false
illumina.msi.enabled=true

msi.api.version=1.X.X

msi.metalnx.list=libmsiget_illumina_meta.so,libmsiobjget_microservices.so,libmsiobjget_version.so,libmsiobjjpeg_extract.so,libmsiobjput_mdbam.so,libmsiobjput_mdbam.so,libmsiobjput_mdmanifest.so,libmsiobjput_mdvcf.so,libmsiobjput_populate.so

msi.irods.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so,libmsiobjput_http.so,libmsiobjput_irods.so,libmsiobjget_irods.so,libmsiobjget_http.so,libmsiobjput_slink.so,libmsiobjget_slink.so

msi.irods.42.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so

msi.other.list=

resource.location.images=/images/,classpath:static/images/
resource.location.fonts=/fonts/,classpath:static/fonts/
resource.location.css=/css/,classpath:static/css/
resource.location.js=/js/,classpath:static/js/
resource.location.i18=classpath:i18n/messages
resource.location.i18-users=classpath:i18n-users/messages

0 comments on commit 09014a9

Please sign in to comment.