Package javax.management.relation

Examples of javax.management.relation.RoleList


    setUpRoles();

    ArrayList roles = new ArrayList();
    roles.add(role1);
    roles.add(role2);
    RoleList full = new RoleList(roles);
    RoleList copy = null;

    try
    {
      // Serialize it
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(full);
   
      // Deserialize it
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bais);
      copy = (RoleList) ois.readObject();
    }
    catch (IOException ioe)
    {
      fail(ioe.toString());
    }
    catch (ClassNotFoundException cnfe)
    {
      fail(cnfe.toString());
    }

    // Did it work?
    assertEquals(2, copy.size());
    assertEquals(role1.toString(), copy.get(0).toString());
    assertEquals(role2.toString(), copy.get(1).toString());
    Iterator iterator = copy.iterator();
    assertEquals(role1.toString(), iterator.next().toString());
    assertEquals(role2.toString(), iterator.next().toString());
  }
View Full Code Here


            fail("createRelation allows invalid relation type name");
       
         caught = false;
         try
         {
            RoleList roleList = new RoleList();
            roleList.add(roleC1);
            roleList.add(roleB1);
            rs.createRelation("relationId", "relationTypeC", roleList);
         }
         catch(RoleNotFoundException e)
         {
            caught = true;
         }
         if (caught == false)
            fail("createRelation allows invalid role name");

         caught = false;
         try
         {
            RoleList roleList = new RoleList();
            roleList.add(roleC1);
            roleList.add(roleCZ2);
            rs.createRelation("relationId", "relationTypeC", roleList);
         }
         catch(InvalidRoleValueException e)
         {
            caught = true;
         }
         if (caught == false)
            fail("createRelation allows a role below the minimum");
       
         caught = false;
         try
         {
            RoleList roleList = new RoleList();
            roleList.add(roleC1);
            roleList.add(roleCZZ);
            rs.createRelation("relationId", "relationTypeC", roleList);
         }
         catch(InvalidRoleValueException e)
         {
            caught = true;
         }
         if (caught == false)
            fail("createRelation allows a role above the maximum");
       
         caught = false;
         try
         {
            RoleList roleList = new RoleList();
            roleList.add(roleC1);
            roleList.add(roleCZZZ);
            rs.createRelation("relationId", "relationTypeC", roleList);
         }
         catch(InvalidRoleValueException e)
         {
            caught = true;
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);

         boolean caught = false;
         try
         {
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);

         boolean caught = false;
         try
         {
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);

         boolean caught = false;
         try
         {
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);

         boolean caught = false;
         try
         {
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);

         boolean caught = false;
         try
         {
View Full Code Here

         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());
View Full Code Here

      {
         ObjectName service = createRelationService("test:type=service", server);
         RelationService rs = (RelationService) services.get(service);
         createRelationTypeC(service);
         createRolesC(server);
         RoleList roles = new RoleList();
         roles.add(roleC1);
         roles.add(roleC2);
         rs.createRelation("relationId", "relationTypeC", roles);
         String[] roleNames = new String[] {"roleC1"};

         boolean caught = false;
         try
View Full Code Here

            caught = true;
         }
         if (caught == false)
            fail("sendRoleUpdateNotification allows null relation id");

         RoleList roleList = new RoleList();
         roleList.add(roleB1);
         roleList.add(roleB2);
         rs.createRelation("relationId", "relationTypeB", roleList);

         caught = false;
         try
         {
View Full Code Here

TOP

Related Classes of javax.management.relation.RoleList

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.