Package org.graylog2.plugin.database.validators

Examples of org.graylog2.plugin.database.validators.Validator.validate()


        for (Map.Entry<String, Validator> validation : validators.entrySet()) {
            Validator v = validation.getValue();
            String field = validation.getKey();

            try {
                ValidationResult validationResult = v.validate(fields.get(field));
                if (validationResult instanceof ValidationResult.ValidationFailed) {
                    LOG.debug("Validation failure: [{}] on field [{}]", v.getClass().getCanonicalName(), field);
                    if (validationErrors.get(field) == null)
                        validationErrors.put(field, new ArrayList<ValidationResult>());
                    validationErrors.get(field).add(validationResult);
View Full Code Here


public class FilledStringValidatorTest {

    @Test
    public void testValidate() throws Exception {
        Validator v = new FilledStringValidator();
        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(534).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new String()).passed());
        assertTrue(v.validate("so valid").passed());
    }
View Full Code Here

    @Test
    public void testValidate() throws Exception {
        Validator v = new FilledStringValidator();
        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(534).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new String()).passed());
        assertTrue(v.validate("so valid").passed());
    }
View Full Code Here

    @Test
    public void testValidate() throws Exception {
        Validator v = new FilledStringValidator();
        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(534).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new String()).passed());
        assertTrue(v.validate("so valid").passed());
    }

}
View Full Code Here

    public void testValidate() throws Exception {
        Validator v = new FilledStringValidator();
        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(534).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new String()).passed());
        assertTrue(v.validate("so valid").passed());
    }

}
View Full Code Here

        Validator v = new FilledStringValidator();
        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(534).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new String()).passed());
        assertTrue(v.validate("so valid").passed());
    }

}
View Full Code Here

    @Test
    public void testValidate() throws Exception {
        Validator v = new DateValidator();

        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(9001).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new java.util.Date()).passed());

        // Only joda datetime.
View Full Code Here

    @Test
    public void testValidate() throws Exception {
        Validator v = new DateValidator();

        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(9001).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new java.util.Date()).passed());

        // Only joda datetime.
        assertTrue(v.validate(new org.joda.time.DateTime(DateTimeZone.UTC)).passed());
View Full Code Here

    public void testValidate() throws Exception {
        Validator v = new DateValidator();

        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(9001).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new java.util.Date()).passed());

        // Only joda datetime.
        assertTrue(v.validate(new org.joda.time.DateTime(DateTimeZone.UTC)).passed());
View Full Code Here

        Validator v = new DateValidator();

        assertFalse(v.validate(null).passed());
        assertFalse(v.validate(9001).passed());
        assertFalse(v.validate("").passed());
        assertFalse(v.validate(new java.util.Date()).passed());

        // Only joda datetime.
        assertTrue(v.validate(new org.joda.time.DateTime(DateTimeZone.UTC)).passed());

        // Only accepts UTC.
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.