Package com.totalchange.jizz.data.entity

Examples of com.totalchange.jizz.data.entity.JizzBroadcast


        // going
        JizzStation station = JizzStationJpaDaoTest
                .createDefaultStation(jizzStationDao);

        // One ending in the past (shouldn't be returned)
        JizzBroadcast past = new JizzBroadcast();
        past.setStation(station);
        past.setFinale(new Date(System.currentTimeMillis() - DAY_IN_MILLIS));
        past = jizzBroadcastJpaDao.createOrUpdateBroadcast(past);

        // One ending in the distant future (shouldn't be returned)
        JizzBroadcast future = new JizzBroadcast();
        future.setStation(station);
        future.setFinale(new Date(System.currentTimeMillis() + MONTHISH_IN_MILLIS));
        future = jizzBroadcastJpaDao.createOrUpdateBroadcast(future);

        // One ending quite soon (should be returned)
        JizzBroadcast next = new JizzBroadcast();
        next.setStation(station);
        next.setFinale(new Date(System.currentTimeMillis() + DAY_IN_MILLIS));
        next = jizzBroadcastJpaDao.createOrUpdateBroadcast(next);

        // So finding the next broadcast should match 'next'
        JizzBroadcast broadcast = jizzBroadcastJpaDao
                .findNearestBroadcast(station);
        assertEquals(next.getId(), broadcast.getId());
    }
View Full Code Here


            result.setEmailAwaitingConfirmation(false);
        }
        result.setLocale(dj.getLocale());

        // Look up the next broadcast and set in its details
        JizzBroadcast broadcast = jizzBroadcastServices
                .getNextBroadcast(station);
        if (broadcast.getActualStart() != null) {
            logger.trace("Broadcast start date isn't estimated - it's "
                    + "confirmed");
            result.setNextBroadcastStartDateEstimated(false);
            result.setNextBroadcastStartDate(broadcast.getActualStart());
        } else {
            logger.trace("Broadcast start date is still estimated");
            result.setNextBroadcastStartDateEstimated(true);
            result.setNextBroadcastStartDate(broadcast.getEstimatedStart());
        }
        result.setNextBroadcastEndDate(broadcast.getFinale());

        // Find this DJ's history for this broadcast
        List<JizzSong> songs = jizzSongServices.getSongsForBroadcast(dj,
                broadcast);
        List<HomeResultSong> resultSongs = new ArrayList<HomeResultSong>(
View Full Code Here

        }
        mockJizzTaskQueue.scheduleNewBroadcastMessages(eq(cal.getTime()),
                anyObject(JizzBroadcast.class));

        replayAll();
        JizzBroadcast broadcast = jizzBroadcastServices
                .getNextBroadcast(mockStation);

        cal = Calendar.getInstance();
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 30);
        cal.set(Calendar.HOUR_OF_DAY, 17);
        cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
        if (cal.before(Calendar.getInstance())) {
            cal.add(Calendar.DATE, 7);
        }
        assertEquals(cal.getTime(), broadcast.getFinale());

        // At the mo each broadcast is crudely expected to last 2 hours. In the
        // future will try and make this a bit more robust.
        cal.add(Calendar.HOUR_OF_DAY, -2);
        assertEquals(cal.getTime(), broadcast.getEstimatedStart());

        verifyAll();
    }
View Full Code Here

    @Test
    public void testSendNewBroadcastMessages() {
        JizzStation mockStation = new JizzStation();
        mockStation.setSongReminderMessageSchedule("30 10 * * Wed,Thu");

        JizzBroadcast mockBroadcast = new JizzBroadcast();
        JizzDj mockDj1 = new JizzDj();
        JizzDj mockDj2 = new JizzDj();
        JizzDj mockDj3 = new JizzDj();

        List<JizzDj> djs = new ArrayList<>();
View Full Code Here

    public void testInvalidSongReminderCron() {
        JizzStation mockStation = new JizzStation();
        mockStation.setLocale("EN");
        mockStation.setSongReminderMessageSchedule("Arrrggghhhhhh");

        JizzBroadcast mockBroadcast = new JizzBroadcast();

        mockJizzErrorServices.reportErrorToAdmins(eq(mockStation), eq("The "
                + "cron trigger 'Arrrggghhhhhh' is not valid, can't "
                + "schedule song reminder"), anyObject(RuntimeException.class));
View Full Code Here

    @Autowired
    private JizzDjDao jizzDjDao;

    private JizzBroadcast newBroadcast(JizzStation station) {
        JizzBroadcast broadcast = new JizzBroadcast();
        broadcast.setStation(station);
        return jizzBroadcastDao.createOrUpdateBroadcast(broadcast);
    }
View Full Code Here

    @Test
    public void testFindSongById() {
        JizzStation station = JizzStationJpaDaoTest
                .createDefaultStation(jizzStationDao);

        JizzBroadcast broadcast = newBroadcast(station);
        JizzDj dj = newDj(station);

        JizzSong song1 = newSong(station, broadcast, dj);
        JizzSong song2 = newSong(station, broadcast, dj);
View Full Code Here

    @Test
    public void testFindSongsForBroadcast() {
        JizzStation station = JizzStationJpaDaoTest
                .createDefaultStation(jizzStationDao);

        JizzBroadcast broadcast1 = newBroadcast(station);
        JizzBroadcast broadcast2 = newBroadcast(station);

        JizzDj dj1 = newDj(station);
        JizzDj dj2 = newDj(station);

        JizzSong songB1D1 = newSong(station, broadcast1, dj1);
View Full Code Here

    @Test
    public void testDeleteSong() {
        JizzStation station = JizzStationJpaDaoTest
                .createDefaultStation(jizzStationDao);

        JizzBroadcast broadcast1 = newBroadcast(station);

        JizzDj dj1 = newDj(station);

        JizzSong song1 = newSong(station, broadcast1, dj1);
        JizzSong song2 = newSong(station, broadcast1, dj1);
View Full Code Here

        JizzDj mockDj = new JizzDj();
        mockDj.setStation(mockStation);
        mockDj.setName("DJ Teste");
        mockDj.setEmail("test@test.com");

        JizzBroadcast mockBroadcast = new JizzBroadcast();
        mockBroadcast.setStation(mockStation);
        mockBroadcast.setEstimatedStart(new Date());

        for (Locale locale : Locale.getAvailableLocales()) {
            JizzEmailResponse response = renderer.generateNewBroadcastEmail(
                    locale, mockStation, mockDj, mockBroadcast);
View Full Code Here

TOP

Related Classes of com.totalchange.jizz.data.entity.JizzBroadcast

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.