Package org.waveprotocol.box.server.account

Examples of org.waveprotocol.box.server.account.HumanAccountDataImpl


    verify(accountStore).removeAccount(ROBOT_ID);
  }

  public void testUnregisterFailsOnHumanAccount() throws PersistenceException {
    when(accountStore.getAccount(HUMAN_ID)).thenReturn(
        new HumanAccountDataImpl(ParticipantId.ofUnsafe(HUMAN_ID.getAddress())));
    try {
      registrar.unregister(HUMAN_ID);
      fail();
    } catch (RobotRegistrationException e) {
      // Expected.
View Full Code Here


    assertEquals(CONSUMER_TOKEN, robotAccountData.getConsumerSecret());
  }

  public void testReRegisterFailsOnExistingHumanAccount() throws PersistenceException {
    when(accountStore.getAccount(HUMAN_ID)).thenReturn(
        new HumanAccountDataImpl(ParticipantId.ofUnsafe(HUMAN_ID.getAddress())));
    try {
      registrar.registerOrUpdate(HUMAN_ID, OTHER_LOCATION);
      fail();
    } catch (RobotRegistrationException e) {
      // Expected.
View Full Code Here

    robotAccountWithCapabilities =
        new RobotAccountDataImpl(ROBOT_ID, "example.com", "secret", new RobotCapabilities(
            capabilities, "FAKEHASH", ProtocolVersion.DEFAULT), true);

    humanAccount = new HumanAccountDataImpl(HUMAN_ID);
    humanAccountWithDigest = new HumanAccountDataImpl(HUMAN_ID,
        new PasswordDigest("password".toCharArray()));
  }
View Full Code Here

   * @throws IllegalArgumentException if the user doesn't exist.
   */
  public static void changeUserPassword(String newPassword, ParticipantId participantId,
      AccountStore accountStore) throws PersistenceException, IllegalArgumentException {
    PasswordDigest newPasswordDigest = new PasswordDigest(newPassword.toCharArray());
    HumanAccountDataImpl account = new HumanAccountDataImpl(participantId, newPasswordDigest);
    if (accountStore.getAccount(participantId) != null) {
      accountStore.removeAccount(participantId);
      accountStore.putAccount(account);
    } else {
      throw new IllegalArgumentException(String.format("User %s does not exist on this domain.",
View Full Code Here

    throws PersistenceException, IllegalArgumentException {
    if (accountStore.getAccount(participantId) != null) {
      throw new IllegalArgumentException(String.format("User %s already exists on this domain.", participantId.getAddress()));
    }

    HumanAccountDataImpl account = new HumanAccountDataImpl(participantId, new PasswordDigest(password.toCharArray()));
    accountStore.putAccount(account);
  }
View Full Code Here

            CollectionUtils.newArrayList(Context.SIBLINGS, Context.PARENT), "blah"));
   
    updatedRobotAccount =
        new RobotAccountDataImpl(ROBOT_ID, "example.com", "secret", new RobotCapabilities(
            capabilities, "FAKEHASH", ProtocolVersion.DEFAULT), true);
    convertedRobot = new HumanAccountDataImpl(ROBOT_ID);
  }
View Full Code Here

  protected abstract AccountStore newAccountStore();

  public final void testRoundtripHumanAccount() throws Exception {
    AccountStore accountStore = newAccountStore();

    HumanAccountDataImpl account = new HumanAccountDataImpl(HUMAN_ID);
    accountStore.putAccount(account);
    AccountData retrievedAccount = accountStore.getAccount(HUMAN_ID);
    assertEquals(account, retrievedAccount);
  }
View Full Code Here

 
  public final void testRoundtripHumanAccountWithPassword() throws Exception {
    AccountStore accountStore = newAccountStore();
   
    accountStore.putAccount(
        new HumanAccountDataImpl(HUMAN_ID, new PasswordDigest("internet".toCharArray())));
    AccountData retrievedAccount = accountStore.getAccount(HUMAN_ID);
    assertTrue(retrievedAccount.asHuman().getPasswordDigest().verify("internet".toCharArray()));
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    waveletProvider = new WaveletProviderStub();
    AccountStore accountStore = new MemoryStore();
    accountStore.putAccount(new HumanAccountDataImpl(ParticipantId.ofUnsafe("fred@example.com")));
    org.eclipse.jetty.server.SessionManager jettySessionManager =
        mock(org.eclipse.jetty.server.SessionManager.class);
    SessionManager sessionManager = new SessionManagerImpl(accountStore, jettySessionManager);
    servlet = new FetchServlet(waveletProvider, protoSerializer, sessionManager);
  }
View Full Code Here

  }

  @Override
  protected void setUp() throws Exception {
    AccountStore store = new MemoryStore();
    store.putAccount(new HumanAccountDataImpl(
        ParticipantId.ofUnsafe("haspwd@example.com"), new PasswordDigest("pwd".toCharArray())));
    store.putAccount(new HumanAccountDataImpl(ParticipantId.ofUnsafe("nopwd@example.com")));
    AccountStoreHolder.init(store, "example.com");
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.box.server.account.HumanAccountDataImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.