Example #1
0
  // -------------------------------------------------------------------------
  @Test
  public void test_search_stringUserId_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setUserId("FooBar");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #2
0
  @Test
  public void test_search_twoKeys_Any_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(ExternalId.of("E", "H"), ExternalId.of("A", "D"));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #3
0
  // -------------------------------------------------------------------------
  @Test
  public void test_search_userIds_none() {
    UserSearchRequest request = new UserSearchRequest();
    request.setObjectIds(new ArrayList<ObjectId>());
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #4
0
  // -------------------------------------------------------------------------
  @Test
  public void test_search_versionAsOf_below() {
    UserSearchRequest request = new UserSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version1Instant.minusSeconds(5)));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #5
0
  @Test
  public void test_search_emailAddress_case() {
    UserSearchRequest request = new UserSearchRequest();
    request.setEmailAddress("*****@*****.**");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #6
0
  @Test
  public void test_search_timeZone_case() {
    UserSearchRequest request = new UserSearchRequest();
    request.setTimeZone("EUROPE/PARIS");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #7
0
  @Test
  public void test_search_oneKey_None_CD_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalId(ExternalId.of("C", "D"));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.NONE);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #8
0
  @Test
  public void test_search_twoKeys_All_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "H")));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ALL);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #9
0
  @Test
  public void test_search_stringUserId() {
    UserSearchRequest request = new UserSearchRequest();
    request.setUserId("Test102");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #10
0
  @Test
  public void test_search_oneKey_Any_GH() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalId(ExternalId.of("G", "H"));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #11
0
  @Test
  public void test_search_threeKeys_Exact_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(ExternalId.of("A", "B"), ExternalId.of("C", "D"));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.EXACT);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #12
0
  @Test
  public void test_search_name_case() {
    UserSearchRequest request = new UserSearchRequest();
    request.setName("TESTUser102");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #13
0
  @Test
  public void test_search_noKeys_None_allMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.NONE);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(_totalUsers, test.getDocuments().size());
  }
Example #14
0
  @Test
  public void test_search_noKeys_Any_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ANY);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(0, test.getDocuments().size());
  }
Example #15
0
  @Test
  public void test_search_name_wildcard() {
    UserSearchRequest request = new UserSearchRequest();
    request.setName("TestUser1*");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
Example #16
0
  // -------------------------------------------------------------------------
  @Test
  public void test_search_oneKey_None_AB() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalId(ExternalId.of("A", "B"));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.NONE);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert202(test.getDocuments().get(0));
  }
Example #17
0
  @Test
  public void test_search_timeZone_wildcard() {
    UserSearchRequest request = new UserSearchRequest();
    request.setTimeZone("Europe/*");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
Example #18
0
  @Test
  public void test_search_emailAddress_wildcard() {
    UserSearchRequest request = new UserSearchRequest();
    request.setEmailAddress("email1*");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
Example #19
0
  @Test
  public void test_search_stringUserId_wildcardCase() {
    UserSearchRequest request = new UserSearchRequest();
    request.setUserId("TEST1*");
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
Example #20
0
  @Test
  public void test_search_versionAsOf_above() {
    UserSearchRequest request = new UserSearchRequest();
    request.setVersionCorrection(VersionCorrection.ofVersionAsOf(_version2Instant.plusSeconds(5)));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(3, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert202(test.getDocuments().get(2)); // new version
  }
Example #21
0
  @Test
  public void test_search_twoKeys_EF_GH() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(ExternalId.of("E", "F"), ExternalId.of("G", "H"));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(3, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert202(test.getDocuments().get(2));
  }
Example #22
0
  @Test
  public void test_search_twoKeys_All_CD_EF() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(ExternalId.of("C", "D"), ExternalId.of("E", "F"));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ALL);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert202(test.getDocuments().get(1));
  }
Example #23
0
  @Test
  public void test_search_threeKeys_All_AB_CD_GH() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalIds(
        ExternalId.of("A", "B"), ExternalId.of("C", "D"), ExternalId.of("G", "H"));
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ALL);
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getDocuments().size());
    assert102(test.getDocuments().get(0));
  }
Example #24
0
  @Test
  public void test_search_userIds() {
    UserSearchRequest request = new UserSearchRequest();
    request.addObjectId(ObjectId.of("DbUsr", "101"));
    request.addObjectId(ObjectId.of("DbUsr", "201"));
    request.addObjectId(ObjectId.of("DbUsr", "9999"));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert202(test.getDocuments().get(1));
  }
Example #25
0
  @Test
  public void test_search_pageTwo() {
    UserSearchRequest request = new UserSearchRequest();
    request.setPagingRequest(PagingRequest.ofPage(2, 2));
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(3, test.getPaging().getFirstItemOneBased());
    assertEquals(2, test.getPaging().getPagingSize());
    assertEquals(_totalUsers, test.getPaging().getTotalItems());

    assertEquals(1, test.getDocuments().size());
    assert202(test.getDocuments().get(0));
  }
Example #26
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void test_search_userIds_badSchemeValidOid() {
   UserSearchRequest request = new UserSearchRequest();
   request.addObjectId(ObjectId.of("Rubbish", "120"));
   _usrMaster.search(request);
 }