ObjectNameQueryImplTestpublic class ObjectNameQueryImplTest extends TestCase
Fields Summary |
---|
static final Set | EmptySet | static final String[] | EmptyStrings |
Methods Summary |
---|
static javax.management.ObjectName | createName(java.lang.String nameString)
ObjectName name = null;
try
{
name = new ObjectName( nameString );
}
catch( Exception e )
{
assert( false );
}
return( name );
| static java.util.Set | createSet(javax.management.ObjectName name)
final HashSet s = new HashSet();
s.add( name );
return( s );
| static java.util.Set | createSet(javax.management.ObjectName[] names)
final HashSet s = new HashSet();
for( int i = 0; i < names.length; ++i )
{
s.add( names[ i ] );
}
return( s );
| public void | testCreation()
new ObjectNameQueryImpl();
| public void | testEmptySet()
final ObjectNameQuery q = new ObjectNameQueryImpl();
assertEquals( 0, q.matchAny( EmptySet, null, null ).size() );
assertEquals( 0, q.matchAny( EmptySet, EmptyStrings, EmptyStrings ).size() );
assertEquals( 0, q.matchAny( EmptySet, null, EmptyStrings ).size() );
assertEquals( 0, q.matchAny( EmptySet, EmptyStrings, null ).size() );
assertEquals( 0, q.matchAll( EmptySet, null, null ).size() );
assertEquals( 0, q.matchAll( EmptySet, EmptyStrings, EmptyStrings ).size() );
assertEquals( 0, q.matchAll( EmptySet, null, EmptyStrings ).size() );
assertEquals( 0, q.matchAll( EmptySet, EmptyStrings, null ).size() );
| public void | testSingleItem()
final ObjectName name1 = createName( ":name=test,type=test" );
final Set testSet = createSet( name1 );
final ObjectNameQuery q = new ObjectNameQueryImpl();
assertEquals( 1, q.matchAny( testSet,
null,
null ).size() );
assertEquals( 1, q.matchAny( testSet,
new String [] { "type" },
new String [] { "test" } ).size() );
assertEquals( 1, q.matchAny( testSet,
new String [] { "type" },
null ).size() );
assertEquals( 1, q.matchAny( testSet,
null,
new String [] { "test" } ).size() );
assertEquals( 1, q.matchAny( testSet,
new String [] { "t.*" },
new String [] { ".*e.*" } ).size() );
assertEquals( 1, q.matchAny( testSet,
null,
new String [] { ".*e.*" } ).size() );
assertEquals( 0, q.matchAny( testSet, EmptyStrings, EmptyStrings ).size() );
assertEquals( 0, q.matchAny( testSet, null, EmptyStrings ).size() );
assertEquals( 0, q.matchAny( testSet, EmptyStrings, null ).size() );
|
|