Package com.totalchange.jizz.data.entity

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


                    + "' is empty and therefore not valid.  Cannot determine "
                    + "current DJ when authentication is failing.");
        }

        logger.trace("Looking up current DJ based on identity {}", loginName);
        JizzDj dj = jizzDjDao.findDjByLoginName(loginName);

        // If this is a new DJ then need to create them
        if (dj == null) {
            logger.debug("Creating new DJ with identity {}", loginName);

            dj = new JizzDj();

            JizzStation station = jizzStationDao.getPrimaryStation();
            if (station == null) {
                throw new RuntimeException("No primary station - a DJ cannot "
                        + "be created until Jizz has been initialised");
            }
            dj.setStation(station);

            // Set DJ's defaults
            dj.setLocale(station.getLocale());

            // Make up a new name for this DJ
            String djName = JizzDjNameMaker.getInstance().newNamePlease(
                    JizzServiceUtils.forLanguageTag(dj.getLocale()));
            dj.setName(djName);

            // Add the current login info for this DJ
            JizzDjLogin login = new JizzDjLogin();
            login.setDj(dj);
            login.setLoginName(loginName);

            Set<JizzDjLogin> logins = new HashSet<JizzDjLogin>();
            logins.add(login);
            dj.setLogins(logins);

            dj = jizzDjDao.createOrUpdateDj(dj);
            logger.debug("Created new DJ {}", dj);
        }
View Full Code Here


    }
   
    @Test
    public void testExecute() throws DispatchException {
        JizzStation mockStation = new JizzStation();
        JizzDj mockDj = new JizzDj();
        mockDj.setName("DJ Pukka Pie");
       
        expect(mockJizzStationDao.getPrimaryStation()).andReturn(mockStation);
        expect(mockJizzDjServices.getCurrentDj()).andReturn(mockDj);

        replayAll();
        HomeResult result = homeHandler.execute(new HomeAction(), null);
        assertEquals(mockDj.getName(), result.getName());
       
        verifyAll();       
    }
View Full Code Here

                mockJizzDjServices);
    }

    @Test
    public void testExecuteNewInstall() throws DispatchException {
        JizzDj mockDj = new JizzDj();
        JizzStation mockStation = new JizzStation();

        expect(mockJizzStationDao.getPrimaryStation()).andReturn(null);
        expect(
                mockJizzStationDao
View Full Code Here

TOP

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

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.