@@ -0,0 +1,3265 @@
+/*%0A * =============================================================================%0A * Copyright 1998-2013, IAESTE Internet Development Team. All rights reserved.%0A * -----------------------------------------------------------------------------%0A * Project: IntraWeb Services (iws-persistence) - net.iaeste.iws.persistence.entities.UserNotificationEntityTest%0A * -----------------------------------------------------------------------------%0A * This software is provided by the members of the IAESTE Internet Development%0A * Team (IDT) to IAESTE A.s.b.l. It is for internal use only and may not be%0A * redistributed. IAESTE A.s.b.l. is not permitted to sell this software.%0A *%0A * This software is provided %22as is%22; the IDT or individuals within the IDT%0A * cannot be held legally responsible for any problems the software may cause.%0A * =============================================================================%0A */%0Apackage net.iaeste.iws.persistence.entities;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport net.iaeste.iws.persistence.AccessDao;%0Aimport net.iaeste.iws.persistence.entities.notifications.NotificationConsumerEntity;%0Aimport net.iaeste.iws.persistence.jpa.AccessJpaDao;%0Aimport net.iaeste.iws.persistence.setup.SpringConfig;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.test.context.support.AnnotationConfigContextLoader;%0Aimport org.springframework.test.context.transaction.TransactionConfiguration;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.PersistenceContext;%0Aimport javax.persistence.Query;%0Aimport java.util.List;%0A%0A/**%0A * @author  Pavel Fiala / last $Author:$%0A * @version $Revision:$ / $Date:$%0A * @since   1.7%0A */%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = %7BSpringConfig.class%7D)%0A@TransactionConfiguration(defaultRollback = true)%0Apublic class NotificationConsumerEntityTest %7B%0A%0A    @PersistenceContext%0A    private EntityManager entityManager;%0A%0A    @Test%0A    @Transactional%0A    public void testClassflow() %7B%0A        final AccessDao dao = new AccessJpaDao(entityManager);%0A        final UserEntity user = dao.findUserByUsername(%22austria@iaeste.at%22);%0A        assertThat(user.getUserName(), is(%22austria@iaeste.at%22));%0A%0A        final GroupEntity group = dao.findNationalGroup(user);%0A        assertNotNull(group);%0A%0A        final NotificationConsumerEntity entity = new NotificationConsumerEntity();%0A        entity.setGroup(group);%0A        entity.setActive(true);%0A        entity.setName(%22Test consumer%22);%0A        entity.setClassName(%22net.iaeste.iws.ejb.notifications.consumer%22);%0A%0A        entityManager.persist(entity);%0A%0A        final Query query = entityManager.createNamedQuery(%22notifications.findConsumersByActive%22);%0A        query.setParameter(%22active%22, true);%0A        final List%3CNotificationConsumerEntity%3E found = query.getResultList();%0A%0A        assertThat(found.size(), is(1));%0A        assertThat(found.get(0), is(entity));%0A    %7D%0A%7D

Add NotificationConsumerEntity test (refs #134)