Ejemplo n.º 1
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());
  }
Ejemplo n.º 2
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());
  }
Ejemplo n.º 3
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());
  }
Ejemplo n.º 4
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());
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 7
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());
  }
Ejemplo n.º 8
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());
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 10
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());
  }
Ejemplo n.º 11
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());
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 13
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));
  }
Ejemplo n.º 14
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());
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 16
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));
  }
Ejemplo n.º 17
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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 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));
  }
Ejemplo n.º 26
0
  // -------------------------------------------------------------------------
  @Test
  public void test_search_documents() {
    UserSearchRequest request = new UserSearchRequest();
    UserSearchResult test = _usrMaster.search(request);

    assertEquals(1, test.getPaging().getFirstItemOneBased());
    assertEquals(Integer.MAX_VALUE, test.getPaging().getPagingSize());
    assertEquals(_totalUsers, test.getPaging().getTotalItems());

    assertEquals(_totalUsers, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert202(test.getDocuments().get(2));
  }