Package javax.management.relation

Examples of javax.management.relation.Role


      if (Constants.QNAME_LITERAL_ITEM.getLocalPart().equals(hint)) roleValue.add(value);
   }

   protected Object createObject() throws SAXException
   {
      return new Role(roleName, roleValue);
   }
View Full Code Here


   public void serialize(QName name, Attributes attributes, Object value,
                         SerializationContext context)
           throws IOException
   {
      Role role = (Role)value;
      context.startElement(name, attributes);
      context.serialize(ROLE_NAME_QNAME, null, role.getRoleName());
      for (Iterator i = role.getRoleValue().iterator(); i.hasNext();)
      {
         ObjectName on = (ObjectName)i.next();
         context.serialize(Constants.QNAME_LITERAL_ITEM, null, on);
      }
      context.endElement();
View Full Code Here

   {
      RoleList list = (RoleList)value;
      context.startElement(name, attributes);
      for (Iterator i = list.iterator(); i.hasNext();)
      {
         Role item = (Role)i.next();
         context.serialize(Constants.QNAME_LITERAL_ITEM, null, item);
      }
      context.endElement();
   }
View Full Code Here

   public void testGetRoleValue_ListHasElements() throws Exception
   {
      List values = new ArrayList();
      values.add(new ObjectName("domain:name=test"));
      Role role = new Role("Test Role", values);
      assertEquals(1, role.getRoleValue().size());
   }
View Full Code Here

      ///////////////// validate querying roles for relationId2(added second) returns the correct roles ////////////////////////////////
      RoleResult result1 = m_relationService.getAllRoles("relationID2");
      RoleList actual1 = result1.getRoles();
      // we have to do this as role does not have an equals or hashcode, must check if it is added it will break compatibility!!!!
      final Role role = (Role)roleList1.get(0);
      boolean success = false;
      for (Iterator iterator = actual1.iterator(); iterator.hasNext();)
      {
         Role role1 = (Role)iterator.next();
         String roleName = role1.getRoleName();
         if (roleName.equals(role.getRoleName())) success = true;
      }
      assertTrue(success);

      ///////////////////// validate querying roles for relaionID (added first) returns the expected roles ///////////////////////////////
      RoleResult result = m_relationService.getAllRoles("relationID");
      RoleList actual = result.getRoles();

      final Role role2 = (Role)roleList.get(0);
      boolean success2 = false;
      for (Iterator iterator = actual.iterator(); iterator.hasNext();)
      {
         Role role1 = (Role)iterator.next();
         String roleName = role1.getRoleName();
         if (roleName.equals(role2.getRoleName())) success2 = true;
      }
      assertTrue(success2);

      //assertTrue(roleList.contains(actual.get(0)));
View Full Code Here

                                   String roleName,
                                   RoleList roleList)
   {
      ArrayList roleValue = new ArrayList();
      roleValue.add(mbeanObjectName);
      Role role = new Role(roleName, roleValue);
      roleList.add(role);
      return roleList;
   }
View Full Code Here

   public void testRoleListCopyCtor() throws Exception
   {
      registerRelationService(true);
      registerMBeans();
      RoleList rl = new RoleList();
      rl.add(new Role("romeo", new ArrayList()));
      rl.add(new Role("juliet", new ArrayList()));
      RoleList rlcopy = new RoleList(rl);
      assertTrue("Bogus copy", rl.equals(rlcopy));

      try
      {
View Full Code Here

   public void testUpdateRoleMap() throws Exception
   {
      List roleValue = new ArrayList();
      roleValue.add(new ObjectName("domain:type=SimpleStandard_2"));
      Role role = new Role("myTestRoleName", roleValue);

      String relationID = "myTestRelation";
      setUpRelationServiceForQueryTesting(relationID, new ObjectName("domain:type=testType"));

      m_relationService.updateRoleMap("domain:type=SimpleStandard_1", role, new ArrayList());
View Full Code Here

      RoleList roleList = new RoleList();
      ArrayList values = new ArrayList();
      values.add(targetObjectName); //our test target
      values.add(mbeanObjectName2);

      roleList.add(new Role("roleName1", values));

      //create first referencing relation (to meanObjectName1);
      m_relationService.createRelation("relationID1", "relationType1", roleList);

      roleList = new RoleList();
      values = new ArrayList();
      values.add(targetObjectName); //our test target
      values.add(mbeanObjectName3);
      roleList.add(new Role("roleName1", values));
      roleList.add(new Role("roleName2", values));

      //create second referencing relation (to meanObjectName1);
      m_relationService.createRelation("relationID2", "relationType1", roleList);

      Map result = m_relationService.findReferencingRelations(targetObjectName, null, null); //our test target should have 2 references by now....
View Full Code Here

      if (infos1.size() != infos2.size()) throw new RuntimeException();
   }

   public void compareRole(Object o1, Object o2)
   {
      Role r1 = (Role)o1;
      Role r2 = (Role)o2;

      if (!r1.getRoleName().equals(r2.getRoleName())) throw new RuntimeException();
      if (!r1.getRoleValue().equals(r2.getRoleValue())) throw new RuntimeException();
   }
View Full Code Here

TOP

Related Classes of javax.management.relation.Role

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.