public static long convertDuration(TimeConstraint timeConstraint) { if (timeConstraint != null) { return convertDuration(timeConstraint.getUnit(), eu.europa.esig.jaxb.policy.TimeUnit.MILLISECONDS, timeConstraint.getValue()); } return Long.MAX_VALUE; }
@Test public void testUnmarshalConstraint() throws Exception { ConstraintsParameters constraintsParameters = unmarshal(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()); }