@Test public void testGetXmlOneUserNoRoles() { DataSourceAclModel model = new DataSourceAclModel(); model.addUser("testUser"); String xml = model.toXml(); assertTrue( xml.contains( " <aces> <recipient>testUser</recipient> <recipientType>0</recipientType>" + " <permissions>4</permissions> <modifiable>false</modifiable> </aces>")); }
@Test public void testGetXmlMultipleRolesNoUsers() { DataSourceAclModel model = new DataSourceAclModel(); model.addRole("testRole"); model.addRole("testRole2"); String xml = model.toXml(); assertTrue( xml.contains( " <aces> <recipient>testRole</recipient> <recipientType>1</recipientType>" + " <permissions>4</permissions> <modifiable>false</modifiable> </aces>")); assertTrue( xml.contains( " <aces> <recipient>testRole2</recipient> <recipientType>1</recipientType>" + " <permissions>4</permissions> <modifiable>false</modifiable> </aces>")); }
@Test public void testGetXmlNoUsersOrRoles() { DataSourceAclModel model = new DataSourceAclModel(); assertNull(model.toXml()); }