policy.setName("readOnly"); //$NON-NLS-1$
policy.setDescription("Only has read only permissions"); //$NON-NLS-1$
policy.setMappedRoleNames(Arrays.asList("jack", "susan")); //$NON-NLS-1$ //$NON-NLS-2$
PermissionMetaData perm1 = new PermissionMetaData();
perm1.setResourceName("catalog.schema.Table1"); //$NON-NLS-1$
perm1.setAllowRead(true);
PermissionMetaData perm2 = new PermissionMetaData();
perm2.setResourceName("catalog.schema.Table2"); //$NON-NLS-1$
perm2.setAllowRead(false);
PermissionMetaData perm3 = new PermissionMetaData();
perm3.setResourceName("catalog.schema.Table3"); //$NON-NLS-1$
perm3.setAllowRead(true);
PermissionMetaData perm4 = new PermissionMetaData();
perm4.setResourceName("catalog.schema.Table4"); //$NON-NLS-1$
perm4.setAllowRead(true);
PermissionMetaData perm5 = new PermissionMetaData();
perm5.setResourceName("catalog.schema.Table5.column1"); //$NON-NLS-1$
perm5.setAllowRead(true);
policy.addPermission(perm1, perm2, perm3, perm4, perm5);
assertTrue(policy.allows("catalog.schema.Table1", PermissionType.READ)); //$NON-NLS-1$