use of com.runwaysdk.Pair in project geoprism-registry by terraframe.
the class AccountServiceControllerTest method createUserWithRoles.
@SuppressWarnings("rawtypes")
private void createUserWithRoles(RestResponse response) {
Pair pair = (Pair) response.getAttribute("roles");
JSONArray roleJSONArray = (JSONArray) pair.getFirst();
Set<String> requiredRolesSet = new HashSet<String>();
requiredRolesSet.add(RegistryRole.Type.getSRA_RoleName());
requiredRolesSet.add(RegistryRole.Type.getRA_RoleName(mohOrg.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRM_RoleName(mohOrg.getCode(), healthFacility.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRC_RoleName(mohOrg.getCode(), healthFacility.getCode()));
requiredRolesSet.add(RegistryRole.Type.getAC_RoleName(mohOrg.getCode(), healthFacility.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRA_RoleName(moiOrg.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRM_RoleName(moiOrg.getCode(), district.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRC_RoleName(moiOrg.getCode(), district.getCode()));
requiredRolesSet.add(RegistryRole.Type.getAC_RoleName(moiOrg.getCode(), district.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRM_RoleName(moiOrg.getCode(), village.getCode()));
requiredRolesSet.add(RegistryRole.Type.getRC_RoleName(moiOrg.getCode(), village.getCode()));
requiredRolesSet.add(RegistryRole.Type.getAC_RoleName(moiOrg.getCode(), village.getCode()));
this.assertReturnedRoles(roleJSONArray, requiredRolesSet, false);
}
use of com.runwaysdk.Pair in project geoprism-registry by terraframe.
the class AccountServiceControllerTest method newInstaneWithOrgRoles.
/**
* Test returning possible roles that can be assigned to a person for a given
* organization.
*/
@Test
@SuppressWarnings("rawtypes")
public void newInstaneWithOrgRoles() {
RestResponse response = (RestResponse) controller.newInstance(clientRequest, "[" + moiOrg.getCode() + "]");
Pair pair = (Pair) response.getAttribute("roles");
JSONArray roleJSONArray = (JSONArray) pair.getFirst();
Assert.assertEquals(7, roleJSONArray.length());
Set<String> rolesFoundSet = new HashSet<String>();
rolesFoundSet.add(RegistryRole.Type.getRA_RoleName(moiOrg.getCode()));
rolesFoundSet.add(RegistryRole.Type.getRM_RoleName(moiOrg.getCode(), district.getCode()));
rolesFoundSet.add(RegistryRole.Type.getRC_RoleName(moiOrg.getCode(), district.getCode()));
rolesFoundSet.add(RegistryRole.Type.getAC_RoleName(moiOrg.getCode(), district.getCode()));
rolesFoundSet.add(RegistryRole.Type.getRM_RoleName(moiOrg.getCode(), village.getCode()));
rolesFoundSet.add(RegistryRole.Type.getRC_RoleName(moiOrg.getCode(), village.getCode()));
rolesFoundSet.add(RegistryRole.Type.getAC_RoleName(moiOrg.getCode(), village.getCode()));
this.assertReturnedRoles(roleJSONArray, rolesFoundSet, false);
}
Aggregations