Package org.newinstance.gucoach.model

Examples of org.newinstance.gucoach.model.Team


        // initialise team entities
        final List<Team> teams = new ArrayList<Team>();
        int position = 1;
        for (final String teamName : teamNames) {
            final Team team = createTeam(position, teamName);
            teams.add(team);
            position++;
        }

        // use task to insert teams into database
View Full Code Here


     * @param position the team's starting position in the league
     * @param name the unique team's name
     * @return the new team
     */
    private Team createTeam(final int position, final String name) {
        final Team team = new Team();
        team.setStartPos(position);
        team.setName(name);
        team.setStrength(0f);
        return team;
    }
View Full Code Here

        // create league button
        final Button buttonCreate = ButtonBuilder.create().text(ResourceLoader.getResource("button.createLeague")).onAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(final ActionEvent event) {
                // TODO validate and save data to database
                final Team team1 = new Team();
                team1.setStartPos(1);
                team1.setName(tfTeamRnk1.getText());
            }
        }).prefWidth(100.0).build();

        // cancel dialogue button
        final Button buttonCancel = ButtonBuilder.create().text(ResourceLoader.getResource("button.cancel")).onAction(new EventHandler<ActionEvent>() {
View Full Code Here

    }

    /** Creates some test teams and fixtures. */
    private void createSomeTeamsAndFixtures() {
        final List<Team> newTeams = new ArrayList<Team>();
        final Team team1 = new Team();
        team1.setName("Acapulco");
        newTeams.add(team1);
        final Team team2 = new Team();
        team2.setName("Miami Beach");
        newTeams.add(team2);
        final Team team3 = new Team();
        team3.setName("Varese");
        newTeams.add(team3);

        // insert teams first and get them back from database in order to get team ids
        teamService.insertTeams(newTeams);
        final List<Team> teams = teamService.findAllTeams();
View Full Code Here

     * @param name the team name
     * @param position the team's starting position
     * @return a new entity
     */
    protected Team createTeam(final String name, final int position) {
        final Team team = new Team();
        team.setStartPos(position);
        team.setName(name);
        team.setStrength(55.0f);
        return team;
    }
View Full Code Here

    }

    @Test(expected = NoResultException.class)
    public void insertAndDeleteStandingsHistoryTest() {
        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Olympique Marseille", 1);
        teams.add(team);

        em.getTransaction().begin();
        teamService.insertTeams(teams);
        em.getTransaction().commit();

        final Date matchDay = new Date();
        team = teamService.findAllTeams().get(0);

        final StandingsHistory standingsHistory = createStandingsHistory(team, matchDay);
        standingsHistoryService.insertStandingsHistory(standingsHistory);

        StandingsHistory result = standingsHistoryService.findStandingsHistoryByTeamAndDate(team, matchDay);
        Assert.assertNotNull(result);
        Assert.assertEquals(team.getId(), result.getTeam().getId());

        // DELETE
        em.getTransaction().begin();
        standingsHistoryService.removeAllStandingsHistory();
        em.getTransaction().commit();
View Full Code Here

    }

    @Test
    public void removeAllStandingsHistoryTest() {
        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Olympique Marseille", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory1 = createStandingsHistory(team, matchDay1);
View Full Code Here

    }

    @Test
    public void updateStandingsHistoryTest() {
        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Olympique Marseille", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory = createStandingsHistory(team, matchDay1);
View Full Code Here

    @Test(expected = PersistenceException.class)
    // TODO test only works if executed last
    public void insertStandingsHistoryTwiceTest() {
        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Paris SG", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory1 = createStandingsHistory(team, matchDay1);
View Full Code Here

        teamService = new TeamService(em);
    }

    @Test
    public void insertFixturesTest() {
        final Team team1 = createTeam("FC Barcelona", 1);
        final Team team2 = createTeam("Manchester United", 2);

        final List<Team> teams = new ArrayList<Team>();
        teams.add(team1);
        teams.add(team2);
View Full Code Here

TOP

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

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.