public void testAllEntityDaoMethods() throws Exception {
final IChannelType channelType = this.jpaChannelTypeDao.createChannelType("BaseType", IChannelType.class.getName(), "foobar");
this.checkPoint();
//Create a definition
final IChannelDefinition chanDef1 = this.jpaChannelDefinitionDao.createChannelDefinition(channelType, "fname1", IPortletAdaptor.class.getName(), "Test Portlet 1", "Test Portlet 1 Title");
IPortletDefinition portDef1 = this.jpaPortletDefinitionDao.getPortletDefinition(chanDef1.getId());
this.checkPoint();
IPortletEntity portEnt1 = this.jpaPortletEntityDao.createPortletEntity(portDef1.getPortletDefinitionId(), "chanSub1", 1);
this.checkPoint();
final IPortletEntity portEnt1a = this.jpaPortletEntityDao.getPortletEntity(portEnt1.getPortletEntityId());
assertEquals(portEnt1, portEnt1a);
final IPortletEntity portEnt1b = this.jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
assertEquals(portEnt1, portEnt1b);
final Set<IPortletEntity> portletEntities1 = this.jpaPortletEntityDao.getPortletEntities(portDef1.getPortletDefinitionId());
assertEquals(Collections.singleton(portEnt1), portletEntities1);
final Set<IPortletEntity> portletEntitiesByUser = this.jpaPortletEntityDao.getPortletEntitiesForUser(1);
assertEquals(Collections.singleton(portEnt1), portletEntitiesByUser);
//Try deleting whole tree
portDef1 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef1.getPortletDefinitionId());
portDef1.getPortletPreferences().getPortletPreferences().add(new PortletPreferenceImpl("defpref1", false, "dpv1", "dpv2"));
this.jpaPortletDefinitionDao.updatePortletDefinition(portDef1);
this.checkPoint();
portEnt1 = this.jpaPortletEntityDao.getPortletEntity(portEnt1.getPortletEntityId());
portEnt1.getPortletPreferences().getPortletPreferences().add(new PortletPreferenceImpl("entpref1", false, "epv1", "epv2"));
this.jpaPortletEntityDao.updatePortletEntity(portEnt1);
this.checkPoint();
final IChannelDefinition chanDef2 = this.jpaChannelDefinitionDao.getChannelDefinition(chanDef1.getId());
this.jpaChannelDefinitionDao.deleteChannelDefinition(chanDef2);
this.checkPoint();
final Set<IPortletEntity> portletEntities2 = this.jpaPortletEntityDao.getPortletEntities(portDef1.getPortletDefinitionId());