Package marauroa.server.db

Examples of marauroa.server.db.DBTransaction


   * @param zone IRPZone
   * @throws IOException in case of an input/output error
   * @throws SQLException in case of an database error
   */
  public void storeRPZone(IRPZone zone) throws IOException, SQLException {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      storeRPZone(transaction, zone);
    } finally {
      TransactionPool.get().commit(transaction);
    }
View Full Code Here


   * @param zone id of zone
   * @return true, if the zone exists; false otherwise
   * @throws SQLException in case of an database error
   */
  public boolean hasRPZone(IRPZone.ID zone) throws SQLException {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      boolean res = hasRPZone(transaction, zone);
      return res;
    } finally {
      TransactionPool.get().commit(transaction);
View Full Code Here

  public BareRPRuleProcessor() {
    new DatabaseFactory().initializeDatabase();
    transactionPool = TransactionPool.get();
    world = BareRPWorld.get();

    DBTransaction transaction = transactionPool.beginWork();
    try {
      JDBCSQLHelper sql = new JDBCSQLHelper(transaction);
      sql.runDBScript("marauroa/test/clear.sql");
      sql.runDBScript("marauroa/server/marauroa_init.sql");
      transactionPool.commit(transaction);
View Full Code Here

  /**
   * Create an account for a player.
   */
  public AccountResult createAccount(String username, String password, String email) {
    DBTransaction transaction = transactionPool.beginWork();
    try {
      if (DAORegister.get().get(AccountDAO.class).hasPlayer(transaction, username)) {
        logger.warn("Account already exist: " + username);
        transactionPool.commit(transaction);
        return new AccountResult(Result.FAILED_PLAYER_EXISTS, username);
View Full Code Here

  /**
   * Create a character for a player
   */
  public CharacterResult createCharacter(String username, String character, RPObject template) {
    DBTransaction transaction = transactionPool.beginWork();
    try {
      /*
       * We filter too short character names.
       */
      if(character.length()<4) {
View Full Code Here

   */
  @Test
  public void addPlayer() throws SQLException {
    String username = "testUser";

    DBTransaction transaction = transactionPool.beginWork();
    try {
      accountDAO.addPlayer(transaction, username, Hash.hash("testPassword"), "email@email.com");
      assertTrue(accountDAO.hasPlayer(transaction, username));
    } finally {
      transactionPool.rollback(transaction);
View Full Code Here

  public void changePassword() throws SQLException, IOException {
    String username = "testUser";

    SecureLoginTest.loadRSAKey();

    DBTransaction transaction = transactionPool.beginWork();
    try {
      accountDAO.addPlayer(transaction, username, Hash.hash("testPassword"), "email@email.com");
      assertTrue(accountDAO.hasPlayer(transaction, username));

      PlayerEntry.SecuredLoginInfo login = SecureLoginTest.simulateSecureLogin(username,
View Full Code Here

   */
  @Test(expected = SQLException.class)
  public void doubleAddedPlayer() throws SQLException {
    String username = "testUser";

    DBTransaction transaction = transactionPool.beginWork();
    try {
      if (accountDAO.hasPlayer(transaction, username)) {
        fail("Player was not expected");
      }
      accountDAO.addPlayer(transaction, username, Hash.hash("testPassword"), "email@email.com");
View Full Code Here

   */
  @Test
  public void removePlayer() throws SQLException {
    String username = "testUser";

    DBTransaction transaction = transactionPool.beginWork();
    try {
      accountDAO.addPlayer(transaction, username, Hash.hash("testPassword"), "email@email.com");
      assertTrue(accountDAO.hasPlayer(transaction, username));
      accountDAO.removePlayer(transaction, username);
      assertFalse(accountDAO.hasPlayer(transaction, username));
View Full Code Here

   */
  @Test
  public void getStatus() throws SQLException {
    String username = "testUser";

    DBTransaction transaction = transactionPool.beginWork();

    try {
      accountDAO.addPlayer(transaction, username, Hash.hash("testPassword"), "email@email.com");
      assertEquals("active", accountDAO.getAccountStatus(transaction, username));
    } finally {
View Full Code Here

TOP

Related Classes of marauroa.server.db.DBTransaction

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.