Package javax.management.relation

Examples of javax.management.relation.RoleResult


  {
    MBeanServer server = createMBeanServer();
    ObjectName service = createRelationService("test:type=service", server);
    createRelationTypeB(service);
    createRolesB(server);
    RoleResult result = null;
    try
    {
      RelationSupport support = new RelationSupport("id", service, server,
                                  "relationTypeB", rolesB);
      addRelation(server, service, support, "test:type=support");
View Full Code Here


  {
    MBeanServer server = createMBeanServer();
    ObjectName service = createRelationService("test:type=service", server);
    createRelationTypeC(service);
    createRolesC(server);
    RoleResult result = null;
    RelationSupport support = null;
    try
    {
      support = new RelationSupport("id", service, server,
                                  "relationTypeC", rolesC);
      addRelation(server, service, support, "test:type=support");
      result = support.getRoles(new String[] {"roleC1", "roleC2" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    checkResult(result, roleInfosC, rolesC);

    try
    {
      result = support.getRoles(new String[] {"roleC1" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    RoleList resolved = result.getRoles();
    assertEquals(1, resolved.size());
    assertEquals(0, result.getRolesUnresolved().size());
    compare(getRole(rolesC, "roleC1"), (Role) resolved.get(0));

    try
    {
      result = support.getRoles(new String[] {"roleC2" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    RoleUnresolvedList unresolved = result.getRolesUnresolved();
    assertEquals(0, result.getRoles().size());
    assertEquals(1, unresolved.size());
    assertEquals("roleC2", ((RoleUnresolved)unresolved.get(0)).getRoleName());
  }
View Full Code Here

      try
      {
         ObjectName service = createRelationService("test:type=service", server);
         createRelationTypeB(service);
         createRolesB(server);
         RoleResult result = null;
         RelationSupport support = new RelationSupport("id", service, server,
                                         "relationTypeB", rolesB);
         addRelation(server, service, support, "test:type=support");
         result = support.getAllRoles();
         checkResult(result, roleInfosB, rolesB);
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleResult result = null;
         RelationSupport support = null;
         support = new RelationSupport("id", service, server,
                                       "relationTypeC", rolesC);
         addRelation(server, service, support, "test:type=support");
         result = rs.getRoles("id", new String[] {"roleC1", "roleC2" });
         checkResult(result, roleInfosC, rolesC);

         result = rs.getRoles("id", new String[] {"roleC1" });
         RoleList resolved = result.getRoles();
         assertEquals(1, resolved.size());
         assertEquals(0, result.getRolesUnresolved().size());
         compare(getRole(rolesC, "roleC1"), (Role) resolved.get(0));

         result = rs.getRoles("id", new String[] {"roleC2" });
         RoleUnresolvedList unresolved = result.getRolesUnresolved();
         assertEquals(0, result.getRoles().size());
         assertEquals(1, unresolved.size());
         assertEquals("roleC2", ((RoleUnresolved)unresolved.get(0)).getRoleName());
      }
      finally
      {
View Full Code Here

   public void serialize(QName name, Attributes attributes, Object value,
                         SerializationContext context)
           throws IOException
   {
      RoleResult role = (RoleResult)value;
      context.startElement(name, attributes);
      context.serialize(ROLE_LIST_QNAME, null, role.getRoles());
      context.serialize(ROLE_UNRESOLVED_LIST_QNAME, null, role.getRolesUnresolved());
      context.endElement();
   }
View Full Code Here

      // retrieve all roles
      try
      {
         Object[] params = {relationId};
         String[] signature = {"java.lang.String"};
         RoleResult roleResult = (RoleResult)(m_server.invoke(m_relationObjectName, "getAllRoles", params, signature));
         RoleList roleList = roleResult.getRoles();
         for (Iterator i = roleList.iterator(); i.hasNext();)
         {
            Role currentRole = (Role)i.next();
            System.out.println(">>>> role name: " + currentRole.getRoleName());
            System.out.println(">>>> role values: " + currentRole.getRoleValue().toString());
         }
         System.out.println("No unresolved Roles roleUnresolved size: " + roleResult.getRolesUnresolved().size());
      }
      catch (Exception ex)
      {
         logger.error("Exception printing the results from relationId: " + relationId);
         System.out.println("Printing the Exception message to validate exception: " + ex.getMessage());
View Full Code Here

                              new Object[]{relationId7, m_relationServiceObjectName, relationTypeName2, roleList1},
                              new String[]{"java.lang.String", "javax.management.ObjectName", "java.lang.String", "javax.management.relation.RoleList"});
         m_proxy.addRelation(relMBeanObjName1);
         System.out.println("------------------------------------------- done --------------------------------------------");
         waitForEnterPressed();
         RoleResult result = m_proxy.getAllRoles(relationId1);
         Iterator i = result.getRoles().iterator();
         while (i.hasNext())
         {
            Role r = (Role)i.next();
            List l = r.getRoleValue();
            Iterator j = l.iterator();
            while (j.hasNext())
            {
               ObjectName objName = (ObjectName)j.next();
               System.out.println("ObjectName: " + objName.getCanonicalName() + " for relationId: " + relationId1);
            }
         }

         RoleResult result2 = m_proxy.getAllRoles(relationId2);
         Iterator i2 = result2.getRoles().iterator();
         while (i2.hasNext())
         {
            Role r = (Role)i2.next();
            List l = r.getRoleValue();
            Iterator j = l.iterator();
View Full Code Here

      return new RoleNotFoundException("RoleNotFoundException");
   }

   public RoleResult createRoleResult() throws MalformedObjectNameException
   {
      return new RoleResult(createRoleList(), createRoleUnresolvedList());
   }
View Full Code Here

  {
    MBeanServer server = createMBeanServer();
    ObjectName service = createRelationService("test:type=service", server);
    createRelationTypeB(service);
    createRolesB(server);
    RoleResult result = null;
    try
    {
      RelationSupport support = new RelationSupport("id", service, server,
                                  "relationTypeB", rolesB);
      addRelation(server, service, support, "test:type=support");
View Full Code Here

  {
    MBeanServer server = createMBeanServer();
    ObjectName service = createRelationService("test:type=service", server);
    createRelationTypeC(service);
    createRolesC(server);
    RoleResult result = null;
    RelationSupport support = null;
    try
    {
      support = new RelationSupport("id", service, server,
                                  "relationTypeC", rolesC);
      addRelation(server, service, support, "test:type=support");
      result = support.getRoles(new String[] {"roleC1", "roleC2" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    checkResult(result, roleInfosC, rolesC);

    try
    {
      result = support.getRoles(new String[] {"roleC1" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    RoleList resolved = result.getRoles();
    assertEquals(1, resolved.size());
    assertEquals(0, result.getRolesUnresolved().size());
    compare(getRole(rolesC, "roleC1"), (Role) resolved.get(0));

    try
    {
      result = support.getRoles(new String[] {"roleC2" });
    }
    catch(Exception e)
    {
      fail(e.toString());
    }
    RoleUnresolvedList unresolved = result.getRolesUnresolved();
    assertEquals(0, result.getRoles().size());
    assertEquals(1, unresolved.size());
    assertEquals("roleC2", ((RoleUnresolved)unresolved.get(0)).getRoleName());
  }
View Full Code Here

TOP

Related Classes of javax.management.relation.RoleResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.