use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.
the class SpecQueryServiceImplTest method testCountDataObjectsMatchingMetadata.
@Test
public void testCountDataObjectsMatchingMetadata() throws Exception {
SpecQueryServiceImpl specQueryService = new SpecQueryServiceImpl();
IRODSServices irodsService = Mockito.mock(IRODSServices.class);
AdminServices adminServices = Mockito.mock(AdminServices.class);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
EnvironmentalInfoAO environmentalInfoAO = irodsFileSystem.getIRODSAccessObjectFactory().getEnvironmentalInfoAO(irodsAccount);
SpecificQueryAO specificQueryAO = irodsFileSystem.getIRODSAccessObjectFactory().getSpecificQueryAO(irodsAccount);
Mockito.when(irodsService.getEnvironmentalInfoAO()).thenReturn(environmentalInfoAO);
Mockito.when(adminServices.getSpecificQueryAO()).thenReturn(specificQueryAO);
specQueryService.setIrodsServices(irodsService);
specQueryService.setAdminServices(adminServices);
List<DataGridMetadataSearch> metadataSearch = new ArrayList<DataGridMetadataSearch>();
DataGridMetadataSearch search = new DataGridMetadataSearch(DATA_AVU_ATTR1, DATA_AVU_VAL1, "", DataGridSearchOperatorEnum.EQUAL);
metadataSearch.add(search);
int count = specQueryService.countDataObjectsMatchingMetadata(metadataSearch, irodsAccount.getZone());
Assert.assertTrue("no recs returned", count > 1);
}
use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.
the class CollectionServiceImplTest method testGetSubCollectionsAndDataObjectsUnderPathThatMatchSearchTextPaginated.
@Test
public void testGetSubCollectionsAndDataObjectsUnderPathThatMatchSearchTextPaginated() throws Exception {
CollectionServiceImpl collectionService = new CollectionServiceImpl();
IRODSServices irodsService = Mockito.mock(IRODSServices.class);
AdminServices adminServices = Mockito.mock(AdminServices.class);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
EnvironmentalInfoAO environmentalInfoAO = irodsFileSystem.getIRODSAccessObjectFactory().getEnvironmentalInfoAO(irodsAccount);
CollectionAndDataObjectListAndSearchAO listAndSearchAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAndDataObjectListAndSearchAO(irodsAccount);
SpecificQueryAO specificQueryAO = irodsFileSystem.getIRODSAccessObjectFactory().getSpecificQueryAO(irodsAccount);
Mockito.when(irodsService.getEnvironmentalInfoAO()).thenReturn(environmentalInfoAO);
Mockito.when(irodsService.getCollectionAndDataObjectListAndSearchAO()).thenReturn(listAndSearchAO);
Mockito.when(adminServices.getSpecificQueryAO()).thenReturn(specificQueryAO);
collectionService.setIrodsServices(irodsService);
collectionService.setAdminServices(adminServices);
List<DataGridCollectionAndDataObject> actual = collectionService.searchCollectionAndDataObjectsByName("textSearch");
Assert.assertTrue("no recs returned", actual.size() > 1);
}
use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.
the class SpecQueryServiceImplTest method testSearchByMetadataDataObjects.
@Test
public void testSearchByMetadataDataObjects() throws Exception {
SpecQueryServiceImpl specQueryService = new SpecQueryServiceImpl();
IRODSServices irodsService = Mockito.mock(IRODSServices.class);
AdminServices adminServices = Mockito.mock(AdminServices.class);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
EnvironmentalInfoAO environmentalInfoAO = irodsFileSystem.getIRODSAccessObjectFactory().getEnvironmentalInfoAO(irodsAccount);
SpecificQueryAO specificQueryAO = irodsFileSystem.getIRODSAccessObjectFactory().getSpecificQueryAO(irodsAccount);
Mockito.when(irodsService.getEnvironmentalInfoAO()).thenReturn(environmentalInfoAO);
Mockito.when(adminServices.getSpecificQueryAO()).thenReturn(specificQueryAO);
specQueryService.setIrodsServices(irodsService);
specQueryService.setAdminServices(adminServices);
List<DataGridMetadataSearch> metadataSearch = new ArrayList<DataGridMetadataSearch>();
DataGridMetadataSearch search = new DataGridMetadataSearch(DATA_AVU_ATTR1, DATA_AVU_VAL1, "", DataGridSearchOperatorEnum.EQUAL);
metadataSearch.add(search);
SpecificQueryResultSet result = specQueryService.searchByMetadata(metadataSearch, irodsAccount.getZone(), false, null, 0, 0);
Assert.assertFalse("no result", result.getResults().isEmpty());
}
use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.
the class SpecQueryServiceImplTest method testSearchByFilePropertiesForDataObjects.
@Test
public void testSearchByFilePropertiesForDataObjects() throws Exception {
SpecQueryServiceImpl specQueryService = new SpecQueryServiceImpl();
IRODSServices irodsService = Mockito.mock(IRODSServices.class);
AdminServices adminServices = Mockito.mock(AdminServices.class);
IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
IRODSAccount test3Account = testingPropertiesHelper.buildIRODSAccountFromSecondaryTestProperties(testingProperties);
EnvironmentalInfoAO environmentalInfoAO = irodsFileSystem.getIRODSAccessObjectFactory().getEnvironmentalInfoAO(irodsAccount);
SpecificQueryAO specificQueryAO = irodsFileSystem.getIRODSAccessObjectFactory().getSpecificQueryAO(irodsAccount);
Mockito.when(irodsService.getEnvironmentalInfoAO()).thenReturn(environmentalInfoAO);
Mockito.when(adminServices.getSpecificQueryAO()).thenReturn(specificQueryAO);
specQueryService.setIrodsServices(irodsService);
specQueryService.setAdminServices(adminServices);
List<DataGridFilePropertySearch> filePropertiesSearch = new ArrayList<>();
DataGridFilePropertySearch dataSearch = new DataGridFilePropertySearch(FilePropertyField.OWNER_NAME, DataGridSearchOperatorEnum.EQUAL, // use test3 because its smaller
test3Account.getUserName());
filePropertiesSearch.add(dataSearch);
dataSearch = new DataGridFilePropertySearch(FilePropertyField.SIZE, DataGridSearchOperatorEnum.BIGGER_THAN, "200");
filePropertiesSearch.add(dataSearch);
SpecificQueryResultSet result = specQueryService.searchByFileProperties(filePropertiesSearch, irodsAccount.getZone(), false, null, 0, 0);
Assert.assertNotNull("no result", result.getResults());
}
Aggregations