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;
}
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);
}
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);
}
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));
}
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);
}
Aggregations