コード例 #1
0
  @Test
  public void listUsers_in_anotherZone() throws Exception {
    String subdomain = generator.generate();
    MockMvcUtils.IdentityZoneCreationResult result =
        utils()
            .createOtherIdentityZoneAndReturnResult(
                subdomain, getMockMvc(), getWebApplicationContext(), null);
    String zoneAdminToken = result.getZoneAdminToken();
    createUser(
        getScimUser(),
        zoneAdminToken,
        IdentityZone.getUaa().getSubdomain(),
        result.getIdentityZone().getId());

    MockHttpServletRequestBuilder get =
        MockMvcRequestBuilders.get("/Users")
            .header("X-Identity-Zone-Subdomain", subdomain)
            .header("Authorization", "Bearer " + zoneAdminToken)
            .accept(APPLICATION_JSON);

    MvcResult mvcResult = getMockMvc().perform(get).andExpect(status().isOk()).andReturn();
    SearchResults searchResults =
        JsonUtils.readValue(mvcResult.getResponse().getContentAsString(), SearchResults.class);
    MatcherAssert.assertThat(searchResults.getResources().size(), is(1));
  }
コード例 #2
0
 @Test
 public void noActiveIdps_ReturnsEmptyResources() throws Exception {
   when(provisioning.retrieveActive(anyString())).thenReturn(Collections.emptyList());
   SearchResults<?> searchResults =
       endpoints.findUsers("username eq \"foo\"", "ascending", 0, 100, false);
   assertTrue(searchResults.getResources().isEmpty());
 }