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

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


        RequestMetaData metaData = new RequestMetaData(
                size != -1 ? size : null,
                time != -1 ? time : null,
                entryName);
       
        RequestIdentifier identifier = new RequestIdentifier(
                ArchiveFileUtils.toTarUri(parentName, entry.getName()));
       
        result.setRequestMetaData(metaData);
        result.setIdentifier(identifier);
        return resultHandler.handleDirectory(result, correlationId, false);
View Full Code Here


        if (queueData != null) {
            // de-duplicate any resources with the same ancestor ID
            Set<Long> ancestorIds = new HashSet<Long>();
            List<RequestIdentifier> identifiers = queueData.getReplayUris();
            for (Iterator<RequestIdentifier> it = identifiers.iterator(); it.hasNext();) {
                RequestIdentifier identifier = it.next();
                ancestorIds.add(identifier.getAncestorId());
            }
           
            // Delete and re-submit all the distinct nodes as new requests
            for (Long ancestorId : ancestorIds) {
                ProfileResourceNode node = resultHandlerDao.loadNode(ancestorId);
View Full Code Here

        URI uri = file.toURI();
        RequestMetaData metaData = new RequestMetaData(file.length(), file
                .lastModified(), file.getName());

        RequestIdentifier identifier = new RequestIdentifier(uri);
        identifier.setParentResourceId(parentId);
        identifier.setResourceId(nodeId);
       
        IdentificationRequest request = requestFactory.newRequest(metaData, identifier);
        try {
            FileInputStream in = new FileInputStream(file);
            try {
View Full Code Here

        RequestMetaData metaData = new RequestMetaData(
                dir.length(),
                dir.lastModified(),
                depth == 0 ? dir.getAbsolutePath() : dir.getName());
       
        RequestIdentifier identifier = new RequestIdentifier(dir.toURI());
        identifier.setParentResourceId(parentId);
        result.setRequestMetaData(metaData);
        result.setIdentifier(identifier);
        return resultHandler.handleDirectory(result, parentId, restricted);
    }
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 = ooXmlIdentifier.submit(request);
       
        assertEquals("fmt/666", results.getResults().iterator().next().getPuid());
View Full Code Here

       
        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(30L);
       
        when(originalRequest.getIdentifier()).thenReturn(identifier);
        when(originalRequest.getSourceInputStream()).thenReturn(new FileInputStream(jarFile));
        handler.handle(originalRequest);
       
View Full Code Here

        File multipartFile = new File(multipartZip);
       
       
        ZipArchiveHandler handler = new ZipArchiveHandler();
        IdentificationRequest originalRequest = mock(IdentificationRequest.class);
        RequestIdentifier identifier = new RequestIdentifier(multipartFile.toURI());
        identifier.setAncestorId(1L);
        identifier.setParentId(10L);
        identifier.setNodeId(30L);
       
        when(originalRequest.getIdentifier()).thenReturn(identifier);
       
       
//        when(originalRequest.getOriginatorNodeId()).thenReturn(10L);
View Full Code Here

        when(in.read()).thenReturn(-1);
        when(in.read(any(byte[].class))).thenReturn(-1);
        when(in.read(any(byte[].class), anyInt(), anyInt())).thenReturn(-1);
        when(in.skip(anyLong())).thenReturn(-1L);
       
        RequestIdentifier identifier = new RequestIdentifier(zipUri);
       
        IdentificationRequest request = factory.newRequest(metaData, identifier);
        assertTrue(request instanceof ZipEntryIdentificationRequest);
       
        assertEquals("fu.bah", request.getFileName());
View Full Code Here

        IdentificationRequestFactory factory = mock(IdentificationRequestFactory.class);
       
       
        URI expectedUri = ArchiveFileUtils.toGZipUri(file.toURI());
       
        RequestIdentifier identifier = new RequestIdentifier(file.toURI());
        identifier.setAncestorId(10L);
        identifier.setParentId(20L);
        identifier.setNodeId(30L);

        RequestIdentifier expectedIdentifier = new RequestIdentifier(expectedUri);
        expectedIdentifier.setAncestorId(10L);
        expectedIdentifier.setParentId(30L);

        when(factory.newRequest(any(RequestMetaData.class), eq(expectedIdentifier)))
            .thenReturn(request);

        AsynchDroid droidCore = mock(AsynchDroid.class);
View Full Code Here

        while ((entry = tarIn.getNextEntry()) != null) {
            URI expectedUri = ArchiveFileUtils.toTarUri(file.toURI(), entry.getName());
            IdentificationRequest mockRequest = mock(IdentificationRequest.class);
            when(mockRequest.toString()).thenReturn(expectedUri.toString());
           
            RequestIdentifier expectedIdentifier = new RequestIdentifier(expectedUri);
            expectedIdentifier.setParentResourceId(expectedParentId);
            expectedIdentifier.setAncestorId(10L);

            when(mockRequest.getIdentifier()).thenReturn(expectedIdentifier);
            mockRequests.add(mockRequest);
            when(factory.newRequest(any(RequestMetaData.class), eq(expectedIdentifier)))
                .thenReturn(mockRequests.get(count));
            count++;
        }
       
        AsynchDroid droidCore = mock(AsynchDroid.class);

        TarArchiveHandler handler = new TarArchiveHandler();
        handler.setFactory(factory);
        handler.setDroidCore(droidCore);
       
        ResultHandler resultHandler = mock(ResultHandler.class);
        when(resultHandler.handleDirectory(any(IdentificationResult.class),
                any(ResourceId.class), anyBoolean())).thenReturn(expectedParentId);
        handler.setResultHandler(resultHandler);
       
        IdentificationRequest originalRequest = mock(IdentificationRequest.class);
        RequestIdentifier originalIdentifier = new RequestIdentifier(file.toURI());
        originalIdentifier.setAncestorId(10L);
        originalIdentifier.setParentId(20L);
        originalIdentifier.setNodeId(30L);
       
        when(originalRequest.getIdentifier()).thenReturn(originalIdentifier);
        when(originalRequest.getSourceInputStream()).thenReturn(new FileInputStream(file));
        handler.handle(originalRequest);
       
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.