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()));
}
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);
}
}
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);
}
}
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);
}
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);
}