Search in sources :

Example 6 with IRODSServices

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);
}
Also used : EnvironmentalInfoAO(org.irods.jargon.core.pub.EnvironmentalInfoAO) AdminServices(com.emc.metalnx.services.interfaces.AdminServices) DataGridMetadataSearch(com.emc.metalnx.core.domain.entity.DataGridMetadataSearch) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) ArrayList(java.util.ArrayList) IRODSServices(com.emc.metalnx.services.interfaces.IRODSServices) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) Test(org.junit.Test)

Example 7 with IRODSServices

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);
}
Also used : EnvironmentalInfoAO(org.irods.jargon.core.pub.EnvironmentalInfoAO) CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) AdminServices(com.emc.metalnx.services.interfaces.AdminServices) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) IRODSServices(com.emc.metalnx.services.interfaces.IRODSServices) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) Test(org.junit.Test)

Example 8 with IRODSServices

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());
}
Also used : EnvironmentalInfoAO(org.irods.jargon.core.pub.EnvironmentalInfoAO) AdminServices(com.emc.metalnx.services.interfaces.AdminServices) DataGridMetadataSearch(com.emc.metalnx.core.domain.entity.DataGridMetadataSearch) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) ArrayList(java.util.ArrayList) SpecificQueryResultSet(org.irods.jargon.core.query.SpecificQueryResultSet) IRODSServices(com.emc.metalnx.services.interfaces.IRODSServices) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) Test(org.junit.Test)

Example 9 with IRODSServices

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());
}
Also used : EnvironmentalInfoAO(org.irods.jargon.core.pub.EnvironmentalInfoAO) AdminServices(com.emc.metalnx.services.interfaces.AdminServices) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataGridFilePropertySearch(com.emc.metalnx.core.domain.entity.DataGridFilePropertySearch) ArrayList(java.util.ArrayList) SpecificQueryResultSet(org.irods.jargon.core.query.SpecificQueryResultSet) IRODSServices(com.emc.metalnx.services.interfaces.IRODSServices) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) Test(org.junit.Test)

Aggregations

AdminServices (com.emc.metalnx.services.interfaces.AdminServices)9 IRODSServices (com.emc.metalnx.services.interfaces.IRODSServices)9 IRODSAccount (org.irods.jargon.core.connection.IRODSAccount)9 EnvironmentalInfoAO (org.irods.jargon.core.pub.EnvironmentalInfoAO)9 SpecificQueryAO (org.irods.jargon.core.pub.SpecificQueryAO)9 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)8 DataGridFilePropertySearch (com.emc.metalnx.core.domain.entity.DataGridFilePropertySearch)4 DataGridMetadataSearch (com.emc.metalnx.core.domain.entity.DataGridMetadataSearch)4 SpecificQueryResultSet (org.irods.jargon.core.query.SpecificQueryResultSet)4 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)1 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)1