FileDocCategorySizeDatePackage
DottedNameRegistryTest.javaAPI DocGlassfish v2 API5551Fri May 04 22:24:16 BST 2007com.sun.enterprise.admin.dottedname

DottedNameRegistryTest

public class DottedNameRegistryTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
DottedNameRegistry1To1ImplcreateNew()

		return( new DottedNameRegistry1To1Impl() );
	
public voidtest1To1Mapping()

		final DottedNameRegistry1To1Impl	registry	= createNew();
		final String				dottedName1	= "a.b.c";
		final String				dottedName2	= "a.b.c.d";
		final ObjectName			objectName	= new ObjectName( ":name=test" );
		
		registry.add( dottedName1, objectName );
		registry.add( dottedName2, objectName );
		
		assertEquals( 1, registry.allDottedNameStrings().size() );
		assertEquals( dottedName2, (String)registry.allDottedNameStrings().iterator().next() );
	
public voidtestAdd()

		final DottedNameRegistry1To1Impl	registry	= createNew();
		final String				dottedName	= "a.b.c";
		final ObjectName			objectName	= new ObjectName( ":name=test" );
		
		registry.add( dottedName, objectName );
		
		assertEquals( objectName, registry.dottedNameToObjectName( dottedName ) );
		assertEquals( dottedName, registry.objectNameToDottedName( objectName ) );
		
		assertEquals( 1, registry.allDottedNameStrings().size() );
		assertEquals( 1, registry.allObjectNames().size() );
		assertEquals( dottedName, (String)registry.allDottedNameStrings().iterator().next() );
	
public voidtestCreation()

		createNew();
	
public voidtestNewIsEmpty()

		assertEquals( 0, createNew().allDottedNameStrings().size()  );
	
public voidtestRemove()

		final DottedNameRegistry1To1Impl	registry	= createNew();
		final String				dottedName	= "a.b.c";
		final ObjectName			objectName	= new ObjectName( ":name=test" );
		
		registry.add( dottedName, objectName );
		registry.remove( dottedName, objectName );
		
		assertEquals( 0, registry.allDottedNameStrings().size() );
		assertEquals( 0, registry.allObjectNames().size() );
	
public voidtestReplaceWorks()

		final DottedNameRegistry1To1Impl	registry	= createNew();
		final String				dottedName1	= "a.b.c";
		final String				dottedName2	= "a.b.c.d";
		final ObjectName			objectName	= new ObjectName( ":name=test" );
		
		registry.add( dottedName1, objectName );
		registry.add( dottedName2, objectName );
		assertEquals( dottedName2, registry.objectNameToDottedName( objectName ) );