Package eu.planets_project.services.datatypes

Examples of eu.planets_project.services.datatypes.DigitalObject$Adapter


     */
    private void testIdentifyThis(URI purl, URI type) throws MalformedURLException {
        /* Create the content: */
        DigitalObjectContent c1 = Content.byReference(purl.toURL());
        /* Given these, we can instantiate our object: */
        DigitalObject object = new DigitalObject.Builder(c1).permanentUri(purl)
                .build();

        /* Now pass this to the service */
        IdentifyResult ir = ids.identify(object, null);

View Full Code Here


    @Test public void byReferenceToUrl() { test(Content.byReference(url)); }
    @Test public void byReferenceToFile() { test(Content.byReference(file())); }
    @Test public void byReferenceToInputStream() { test(Content.byReference(stream)); }

    private void test(DigitalObjectContent content) {
        DigitalObject in = new DigitalObject.Builder(content).build();
        MigrateResult res = migrate.migrate(in, null, null, null);
        DigitalObject out = res.getDigitalObject();
        // We require the input and output object to be equal:
        Assert.assertEquals("Input and output objects must be equal", in, out);
    }
View Full Code Here

        try {
            /*
             * To test usability of the digital object instance in web services, we simply pass one into the service and
             * expect one back:
             */
            DigitalObject input = new DigitalObject.Builder(Content.byReference(new URL("http://some"))).build();
            System.out.println("Input: " + input);

            MigrateResult mr = dom.migrate(input, null, null, null);
            DigitalObject doOut = mr.getDigitalObject();

            assertTrue("Resulting digital object is null.", doOut != null);

            System.out.println("Output: " + doOut);

View Full Code Here

                    new DigitalObject.Builder(
                            Content.byValue(textBlob.getBytes()));
            factory.title(digitalObject.getTitle() + ".txt");
            // Unicode File format (UTF-16)
            factory.format(outputformatUnicode);
            final DigitalObject textObject = factory.build();

            return new MigrateResult(textObject, report);

        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

                    new DigitalObject.Builder(
                            Content.byValue(htmlBlob.getBytes()));
            factory.title(digitalObject.getTitle() + ".html");
            // HTML 4.0 File format
            factory.format(outputformatHtml);
            DigitalObject htmlObject = factory.build();

            return new MigrateResult(htmlObject, report);

        } catch (Exception e) {
            log.severe(e.getClass().getName()+": "+e.getMessage());
View Full Code Here

      // ignore the .svn folder ;-)
      if(currentFile.isHidden() /*|| !currentFile.getName().contains("presentation")*/) {
        continue;
      }
      printTestTitle("Testing OdfValidator with input file: " + currentFile.getName());
      DigitalObject testIn = new DigitalObject.Builder(Content.byReference(currentFile)).title(currentFile.getName()).build();
     
      URI format = techReg.createExtensionUri(FilenameUtils.getExtension(currentFile.getName()));
     
      ValidateResult vr = validator.validate(testIn, format, null);
     
View Full Code Here

    public final void testTextMigration() {

        try {
            System.out.println(texttestpdf.getCanonicalPath());

            /**
             * Testing the web services by calling it with
             * a digital object instance containing a PDF file version 1.4
             * and expect the service to return a file containing UTF-8 text.
             */
            final DigitalObject doInput =
                new DigitalObject.Builder(
                    Content.byReference((texttestpdf).toURI().toURL()))
                    .permanentUri(URI.create("http://example.com/test.pdf"))
                    .title("test.pdf")
                    .build();
            System.out.println("Input " + doInput);

            URI inputformatpdf = null;
            URI outputformatUnicode = null;

            inputformatpdf = new URI("info:pronom/fmt/18");
            outputformatUnicode = new URI("info:pronom/x-fmt/16");

            final MigrateResult mr = dom.migrate(doInput, inputformatpdf,
                outputformatUnicode, null);
            final DigitalObject doOutput = mr.getDigitalObject();

            assertNotNull("Resulting digital object is null.", doOutput);

            System.out.println("Output" + doOutput);

View Full Code Here

    public final void testHtmlMigration() {

        try {
            System.out.println(htmltestpdf.getCanonicalPath());

            /**
             * Testing the web services by calling it with
             * a digital object instance containing a PDF file version 1.4,
             * and expect the service to return a file containing HTML 4.0 text.
             */
            final DigitalObject doInput =
                new DigitalObject.Builder(
                        Content.byReference((htmltestpdf)
                        .toURI().toURL()))
                        .permanentUri(URI.create("http://example.com/test.pdf"))
                        .title("test.pdf")
                        .build();
            System.out.println("Input " + doInput);


            URI inputformatpdf = null;
            URI outputformatHtmlUnicode = null;

            inputformatpdf = new URI("info:pronom/fmt/18");
            outputformatHtmlUnicode = new URI("info:pronom/fmt/99");

            final MigrateResult mr = dom.migrate(doInput, inputformatpdf,
                outputformatHtmlUnicode, null);
            final DigitalObject doOutput = mr.getDigitalObject();

            assertNotNull("Resulting digital object is null.", doOutput);

            System.out.println("Output" + doOutput);

View Full Code Here

        System.out.println("Testing characterisation of " + type);
        File file = new File(SAMPLES + type.sample);
        if (file.length() == 0) {
            throw new IllegalStateException("Empty file: " + file);
        }
        DigitalObject digitalObject = new DigitalObject.Builder(Content
                .byValue(file)).build();
        CharacteriseResult characteriseResult = characterizer.characterise(
                digitalObject, null);
        List<Property> properties = characteriseResult.getProperties();
        System.out.println("Characterised " + file.getAbsolutePath() + " as: "
View Full Code Here

    catch (MalformedURLException e)
    {
      e.printStackTrace();
    }

    DigitalObject inPng = new DigitalObject.Builder(pngContent).build();
    DigitalObject inTiff = new DigitalObject.Builder(tifContent).build();

    ValidateResult result;
    /* Check with null PRONOM URI, both with PNG and TIFF */
    try {
      result = tiffCheck.validate(inTiff, null, null);
View Full Code Here

TOP

Related Classes of eu.planets_project.services.datatypes.DigitalObject$Adapter

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.