public void testAddPrivilege()
throws Exception
{
AuthorizationManager authzManager = this.getAuthorizationManager();
Privilege privilege = new Privilege();
privilege.addProperty("foo1", "bar2");
privilege.addProperty("bar1", "foo2");
privilege.setId("new-priv");
privilege.setName("new-name");
privilege.setDescription("new-description");
privilege.setReadOnly(true);
privilege.setType("TEST");
authzManager.addPrivilege(privilege);
CPrivilege secPriv = this.getConfigurationManager().readPrivilege(privilege.getId());
Assert.assertEquals(privilege.getId(), secPriv.getId());
Assert.assertEquals(privilege.getName(), secPriv.getName());
Assert.assertEquals(privilege.getDescription(), secPriv.getDescription());
Assert.assertEquals(privilege.getType(), secPriv.getType());
Assert.assertEquals(privilege.getProperties().size(), secPriv.getProperties().size());
Map<String, String> props = this.getPropertyMap(secPriv);
Assert.assertEquals("bar2", props.get("foo1"));
Assert.assertEquals("foo2", props.get("bar1"));