Search in sources :

Example 31 with DataGridCollectionAndDataObject

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

the class TestAddMetadataToColls 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.createRandomMetadataAsString(NUMBER_OF_METADATA_TAGS);
    for (int i = 0; i < NUMBER_OF_COLLS; i++) {
        String collname = BASE_COLL_NAME + i;
        String collPath = String.format("%s/%s", path, collname);
        cs.createCollection(new DataGridCollectionAndDataObject(collPath, path, true));
        for (String metadataStr : expectedMetadataList) {
            String[] metadata = metadataStr.split(" ");
            String attr = metadata[0], val = metadata[1], unit = metadata[2];
            metadataService.addMetadataToPath(collPath, attr, val, unit);
        }
    }
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Before(org.junit.Before)

Example 32 with DataGridCollectionAndDataObject

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

the class TestCopyCollWithMetadata method setUp.

@Before
public void setUp() throws DataGridException {
    parentPath = String.format("/%s/home/%s", zone, username);
    srcPath = String.format("%s/test-metadata-transfer", parentPath);
    dstPath = String.format("%s/dst-test-metadata-transfer", parentPath);
    fos.deleteCollection(srcPath, true);
    fos.deleteCollection(dstPath, true);
    cs.createCollection(new DataGridCollectionAndDataObject(srcPath, parentPath, true));
    cs.createCollection(new DataGridCollectionAndDataObject(dstPath, parentPath, true));
    expectedMetadataList = new ArrayList<>();
    expectedMetadataList.add("attr1 val1 unit1");
    expectedMetadataList.add("attr2 val2 unit2");
    expectedMetadataList.add("attr3 val3 unit3");
    for (int i = 0; i < NUMBER_OF_COLLS; i++) {
        String collname = BASE_COLL_NAME + i;
        String collSrcPath = String.format("%s/%s", srcPath, collname);
        cs.createCollection(new DataGridCollectionAndDataObject(collSrcPath, srcPath, true));
        for (String s : expectedMetadataList) {
            String[] metadata = s.split(" ");
            String attr = metadata[0], val = metadata[1], unit = metadata[2];
            metadataService.addMetadataToPath(collSrcPath, attr, val, unit);
        }
    }
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Before(org.junit.Before)

Example 33 with DataGridCollectionAndDataObject

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

the class TestMetadataCase method assertMetadataSearch.

private void assertMetadataSearch(int expectedNumOfFiles, int expectedNumOfMatchesByFile) throws DataGridConnectionRefusedException {
    objs = metadataService.findByMetadata(search, new DataGridPageContext(), 1, 100);
    assertTrue(objs.size() >= expectedNumOfFiles);
    for (DataGridCollectionAndDataObject obj : objs) {
        assertTrue(obj.isVisibleToCurrentUser());
        assertFalse(obj.isCollection());
        assertEquals(expectedNumOfMatchesByFile, obj.getNumberOfMatches());
    }
}
Also used : DataGridPageContext(com.emc.metalnx.core.domain.entity.DataGridPageContext) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Example 34 with DataGridCollectionAndDataObject

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

the class TestMetadataCase method setUp.

@Before
public void setUp() throws DataGridException {
    parentPath = String.format("/%s/home/%s", zone, username);
    targetPath = String.format("%s/test-metadata-search", parentPath);
    fos.deleteCollection(targetPath, true);
    cs.createCollection(new DataGridCollectionAndDataObject(targetPath, parentPath, true));
    for (int i = 0; i < NUMBER_OF_FILES; i++) {
        String filename = BASE_FILE_NAME + i + ".txt";
        MockMultipartFile file = new MockMultipartFile(filename, "Hello World".getBytes());
        us.upload(file, targetPath, false, false, "", RESOURCE, false);
        String filepath = String.format("%s/%s", targetPath, filename);
        metadataService.addMetadataToPath(filepath, "TEST", "TEST", "TEST");
        metadataService.addMetadataToPath(filepath, "test", "test", "test");
        metadataService.addMetadataToPath(filepath, "TeSt", "tEsT", "teST");
    }
    attr = "test";
    val = "TEST";
    unit = "TEst";
    search = new ArrayList<>();
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) Before(org.junit.Before)

Example 35 with DataGridCollectionAndDataObject

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

the class TestReadPermissionOnFiles method setUp.

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

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