Examples of JizzDj


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

        assertTrue("6 character email confirmation key generated", mockDj
                .getEmailConfirmation().length() == 6);
    }

    public void testConfirmEmailAddress() throws InvalidKeyException {
        JizzDj mockDj = new JizzDj();

        try {
            jizzDjServices.confirmEmailAddress(mockDj, null);
            fail("Expected invalid key exception for empty key");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }

        try {
            jizzDjServices.confirmEmailAddress(mockDj, "");
            fail("Expected invalid key exception for empty key");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }

        expect(mockJizzDjDao.getDj(mockDj.getId())).andReturn(mockDj);
        replayAll();
        try {
            jizzDjServices.confirmEmailAddress(mockDj, "123456");
            fail("Expected invalid key exception for empty email");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }
        verifyAll();
        resetAll();

        mockDj.setEmail("");
        expect(mockJizzDjDao.getDj(mockDj.getId())).andReturn(mockDj);
        replayAll();
        try {
            jizzDjServices.confirmEmailAddress(mockDj, "123456");
            fail("Expected invalid key exception for empty email");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }
        verifyAll();
        resetAll();

        mockDj.setEmail("test@test.com");
        expect(mockJizzDjDao.getDj(mockDj.getId())).andReturn(mockDj);
        replayAll();
        try {
            jizzDjServices.confirmEmailAddress(mockDj, "123456");
            fail("Expected invalid key exception for email already being "
                    + "confirmed");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }
        verifyAll();
        resetAll();

        mockDj.setEmailConfirmation("654321");
        expect(mockJizzDjDao.getDj(mockDj.getId())).andReturn(mockDj);
        replayAll();
        try {
            jizzDjServices.confirmEmailAddress(mockDj, "123456");
            fail("Expected invalid key exception for keys not matching");
        } catch (InvalidKeyException kEx) {
            // Good!
            logger.debug("Expected error", kEx);
        }
        verifyAll();
        resetAll();

        mockDj.setEmailConfirmation("123456");
        expect(mockJizzDjDao.getDj(mockDj.getId())).andReturn(mockDj);
        expect(mockJizzDjDao.createOrUpdateDj(mockDj)).andReturn(mockDj);
        replayAll();
        jizzDjServices.confirmEmailAddress(mockDj, "123456");
        verifyAll();
        assertNull("Email should be confirmed", mockDj.getEmailConfirmation());
    }
View Full Code Here

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

    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<>();
        djs.add(mockDj1);
        djs.add(mockDj2);
        djs.add(mockDj3);
View Full Code Here

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

        JizzStation mockStation = new JizzStation();
        mockStation.setSmtpServerHost("localhost");
        mockStation.setSmtpServerPort(SMTP_TEST_PORT);
        mockStation.setUrl("http://test.jizz.com/jizz/");

        JizzDj mockDj = new JizzDj();
        mockDj.setStation(mockStation);
        mockDj.setLocale("en");
        mockDj.setName("Test");
        mockDj.setEmail("test@test.com");
        mockDj.setEmailConfirmation("123456");

        JizzEmailResponse mockEmailResponse = new JizzEmailResponse() {
            @Override
            public String getSubject() {
                return "Test Confirmation";
            }

            @Override
            public String getPlainText() {
                return "Test Plain Text Message";
            }

            @Override
            public String getHtml() {
                return "<h1>Test HTML Message</h1>";
            }
        };
        expect(
                mockEmailRenderer.generateConfirmAddressEmail(
                        Locale.forLanguageTag(mockDj.getLocale()),
                        mockStation,
                        mockDj,
                        mockStation.getUrl() + "confirm?key="
                                + mockDj.getEmailConfirmation())).andReturn(
                mockEmailResponse);

        SimpleSmtpServer smtp = SimpleSmtpServer.start(mockStation
                .getSmtpServerPort());
        replay(mockEmailRenderer);
View Full Code Here

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

    @Test
    public void testReportErrorToAdmins() {
        JizzStation mockStation = new JizzStation();

        JizzDj admin1 = new JizzDj(), admin2 = new JizzDj(), admin3 = new JizzDj();
        JizzDj dj1 = new JizzDj(), dj2 = new JizzDj(), dj3 = new JizzDj();

        List<JizzDj> djs = new ArrayList<>();
        djs.add(dj1);
        djs.add(admin1);
        djs.add(dj2);
View Full Code Here

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

        broadcast.setStation(station);
        return jizzBroadcastDao.createOrUpdateBroadcast(broadcast);
    }

    private JizzDj newDj(JizzStation station) {
        JizzDj dj = new JizzDj();
        dj.setStation(station);
        return jizzDjDao.createOrUpdateDj(dj);
    }
View Full Code Here

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

    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);

        JizzSong song = jizzSongJpaDao.findSongById(song1.getId());
View Full Code Here

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

                .createDefaultStation(jizzStationDao);

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

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

        JizzSong songB1D1 = newSong(station, broadcast1, dj1);
        JizzSong songB1D2 = newSong(station, broadcast1, dj2);
        JizzSong songB2D1 = newSong(station, broadcast2, dj1);
        JizzSong songB2D2 = newSong(station, broadcast2, dj2);
View Full Code Here

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

        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);
        JizzSong song3 = newSong(station, broadcast1, dj1);
        JizzSong song4 = newSong(station, broadcast1, dj1);
View Full Code Here

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

        JizzEmailVelocityRenderer renderer = new JizzEmailVelocityRenderer();

        JizzStation mockStation = new JizzStation();
        mockStation.setName("Test Station");

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

        for (Locale locale : Locale.getAvailableLocales()) {
            JizzEmailResponse response = renderer.generateConfirmAddressEmail(
                    locale, mockStation, mockDj,
                    "http://test.jizz.com/jizz/confirm?key=123456");
View Full Code Here

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

    }

    private BlockingBroadcastStream makeMockBbs(int numSourcesToCreate) {
        MockBroadcastStream bs = new MockBroadcastStream();
        for (int num = 0; num < numSourcesToCreate; num++) {
            JizzDj dj = new JizzDj();
            dj.setName("DJ Test" + (num + 1));

            JizzSong song = new JizzSong();
            song.setDj(dj);
            song.setArtist("Artist Test" + (num + 1));
            song.setTitle("Title Test" + (num + 1));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.