Package net.yura.lobby.database.impl

Examples of net.yura.lobby.database.impl.JPADatabase


        catch (Exception ex) {
            throw new RuntimeException(ex);
        }

        //database = new net.yura.lobby.database.impl.MemoryDatabase();
        database = new JPADatabase();

        TurnBasedGame.scheduler.pause();
        loadFromDB();
        TurnBasedGame.scheduler.resume();
View Full Code Here


    }

    @Test
    public void testSaveGame() {
        System.out.println("saveGame");
        Database database = new JPADatabase();
       
        database.startTransaction();
        GameTypeRoom gameTypeRoom = database.getGameTypes().iterator().next();
        database.endTransaction();
       
        User user = new User();
       
        database.startTransaction();
        database.saveUser(user);
        database.endTransaction();
       
        GameRoom gameRoom = new GameRoom();
        gameRoom.setName("Test Game Room");
        gameRoom.setMaxPlayers(2);
        gameRoom.setOptions("0\n2\n2\nchoosemap sersom.map\nstartgame domination increasing");

        gameRoom.setGameTypeRoom(gameTypeRoom);
        gameTypeRoom.getGameRooms().add(gameRoom);
       
        gameRoom.getUsers().add(user);
        user.getGames().add(gameRoom);
       
        database.startTransaction();
        database.saveGame(gameRoom);
        database.endTransaction();

        User user2 = new User();
       
        database.startTransaction();
        database.saveUser(user2);
        database.endTransaction();

        gameRoom.getUsers().add(user2);
        user2.getGames().add(gameRoom);

        database.startTransaction();
        database.saveGame(gameRoom);
        database.endTransaction();
       
    }
View Full Code Here

TOP

Related Classes of net.yura.lobby.database.impl.JPADatabase

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.