| 1 |
/*
|
| 2 |
* Copyright 2004 The Apache Software Foundation
|
| 3 |
*
|
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
* you may not use this file except in compliance with the License.
|
| 6 |
* You may obtain a copy of the License at
|
| 7 |
*
|
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
*
|
| 10 |
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
* See the License for the specific language governing permissions and
|
| 14 |
* limitations under the License.
|
| 15 |
*
|
| 16 |
*/
|
| 17 |
package org.apache.directory.shared.ldap.name;
|
| 18 |
|
| 19 |
|
| 20 |
import javax.naming.InvalidNameException;
|
| 21 |
import javax.naming.NamingException;
|
| 22 |
|
| 23 |
import junit.framework.TestCase;
|
| 24 |
|
| 25 |
|
| 26 |
/**
|
| 27 |
* Testcase devised specifically for DIRSERVER-584.
|
| 28 |
*
|
| 29 |
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
|
| 30 |
* @version $Rev$
|
| 31 |
* @see <a href="https://issues.apache.org/jira/browse/DIRSERVER-584">DIRSERVER-584</a>
|
| 32 |
*/
|
| 33 |
public class DnParserDIRSERVER_584_Test extends TestCase
|
| 34 |
{
|
| 35 |
static DnParser parser;
|
| 36 |
|
| 37 |
|
| 38 |
public static DnParser getParser() throws NamingException
|
| 39 |
{
|
| 40 |
if ( parser == null )
|
| 41 |
{
|
| 42 |
parser = new DnParser();
|
| 43 |
}
|
| 44 |
|
| 45 |
return parser;
|
| 46 |
}
|
| 47 |
|
| 48 |
|
| 49 |
/**
|
| 50 |
* Need this testa() to run first to mess up the state of the static parser.
|
| 51 |
*/
|
| 52 |
public void testa() throws Exception
|
| 53 |
{
|
| 54 |
DnParser parser = getParser();
|
| 55 |
|
| 56 |
try
|
| 57 |
{
|
| 58 |
parser.parse( "ou=test=testing" );
|
| 59 |
fail( "should never get here" );
|
| 60 |
}
|
| 61 |
catch ( InvalidNameException e )
|
| 62 |
{
|
| 63 |
}
|
| 64 |
}
|
| 65 |
|
| 66 |
|
| 67 |
/**
|
| 68 |
* Need this testb() to run second to use the mess up static parser. This
|
| 69 |
* test should succeed but fails.
|
| 70 |
*/
|
| 71 |
public void testb() throws Exception
|
| 72 |
{
|
| 73 |
DnParser parser = getParser();
|
| 74 |
parser.parse( "ou=system" );
|
| 75 |
}
|
| 76 |
}
|