Package javax.management.relation

Examples of javax.management.relation.RoleInfo


   /**
    * Test create relation type errors
    */
   public void testAddRelationTypeErrors() throws Exception
   {
      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      RelationService rs = null;
      RelationTypeSupport rtsupp = null;

      // Null relation type
      boolean caught = false;
      try
      {
         roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
         roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
         roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
         rs = new RelationService(true);
         rs.addRelationType(null);
      }
      catch (IllegalArgumentException e)
View Full Code Here


   /**
    * Test create relation type, getRoleInfo and getRoleInfos
    */
   public void testCreationRelationType() throws Exception
   {
      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      RelationService rs = null;
      ArrayList result = null;
      RoleInfo result1 = null;
      RoleInfo result2 = null;
      roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
      roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
      roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
      rs = new RelationService(true);
      rs.createRelationType("RelationTypeName", roleInfos);
      result = (ArrayList) rs.getRoleInfos("RelationTypeName");
      result1 = rs.getRoleInfo("RelationTypeName", "roleInfo1");
      result2 = rs.getRoleInfo("RelationTypeName", "roleInfo2");

      // Check the roleInfos
      assertEquals(2, result.size());
      assertEquals(roleInfo1.toString(), result1.toString());
      assertEquals(roleInfo2.toString(), result2.toString());
   }
View Full Code Here

   /**
    * Test create relation type errors
    */
   public void testCreateRelationTypeErrors() throws Exception
   {
      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      RelationService rs = null;

      // Null relation type name
      boolean caught = false;
      try
      {
         roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
         roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
         roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
         rs = new RelationService(true);
         rs.createRelationType(null, roleInfos);
      }
      catch (IllegalArgumentException e)
View Full Code Here

   /**
    * Test getRoleInfo errors
    */
   public void testGetRoleInfoErrors() throws Exception
   {
      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      RelationService rs = null;
      roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
      roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
      roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
      rs = new RelationService(true);
      rs.createRelationType("RelationTypeName", roleInfos);

      boolean caught = false;
View Full Code Here

   /**
    * Test getRoleInfos errors
    */
   public void testGetRoleInfosErrors() throws Exception
   {
      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      RelationService rs = null;
      roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
      roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
      roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
      rs = new RelationService(true);
      rs.createRelationType("RelationTypeName", roleInfos);

      boolean caught = false;
View Full Code Here

   public void testGetAllRelationTypeNames() throws Exception
   {
      RelationService rs = new RelationService(true);
      assertEquals(0, rs.getAllRelationTypeNames().size());

      RoleInfo roleInfo1 = null;
      RoleInfo roleInfo2 = null;
      RoleInfo[] roleInfos = null;
      roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
      roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
      roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
      rs.createRelationType("name1", roleInfos);
      rs.createRelationType("name2", roleInfos);
      rs.createRelationType("name3", roleInfos);
View Full Code Here

      try
      {
         RelationService rs = new RelationService(true);
         assertEquals(0, rs.getAllRelationTypeNames().size());

         RoleInfo roleInfo1 = null;
         RoleInfo roleInfo2 = null;
         RoleInfo[] roleInfos = null;
         ObjectName name = new ObjectName("test:type = rs");
         server.registerMBean(rs, name);
         roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
         roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
         roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
         rs.createRelationType("name1", roleInfos);
         rs.createRelationType("name2", roleInfos);
         rs.createRelationType("name3", roleInfos);
         rs.removeRelationType("name3");
View Full Code Here

   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      try
      {
         RelationService rs = null;
         RoleInfo roleInfo1 = null;
         RoleInfo roleInfo2 = null;
         RoleInfo[] roleInfos = null;
         rs = new RelationService(true);
         roleInfo1 = new RoleInfo("roleInfo1", Trivial.class.getName());
         roleInfo2 = new RoleInfo("roleInfo2", Trivial.class.getName());
         roleInfos = new RoleInfo[] { roleInfo1, roleInfo2 };
         rs.createRelationType("name1", roleInfos);

         boolean caught = false;
         try
View Full Code Here

   private RoleInfo createRoleInfo(String name, Class mbean,
                                   boolean read, boolean write,
                                   int min, int max)
   {
      RoleInfo result = null;
      try
      {
         result = new RoleInfo(name, mbean.getName(), read, write, min, max, "");
      }
      catch(Exception e)
      {
         fail(e.toString());
      }
View Full Code Here

      Iterator iterator = resolved.iterator();
      while (iterator.hasNext())
      {
         Role role = (Role) iterator.next();
         String roleName = role.getRoleName();
         RoleInfo info = (RoleInfo) infos.get(roleName);
         if (info == null)
            fail("unknown role " + roleName);
         if (info.isReadable() == false)
            fail("role should not be readable " + roleName);
         Role original = removeRole(copy, roleName);
         compareListOfObjectNames(original.getRoleValue(), role.getRoleValue());
      }

      iterator = copy.iterator();
      while (iterator.hasNext())
      {
         Role role = (Role) iterator.next();
         String roleName = role.getRoleName();
         RoleInfo info = (RoleInfo) infos.get(roleName);
         if (info.isReadable() == true)
            fail("missing role " + roleName);
      }
   }
View Full Code Here

TOP

Related Classes of javax.management.relation.RoleInfo

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.