コード例 #1
0
  @Test
  public void roleSearchWithEscapedCharacterSucceeds() throws Exception {
    String param = "cn=mouse\\, jerry,ou=people,dc=springframework,dc=org";

    Set<String> values =
        template.searchForSingleAttributeValues(
            "ou=groups", "(member={0})", new String[] {param}, "cn");

    assertEquals(1, values.size());
  }
コード例 #2
0
  @Test
  public void testRoleSearchForMissingAttributeFailsGracefully() {
    String param = "uid=ben,ou=people,dc=springframework,dc=org";

    Set<String> values =
        template.searchForSingleAttributeValues(
            "ou=groups", "(member={0})", new String[] {param}, "mail");

    assertEquals(0, values.size());
  }
コード例 #3
0
  @Test
  public void roleSearchReturnsCorrectNumberOfRoles() {
    String param = "uid=ben,ou=people,dc=springframework,dc=org";

    Set<String> values =
        template.searchForSingleAttributeValues(
            "ou=groups", "(member={0})", new String[] {param}, "ou");

    assertEquals("Expected 3 results from search", 3, values.size());
    assertTrue(values.contains("developer"));
    assertTrue(values.contains("manager"));
    assertTrue(values.contains("submanager"));
  }