use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class MetadataServiceImpl method copyMetadata.
@Override
public boolean copyMetadata(String srcPath, String dstPath) throws DataGridConnectionRefusedException {
if (srcPath == null || srcPath.isEmpty() || dstPath == null || dstPath.isEmpty())
return false;
logger.info("Copying metadata from {} to {}", srcPath, dstPath);
boolean isMetadataCopied = true;
for (DataGridMetadata metadata : findMetadataValuesByPath(srcPath)) {
isMetadataCopied &= addMetadataToPath(dstPath, metadata);
}
return isMetadataCopied;
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddDataGridMetadataListToObjs method setUp.
@Before
public void setUp() throws DataGridException {
parentPath = String.format("/%s/home/%s", zone, username);
path = String.format("%s/test-metadata-transfer", parentPath);
fos.deleteCollection(path, true);
cs.createCollection(new DataGridCollectionAndDataObject(path, parentPath, true));
expectedMetadataList = new ArrayList<>();
expectedMetadataList.add(new DataGridMetadata("attr1", "val1", "unit1"));
expectedMetadataList.add(new DataGridMetadata("attr2", "val2", "unit2"));
expectedMetadataList.add(new DataGridMetadata("attr3", "val3", "unit3"));
MockMultipartFile file;
for (int i = 0; i < NUMBER_OF_FILES; i++) {
String filename = BASE_FILE_NAME + i;
String filepath = String.format("%s/%s", path, filename);
file = new MockMultipartFile(filename, "Hello World Transfer".getBytes());
us.upload(file, path, false, false, "", RESOURCE, false);
metadataService.addMetadataToPath(filepath, expectedMetadataList);
}
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddDataGridMetadataToObjs method setUp.
@Before
public void setUp() throws DataGridException {
parentPath = String.format("/%s/home/%s", zone, username);
path = String.format("%s/test-metadata-transfer", parentPath);
fos.deleteCollection(path, true);
cs.createCollection(new DataGridCollectionAndDataObject(path, parentPath, true));
expectedMetadataList = MetadataUtils.createRandomMetadata(NUMBER_OF_METADATA_TAGS);
MockMultipartFile file;
for (int i = 0; i < NUMBER_OF_FILES; i++) {
String filename = BASE_FILE_NAME + i;
String filepath = String.format("%s/%s", path, filename);
file = new MockMultipartFile(filename, "Hello World Transfer".getBytes());
us.upload(file, path, false, false, "", RESOURCE, false);
for (DataGridMetadata metadata : expectedMetadataList) {
metadataService.addMetadataToPath(filepath, metadata);
}
}
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestAddMetadataToObjs method assertMetadataInPath.
private void assertMetadataInPath(String path) throws DataGridConnectionRefusedException {
List<DataGridMetadata> actualMetadataList = metadataService.findMetadataValuesByPath(path);
Assert.assertEquals(expectedMetadataList.size(), actualMetadataList.size());
for (DataGridMetadata m : actualMetadataList) {
String metadataStr = m.getAttribute() + " " + m.getValue() + " " + m.getUnit();
assertTrue(expectedMetadataList.contains(metadataStr));
}
}
use of com.emc.metalnx.core.domain.entity.DataGridMetadata in project metalnx-web by irods-contrib.
the class TestCopyCollWithMetadata method assertMetadataInPath.
private void assertMetadataInPath(String path) throws DataGridConnectionRefusedException {
List<DataGridMetadata> actualMetadataList = metadataService.findMetadataValuesByPath(path);
assertEquals(expectedMetadataList.size(), actualMetadataList.size());
for (DataGridMetadata m : actualMetadataList) {
String metadataStr = m.getAttribute() + " " + m.getValue() + " " + m.getUnit();
assertTrue(expectedMetadataList.contains(metadataStr));
}
}
Aggregations