use of javax.validation.ValidatorFactory in project wildfly by wildfly.
the class BeanValidationFactoryDeployer method undeploy.
@Override
public void undeploy(DeploymentUnit context) {
ValidatorFactory validatorFactory = context.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY);
if ((validatorFactory != null) && (!WeldDeploymentMarker.isPartOfWeldDeployment(context))) {
// If the ValidatorFactory is not CDI-enabled, close it here. Otherwise, it's
// closed via CdiValidatorFactoryService before the Weld service is stopped.
validatorFactory.close();
}
context.removeAttachment(BeanValidationAttachments.VALIDATOR_FACTORY);
}
use of javax.validation.ValidatorFactory in project ORCID-Source by ORCID.
the class ManagePasswordOptionsValidationFormTest method resetValidator.
@Before
public void resetValidator() {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
validator = factory.getValidator();
}
use of javax.validation.ValidatorFactory in project ORCID-Source by ORCID.
the class ChangePasswordFormValidatorTest method resetValidator.
@Before
public void resetValidator() {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
validator = factory.getValidator();
}
use of javax.validation.ValidatorFactory in project API by ca-cwds.
the class ParticipantTest method setup.
@Before
public void setup() {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
validator = factory.getValidator();
MAPPER.configure(SerializationFeature.INDENT_OUTPUT, true);
Participant validParticipant = this.validParticipant();
roles.add("Victim");
Address address = new Address("", "", "123 First St", "San Jose", "CA", 94321, "Home");
addresses.add(address);
MAPPER.configure(SerializationFeature.INDENT_OUTPUT, true);
when(mockedParticipantResource.create(eq(validParticipant))).thenReturn(Response.status(Response.Status.NO_CONTENT).entity(null).build());
}
use of javax.validation.ValidatorFactory in project oxCore by GluuFederation.
the class UIInputContainer method getDefaultValidator.
/**
* Get the default Bean Validation Validator to read the contraints for a
* property.
*/
private Validator getDefaultValidator(final FacesContext context) throws FacesException {
if (!beanValidationPresent) {
return null;
}
ValidatorFactory validatorFactory;
Object cachedObject = context.getExternalContext().getApplicationMap().get(BeanValidator.VALIDATOR_FACTORY_KEY);
if (cachedObject instanceof ValidatorFactory) {
validatorFactory = (ValidatorFactory) cachedObject;
} else {
try {
validatorFactory = Validation.buildDefaultValidatorFactory();
} catch (ValidationException e) {
throw new FacesException("Could not build a default Bean Validator factory", e);
}
context.getExternalContext().getApplicationMap().put(BeanValidator.VALIDATOR_FACTORY_KEY, validatorFactory);
}
return validatorFactory.getValidator();
}
Aggregations