Package org.newinstance.gucoach.model

Examples of org.newinstance.gucoach.model.Player


     * Converts a data record of a player into a player entity.
     *
     * @param record the record to convert
     */
    private void convertRecordToPlayer(final String[] record) {
        final Player player = new Player();
        player.setId(new Long(record[AttributePosition.ID]));
        player.setFirstName(record[AttributePosition.FIRSTNAME]);
        player.setLastName(record[AttributePosition.LASTNAME]);
        try {
            player.setCountry(Country.valueOf(record[AttributePosition.COUNTRY]));
        } catch (final IllegalArgumentException e) {
            // TODO remove if all countries are provided
            System.out.println("Country [" + record[AttributePosition.COUNTRY] + "] is missing in model.");
            e.printStackTrace();
        }
        player.setHeight(new Integer(record[AttributePosition.HEIGHT]));
        player.setPersonality(record[AttributePosition.PERSONALITY]);
        player.setBirthday(record[AttributePosition.BIRTHDAY]);
        player.setStrongFoot(StrongFoot.valueOf(record[AttributePosition.STRONG_FOOT].toUpperCase()));
        player.setImportDate(importDate);
        players.put(player.getId(), player);
    }
View Full Code Here


        playerHistoryService = new PlayerHistoryService(em);
    }

    @Test
    public void executeDeleteTest() {
        final Player player1 = createPlayer(556677L);
        final Player player2 = createPlayer(889933L);

        em.getTransaction().begin();
        playerService.insertPlayer(player1);
        playerService.insertPlayer(player2);
        em.getTransaction().commit();
View Full Code Here

        ImportController importController = new ImportControllerImpl(em);
        importController.executeImport(new File(SAMPLE_IMPORT_FILE));
        // now import new file to update player data
        importController = new ImportControllerImpl(em);
        importController.executeImport(new File(SAMPLE_IMPORT_FILE_UPDATE));
        final Player deletedPlayer = em.find(Player.class, 4848870L);
        Assert.assertNull(deletedPlayer);
    }
View Full Code Here

        playerStatsService = new PlayerStatsService(em);
    }

    @Test(expected = NoResultException.class)
    public void insertAndDeletePlayerStatsTest() {
        final Player player = createPlayer();
        final PlayerStats playerStats1 = createPlayerStats(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerStatsService.insertPlayerStats(playerStats1);
View Full Code Here

        playerStatsService.findPlayerStatsByPlayer(player);
    }

    @Test
    public void insertPlayerStatsTest() {
        final Player player = createPlayer();
        final PlayerStats playerStats = createPlayerStats(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerStatsService.insertPlayerStats(playerStats);
View Full Code Here

        Assert.assertEquals(Position.DEF, result.getPosition());
    }

    @Test(expected = NoResultException.class)
    public void insertUpdateAndDeletePlayerStatsTest() {
        final Player player = createPlayer();
        final PlayerStats playerStats1 = createPlayerStats(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerStatsService.insertPlayerStats(playerStats1);
View Full Code Here

        playerStatsService.findPlayerStatsByPlayer(player);
    }

    @Test
    public void updatePlayerStatsTest() {
        final Player player = createPlayer();
        final PlayerStats playerStats = createPlayerStats(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerStatsService.insertPlayerStats(playerStats);
View Full Code Here

        playerHistoryService = new PlayerHistoryService(em);
    }

    @Test
    public void insertPlayerHistoryTest() {
        final Player player = createPlayer();
        final PlayerHistory playerHistory = createPlayerHistory(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerHistoryService.insertPlayerHistory(playerHistory);
View Full Code Here

        Assert.assertEquals(17, result.getSkillPlaymaking().intValue());
    }

    @Test
    public void findAllImportDatesTest() {
        final Player player = createPlayer();

        final Calendar cal = Calendar.getInstance();
        final PlayerHistory playerHistory1 = createPlayerHistory(player);
        playerHistory1.setPlayer(player);
        playerHistory1.setImportDate(cal.getTime());
View Full Code Here

        Assert.assertEquals(2, dates.size());
    }

    @Test
    public void findLatestImportDateTest() {
        final Player player = createPlayer();

        final Calendar cal = Calendar.getInstance();
        // reset time because time part is not persisted into database at all
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
View Full Code Here

TOP

Related Classes of org.newinstance.gucoach.model.Player

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.