@Test public void testAddAndFindGroupByName() throws Exception { final Group createdGroup = groupDao.add(TestData.Group.getTestData()); TestData.Group.assertEqualsTestGroup(createdGroup); final Group retrievedGroup = groupDao.findByName(TestData.DIRECTORY_ID, TestData.Group.NAME); TestData.Group.assertEqualsTestGroup(retrievedGroup); }
@Test public void testAddAndStoreAttributesAndFindGroupWithAttributesByName() throws Exception { final Group createdGroup = groupDao.add(TestData.Group.getTestData()); TestData.Group.assertEqualsTestGroup(createdGroup); groupDao.storeAttributes(createdGroup, TestData.Attributes.getTestData()); final GroupWithAttributes retrievedGroup = groupDao.findByNameWithAttributes(TestData.DIRECTORY_ID, TestData.Group.NAME); TestData.Group.assertEqualsTestGroup(retrievedGroup); TestData.Attributes.assertEqualsTestData(retrievedGroup); }
@Test public void testUpdateGroup() throws Exception { final Group createdGroup = groupDao.add(TestData.Group.getTestData()); TestData.Group.assertEqualsTestGroup(createdGroup); final boolean updatedIsActive = false; final String updatedDescription = "updated Description"; groupDao.update( TestData.Group.getGroup( createdGroup.getName(), createdGroup.getDirectoryId(), updatedIsActive, updatedDescription, createdGroup.getType())); final Group updatedGroup = groupDao.findByName(TestData.DIRECTORY_ID, TestData.Group.NAME); assertEquals(TestData.Group.NAME, updatedGroup.getName()); assertEquals(TestData.DIRECTORY_ID, updatedGroup.getDirectoryId()); assertEquals(TestData.Group.TYPE, updatedGroup.getType()); assertEquals(updatedIsActive, updatedGroup.isActive()); assertEquals(updatedDescription, updatedGroup.getDescription()); }