{
ObjectName service = createRelationService("test:type=service", server);
createRelationTypeC(service);
createRolesC(server);
createRolesCX(server);
RelationSupport support = null;
ObjectName on = null;
Listener listener = new Listener(RelationNotification.RELATION_MBEAN_UPDATE);
try
{
support = new RelationSupport("id1", service, server,
"relationTypeC", rolesC);
addRelation(server, service, support, "test:type=support1");
server.addNotificationListener(service, listener, null, null);
support.setRole(roleCX2);
on = new ObjectName("test:type=support1");
}
catch(Exception e)
{
fail(e.toString());
}
RoleList shouldBe = new RoleList();
shouldBe.add(roleC1);
shouldBe.add(roleCX2);
compare(shouldBe, support.retrieveAllRoles());
RelationNotification rn = listener.check(1);
assertEquals(new ArrayList(), rn.getMBeansToUnregister());
assertEquals(roleCX2.getRoleValue(), rn.getNewRoleValue());
assertEquals(on, rn.getObjectName());
assertEquals(roleC2.getRoleValue(), rn.getOldRoleValue());