コード例 #1
0
ファイル: StoreTest.java プロジェクト: Rjoydip/elasticsearch
 public void assertDeleteContent(Store store, DirectoryService service) throws IOException {
   store.deleteContent();
   assertThat(
       Arrays.toString(store.directory().listAll()),
       store.directory().listAll().length,
       equalTo(0));
   assertThat(store.stats().sizeInBytes(), equalTo(0l));
   for (Directory dir : service.build()) {
     assertThat(dir.listAll().length, equalTo(0));
   }
 }
コード例 #2
0
ファイル: WSTest.java プロジェクト: Rahman14354/billing
  /**
   * Test for BlacklistUserStatusTask. When a user's status moves to suspended or higher, the user
   * and all their information is added to the blacklist.
   */
  @Test(enabled = false)
  public void testBlacklistUserStatus() {
    UserWS user =
        buildUser(
            PRANCING_PONY_ACCOUNT_TYPE, "BlackListFirst", "BlackListSecond", "4916347258194745");
    user.setId(api.createUser(user));

    // expected filter response messages
    String[] messages = new String[3];
    messages[0] = "User id is blacklisted.";
    messages[1] = "Name is blacklisted.";
    messages[2] = "Credit card number is blacklisted.";

    //	    TODO: for now we do not test for these three
    //        messages[3] = "Address is blacklisted.";
    //        messages[4] = "IP address is blacklisted.";
    //        messages[5] = "Phone number is blacklisted.";

    // check that a user isn't blacklisted
    user = api.getUserWS(user.getId());
    // CXF returns null
    if (user.getBlacklistMatches() != null) {
      assertTrue("User shouldn't be blacklisted yet", user.getBlacklistMatches().length == 0);
    }

    // change their status to suspended
    user.setStatusId(STATUS_SUSPENDED);
    user.setPassword(null);
    api.updateUser(user);

    // check all their records are now blacklisted
    user = api.getUserWS(user.getId());
    assertEquals(
        "User records should be blacklisted.",
        Arrays.toString(messages),
        Arrays.toString(user.getBlacklistMatches()));

    // cleanup
    api.deleteUser(user.getId());
  }