Examples of ValidateResult


Examples of eu.planets_project.services.validate.ValidateResult

      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

Examples of eu.planets_project.services.validate.ValidateResult

    }

    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

Examples of eu.planets_project.services.validate.ValidateResult

     * @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

Examples of org.wso2.xkms2.ValidateResult

            OMElement element = getElement(request);
            OMElement result = sendReceive(element, serviceURL);
            result = buildElement(result);

            ValidateResult validateResult = getValidateResult(result);
            List keybinds = validateResult.getKeyBindingList();
            KeyBinding keybinding = (KeyBinding) keybinds.get(0);

            Status status = keybinding.getStatus();

            return StatusValue.VALID.equals(status.getStatusValue());
View Full Code Here

Examples of org.wso2.xkms2.ValidateResult

        locateResult.setId(getRamdomId());
        return locateResult;
    }
   
    public static ValidateResult createValidateResult() {
        ValidateResult validateResult = new ValidateResult();
        validateResult.setId(getRamdomId());
        return validateResult;
    }
View Full Code Here

Examples of org.wso2.xkms2.ValidateResult

            if (cert == null) {
                throw new XKMSException(XKMSException.FAILURE, "CertNotPresent");
            }

            if (verifyTrust(cert)) {
                ValidateResult validateResult = XKMSUtil.createValidateResult();
                buildResultType((RequestAbstractType) validateRequest,
                        (ResultType) validateResult);

                String subjectDN = cert.getIssuerDN().getName();
                BigInteger issuerSerial = cert.getSerialNumber();

                String alias = getAliasForX509Cert(subjectDN, issuerSerial);
                X509Certificate[] certs = getCertificates(alias);

                KeyBinding keyBinding = XKMSUtil.createKeyBinding();
                validateResult.addKeyBinding(keyBinding);

                addKeyInfo(respondWith, alias, certs, keyBinding);
                addKeyUsage(certs[0], keyBinding);
                addStatus(true, keyBinding);

                return validateResult;

            } else {

                ValidateResult result = XKMSUtil.createValidateResult();
                buildResultType((RequestAbstractType) validateRequest,
                        (ResultType) result);

                KeyBinding keybinding = XKMSUtil.createKeyBinding();
                X509Certificate[] certs = new X509Certificate[] { cert };

                addKeyInfo(validateRequest.getRespondWith(), null, certs,
                        keybinding);
                addKeyUsage(certs[0], keybinding);
                addStatus(false, keybinding);
                result.addKeyBinding(keybinding);

                return result;
            }

        } catch (XKMSException ex) {
            ValidateResult resultType = XKMSUtil.createValidateResult();
            buildFault(validateRequest, resultType, ex);
            return resultType;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.