Search in sources :

Example 51 with DataGridCollectionAndDataObject

use of com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject in project metalnx-web by irods-contrib.

the class DataGridUtils method mapListingEntryToDataGridCollectionAndDataObject.

/**
 * Maps a CollectionAndDataObjectListingEntry object into a DataGridCollectionAndDataObject
 * object
 *
 * @param entry
 *            CollectionAndDataObjectListingEntry object to map into DataGridCollectionAndDataObject
 * @return instance of DataGridCollectionAndDataObject
 */
public static DataGridCollectionAndDataObject mapListingEntryToDataGridCollectionAndDataObject(CollectionAndDataObjectListingEntry entry) {
    logger.debug("Mapping a CollectionAndDataObjectListingEntry into a " + "DataGridCollectionAndDataObject");
    String entryPath = "";
    if (entry.isCollection()) {
        entryPath = entry.getPathOrName();
    } else {
        entryPath = entry.getParentPath() + "/" + entry.getPathOrName();
    }
    String nodeLabelDisplayValue = entry.getNodeLabelDisplayValue();
    String entryName = nodeLabelDisplayValue == null || nodeLabelDisplayValue.isEmpty() ? entryPath : nodeLabelDisplayValue;
    DataGridCollectionAndDataObject dataGridCollectionAndDataObject = new DataGridCollectionAndDataObject(entryPath, entryName, entry.getParentPath(), entry.isCollection());
    dataGridCollectionAndDataObject.setCreatedAt(entry.getCreatedAt());
    dataGridCollectionAndDataObject.setModifiedAt(entry.getModifiedAt());
    dataGridCollectionAndDataObject.setOwner(entry.getOwnerName());
    dataGridCollectionAndDataObject.setDisplaySize(entry.getDisplayDataSize());
    dataGridCollectionAndDataObject.setSize(entry.getDataSize());
    return dataGridCollectionAndDataObject;
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Example 52 with DataGridCollectionAndDataObject

use of com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject in project metalnx-web by irods-contrib.

the class CollectionServiceImplTest method testFindByNameForZoneHome.

@Test
public /**
 * Tests NIEHS bug 500 errors browsing to home or zone #2
 *
 * @throws Exception
 */
void testFindByNameForZoneHome() throws Exception {
    IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties);
    IRODSServicesImpl irodsServices = new IRODSServicesImpl();
    irodsServices.setIrodsAccount(irodsAccount);
    irodsServices.irodsAccessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory();
    CollectionServiceImpl collectionService = new CollectionServiceImpl();
    collectionService.irodsServices = irodsServices;
    StringBuilder sb = new StringBuilder();
    sb.append('/');
    sb.append(irodsAccount.getZone());
    sb.append("/home");
    DataGridCollectionAndDataObject actual = collectionService.findByName(sb.toString());
    Assert.assertNotNull("no recs returned", actual);
}
Also used : IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Test(org.junit.Test)

Example 53 with DataGridCollectionAndDataObject

use of com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject in project metalnx-web by irods-contrib.

the class RuleDeploymentServiceImpl method createRuleCache.

@Override
public void createRuleCache() throws DataGridException {
    String parentPath = String.format("/%s", configService.getIrodsZone());
    DataGridCollectionAndDataObject ruleCacheDir = new DataGridCollectionAndDataObject(getRuleCachePath(), parentPath, true);
    collectionService.createCollection(ruleCacheDir);
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Example 54 with DataGridCollectionAndDataObject

use of com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject in project metalnx-web by irods-contrib.

the class TestMostRestrictivePermission method setUp.

@Before
public void setUp() throws DataGridException {
    parentPath = String.format("/%s/home/%s", zone, username);
    targetPath = String.format("%s/test-perm-%d", parentPath, System.currentTimeMillis());
    fos.deleteCollection(targetPath, true);
    cs.createCollection(new DataGridCollectionAndDataObject(targetPath, parentPath, true));
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Before(org.junit.Before)

Example 55 with DataGridCollectionAndDataObject

use of com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject in project metalnx-web by irods-contrib.

the class TestRuleDeploymentService method testDeployRule.

@Test
public void testDeployRule() throws DataGridException {
    ArgumentCaptor<String> argCaptor = ArgumentCaptor.forClass(String.class);
    ruleDeploymentService.deployRule(file);
    verify(ruleService).execDeploymentRule(argCaptor.capture(), argCaptor.capture(), argCaptor.capture());
    assertFalse(argCaptor.getAllValues().get(1).endsWith(RULE_FILE_EXTENSION));
    List<DataGridCollectionAndDataObject> items = collectionService.getSubCollectionsAndDataObjetsUnderPath(ruleCachePath);
    boolean ruleInCache = false;
    for (DataGridCollectionAndDataObject item : items) {
        if (TEST_RULE_NAME.equals(item.getName())) {
            ruleInCache = true;
            break;
        }
    }
    assertTrue(ruleInCache);
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)55 JargonException (org.irods.jargon.core.exception.JargonException)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 Before (org.junit.Before)11 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)9 FileNotFoundException (org.irods.jargon.core.exception.FileNotFoundException)9 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)7 ArrayList (java.util.ArrayList)7 CollectionAndDataObjectListingEntry (org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)7 DataGridPageContext (com.emc.metalnx.core.domain.entity.DataGridPageContext)6 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)6 DataGridMetadata (com.emc.metalnx.core.domain.entity.DataGridMetadata)5 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)5 Date (java.util.Date)4 HashMap (java.util.HashMap)4 JargonQueryException (org.irods.jargon.core.query.JargonQueryException)4 DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)3 UnsupportedDataGridFeatureException (com.emc.metalnx.core.domain.exceptions.UnsupportedDataGridFeatureException)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3