Search in sources :

Example 46 with Validator

use of com.yahoo.rdl.Validator in project athenz by yahoo.

the class ZTSCoreTest method testPathElement.

@Test
public void testPathElement() {
    String[] goodPathElements = { "i-132432432143", "a-zA-Z0-9-._~=+@$,:", "a-23434$asdfdf-343", "abc:test-asdfdsf,234333", "abc~test" };
    Schema schema = ZTSSchema.instance();
    Validator validator = new Validator(schema);
    for (String s : goodPathElements) {
        Result result = validator.validate(s, "PathElement");
        assertTrue(result.valid, s);
    }
    String[] badPathElements = { "abc/test/atest", "abc%asdfadsfd", "Non_ascii:��", "asdf;test", "great!test", "query&element", "query?element" };
    for (String s : badPathElements) {
        Result result = validator.validate(s, "PathElement");
        assertFalse(result.valid, s);
    }
}
Also used : Schema(com.yahoo.rdl.Schema) Validator(com.yahoo.rdl.Validator) Result(com.yahoo.rdl.Validator.Result) Test(org.testng.annotations.Test)

Example 47 with Validator

use of com.yahoo.rdl.Validator in project athenz by yahoo.

the class ZTSImpl method loadSchemaValidator.

void loadSchemaValidator() {
    schema = ZTSSchema.instance();
    validator = new Validator(schema);
}
Also used : Validator(com.yahoo.rdl.Validator)

Aggregations

Validator (com.yahoo.rdl.Validator)47 Schema (com.yahoo.rdl.Schema)45 Result (com.yahoo.rdl.Validator.Result)45 Test (org.testng.annotations.Test)45 ArrayList (java.util.ArrayList)3 Struct (com.yahoo.rdl.Struct)1