Package eu.planets_project.services.validate

Examples of eu.planets_project.services.validate.ValidateResult


        ServiceReport sr = new ServiceReport(Type.INFO, Status.SUCCESS, message);
        log.info(message);
        if (dob == null) {
            return new ValidateResult.Builder(format, sr).build();
        } else {
            ValidateResult result = new ValidateResult.Builder(format, sr)
                    .ofThisFormat(true).validInRegardToThisFormat(true).build();
            return result;
        }
    }
View Full Code Here


   
    CoreOdfValidator odfValidator = new CoreOdfValidator();
   
    OdfValidatorResult result = odfValidator.validate(inputOdfFile, parameters);
   
    ValidateResult vr = null;
   
    if(result.documentIsValid()) {
      vr = new ValidateResult.Builder(format,
                  new ServiceReport(Type.INFO, Status.SUCCESS, result.getValidationResultAsString()))
                  .ofThisFormat(result.isOdfFile())
View Full Code Here

                    "Unsupported format: " + format);
        } else {
            valid = basicValidateOneBinary(digitalObject, format);
            report = new ServiceReport(Type.INFO, Status.SUCCESS, "OK");
        }
        ValidateResult result = new ValidateResult.Builder(format, report)
                .ofThisFormat(valid).build();
        return result;
    }
View Full Code Here

        Assert.assertTrue("Validation failed for: " + f, b);
    }
   
    @Test
    public void testUnsupported() throws MalformedURLException {
        ValidateResult vr = jhove.validate(new DigitalObject.Builder(Content
                .byReference(new File(TestFile.BMP.getLocation()).toURI()
                        .toURL())).build(), TestFile.BMP.getTypes().iterator()
                .next(), null);
        ServiceReport report = vr.getReport();
        /*
         * If validation was attempted for an unsupported format, the report
         * will be of type ERROR:
         */
        Assert.assertEquals(ServiceReport.Type.ERROR, report.getType());
View Full Code Here

        System.err.println("Report message: " + report.getMessage());
    }
   
    @Test
    public void testInvalid() throws MalformedURLException {
        ValidateResult vr = jhove.validate(new DigitalObject.Builder(Content
                .byReference(new File(TestFile.XML.getLocation()).toURI()
                        .toURL())).build(), TestFile.PDF.getTypes().iterator()
                .next(), null);
        Assert.assertFalse("Invalid should be invalidated; ", vr
                .isValidInRegardToThisFormat()
                && vr.isOfThisFormat());
    }
View Full Code Here

   * {@inheritDoc}
     * @see Validate#validate(eu.planets_project.services.datatypes.DigitalObject, java.net.URI, eu.planets_project.services.datatypes.Parameter)
   */
  public ValidateResult validate(final DigitalObject o, final URI fmt, List<Parameter> paramenters)
  {
    ValidateResult result;
    File tempFile =  DigitalObjectUtils.toFile(o);
    boolean valid = basicValidateOneBinary(tempFile, fmt);

    result = new ValidateResult.Builder(fmt, new ServiceReport(Type.INFO,
                Status.SUCCESS, "OK")).ofThisFormat(valid).build();
View Full Code Here

      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);
     
      assertTrue("ValidateResult should not be NULL!", vr!=null);
      ServiceReport sr = vr.getReport();
      System.out.println(sr);
    }
  }
View Full Code Here

    }

    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);
      assertTrue("Valid TIFF was not validated;",
        result.isValidInRegardToThisFormat());

      result = tiffCheck.validate(inPng, null, null );
      assertTrue("Invalid TIFF was not invalidated;",
        !result.isValidInRegardToThisFormat() );

      /* Check with valid and invalid PRONOM URI */
      URI uri = new URI("info:pronom/fmt/7");
      result = tiffCheck.validate(inTiff, uri, null );
      assertTrue("Valid TIFF with URI was not validated;",
        result.isValidInRegardToThisFormat() );

      /* This should throw an IllegalArgumentException: */
      uri = new URI("info:pronom/fmt/11");
      result = tiffCheck.validate(inTiff, uri, null );
      assertTrue("Valid TIFF with invalid URI not invalidated;",
        result.isValidInRegardToThisFormat() );

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

     * @param purl
     * @param type
     */
    private void testValidateThis(DigitalObject dob, URI type, boolean ofThisFormat, boolean inRegardToThisFormat ) {
        /* Now pass this to the service */
        ValidateResult ir = ids.validate(dob, type, null);

        /* Check the result */
        System.out.println("Recieved is of format: " + ir.isOfThisFormat());
        System.out.println("Recieved is of format and valid: " + ir.isValidInRegardToThisFormat());
        System.out.println("Recieved service report: " + ir.getReport());
        assertEquals("The returned type did not match the expected;", ofThisFormat , ir.isOfThisFormat() );
        assertEquals("The returned type did not match the expected;", inRegardToThisFormat , ir.isValidInRegardToThisFormat() );

    }
View Full Code Here

TOP

Related Classes of eu.planets_project.services.validate.ValidateResult

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.