Search in sources :

Example 46 with Schema

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

the class ZMSCoreTest method testAccess.

@Test
public void testAccess() {
    Access a = new Access().setGranted(true);
    Schema schema = ZMSSchema.instance();
    Validator validator = new Validator(schema);
    Result result = validator.validate(a, "Access");
    assertTrue(result.valid);
    Access a2 = new Access().setGranted(false);
    assertEquals(a.getGranted(), true);
    assertTrue(a.equals(a));
    assertFalse(a.equals(a2));
    assertFalse(a.equals(new String()));
}
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 Schema

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

the class ZTSCoreTest method AWSArnRoleName.

@Test
public void AWSArnRoleName() {
    String[] goodAWSRoles = { "test-role", "test.role", "test@role=again+plus", "sso/test@role=again+plus", "eng/athenz/product/role_role1-role3", "eng/athenz-path/product/role_role1-role3", "eng/athenz.path_path2/product/role_role1-role3" };
    Schema schema = ZTSSchema.instance();
    Validator validator = new Validator(schema);
    for (String s : goodAWSRoles) {
        Result result = validator.validate(s, "AWSArnRoleName");
        assertTrue(result.valid, s);
    }
    String[] badAWSRoles = { "test:role", "Non_ascii:��", "/role1", "sso:role/role1", "sso+role/role2", "org//unit/role1" };
    for (String s : badAWSRoles) {
        Result result = validator.validate(s, "AWSArnRoleName");
        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 48 with Schema

use of com.yahoo.rdl.Schema 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 49 with Schema

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

the class ZTSImplTest method testGetSchema.

@Test
public void testGetSchema() {
    Schema schema = zts.getRdlSchema(null);
    assertNotNull(schema);
}
Also used : Schema(com.yahoo.rdl.Schema) Test(org.testng.annotations.Test)

Example 50 with Schema

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

the class ZMSImplTest method testSchema.

@Test
public void testSchema() {
    Schema schema = zms.schema();
    assertNotNull(schema);
}
Also used : Schema(com.yahoo.rdl.Schema)

Aggregations

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