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

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


        }

        File file = new File("test_sig_files/sample.pdf");
        assertTrue(file.exists());

        RequestIdentifier identifier = new RequestIdentifier(file.toURI());
       
        IdentificationRequest request = mock(IdentificationRequest.class);
        when(request.getIdentifier()).thenReturn(identifier);
        when(request.getRequestMetaData()).thenThrow(new RuntimeException("I failed"));
View Full Code Here


        assertTrue(file.exists());
        URI resourceUri = file.toURI();
 
        InputStream in = new FileInputStream(file);
        RequestMetaData metaData = new RequestMetaData(file.length(), file.lastModified(), SCANFILE);
        RequestIdentifier identifier = new RequestIdentifier(resourceUri);
        identifier.setParentId(1L);
       
        IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
        request.open(in);

        IdentificationResultCollection resultsCollection = droid.matchBinarySignatures(request);
View Full Code Here

        URI resourceUri = file.toURI();

        InputStream in = new FileInputStream(file);
        RequestMetaData metaData = new RequestMetaData(file.length(), file.lastModified(), "persistence.zip");
       
        RequestIdentifier identifier = new RequestIdentifier(resourceUri);
        identifier.setParentId(1L);
        identifier.setParentPrefix("X");
        identifier.setAncestorId(1L);
       
        IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
        request.open(in);

        Future<IdentificationResultCollection> future = submissionGateway.submit(request);
View Full Code Here

        assertTrue(file.exists());
        URI resourceUri = file.toURI();
 
        InputStream in = new FileInputStream(file);
        RequestMetaData metaData = new RequestMetaData(file.length(), file.lastModified(), SCANFILE);
        RequestIdentifier identifier = new RequestIdentifier(resourceUri);
        identifier.setParentId(1L);
       
        IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
        request.open(in);

        IdentificationResultCollection resultsCollection = droid.matchBinarySignatures(request);
View Full Code Here

        assertTrue(file.exists());
        URI resourceUri = file.toURI();
 
        InputStream in = new FileInputStream(file);
        RequestMetaData metaData = new RequestMetaData(file.length(), file.lastModified(), SCANFILE);
        RequestIdentifier identifier = new RequestIdentifier(resourceUri);
        identifier.setParentId(1L);
       
        IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
        request.open(in);

        IdentificationResultCollection resultsCollection = droid.matchBinarySignatures(request);
View Full Code Here

        assertTrue(file.exists());
        URI resourceUri = file.toURI();
 
        InputStream in = new FileInputStream(file);
        RequestMetaData metaData = new RequestMetaData(file.length(), file.lastModified(), "sample.pdf");
        RequestIdentifier identifier = new RequestIdentifier(resourceUri);
        identifier.setParentId(1L);
       
        IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
        request.open(in);
//        IdentificationRequest request = ResourceWrapperFactoryImpl.newResourceWrapper(resourceUri, 1L);
       
View Full Code Here

        metaData = new RequestMetaData(entry.getSize(), null, "profile.xml");
        //metaData = mock(RequestMetaData.class);
        URI parentUri = new File(droidZipFileName).toURI();
        URI entryUri = new URI("zip:" + parentUri + "!/profile.xml");
       
        identifier = new RequestIdentifier(entryUri);
       
        //when(metaData.getSize()).thenReturn(entry.getSize());
        //when(metaData.getName()).thenReturn("profile.xml");
       
        zipResource = new ZipEntryIdentificationRequest(metaData, identifier, 3, 5, tmpDir);
View Full Code Here

    public void setup() throws Exception {
   
        file = new File(getClass().getResource("/testXmlFile.xml.gz").getFile());
       
        metaData = new RequestMetaData(null, null, "foo");
        identifier = new RequestIdentifier(URI.create(GzipUtils.getUncompressedFilename(file.toURI().toString())));
        gzRequest = new GZipIdentificationRequest(
                metaData, identifier,
                100, 12000, new File("tmp"));
        GzipCompressorInputStream in = new GzipCompressorInputStream(new FileInputStream(file));
        gzRequest.open(in);
View Full Code Here

    }
   
    @Test
    public void testOneArgContructor() throws IOException {
        file = new File(getClass().getResource("/testXmlFile.xml.gz").getFile());
        identifier = new RequestIdentifier(URI.create(GzipUtils.getUncompressedFilename(file.toURI().toString())));
        gzRequest = new GZipIdentificationRequest(
                new RequestMetaData(12L, 13L, file.getName()), identifier, tmpDir);
       
        GzipCompressorInputStream in = new GzipCompressorInputStream(
                new FileInputStream(file));
View Full Code Here

    }
   
    @Test
    public void testGetMetaData() {
       
        identifier = new RequestIdentifier(URI.create(GzipUtils.getUncompressedFilename(file.toURI().toString())));
        assertEquals(identifier, gzRequest.getIdentifier());
       
        assertEquals("xml", gzRequest.getExtension());
        assertEquals(StringUtils.substringBeforeLast(file.getName(), ".gz"), gzRequest.getFileName());
        assertEquals(metaData, gzRequest.getRequestMetaData());
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.