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

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


       
        AsynchDroid droidCore = mock(AsynchDroid.class);
        handler.setDroidCore(droidCore);
       
        IdentificationRequest originalRequest = mock(IdentificationRequest.class);
        RequestIdentifier identifier = new RequestIdentifier(jarFile.toURI());
        identifier.setAncestorId(10L);
        //identifier.setParentId(20L);
        identifier.setNodeId(20L);
       
        when(originalRequest.getIdentifier()).thenReturn(identifier);
        when(originalRequest.getSourceInputStream()).thenReturn(new FileInputStream(jarFile));
        handler.handle(originalRequest);
       
View Full Code Here


       
        RequestMetaData metaData = mock(RequestMetaData.class);
        IdentificationRequest request = mock(IdentificationRequest.class);
        when(request.getSourceInputStream()).thenReturn(word97Stream);
        when(request.getRequestMetaData()).thenReturn(metaData);
        RequestIdentifier requestIdentifier = mock(RequestIdentifier.class);
        when(request.getIdentifier()).thenReturn(requestIdentifier);
       
        IdentificationResultCollection results = ole2Identifier.submit(request);
       
        assertEquals("fmt/666", results.getResults().iterator().next().getPuid());
View Full Code Here

       
        RequestMetaData metaData = mock(RequestMetaData.class);
        IdentificationRequest request = mock(IdentificationRequest.class);
        when(request.getSourceInputStream()).thenReturn(word97Stream);
        when(request.getRequestMetaData()).thenReturn(metaData);
        RequestIdentifier requestIdentifier = mock(RequestIdentifier.class);
        when(request.getIdentifier()).thenReturn(requestIdentifier);
       
        IdentificationRequestFactory requestFactory = mock(IdentificationRequestFactory.class);
        when(requestFactory.newRequest(null, null))
            .thenReturn(request);
View Full Code Here

       
        RequestMetaData metaData = mock(RequestMetaData.class);
        IdentificationRequest request = mock(IdentificationRequest.class);
        when(request.getSourceInputStream()).thenReturn(word97Stream);
        when(request.getRequestMetaData()).thenReturn(metaData);
        RequestIdentifier requestIdentifier = mock(RequestIdentifier.class);
        when(request.getIdentifier()).thenReturn(requestIdentifier);
       
        IdentificationRequestFactory requestFactory = mock(IdentificationRequestFactory.class);
        when(requestFactory.newRequest(null, null)).thenReturn(request);
//        ole2Identifier.setRequestFactory(requestFactory);
View Full Code Here

       
        RequestMetaData metaData = mock(RequestMetaData.class);
        IdentificationRequest request = mock(IdentificationRequest.class);
        when(request.getSourceInputStream()).thenReturn(odfTextStream);
        when(request.getRequestMetaData()).thenReturn(metaData);
        RequestIdentifier requestIdentifier = mock(RequestIdentifier.class);
        when(request.getIdentifier()).thenReturn(requestIdentifier);
       
        IdentificationResultCollection results = odfIdentifier.submit(request);
       
        assertEquals("fmt/667", results.getResults().iterator().next().getPuid());
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public void handleError(IdentificationException e) {
        final IdentificationRequest request = e.getRequest();
        final RequestIdentifier identifier = request.getIdentifier();
        URI uri = identifier.getUri();
        //log.debug(String.format("handling error for job [%s]", uri));
       
        final Long nodeId = identifier.getNodeId();
        ProfileResourceNode node;
        if (nodeId != null) {
            node = loadNode(nodeId);
            node.getMetaData().setNodeStatus(NodeStatus.ERROR);
            // Need to initialise the collection eagerly...
            node.getFormatIdentifications().size();
        } else {
            node = new ProfileResourceNode(uri);
            node.setFinished(new Date());
            final NodeMetaData metaData = node.getMetaData();
           
            metaData.setNodeStatus(getNodeStatus(e.getErrorType()));
            metaData.setResourceType(ResourceType.FILE);
            node.setNoFormatsIdentified();
           
            RequestMetaData requestMetaData = request.getRequestMetaData();
           
            metaData.setName(requestMetaData.getName());
            metaData.setSize(requestMetaData.getSize());
            metaData.setExtension(request.getExtension());
            metaData.setLastModified(request.getRequestMetaData().getTime());
            metaData.setHash(requestMetaData.getHash());
           
            node.addFormatIdentification(Format.NULL);
            setNodeIds(node, identifier.getParentResourceId());
        }
        batchNode(node);
        progressMonitor.stopJob(node);
    }
View Full Code Here

            entryName = entry.getName();
            if ("saved/profile.xml".equals(entryName)) {
                size = entry.getSize();
                modTime = entry.getModTime();
                metaData = new RequestMetaData(modTime.getTime(), size, "profile.xml");
                identifier = new RequestIdentifier(ArchiveFileUtils.toTarUri(new File(fileName).toURI(), entryName));
                break;
            }
        }
        tarResource = new TarEntryIdentificationRequest(metaData, identifier, 3, 5, tmpDir);
        tarResource.open(in);
View Full Code Here

        File file = new File(gZipFile);
        if (!file.exists()) {
            fail("GZIP test file not found");
        }
        URI uri = file.toURI();
        RequestIdentifier identifier = new RequestIdentifier(uri);
        identifier.setParentId(1L);
        try {
            fileName = file.getCanonicalPath();
            RequestMetaData metaData =
                new RequestMetaData(file.length(), file.lastModified(), fileName);
            FileSystemIdentificationRequest request =
View Full Code Here

        File file = new File(tarFile);
        if (!file.exists()) {
            fail("TAR test file not found");
        }
        URI uri = file.toURI();
        RequestIdentifier identifier = new RequestIdentifier(uri);
        identifier.setParentId(1L);
        try {
            fileName = file.getCanonicalPath();
            RequestMetaData metaData =
                new RequestMetaData(file.length(), file.lastModified(), fileName);
            FileSystemIdentificationRequest request =
View Full Code Here

        File file = new File(zipFile);
        if (!file.exists()) {
            fail("ZIP test file not found");
        }
        URI uri = file.toURI();
        RequestIdentifier identifier = new RequestIdentifier(uri);
        identifier.setParentId(1L);
        try {
            fileName = file.getCanonicalPath();
            RequestMetaData metaData =
                new RequestMetaData(file.length(), file.lastModified(), fileName);
            FileSystemIdentificationRequest request =
View Full Code Here

TOP

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

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.