Package uk.gov.nationalarchives.droid.core.interfaces

Examples of uk.gov.nationalarchives.droid.core.interfaces.ResourceId


        final File file = new File("tmp/fictional");
        URI uri = file.toURI();
       
        directoryEventHandler.setResultHandler(resultHandler);
       
        ResourceId id = new ResourceId(123L, "");
       
        directoryEventHandler.onEvent(file, id, 1, true);
       
        ArgumentCaptor<IdentificationResult> captor = ArgumentCaptor.forClass(IdentificationResult.class);
        verify(resultHandler).handleDirectory(captor.capture(), eq(id), eq(true));
View Full Code Here


        when(dir.toURI()).thenReturn(uri);
        when(dir.length()).thenReturn(length);
        when(dir.getName()).thenReturn("my-dir");
        when(dir.getAbsolutePath()).thenReturn("c:/my-dir");
       
        ResourceId id = new ResourceId(1L, "");
       
        directoryEventHandler.setResultHandler(resultHandler);
        directoryEventHandler.onEvent(dir, id, 1, false);
       
        ArgumentCaptor<IdentificationResult> resultCaptor = ArgumentCaptor.forClass(IdentificationResult.class);
View Full Code Here

        when(dir.toURI()).thenReturn(uri);
        when(dir.length()).thenReturn(length);
        when(dir.getName()).thenReturn("my-dir");
        when(dir.getAbsolutePath()).thenReturn("c:/my-dir");
       
        ResourceId id = new ResourceId(1L, "");
       
        directoryEventHandler.setResultHandler(resultHandler);
        directoryEventHandler.onEvent(dir, id, 0, false);
       
        ArgumentCaptor<IdentificationResult> resultCaptor = ArgumentCaptor.forClass(IdentificationResult.class);
View Full Code Here

        metaData.setNodeStatus(NodeStatus.DONE);

        node.setMetaData(metaData);
        node.setExtensionMismatch(results.getExtensionMismatch());
        node.setFinished(new Date());
        ResourceId parentId = results.getCorrelationId();
        resultHandlerDao.save(node, parentId);
        if (results.getResults().isEmpty()) {
            node.addFormatIdentification(Format.NULL);
            node.setZeroIdentifications();
        } else {
            for (IdentificationResult result : results.getResults()) {
                node.getMetaData().setIdentificationMethod(result.getMethod());
                //log.debug(String.format("Handling ID puid[%s]; uri[%s]", result.getPuid(), results.getUri()));
                Format format = resultHandlerDao.loadFormat(result.getPuid());
                node.addFormatIdentification(format);
            }
        }
       
        progressMonitor.stopJob(node);
        return new ResourceId(node.getId(), node.getPrefix());
    }
View Full Code Here

        node.setFinished(new Date());

        node.addFormatIdentification(Format.NULL);

        progressMonitor.stopJob(node);
        return new ResourceId(node.getId(), node.getPrefix());
    }
View Full Code Here

        ProfileResourceNode node = mock(ProfileResourceNode.class);
        when(node.getUri()).thenReturn(uri);
       
        ArgumentCaptor<IdentificationRequest> requestCaptor = ArgumentCaptor.forClass(IdentificationRequest.class);

        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
        verify(identificationEngine).submit(requestCaptor.capture());
    }
View Full Code Here

       
        SubmissionThrottle throttle = mock(SubmissionThrottle.class);
        fileEventHandler.setSubmissionThrottle(throttle);
       
        File file = new File("test_sig_files/DROID 5  Architecture.doc");
        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
        verify(throttle).apply();
    }
View Full Code Here

        fileEventHandler.setResultHandler(resultHandler);
       
        SubmissionThrottle throttle = mock(SubmissionThrottle.class);
        fileEventHandler.setSubmissionThrottle(throttle);

        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
        ArgumentCaptor<IdentificationException> exCaptor = ArgumentCaptor.forClass(IdentificationException.class);
        verify(resultHandler).handleError(exCaptor.capture());
       
        final IdentificationException thrown = exCaptor.getValue();
View Full Code Here

         * @param prefixPath the path of
         */
        private ResourceId processAncestorFolders(String path) {
            // Split the path string into a list of ancestor paths:
            List<String> paths = ArchiveFileUtils.getAncestorPaths(path);
            ResourceId longestParentId = parentId;
           
            // Find the longest path we *have* seen before (if any):
            // (ancestor paths are ordered longest first)
            int longestSeenBefore = paths.size();
            ResourceId correlationId = null;
            for (int pathIndex = 0; pathIndex < paths.size(); pathIndex++) {
                correlationId = directories.get(paths.get(pathIndex));
                if (correlationId != null) {
                    longestSeenBefore = pathIndex;
                    longestParentId = correlationId;
View Full Code Here

       
        @Override
        protected void handleEntry(ZipEntry entry) throws IOException {
            String entryName = entry.getName();
            final String prefixPath = FilenameUtils.getPath(entryName);
            ResourceId correlationId = parentId; // by default, files are correlated to the parent.

            // If there is a path, get the actual correlation id for its parent folder:
            if (!prefixPath.isEmpty()) {
                correlationId = directories.get(prefixPath);
                // If we haven't seen the path before, add the ancestor folders not yet seen:
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.core.interfaces.ResourceId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.