Package uk.gov.nationalarchives.droid.container

Examples of uk.gov.nationalarchives.droid.container.ContainerSignature


   
   
    @Test
    public void testIdentifyWordDocumentFromRootFile() throws IOException {
       
        ContainerSignature sig = new ContainerSignature();
        sig.setId(100);
        sig.setDescription("Word 97 OLE2");
       
        ContainerFile containerFile = new ContainerFile();
        containerFile.setPath("WordDocument");
        sig.setFiles(Arrays.asList(new ContainerFile[] {containerFile}));
       
        Map<Integer, List<FileFormatMapping>> formats = new HashMap<Integer, List<FileFormatMapping>>();
        FileFormatMapping fileFormat = new FileFormatMapping();
        fileFormat.setPuid("fmt/666");
        List<FileFormatMapping> formatMapping = new ArrayList<FileFormatMapping>();
View Full Code Here


    }

    @Test
    public void testIdentifyWordDocumentFromRootFileAndCompObj() throws IOException {
       
        ContainerSignature sig = new ContainerSignature();
        sig.setId(100);
        sig.setDescription("Word 97 OLE2");
       
        ContainerFile rootFile = new ContainerFile();
        rootFile.setPath("WordDocument");

        ContainerFile compObj = new ContainerFile();
        compObj.setPath("CompObj");
        //compObj.setTextSignature(".*Word.Document.8.*");

        sig.setFiles(Arrays.asList(new ContainerFile[] {rootFile, compObj}));
       
        Map<Integer, List<FileFormatMapping>> formats = new HashMap<Integer, List<FileFormatMapping>>();
        FileFormatMapping fileFormat = new FileFormatMapping();
        fileFormat.setPuid("fmt/666");
        List<FileFormatMapping> formatMapping = new ArrayList<FileFormatMapping>();
View Full Code Here

    }

    @Test
    public void testIdentifyContainerUsingCompObj() throws IOException {
       
        ContainerSignature wordSig = new ContainerSignature();
        wordSig.setId(100);
        wordSig.setDescription("Word 97 OLE2");
       
        ContainerFile wordDocument = new ContainerFile();
        wordDocument.setPath("WordDocument");

        ContainerFile wordCompObj = new ContainerFile();
        wordCompObj.setPath("CompObj");
        //wordCompObj.setTextSignature(".*Word.Document.8.*");

        wordSig.setFiles(Arrays.asList(new ContainerFile[] {wordDocument, wordCompObj}));
       
        ContainerSignature excelSig = new ContainerSignature();
        excelSig.setId(100);
        excelSig.setDescription("Word 97 OLE2");
       
        ContainerFile workbook = new ContainerFile();
        workbook.setPath("Workbook");

        ContainerFile excelCompObj = new ContainerFile();
        excelCompObj.setPath("CompObj");
        //excelCompObj.setTextSignature(".*Word.Document.8.*");

        excelSig.setFiles(Arrays.asList(new ContainerFile[] {workbook, excelCompObj}));

        Map<Integer, List<FileFormatMapping>> formats = new HashMap<Integer, List<FileFormatMapping>>();
        FileFormatMapping fileFormat = new FileFormatMapping();
        fileFormat.setPuid("fmt/666");
        List<FileFormatMapping> formatMapping = new ArrayList<FileFormatMapping>();
View Full Code Here

    }

    @Test
    public void testIdentifyWordDocument() throws IOException {
       
        ContainerSignature sig = new ContainerSignature();
        sig.setId(100);
        sig.setDescription("Word 97 OOXML");
       
        ContainerFile containerFile = new ContainerFile();
        containerFile.setPath("[Content_Types].xml");
        //containerFile.setTextSignature(
        //      ".*ContentType=\"application/vnd\\.openxmlformats-"
        //    + "officedocument\\.wordprocessingml\\.document\\.main\\+xml\".*");
        sig.setFiles(Arrays.asList(new ContainerFile[] {containerFile}));

        Map<Integer, List<FileFormatMapping>> formats = new HashMap<Integer, List<FileFormatMapping>>();
        FileFormatMapping fileFormat = new FileFormatMapping();
        fileFormat.setPuid("fmt/666");
        List<FileFormatMapping> formatMapping = new ArrayList<FileFormatMapping>();
View Full Code Here

        ooXmlIdentifier.init();
       
        List<ContainerSignature> containerSignatures = ooXmlIdentifier.getContainerSignatures();
        assertEquals(3, containerSignatures.size());
       
        ContainerSignature sig = containerSignatures.get(0);
       
        assertEquals("Microsoft Word OOXML", sig.getDescription());
        assertEquals("[Content_Types].xml", sig.listFiles().get(0).getPath());
        //assertEquals(".*ContentType=\"application/vnd\\.openxmlformats-"
        //        + "officedocument\\.wordprocessingml\\.document\\.main\\+xml\".*",
        //        sig.listFiles().get(0).getTextSignature());
    }
View Full Code Here

    @Test
    @Ignore
    public void testIdentifyTextDocument() throws IOException {
       
        ContainerSignature sig = new ContainerSignature();
        sig.setId(100);
        sig.setDescription("ODF Wrong text signature");
       
        ContainerFile containerFile = new ContainerFile();
        containerFile.setPath("META-INF/manifest.xml");
        //containerFile.setTextSignature(".*manifest:media-type=\"foo\".*");
        sig.setFiles(Arrays.asList(new ContainerFile[] {containerFile}));
       
        ContainerSignature sig2 = new ContainerSignature();
        sig2.setId(101);
        sig2.setDescription("ODF Text");

        ContainerFile containerFile2 = new ContainerFile();
        containerFile2.setPath("META-INF/manifest.xml");
        //containerFile2.setTextSignature(
        //  ".*manifest:media-type=\"application/vnd\\.oasis\\.opendocument\\.text\".{0,50}manifest:full-path=\"/\".*");
        sig2.setFiles(Arrays.asList(new ContainerFile[] {containerFile2}));

        Map<Integer, List<FileFormatMapping>> formats = new HashMap<Integer, List<FileFormatMapping>>();
        FileFormatMapping fileFormatText = new FileFormatMapping();
        fileFormatText.setPuid("fmt/666");
        List<FileFormatMapping> mappings = new ArrayList<FileFormatMapping>();
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.container.ContainerSignature

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.