Search in sources :

Example 1 with IRODSServices

use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.

the class SpecQueryServiceImplTest method testCountCollectionsMatchingMetadata.

@Test
public void testCountCollectionsMatchingMetadata() 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(COLL_AVU_ATTR1, COLL_AVU_VAL1, "", DataGridSearchOperatorEnum.EQUAL);
    metadataSearch.add(search);
    int count = specQueryService.countCollectionsMatchingMetadata(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 2 with IRODSServices

use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.

the class SpecQueryServiceImplTest method testSearchByFilePropertiesForCollections.

@Test
public void testSearchByFilePropertiesForCollections() 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, test3Account.getUserName());
    filePropertiesSearch.add(dataSearch);
    SpecificQueryResultSet result = specQueryService.searchByFileProperties(filePropertiesSearch, irodsAccount.getZone(), true, 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) 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)

Example 3 with IRODSServices

use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.

the class SpecQueryServiceImplTest method testCountCollectionsMatchingFileProperties.

@Test
public void testCountCollectionsMatchingFileProperties() 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<DataGridFilePropertySearch> filePropertiesSearch = new ArrayList<>();
    DataGridFilePropertySearch dataSearch = new DataGridFilePropertySearch(FilePropertyField.OWNER_NAME, DataGridSearchOperatorEnum.EQUAL, irodsAccount.getUserName());
    filePropertiesSearch.add(dataSearch);
    int count = specQueryService.countCollectionsMatchingFileProperties(filePropertiesSearch, 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) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataGridFilePropertySearch(com.emc.metalnx.core.domain.entity.DataGridFilePropertySearch) ArrayList(java.util.ArrayList) IRODSServices(com.emc.metalnx.services.interfaces.IRODSServices) SpecificQueryAO(org.irods.jargon.core.pub.SpecificQueryAO) Test(org.junit.Test)

Example 4 with IRODSServices

use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.

the class SpecQueryServiceImplTest method testSearchByMetadataCollections.

@Test
public void testSearchByMetadataCollections() 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(COLL_AVU_ATTR1, COLL_AVU_VAL1, "", DataGridSearchOperatorEnum.EQUAL);
    metadataSearch.add(search);
    SpecificQueryResultSet result = specQueryService.searchByMetadata(metadataSearch, irodsAccount.getZone(), true, 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 5 with IRODSServices

use of com.emc.metalnx.services.interfaces.IRODSServices in project metalnx-web by irods-contrib.

the class SpecQueryServiceImplTest method testCountDataObjectsMatchingFileProperties.

@Test
public void testCountDataObjectsMatchingFileProperties() 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<DataGridFilePropertySearch> filePropertiesSearch = new ArrayList<>();
    DataGridFilePropertySearch dataSearch = new DataGridFilePropertySearch(FilePropertyField.OWNER_NAME, DataGridSearchOperatorEnum.EQUAL, irodsAccount.getUserName());
    filePropertiesSearch.add(dataSearch);
    dataSearch = new DataGridFilePropertySearch(FilePropertyField.SIZE, DataGridSearchOperatorEnum.BIGGER_THAN, "200");
    filePropertiesSearch.add(dataSearch);
    int count = specQueryService.countDataObjectsMatchingFileProperties(filePropertiesSearch, 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) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataGridFilePropertySearch(com.emc.metalnx.core.domain.entity.DataGridFilePropertySearch) ArrayList(java.util.ArrayList) 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