Package com.sun.enterprise.management.offline

Examples of com.sun.enterprise.management.offline.OfflineDottedNamesRegistry


    }

        private OfflineDottedNamesRegistry
    create()
    {
        return new OfflineDottedNamesRegistry();
    }
View Full Code Here


 
 
    public void
  testIllegalAdd()
  {
      final OfflineDottedNamesRegistry    reg = create();
     
      try
      {
          reg.addMapping( null, "foo", dummySet() );
          assert false : "Expected exception adding null ObjectName";
      }
      catch ( Exception e )
      {
      }
     
      try
      {
          reg.addMapping( createObjectName( "XXX", "ZZZ" ), null, dummySet() );
          assert false : "Expected exception adding null prefix";
      }
      catch ( Exception e )
      {
      }
     
      try
      {
          reg.addMapping( createObjectName( "XXX", "ZZZ" ), "foo", null );
          assert false : "Expected exception adding null attributes";
      }
      catch ( Exception e )
      {
      }
     
      try
      {
          reg.addMapping( createObjectName( "XXX", "ZZZ" ), "foo", dummySet() );
          // try to add again
          reg.addMapping( createObjectName( "XXX", "ZZZ" ), "foo", dummySet() );
          assert false : "Expected exception adding same ObjectName";
      }
      catch ( Exception e )
      {
      }
View Full Code Here

 
 
    public void
  testAddRemove()
  {
      final OfflineDottedNamesRegistry    reg = create();
     
      final int ITER  = 1000;
     
      final Set<String>   attrs   = dummySet();
      final ObjectName[]  objectNames = new ObjectName[ ITER ];
      final String[]      prefixes = new String[ ITER ];
     
      for( int i = 0; i < ITER; ++i )
      {
          final String prefix = "foo" + i;
          final ObjectName objectName = createObjectName( "test" + i, "" + i );

          objectNames[ i ]    = objectName;
          prefixes[ i ]       = prefix;
         
          reg.addMapping( objectName, prefix, attrs );
          assert( reg.getPrefix( objectName ) ==  prefix );
          assert( reg.getObjectName( prefix ) == objectName );
          assert( reg.getLegalAttributes( objectName ).equals( attrs ) );
      }
     
      for( int i = 0; i < ITER; ++i )
      {
          final ObjectName    objectName  = objectNames[ i ];
          final String        prefix  = prefixes[ i ];
         
          assert( reg.getPrefix( objectName ) ==  prefix );
          assert( reg.getObjectName( prefix ) == objectName );
          assert( reg.getLegalAttributes( objectName ).equals( attrs ) );
         
          reg.removeMapping( objectName );
         
          assert( reg.getPrefix( objectName) == null );
          assert( reg.getObjectName( prefixes[ i ] ) == null );
          assert( reg.getLegalAttributes( objectName ) == null );
      }
  }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.management.offline.OfflineDottedNamesRegistry

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.