@Test public void testGetXmlMultipleUsersNoRoles() { DataSourceAclModel model = new DataSourceAclModel(); model.addUser("testUser"); model.addUser("testUser2"); String xml = model.toXml(); assertTrue( xml.contains( " <aces> <recipient>testUser</recipient> <recipientType>0</recipientType>" + " <permissions>4</permissions> <modifiable>false</modifiable> </aces>")); assertTrue( xml.contains( " <aces> <recipient>testUser2</recipient> <recipientType>0</recipientType>" + " <permissions>4</permissions> <modifiable>false</modifiable> </aces>")); }
@Test public void testCreateAndAddUserRoles() { DataSourceAclModel model = new DataSourceAclModel(); assertNull(model.getRoles()); assertNull(model.getUsers()); model.addRole("testRole"); model.addUser("testUser"); assertEquals("testRole", model.getRoles().get(0)); assertEquals("testUser", model.getUsers().get(0)); model.setUsers(Arrays.asList("otherTestUser")); model.setRoles(Arrays.asList("otherTestRole")); assertEquals("otherTestRole", model.getRoles().get(0)); assertEquals("otherTestUser", model.getUsers().get(0)); }