ValidationPolicyFacade extends AbstractJaxbFacade<ConstraintsParameters> { public static ValidationPolicyFacade newFacade() { return new ValidationPolicyFacade(); }  static ValidationPolicyFacade newFacade(); ValidationPolicy getDefaultValidationPolicy(); ValidationPolicy getTrustedListValidationPolicy(); ValidationPolicy getValidationPolicy(String path); ValidationPolicy getValidationPolicy(InputStream is); ValidationPolicy getValidationPolicy(File file);  }
@Test public void testUnmarshalling() throws Exception { ConstraintsParameters constraintsParameters = ValidationPolicyFacade.newFacade() .unmarshall(new File("src/test/resources/constraint.xml")); Algo algo = constraintsParameters.getSignatureConstraints().getBasicSignatureConstraints().getCryptographic() .getMiniPublicKeySize().getAlgo().get(0); assertNotNull(algo); String algoName = algo.getValue(); assertEquals("DSA", algoName); assertEquals(128, algo.getSize()); String marshall = ValidationPolicyFacade.newFacade().marshall(constraintsParameters); assertNotNull(marshall); }
@Test public void testUnmarshallingWithModel() throws Exception { ConstraintsParameters constraintsParameters = ValidationPolicyFacade.newFacade() .unmarshall(new File("src/test/resources/constraint.xml")); ModelConstraint mc = new ModelConstraint(); mc.setValue(Model.SHELL); constraintsParameters.setModel(mc); String marshall = ValidationPolicyFacade.newFacade().marshall(constraintsParameters); assertNotNull(marshall); ConstraintsParameters cp = ValidationPolicyFacade.newFacade().unmarshall(marshall); assertNotNull(cp); assertNotNull(cp.getModel()); assertEquals(mc.getValue(), cp.getModel().getValue()); }
@Test public void testUnmarshalCoreValidation() throws Exception { ConstraintsParameters constraintsParameters = ValidationPolicyFacade.newFacade() .unmarshall(new File("src/test/resources/constraint-core-validation.xml")); assertNotNull(constraintsParameters); }
@Test public void testUnmarshalConstraint() throws Exception { ConstraintsParameters constraintsParameters = ValidationPolicyFacade.newFacade() .unmarshall(new File("src/test/resources/constraint.xml")); RevocationConstraints revocation = constraintsParameters.getRevocation(); assertNotNull(revocation); TimeConstraint revocationFreshness = revocation.getRevocationFreshness(); assertNotNull(revocationFreshness); assertEquals(Level.FAIL, revocationFreshness.getLevel()); assertEquals(TimeUnit.DAYS, revocationFreshness.getUnit()); assertNotNull(revocationFreshness.getValue()); assertEquals(0, revocationFreshness.getValue().intValue()); }