| Chunk |
|---|
| Conflicting content |
|---|
import junit.framework.Assert; import junit.framework.TestCase; <<<<<<< HEAD import junit.framework.Assert; import junit.framework.TestCase; ======= >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import org.apache.directory.shared.asn1.codec.EncoderException; import org.apache.directory.shared.asn1.primitives.BitString; import org.apache.directory.shared.asn1.util.Asn1StringUtils; |
| Solution content |
|---|
import junit.framework.Assert; import junit.framework.TestCase; import org.apache.directory.shared.asn1.codec.EncoderException; import org.apache.directory.shared.asn1.primitives.BitString; import org.apache.directory.shared.asn1.util.Asn1StringUtils; |
| File |
|---|
| ValueTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
{
byte[] encoded = null;
int[] testedInt = new int[]
<<<<<<< HEAD
{ Integer.MIN_VALUE, -2147483647, -16777216, -16777215, -8388608, -8388607, -65536, -65535, -32768, -32767,
-256, -255, -128, -127, -1, 0, 1, 127, 128, 255, 256, 32767, 32768, 65535, 65536, 8388607, 8388608,
16777215, 16777216, Integer.MAX_VALUE };
=======
{
Integer.MIN_VALUE,
-2147483647,
-16777216,
-16777215,
-8388608,
-8388607,
-65536,
-65535,
-32768,
-32767,
-256,
-255,
-128,
-127,
-1,
0,
1,
127,
128,
255,
256,
32767,
32768,
65535,
65536,
8388607,
8388608,
16777215,
16777216,
Integer.MAX_VALUE };
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
for ( int i:testedInt )
{ |
| Solution content |
|---|
{
byte[] encoded = null;
int[] testedInt = new int[]
{
Integer.MIN_VALUE,
-2147483647,
-16777216,
-16777215,
-8388608,
-8388607,
-65536,
-65535,
-32768,
-32767,
-256,
-255,
-128,
-127,
-1,
0,
1,
127,
128,
255,
256,
32767,
32768,
65535,
65536,
8388607,
8388608,
16777215,
16777216,
Integer.MAX_VALUE };
for ( int i:testedInt )
{ |
| File |
|---|
| ValueTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Array initializer |
| Chunk |
|---|
| Conflicting content |
|---|
{
byte[] encoded = null;
int[] testedInt = new int[]
<<<<<<< HEAD
{ Integer.MIN_VALUE, -2147483647, -16777216, -16777215, -8388608, -8388607, -65536, -65535, -32768, -32767,
-256, -255, -128, -127, -1, 0, 1, 127, 128, 255, 256, 32767, 32768, 65535, 65536, 8388607, 8388608,
16777215, 16777216, Integer.MAX_VALUE };
=======
{
Integer.MIN_VALUE,
-2147483647,
-16777216,
-16777215,
-8388608,
-8388607,
-65536,
-65535,
-32768,
-32767,
-256,
-255,
-128,
-127,
-1, 0,
1,
127,
128,
255,
256,
32767,
32768,
65535,
65536,
8388607,
8388608,
16777215,
16777216,
Integer.MAX_VALUE };
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
for ( int i:testedInt )
{ |
| Solution content |
|---|
{
byte[] encoded = null;
int[] testedInt = new int[]
{
Integer.MIN_VALUE,
-2147483647,
-16777216,
-16777215,
-8388608,
-8388607,
-65536,
-65535,
-32768,
-32767,
-256,
-255,
-128,
-127,
-1, 0,
1,
127,
128,
255,
256,
32767,
32768,
65535,
65536,
8388607,
8388608,
16777215,
16777216,
Integer.MAX_VALUE };
for ( int i:testedInt )
{ |
| File |
|---|
| ValueTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Array initializer |
| Chunk |
|---|
| Conflicting content |
|---|
{
sb.append( '/' ).append( urlEncode( dn.toString(), false ) );
<<<<<<< HEAD
if ( ( attributes.size() != 0 )
=======
if ( attributes.size() != 0 || forceScopeRendering
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
|| ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) ||
( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) )
{ |
| Solution content |
|---|
{
sb.append( '/' ).append( urlEncode( dn.toString(), false ) );
if ( attributes.size() != 0 || forceScopeRendering
|| ( ( scope != SearchControls.OBJECT_SCOPE ) || ( filter != null ) ||
( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) )
{ |
| File |
|---|
| LdapURL.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
if ( filter != null )
{
<<<<<<< HEAD
for ( String key:extensions.keySet() )
{
if ( !isFirst )
{
sb.append( ',' );
}
else
{
isFirst = false;
}
sb.append( urlEncode( key, false ) ).append( '=' ).append(
urlEncode( extensions.get( key ), true ) );
}
=======
sb.append( urlEncode( filter, false ) );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) |
| Solution content |
|---|
if ( filter != null )
{
sb.append( urlEncode( filter, false ) );
}
if ( ( extensions.size() != 0 ) || ( criticalExtensions.size() != 0 ) ) |
| File |
|---|
| LdapURL.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
if ( extensions.size() != 0 )
{
<<<<<<< HEAD
if ( !isFirst )
=======
for ( String key:extensions.keySet() )
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
if ( !isFirst ) |
| Solution content |
|---|
if ( extensions.size() != 0 )
{
for ( String key:extensions.keySet() )
{
if ( !isFirst ) |
| File |
|---|
| LdapURL.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
=======
/**
* If set to true forces the toString method to render the scope
* regardless of optional nature. Use this when you want explicit
* search URL scope rendering.
*
* @param forceScopeRendering the forceScopeRendering to set
*/
public void setForceScopeRendering( boolean forceScopeRendering )
{
this.forceScopeRendering = forceScopeRendering;
}
/**
* If set to true forces the toString method to render the scope
* regardless of optional nature. Use this when you want explicit
* search URL scope rendering.
*
* @return the forceScopeRendering
*/
public boolean isForceScopeRendering()
{
return forceScopeRendering;
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
} |
| Solution content |
|---|
*/
}
}
/**
* If set to true forces the toString method to render the scope
* regardless of optional nature. Use this when you want explicit
* search URL scope rendering.
*
* @param forceScopeRendering the forceScopeRendering to set
public void setForceScopeRendering( boolean forceScopeRendering )
{
this.forceScopeRendering = forceScopeRendering;
}
/**
* If set to true forces the toString method to render the scope
* regardless of optional nature. Use this when you want explicit
* search URL scope rendering.
*
* @return the forceScopeRendering
*/
public boolean isForceScopeRendering()
{
return forceScopeRendering;
}
} |
| File |
|---|
| LdapURL.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
package org.apache.directory.shared.ldap.entry; <<<<<<< HEAD ======= import java.io.Externalizable; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import java.util.Iterator; import java.util.List; |
| Solution content |
|---|
package org.apache.directory.shared.ldap.entry; import java.io.Externalizable; import java.util.Iterator; import java.util.List; |
| File |
|---|
| Entry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
package org.apache.directory.shared.ldap.entry.client; <<<<<<< HEAD ======= import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; |
| Solution content |
|---|
package org.apache.directory.shared.ldap.entry.client; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; |
| File |
|---|
| DefaultClientAttribute.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public AndNode( List |
| Solution content |
|---|
*/
public AndNode( List |
| File |
|---|
| AndNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
=======
* @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "AssertionNode can't be part of a refinement" );
}
/**
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
* @see Object#hashCode()
* @return the instance's hash code
*/ |
| Solution content |
|---|
/**
* @see ExprNode#printRefinementToBuffer(StringBuilder)
*/
public StringBuilder printRefinementToBuffer( StringBuilder buf ) throws UnsupportedOperationException
{
throw new UnsupportedOperationException( "AssertionNode can't be part of a refinement" );
}
/**
* @see Object#hashCode()
* @return the instance's hash code
*/ |
| File |
|---|
| AssertionNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
* @param childList the child nodes under this branch node.
* @param assertionType the node's type
*/
<<<<<<< HEAD
protected BranchNode( List |
| Solution content |
|---|
* @param childList the child nodes under this branch node.
*/
protected BranchNode( AssertionType assertionType, List |
| File |
|---|
| BranchNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
else
{
this.children = childList;
<<<<<<< HEAD
=======
}
}
/**
* Creates a BranchNode using a logical operator and a list of children.
*
* @param assertionType the node's type
* @param childList the child nodes under this branch node.
*/
protected BranchNode( AssertionType assertionType, ExprNode... childList )
{
super( assertionType );
if ( null == children )
{
this.children = new ArrayList |
| Solution content |
|---|
else
{
this.children = childList;
}
}
/**
* Creates a BranchNode using a logical operator and a list of children.
*
* @param assertionType the node's type
* @param childList the child nodes under this branch node.
*/
protected BranchNode( AssertionType assertionType, ExprNode... childList )
{
super( assertionType );
if ( null == children )
{
this.children = new ArrayList |
| File |
|---|
| BranchNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method invocation |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
/**
* Creates a new emptyExtensibleNode object.
*
<<<<<<< HEAD
* @param attribute The attribute's ID for this node
=======
* @param attribute the attribute associated with this node
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
*/
public ExtensibleNode( String attribute )
{ |
| Solution content |
|---|
/**
* Creates a new emptyExtensibleNode object.
*
* @param attribute the attribute associated with this node
*/
public ExtensibleNode( String attribute )
{ |
| File |
|---|
| ExtensibleNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
{
return false;
}
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
return attribute.equals( ( ( LeafNode ) other ).getAttribute() );
}
} |
| Solution content |
|---|
{
return false;
}
return attribute.equals( ( ( LeafNode ) other ).getAttribute() );
}
} |
| File |
|---|
| LeafNode.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public OrNode( List |
| Solution content |
|---|
*/
public OrNode( List |
| File |
|---|
| OrNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
* @author Apache Directory Project * @version $Revision$ */ <<<<<<< HEAD public class SimpleNode extends LeafNode ======= public abstract class SimpleNode |
| Solution content |
|---|
* @author Apache Directory Project * @version $Revision$ */ public abstract class SimpleNode |
| File |
|---|
| SimpleNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Class signature |
| Chunk |
|---|
| Conflicting content |
|---|
/** the value */
protected Value |
| Solution content |
|---|
/** the value */
protected Value |
| File |
|---|
| SimpleNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
*
* @param attribute the attribute name
* @param value the value to test for
<<<<<<< HEAD
* @param assertionType the node's type
=======
* @param assertionType the type of assertion represented by this ExprNode
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
*/
protected SimpleNode( String attribute, Value |
| Solution content |
|---|
*
* @param attribute the attribute name
* @param value the value to test for
* @param assertionType the type of assertion represented by this ExprNode
*/
protected SimpleNode( String attribute, Value |
| File |
|---|
| SimpleNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
=======
* Pretty prints this expression node along with annotation information.
*
* TODO - perhaps this belong in some utility class?
*
* @param buf the buffer to print into
* @return the same buf argument returned for call chaining
*/
public StringBuilder printToBuffer( StringBuilder buf )
{
if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
{
buf.append( ":[" );
buf.append( getAnnotations().get( "count" ).toString() );
buf.append( "] " );
}
buf.append( ')' );
return buf;
}
/**
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
* @see ExprNode#printRefinementToBuffer(StringBuilder)
* @return The buffer in which the refinement has been appended
* @throws UnsupportedOperationException if this node isn't a part of a refinement. |
| Solution content |
|---|
/**
* Pretty prints this expression node along with annotation information.
*
* TODO - perhaps this belong in some utility class?
*
* @param buf the buffer to print into
* @return the same buf argument returned for call chaining
*/
public StringBuilder printToBuffer( StringBuilder buf )
{
if ( ( null != getAnnotations() ) && getAnnotations().containsKey( "count" ) )
{
buf.append( ":[" );
buf.append( getAnnotations().get( "count" ).toString() );
buf.append( "] " );
}
buf.append( ')' );
return buf;
}
/**
* @see ExprNode#printRefinementToBuffer(StringBuilder)
* @return The buffer in which the refinement has been appended
* @throws UnsupportedOperationException if this node isn't a part of a refinement. |
| File |
|---|
| SimpleNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
* Creates a new SubstringNode object without any value
*
* @param attribute the name of the attribute to substring assert
<<<<<<< HEAD
* @param attribute The attribute's ID
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
*/
public SubstringNode( String attribute )
{ |
| Solution content |
|---|
* Creates a new SubstringNode object without any value
*
* @param attribute the name of the attribute to substring assert
*/
public SubstringNode( String attribute )
{ |
| File |
|---|
| SubstringNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
*
* @param normalizer the normalizer to use for pattern component normalization
* @return the equivalent compiled regular expression
<<<<<<< HEAD
* @param normalizer The normalizer to use for the substring expressions
* @exception NamingException If the substring can't be normalized
* @exception PatternSyntaxException If the regexp is invalid
=======
* @throws NamingException if there are problems while normalizing
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
*/
public final Pattern getRegex( Normalizer normalizer ) throws NamingException
{ |
| Solution content |
|---|
*
* @param normalizer the normalizer to use for pattern component normalization
* @return the equivalent compiled regular expression
* @throws NamingException if there are problems while normalizing
*/
public final Pattern getRegex( Normalizer normalizer ) throws NamingException
{ |
| File |
|---|
| SubstringNode.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
package org.apache.directory.shared.ldap.ldif; <<<<<<< HEAD import java.io.Serializable; ======= import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import java.util.HashMap; import java.util.LinkedList; import java.util.List; |
| Solution content |
|---|
package org.apache.directory.shared.ldap.ldif; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.HashMap; import java.util.LinkedList; import java.util.List; |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import java.util.LinkedList; import java.util.List; import java.util.Map; <<<<<<< HEAD import javax.naming.InvalidNameException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.ModificationItem; import javax.naming.ldap.Control; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.util.StringTools; ======= >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import javax.naming.InvalidNameException; import javax.naming.NamingException; |
| Solution content |
|---|
import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.naming.InvalidNameException; import javax.naming.NamingException; |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*
* @param attr The attribute to be added
*/
<<<<<<< HEAD
public void addModificationItem( int modOp, Attribute attr )
=======
public void addModificationItem( int modOp, EntryAttribute attr )
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
if ( changeType == ChangeType.Modify )
{ |
| Solution content |
|---|
*
* @param attr The attribute to be added
*/
public void addModificationItem( int modOp, EntryAttribute attr )
{
if ( changeType == ChangeType.Modify )
{ |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
{
for ( Modification modif:modificationList )
{
<<<<<<< HEAD
ModificationItemImpl modifClone = new ModificationItemImpl( modif.getModificationOp(),
(Attribute) modif.getAttribute().clone() );
=======
Modification modifClone = new ClientModification( modif.getOperation(),
(EntryAttribute) modif.getAttribute().clone() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
clone.modificationList.add( modifClone );
}
} |
| Solution content |
|---|
{
for ( Modification modif:modificationList )
{
Modification modifClone = new ClientModification( modif.getOperation(),
(EntryAttribute) modif.getAttribute().clone() );
clone.modificationList.add( modifClone );
}
} |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
<<<<<<< HEAD
{
for ( String key:modificationItems.keySet() )
{
ModificationItemImpl modif = modificationItems.get( key );
ModificationItemImpl modifClone = new ModificationItemImpl( modif.getModificationOp(),
(Attribute) modif.getAttribute().clone() );
=======
Modification modif = modificationItems.get( key );
Modification modifClone = new ClientModification( modif.getOperation(),
(EntryAttribute) modif.getAttribute().clone() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
clone.modificationItems.put( key, modifClone );
}
|
| Solution content |
|---|
{
for ( String key:modificationItems.keySet() )
{
Modification modif = modificationItems.get( key );
Modification modifClone = new ClientModification( modif.getOperation(),
(EntryAttribute) modif.getAttribute().clone() );
clone.modificationItems.put( key, modifClone );
}
|
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
for ( EntryAttribute attribute:entry )
{
<<<<<<< HEAD
for ( NamingEnumeration extends Attribute> attrs = attributes.getAll();
attrs.hasMoreElements();
attribute = attrs.nextElement())
{
if ( attribute == null )
{
sb.append( " Null attribute\n" );
continue;
}
sb.append( " ").append( attribute.getID() ).append( ":\n" );
Object value = null;
for ( NamingEnumeration> values = attribute.getAll();
values.hasMoreElements();
value = values.nextElement())
{
if ( value instanceof String )
{
sb.append( " " ).append( (String)value ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[]) value ) ).append('\n' );
}
=======
if ( attribute == null )
{
sb.append( " Null attribute\n" );
continue;
}
sb.append( " ").append( attribute.getId() ).append( ":\n" );
for ( Value> value:attribute )
{
if ( value instanceof ClientStringValue )
{
sb.append( " " ).append( value.get() ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[])value.get() ) ).append('\n' );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
}
} |
| Solution content |
|---|
for ( EntryAttribute attribute:entry )
{
if ( attribute == null )
{
sb.append( " Null attribute\n" );
continue;
}
sb.append( " ").append( attribute.getId() ).append( ":\n" );
for ( Value> value:attribute )
{
if ( value instanceof ClientStringValue )
{
sb.append( " " ).append( value.get() ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[])value.get() ) ).append('\n' );
}
}
} |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
{
for ( Value> value:attribute )
{
<<<<<<< HEAD
Object value = null;
for ( NamingEnumeration> values = attribute.getAll();
values.hasMoreElements();
value = values.nextElement() )
{
if ( value instanceof String )
{
sb.append( " " ).append( (String)value ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[]) value ) ).append('\n' );
}
=======
if ( value instanceof ClientStringValue )
{
sb.append( " " ).append( (String)value.get() ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[]) value.get() ) ).append('\n' );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
}
} |
| Solution content |
|---|
{
for ( Value> value:attribute )
{
if ( value instanceof ClientStringValue )
{
sb.append( " " ).append( (String)value.get() ).append('\n' );
}
else
{
sb.append( " " ).append( StringTools.dumpBytes( (byte[]) value.get() ) ).append('\n' );
}
}
} |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
{
int result = 37;
<<<<<<< HEAD
if ( dn != null )
{
result = result*17 + dn.hashCode();
=======
if ( entry.getDn() != null )
{
result = result*17 + entry.getDn().hashCode();
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
if ( changeType != null ) |
| Solution content |
|---|
{
int result = 37;
if ( entry.getDn() != null )
{
result = result*17 + entry.getDn().hashCode();
}
if ( changeType != null ) |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
{
case Add :
// Checks the attributes
<<<<<<< HEAD
if ( attributes != null )
{
result = result * 17 + attributes.hashCode();
=======
if ( entry != null )
{
result = result * 17 + entry.hashCode();
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
break; |
| Solution content |
|---|
{
case Add :
// Checks the attributes
if ( entry != null )
{
result = result * 17 + entry.hashCode();
}
break; |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
{
result = result * 17 + modificationList.hashCode();
<<<<<<< HEAD
for ( ModificationItem modification:modificationList )
=======
for ( Modification modification:modificationList )
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
result = result * 17 + modification.hashCode();
} |
| Solution content |
|---|
{
result = result * 17 + modificationList.hashCode();
for ( Modification modification:modificationList )
{
result = result * 17 + modification.hashCode();
} |
| File |
|---|
| LdifEntry.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| Chunk |
|---|
| Conflicting content |
|---|
import java.util.ArrayList; import java.util.List; <<<<<<< HEAD import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.ModificationItem; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; ======= import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import org.apache.directory.shared.ldap.entry.Entry; import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue; import org.apache.directory.shared.ldap.entry.client.ClientModification; import org.apache.directory.shared.ldap.entry.client.ClientStringValue; import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.util.AttributeUtils; |
| Solution content |
|---|
import java.util.ArrayList; import java.util.List; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import org.apache.directory.shared.ldap.entry.Entry; import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.ModificationOperation; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue; import org.apache.directory.shared.ldap.entry.client.ClientModification; import org.apache.directory.shared.ldap.entry.client.ClientStringValue; import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.util.AttributeUtils; |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
*/
public static boolean isLDIFSafe( String str )
{
<<<<<<< HEAD
=======
if ( str == null )
{
// A null string is LDIF safe
return true;
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
// Checking the first char
char currentChar = str.charAt(0);
|
| Solution content |
|---|
}
*/
public static boolean isLDIFSafe( String str )
{
if ( str == null )
{
// A null string is LDIF safe
return true;
// Checking the first char
char currentChar = str.charAt(0);
|
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
{
return false;
}
<<<<<<< HEAD
// Checking the other chars
for (int i = 1; i < str.length(); i++)
{
currentChar = str.charAt(i);
if ( ( currentChar > 127 ) || !LDIF_SAFE_OTHER_CHARS_ALPHABET[currentChar] )
{
return false;
}
}
=======
// Checking the other chars
for (int i = 1; i < str.length(); i++)
{
currentChar = str.charAt(i);
if ( ( currentChar > 127 ) || !LDIF_SAFE_OTHER_CHARS_ALPHABET[currentChar] )
{
return false;
}
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
// The String cannot end with a space
return ( currentChar != ' ' );
} |
| Solution content |
|---|
{
return false;
}
// Checking the other chars
for (int i = 1; i < str.length(); i++)
{
currentChar = str.charAt(i);
if ( ( currentChar > 127 ) || !LDIF_SAFE_OTHER_CHARS_ALPHABET[currentChar] )
{
return false;
}
}
// The String cannot end with a space
return ( currentChar != ' ' );
} |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| For statement |
| Chunk |
|---|
| Conflicting content |
|---|
{
StringBuilder sb = new StringBuilder();
<<<<<<< HEAD
NamingEnumeration extends Attribute> ne = attrs.getAll();
while ( ne.hasMore() )
{
Object attribute = ne.next();
if ( attribute instanceof Attribute )
{
sb.append( convertToLdif( (Attribute) attribute, length ) );
}
=======
for ( EntryAttribute attribute:entry )
{
sb.append( convertToLdif( attribute, length ) );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
return sb.toString(); |
| Solution content |
|---|
{
StringBuilder sb = new StringBuilder();
for ( EntryAttribute attribute:entry )
{
sb.append( convertToLdif( attribute, length ) );
}
return sb.toString(); |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| For statement |
| If statement |
| Method invocation |
| Variable |
| While statement |
| Chunk |
|---|
| Conflicting content |
|---|
return sb.toString();
}
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* Convert an Entry to LDIF |
| Solution content |
|---|
return sb.toString();
}
/**
* Convert an Entry to LDIF |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
* @return the corresponding LDIF code as a String
* @throws NamingException If a naming exception is encountered.
*/
<<<<<<< HEAD
public static String convertToLdif( Attribute attr, int length ) throws NamingException
{
StringBuilder sb = new StringBuilder();
// iterating on the attribute's values
for ( int i = 0; i < attr.size(); i++ )
{
StringBuilder lineBuffer = new StringBuilder();
lineBuffer.append( attr.getID() );
Object value = attr.get( i );
=======
public static String convertToLdif( EntryAttribute attr, int length ) throws NamingException
{
StringBuilder sb = new StringBuilder();
for ( Value> value:attr )
{
StringBuilder lineBuffer = new StringBuilder();
lineBuffer.append( attr.getId() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
// First, deal with null value (which is valid)
if ( value == null ) |
| Solution content |
|---|
* @return the corresponding LDIF code as a String
* @throws NamingException If a naming exception is encountered.
*/
public static String convertToLdif( EntryAttribute attr, int length ) throws NamingException
{
StringBuilder sb = new StringBuilder();
for ( Value> value:attr )
{
StringBuilder lineBuffer = new StringBuilder();
lineBuffer.append( attr.getId() );
// First, deal with null value (which is valid)
if ( value == null ) |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| For statement |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
{
lineBuffer.append( ':' );
}
<<<<<<< HEAD
else if ( value instanceof byte[] )
{
// It is binary, so we have to encode it using Base64 before adding it
char[] encoded = Base64.encode( ( byte[] ) value );
=======
else if ( value instanceof ClientBinaryValue )
{
// It is binary, so we have to encode it using Base64 before adding it
char[] encoded = Base64.encode( ( byte[] ) value.get() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
lineBuffer.append( ":: " + new String( encoded ) );
} |
| Solution content |
|---|
{
lineBuffer.append( ':' );
}
else if ( value instanceof ClientBinaryValue )
{
// It is binary, so we have to encode it using Base64 before adding it
char[] encoded = Base64.encode( ( byte[] ) value.get() );
lineBuffer.append( ":: " + new String( encoded ) );
} |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
else if ( value instanceof ClientStringValue )
{
// It's a String but, we have to check if encoding isn't required
<<<<<<< HEAD
String str = (String) value;
if ( !LdifUtils.isLDIFSafe( str ) )
{
lineBuffer.append( ":: " + encodeBase64( (String)value ) );
}
else
{
lineBuffer.append( ": " + value );
=======
String str = (String) value.get();
if ( !LdifUtils.isLDIFSafe( str ) )
{
lineBuffer.append( ":: " + encodeBase64( str ) );
}
else
{
lineBuffer.append( ":" );
if ( str != null)
{
lineBuffer.append( " " ).append( str );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
}
|
| Solution content |
|---|
else if ( value instanceof ClientStringValue )
{
// It's a String but, we have to check if encoding isn't required
String str = (String) value.get();
if ( !LdifUtils.isLDIFSafe( str ) )
{
lineBuffer.append( ":: " + encodeBase64( str ) );
}
else
{
lineBuffer.append( ":" );
if ( str != null)
{
lineBuffer.append( " " ).append( str );
}
}
}
|
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Cast expression |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
* @param deletedEntry The entry which has been deleted
* @return A reverse LDIF
*/
<<<<<<< HEAD
public static LdifEntry reverseDel( LdapDN dn, Attributes deletedEntry )
=======
public static LdifEntry reverseDel( LdapDN dn, Entry deletedEntry ) throws NamingException
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
LdifEntry entry = new LdifEntry();
|
| Solution content |
|---|
* @param deletedEntry The entry which has been deleted
* @return A reverse LDIF
*/
public static LdifEntry reverseDel( LdapDN dn, Entry deletedEntry ) throws NamingException
{
LdifEntry entry = new LdifEntry();
|
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
* @return A new LDIF entry with a reverted DN
* @throws NamingException If the name reverting failed
*/
<<<<<<< HEAD
public static LdifEntry reverseRename( Attributes t0, LdapDN t0_dn, Rdn t1_rdn ) throws NamingException
=======
public static List |
| Solution content |
|---|
* @return A new LDIF entry with a reverted DN
* @throws NamingException If the name reverting failed
*/
public static List |
| File |
|---|
| LdifUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
{
escaped = true;
break;
<<<<<<< HEAD
}
}
// Here, we have a char to escape. Start again the loop...
if ( escaped )
{
for ( int i = 0; i < valueLength; i++ )
{
char c = chars[i];
if ( ( c < 0) || ( c > 128 ) )
{
// For chars which are not ASCII, use their hexa value prefixed by an '\'
byte[] bb = StringTools.getBytesUtf8( normalizedValue.substring( i, i + 1 ) );
for ( byte b:bb )
{
sb.append( '\\' ).
append( StringTools.dumpHex( (byte)(( b & 0x00F0 ) >> 4) ) ).
append( StringTools.dumpHex( b ) );
}
}
else if ( DN_ESCAPED_CHARS[ c ] )
{
// Some chars need to be escaped even if they are US ASCII
// Just prefix them with a '\'
// Special cases are ' ' (space), '#') which need a special
// treatment.
if ( c == ' ' )
{
if ( ( i == 0 ) || ( i == valueLength - 1 ) )
{
sb.append( '\\' ).append( c );
}
else
{
sb.append( ' ' );
}
continue;
}
else if ( c == '#' )
{
if ( i == 0 )
{
sb.append( "\\#" );
continue;
}
else
{
sb.append( '#' );
}
continue;
}
sb.append( '\\' ).append( c );
}
else
{
// Standard ASCII chars are just appended
sb.append( c );
}
}
}
=======
}
}
// Here, we have a char to escape. Start again the loop...
if ( escaped )
{
for ( int i = 0; i < valueLength; i++ )
{
char c = chars[i];
if ( ( c < 0) || ( c > 128 ) )
{
// For chars which are not ASCII, use their hexa value prefixed by an '\'
byte[] bb = StringTools.getBytesUtf8( normalizedValue.substring( i, i + 1 ) );
for ( byte b:bb )
{
sb.append( '\\' ).
append( StringTools.dumpHex( (byte)(( b & 0x00F0 ) >> 4) ) ).
append( StringTools.dumpHex( b ) );
}
}
else if ( DN_ESCAPED_CHARS[ c ] )
{
// Some chars need to be escaped even if they are US ASCII
// Just prefix them with a '\'
// Special cases are ' ' (space), '#') which need a special
// treatment.
if ( c == ' ' )
{
if ( ( i == 0 ) || ( i == valueLength - 1 ) )
{
sb.append( '\\' ).append( c );
}
else
{
sb.append( ' ' );
}
continue;
}
else if ( c == '#' )
{
if ( i == 0 )
{
sb.append( "\\#" );
continue;
}
else
{
sb.append( '#' );
}
continue;
}
sb.append( '\\' ).append( c );
}
else
{
// Standard ASCII chars are just appended
sb.append( c );
}
}
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
else
{
// The String does not contain any escaped char : |
| Solution content |
|---|
{
escaped = true;
break;
}
}
// Here, we have a char to escape. Start again the loop...
if ( escaped )
{
for ( int i = 0; i < valueLength; i++ )
{
char c = chars[i];
if ( ( c < 0) || ( c > 128 ) )
{
// For chars which are not ASCII, use their hexa value prefixed by an '\'
byte[] bb = StringTools.getBytesUtf8( normalizedValue.substring( i, i + 1 ) );
for ( byte b:bb )
{
sb.append( '\\' ).
append( StringTools.dumpHex( (byte)(( b & 0x00F0 ) >> 4) ) ).
append( StringTools.dumpHex( b ) );
}
}
else if ( DN_ESCAPED_CHARS[ c ] )
{
// Some chars need to be escaped even if they are US ASCII
// Just prefix them with a '\'
// Special cases are ' ' (space), '#') which need a special
// treatment.
if ( c == ' ' )
{
if ( ( i == 0 ) || ( i == valueLength - 1 ) )
{
sb.append( '\\' ).append( c );
}
else
{
sb.append( ' ' );
}
continue;
}
else if ( c == '#' )
{
if ( i == 0 )
{
sb.append( "\\#" );
continue;
}
else
{
sb.append( '#' );
}
continue;
}
sb.append( '\\' ).append( c );
}
else
{
// Standard ASCII chars are just appended
sb.append( c );
}
}
}
else
{
// The String does not contain any escaped char : |
| File |
|---|
| AttributeTypeAndValue.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| For statement |
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
/**
* Create a DN when deserializing it.
<<<<<<< HEAD
=======
*
* Note : this constructor is used only by the deserialization method.
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
* @param upName The user provided name
* @param normName the normalized name
* @param bytes the name as a byte[] |
| Solution content |
|---|
/**
* Create a DN when deserializing it.
*
* Note : this constructor is used only by the deserialization method.
* @param upName The user provided name
* @param normName the normalized name
* @param bytes the name as a byte[] |
| File |
|---|
| LdapDN.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
Object upValue = rdn.getUpValue();
String upType = rdn.getUpType();
rdn.clear();
<<<<<<< HEAD
Object normStringValue = DefaultStringNormalizer.normalizeString( (String)upValue );
=======
Object normStringValue = DefaultStringNormalizer.normalizeString( ( String ) upValue );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
Object normValue = oidNormalizer.getNormalizer().normalize( normStringValue );
rdn.addAttributeTypeAndValue( upType, oidNormalizer.getAttributeTypeOid(), upValue, normValue ); |
| Solution content |
|---|
Object upValue = rdn.getUpValue();
String upType = rdn.getUpType();
rdn.clear();
Object normStringValue = DefaultStringNormalizer.normalizeString( ( String ) upValue );
Object normValue = oidNormalizer.getNormalizer().normalize( normStringValue );
rdn.addAttributeTypeAndValue( upType, oidNormalizer.getAttributeTypeOid(), upValue, normValue ); |
| File |
|---|
| LdapDN.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
default:
return ((TreeSet |
| Solution content |
|---|
break;
default:
return ((TreeSet |
| File |
|---|
| Rdn.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Case statement |
| Cast expression |
| Comment |
| Method invocation |
| Method signature |
| Return statement |
| Switch statement |
| Chunk |
|---|
| Conflicting content |
|---|
case '=':
throw new IllegalArgumentException( "Unescaped special characters are not allowed" );
<<<<<<< HEAD
default:
byte[] result = StringTools.charToBytes( chars[i] );
System.arraycopy( result, 0, bytes, pos, result.length );
pos += result.length;
=======
case ' ':
if ( ( i == 0 ) || ( i == chars.length - 1) )
{
throw new IllegalArgumentException( "Unescaped special characters are not allowed" );
}
else
{
bytes[pos++] = ' ';
break;
}
default:
if ( ( chars[i] >= 0 ) && ( chars[i] < 128 ) )
{
bytes[pos++] = (byte)chars[i];
}
else
{
byte[] result = StringTools.charToBytes( chars[i] );
System.arraycopy( result, 0, bytes, pos, result.length );
pos += result.length;
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
break;
} |
| Solution content |
|---|
case '=':
throw new IllegalArgumentException( "Unescaped special characters are not allowed" );
case ' ':
if ( ( i == 0 ) || ( i == chars.length - 1) )
{
throw new IllegalArgumentException( "Unescaped special characters are not allowed" );
}
else
{
bytes[pos++] = ' ';
break;
}
default:
if ( ( chars[i] >= 0 ) && ( chars[i] < 128 ) )
{
bytes[pos++] = (byte)chars[i];
}
else
{
byte[] result = StringTools.charToBytes( chars[i] );
System.arraycopy( result, 0, bytes, pos, result.length );
pos += result.length;
}
break;
} |
| File |
|---|
| Rdn.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Case statement |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
pos.end++;
pos.length = length + 2;
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
return StringTools.utf8ToString( buffer, length );
<<<<<<< HEAD
//return StringTools.utf8ToString( bytes, pos.start, pos.length );
=======
}
else
{ |
| Solution content |
|---|
pos.end++;
pos.length = length + 2;
return StringTools.utf8ToString( buffer, length );
}
else
{ |
| File |
|---|
| RdnParser.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
String upValue = StringTools.utf8ToString( dn, start2, pos.length );
rdn.addAttributeTypeAndValue( type, type, upValue, value );
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
rdn.normalize();
pos.start = pos.end; |
| Solution content |
|---|
String upValue = StringTools.utf8ToString( dn, start2, pos.length );
rdn.addAttributeTypeAndValue( type, type, upValue, value );
rdn.normalize();
pos.start = pos.end; |
| File |
|---|
| RdnParser.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
import javax.naming.directory.InvalidAttributeIdentifierException; import javax.naming.directory.ModificationItem; <<<<<<< HEAD import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; ======= import org.apache.directory.shared.ldap.entry.Entry; import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.directory.shared.ldap.name.LdapDN; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.MatchingRule; import org.apache.directory.shared.ldap.schema.NoOpNormalizer; |
| Solution content |
|---|
import javax.naming.directory.InvalidAttributeIdentifierException; import javax.naming.directory.ModificationItem; import org.apache.directory.shared.ldap.entry.Entry; import org.apache.directory.shared.ldap.entry.EntryAttribute; import org.apache.directory.shared.ldap.entry.Modification; import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute; import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry; import org.apache.directory.shared.ldap.message.AttributeImpl; import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.MatchingRule; import org.apache.directory.shared.ldap.schema.NoOpNormalizer; |
| File |
|---|
| AttributeUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
false, false, false, false, false, false, false, false // 78 -> 7F
};
<<<<<<< HEAD
=======
/**
* [0x01-0x1F] | 0x21 | [0x24-0x2A] | [0x2D-0x3A] | 0x3D | [0x3F-0x5B] | [0x5D-0x7F]
*/
private static final boolean[] LUTF1 =
{
false, true, true, true, true, true, true, true, // 00 -> 07 '\0'
true, true, true, true, true, true, true, true, // 08 -> 0F
true, true, true, true, true, true, true, true, // 10 -> 17
true, true, true, true, true, true, true, true, // 18 -> 1F
false, true, false, false, true, true, true, true, // 20 -> 27 ( ' ', '"', '#' )
true, true, true, false, false, true, true, true, // 28 -> 2F ( '+', ',' )
true, true, true, true, true, true, true, true, // 30 -> 37
true, true, true, false, false, true, false, true, // 38 -> 3F ( ';', '<', '>' )
true, true, true, true, true, true, true, true, // 40 -> 47
true, true, true, true, true, true, true, true, // 48 -> 4F
true, true, true, true, true, true, true, true, // 50 -> 57
true, true, true, true, false, true, true, true, // 58 -> 5F ( '\' )
true, true, true, true, true, true, true, true, // 60 -> 67
true, true, true, true, true, true, true, true, // 68 -> 6F
true, true, true, true, true, true, true, true, // 70 -> 77
true, true, true, true, true, true, true, true // 78 -> 7F
};
/**
* [0x01-0x21] | [0x23-0x2A] | [0x2D-0x3A] | 0x3D | [0x3F-0x5B] | [0x5D-0x7F]
*/
private static final boolean[] SUTF1 =
{
false, true, true, true, true, true, true, true, // 00 -> 07 '\0'
true, true, true, true, true, true, true, true, // 08 -> 0F
true, true, true, true, true, true, true, true, // 10 -> 17
true, true, true, true, true, true, true, true, // 18 -> 1F
true, true, false, true, true, true, true, true, // 20 -> 27 ( '"' )
true, true, true, false, false, true, true, true, // 28 -> 2F ( '+', ',' )
true, true, true, true, true, true, true, true, // 30 -> 37
true, true, true, false, false, true, false, true, // 38 -> 3F ( ';', '<', '>' )
true, true, true, true, true, true, true, true, // 40 -> 47
true, true, true, true, true, true, true, true, // 48 -> 4F
true, true, true, true, true, true, true, true, // 50 -> 57
true, true, true, true, false, true, true, true, // 58 -> 5F ( '\' )
true, true, true, true, true, true, true, true, // 60 -> 67
true, true, true, true, true, true, true, true, // 68 -> 6F
true, true, true, true, true, true, true, true, // 70 -> 77
true, true, true, true, true, true, true, true // 78 -> 7F
};
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* ' ' | '"' | '#' | '+' | ',' | ';' | '<' | '=' | '>' | '\' |
* 0x22 | 0x23 | 0x2B | 0x2C | 0x3B | 0x3C | 0x3D | 0x3E | 0x5C |
| Solution content |
|---|
false, false, false, false, false, false, false, false // 78 -> 7F
};
/**
* [0x01-0x1F] | 0x21 | [0x24-0x2A] | [0x2D-0x3A] | 0x3D | [0x3F-0x5B] | [0x5D-0x7F]
*/
private static final boolean[] LUTF1 =
{
false, true, true, true, true, true, true, true, // 00 -> 07 '\0'
true, true, true, true, true, true, true, true, // 08 -> 0F
true, true, true, true, true, true, true, true, // 10 -> 17
true, true, true, true, true, true, true, true, // 18 -> 1F
false, true, false, false, true, true, true, true, // 20 -> 27 ( ' ', '"', '#' )
true, true, true, false, false, true, true, true, // 28 -> 2F ( '+', ',' )
true, true, true, true, true, true, true, true, // 30 -> 37
true, true, true, false, false, true, false, true, // 38 -> 3F ( ';', '<', '>' )
true, true, true, true, true, true, true, true, // 40 -> 47
true, true, true, true, true, true, true, true, // 48 -> 4F
true, true, true, true, true, true, true, true, // 50 -> 57
true, true, true, true, false, true, true, true, // 58 -> 5F ( '\' )
true, true, true, true, true, true, true, true, // 60 -> 67
true, true, true, true, true, true, true, true, // 68 -> 6F
true, true, true, true, true, true, true, true, // 70 -> 77
true, true, true, true, true, true, true, true // 78 -> 7F
};
/**
* [0x01-0x21] | [0x23-0x2A] | [0x2D-0x3A] | 0x3D | [0x3F-0x5B] | [0x5D-0x7F]
*/
private static final boolean[] SUTF1 =
{
false, true, true, true, true, true, true, true, // 00 -> 07 '\0'
true, true, true, true, true, true, true, true, // 08 -> 0F
true, true, true, true, true, true, true, true, // 10 -> 17
true, true, true, true, true, true, true, true, // 18 -> 1F
true, true, false, true, true, true, true, true, // 20 -> 27 ( '"' )
true, true, true, false, false, true, true, true, // 28 -> 2F ( '+', ',' )
true, true, true, true, true, true, true, true, // 30 -> 37
true, true, true, false, false, true, false, true, // 38 -> 3F ( ';', '<', '>' )
true, true, true, true, true, true, true, true, // 40 -> 47
true, true, true, true, true, true, true, true, // 48 -> 4F
true, true, true, true, true, true, true, true, // 50 -> 57
true, true, true, true, false, true, true, true, // 58 -> 5F ( '\' )
true, true, true, true, true, true, true, true, // 60 -> 67
true, true, true, true, true, true, true, true, // 68 -> 6F
true, true, true, true, true, true, true, true, // 70 -> 77
true, true, true, true, true, true, true, true // 78 -> 7F
};
/**
* ' ' | '"' | '#' | '+' | ',' | ';' | '<' | '=' | '>' | '\' |
* 0x22 | 0x23 | 0x2B | 0x2C | 0x3B | 0x3C | 0x3D | 0x3E | 0x5C |
| File |
|---|
| DNUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Array initializer |
| Attribute |
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
=======
* Check if the current character is a SUTF1 (Stringchar UTF ascii char) |
| Solution content |
|---|
/**
* Check if the current character is a SUTF1 (Stringchar UTF ascii char) |
| File |
|---|
| DNUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
throw new NotImplementedException();
}
<<<<<<< HEAD
/**
* Creates, fills and returns an Attributes instance using the LDIF encoded
* within the property value. The LDIF should use '*' (asterisk) characters
* as line delimiters within the property value. These are replaced with
* newlines and fed to the LDIF parser. Also note that the LdifParser
* deposites the DN as a property within the attributes object.
*
* @param props
* the properties to get the ldif property from
* @param key
* the key for the LDIF property
* @return the attributes for the encoded LDIF entry
*/
public static Attributes fillAttributes( Properties props, String key, Attributes values ) throws NamingException
{
if ( props == null || !props.containsKey( key ) || props.getProperty( key ) == null )
{
if ( values == null )
{
return new AttributesImpl();
}
return values;
}
String ldif = props.getProperty( key ).trim().replace( '*', '\n' );
LdifReader ldifReader = new LdifReader( new StringReader( ldif ) );
LdifEntry entry = ldifReader.next();
if ( entry != null )
{
values = entry.getAttributes();
}
return values;
}
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
} |
| Solution content |
|---|
throw new NotImplementedException();
}
} |
| File |
|---|
| PropertiesUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
continue;
}
}
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
if ( escaped )
{ |
| Solution content |
|---|
continue;
}
}
if ( escaped )
{ |
| File |
|---|
| StringTools.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
{
buf.append( str.charAt( ii ) );
}
<<<<<<< HEAD
}
if ( escaped )
{
// We should not have a '\' at the end of the string
throw new InvalidNameException( "The DN must not ends with a '\\'." );
}
=======
}
if ( escaped )
{
// We should not have a '\' at the end of the string
throw new InvalidNameException( "The DN must not ends with a '\\'." );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
return buf.toString();
} |
| Solution content |
|---|
{
buf.append( str.charAt( ii ) );
}
}
if ( escaped )
{
// We should not have a '\' at the end of the string
throw new InvalidNameException( "The DN must not ends with a '\\'." );
}
return buf.toString();
} |
| File |
|---|
| StringTools.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| If statement |
| Chunk |
|---|
| Conflicting content |
|---|
import org.apache.directory.shared.ldap.codec.util.LdapURL; import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException; import org.apache.directory.shared.ldap.name.LdapDN; <<<<<<< HEAD ======= import org.junit.Test; import org.junit.Ignore; >>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903 /** |
| Solution content |
|---|
import org.apache.directory.shared.ldap.codec.util.LdapURL; import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException; import org.apache.directory.shared.ldap.name.LdapDN; import org.junit.Test; import org.junit.Ignore; /** |
| File |
|---|
| LdapUrlTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
<<<<<<< HEAD
=======
/**
* test a LdapURL without a scheme
*
*/
@Test
public void testLdapURLNoScheme()
{
try
{
new LdapURL( "/ou=system" );
fail();
}
catch ( LdapURLEncodingException luee )
{
assertTrue( true );
}
}
/**
* test a LdapURL without a host but with a DN
*
*/
@Test
public void testLdapURLNoHostDN()
{
try
{
LdapURL url = new LdapURL( "ldap:///ou=system" );
assertEquals( "ldap:///ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a host, no port, and a DN
*
*/
@Test
public void testLdapURLHostNoPortDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost/ou=system" );
assertEquals( "ldap://localhost/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no host, a port, and a DN
*
*/
@Test
public void testLdapURLNoHostPortDN()
{
try
{
new LdapURL( "ldap://:123/ou=system" );
fail();
}
catch ( LdapURLEncodingException luee )
{
assertTrue( true );
}
}
/**
{
/**
* test a LdapURL with no DN
*
*/
@Test
public void testLdapURLNoDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN and no attributes
*
*/
@Test
public void testLdapURLNoDNNoAttrs()
{
try
LdapURL url = new LdapURL( "ldap://localhost:123/?" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes and no scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope and no filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN and attributes
*
*/
@Test
public void testLdapURLDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN and attributes
*
*/
@Test
public void testLdapURLDNAttrs()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,dc,cn" );
assertEquals( "ldap://localhost:123/ou=system?ou,dc,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
* test a LdapURL with no DN and attributes
*
*/
@Test
public void testLdapURLNoDNAttrs()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,dc,cn" );
assertEquals( "ldap://localhost:123/?ou,dc,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub" );
assertEquals( "ldap://localhost:123/??sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an scope base
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an default scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes an scope
*
*/
@Test
public void testLdapURLDNNoAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub" );
assertEquals( "ldap://localhost:123/ou=system??sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes an scope base
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
{
/**
* test a LdapURL with a DN, no attributes an default scope
*
*/
@Test
public void testLdapURLDNNoAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an scope
*
*/
@Test
public void testLdapURLNoDNAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?sub" );
assertEquals( "ldap://localhost:123/?ou,cn?sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an scope base
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?base" );
assertEquals( "ldap://localhost:123/?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an default scope
*
*/
@Test
public void testLdapURLNoDNAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?" );
assertEquals( "ldap://localhost:123/?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an scope
*
*/
@Test
public void testLdapURLDNAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?sub" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn?sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an scope base
*
*/
@Test
public void testLdapURLDNAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?base" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an default scope
*
*/
@Test
public void testLdapURLDNAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope and filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???(cn=test)" );
assertEquals( "ldap://localhost:123/???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope and filter
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system???(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope and filter
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc??(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope and filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub?(cn=test)" );
assertEquals( "ldap://localhost:123/??sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base?(cn=test)" );
assertEquals( "ldap://localhost:123/???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a scope and filter
*
*/
@Test
public void testLdapURLNoDNAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc?sub?(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc?sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc?base?(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope and filter
*
*/
@Test
public void testLdapURLDNNoAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system??sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, no scope and filter
*
*/
@Test
public void testLdapURLDNAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,dc,ou??(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,dc,ou??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope and filter
*
public void testLdapURLDNAttrsScopeBaseFilter()
{
fail();
try
{
*/
@Test
public void testLdapURLDNAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, and filter
*
*/
@Test
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, no filter and no extension
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilterNoExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/????" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/????!a=b,!c" );
assertEquals( "ldap://localhost:123/????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/??sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
}
}
/**
* test a LdapURL with no DN, no attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base??!a=b,!c" );
assertEquals( "ldap://localhost:123/????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/??sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou???!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeNoFilterExtension()
{
try
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?base??!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou?sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system????!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system??sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system??sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
} |
| Solution content |
|---|
Assert.assertEquals( "ldap:///dc=example,dc=com", url.toString() );
}
/**
* test a LdapURL without a scheme
*
*/
@Test
public void testLdapURLNoScheme()
{
try
{
new LdapURL( "/ou=system" );
fail();
}
catch ( LdapURLEncodingException luee )
{
assertTrue( true );
}
}
/**
* test a LdapURL without a host but with a DN
*
*/
@Test
public void testLdapURLNoHostDN()
{
try
{
LdapURL url = new LdapURL( "ldap:///ou=system" );
assertEquals( "ldap:///ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a host, no port, and a DN
*
*/
@Test
public void testLdapURLHostNoPortDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost/ou=system" );
assertEquals( "ldap://localhost/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
}
{
fail();
}
}
/**
* test a LdapURL with no host, a port, and a DN
*
*/
@Test
public void testLdapURLNoHostPortDN()
{
try
{
new LdapURL( "ldap://:123/ou=system" );
fail();
}
}
catch ( LdapURLEncodingException luee )
{
assertTrue( true );
}
}
/**
* test a LdapURL with no DN
*
*/
@Test
public void testLdapURLNoDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN and no attributes
*
*/
@Test
public void testLdapURLNoDNNoAttrs()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes and no scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope and no filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN and attributes
*
*/
@Test
public void testLdapURLDN()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN and attributes
*
*/
@Test
public void testLdapURLDNAttrs()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,dc,cn" );
assertEquals( "ldap://localhost:123/ou=system?ou,dc,cn", url.toString() );
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN and attributes
*
*/
@Test
public void testLdapURLNoDNAttrs()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,dc,cn" );
assertEquals( "ldap://localhost:123/?ou,dc,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub" );
assertEquals( "ldap://localhost:123/??sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an scope base
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes an default scope
*
*/
@Test
public void testLdapURLNoDNNoAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes an scope
*
*/
@Test
public void testLdapURLDNNoAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub" );
assertEquals( "ldap://localhost:123/ou=system??sub", url.toString() );
}
{
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes an scope base
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes an default scope
*
*/
@Test
public void testLdapURLDNNoAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??" );
assertEquals( "ldap://localhost:123/ou=system", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an scope
*
*/
@Test
public void testLdapURLNoDNAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?sub" );
assertEquals( "ldap://localhost:123/?ou,cn?sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an scope base
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBase()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?base" );
assertEquals( "ldap://localhost:123/?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes an default scope
*
*/
@Test
public void testLdapURLNoDNAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?ou,cn?" );
assertEquals( "ldap://localhost:123/?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an scope
*
*/
@Test
public void testLdapURLDNAttrsScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?sub" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn?sub", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an scope base
*
*/
@Test
public void testLdapURLDNAttrsScopeBase()
{
try
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?base" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes an default scope
*
*/
@Test
public void testLdapURLDNAttrsDefaultScope()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?ou,cn?" );
assertEquals( "ldap://localhost:123/ou=system?ou,cn", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope and filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???(cn=test)" );
assertEquals( "ldap://localhost:123/???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope and filter
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system???(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope and filter
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc??(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope and filter
*
*/
@Test
try
public void testLdapURLNoDNNoAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub?(cn=test)" );
assertEquals( "ldap://localhost:123/??sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
{
* test a LdapURL with no DN, no attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base?(cn=test)" );
assertEquals( "ldap://localhost:123/???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a scope and filter
*
*/
@Test
public void testLdapURLNoDNAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc?sub?(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc?sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,ou,dc?base?(cn=test)" );
assertEquals( "ldap://localhost:123/?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope and filter
*
*/
@Test
public void testLdapURLDNNoAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system??sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
}
/**
* test a LdapURL with a DN, some attributes, no scope and filter
*
*/
@Test
public void testLdapURLDNAttrsNoScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,dc,ou??(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,dc,ou??(cn=test)", url.toString() );
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope and filter
*
*/
@Test
public void testLdapURLDNAttrsScopeFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, and filter
*
*/
@Test
public void testLdapURLDNAttrsScopeBaseFilter()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base?(cn=test)" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, no filter and no extension
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilterNoExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/????" );
assertEquals( "ldap://localhost:123/", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/????!a=b,!c" );
assertEquals( "ldap://localhost:123/????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/???(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeNoFilterExtension()
LdapURL url = new LdapURL( "ldap://localhost:123/??sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/??sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base??!a=b,!c" );
assertEquals( "ldap://localhost:123/????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/??sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, no attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNNoAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/??base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou???!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
/**
* test a LdapURL with no DN, some attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou?sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?base??!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou?sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with no DN, some attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLNoDNAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/?cn,dc,ou?base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/?cn,dc,ou??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system????!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsNoScopeFilterExtension()
{
try
{
}
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system??sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system????!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system??sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, no attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNNoAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system??base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system???(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, no scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsNoScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
/**
* test a LdapURL with a DN, some attributes, no scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsNoScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub??!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, no filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeBaseNoFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base??!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc???!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc?sub?(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
/**
* test a LdapURL with a DN, some attributes, a base scope, a filter and some extensions
*
*/
@Test
public void testLdapURLDNAttrsScopeBaseFilterExtension()
{
try
{
LdapURL url = new LdapURL( "ldap://localhost:123/ou=system?cn,ou,dc?base?(cn=test)?!a=b,!c" );
assertEquals( "ldap://localhost:123/ou=system?cn,ou,dc??(cn=test)?!a=b,!c", url.toString() );
}
catch ( LdapURLEncodingException luee )
{
fail();
}
}
} |
| File |
|---|
| LdapUrlTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
assertTrue( node instanceof EqualityNode );
}
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a filter with a # in value
*/ |
| Solution content |
|---|
assertTrue( node instanceof EqualityNode );
}
/**
* test a filter with a # in value
*/ |
| File |
|---|
| FilterParserTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
@Test
public void testEqualsFilterWithPoundInValue() throws ParseException
{
<<<<<<< HEAD
SimpleNode node = ( SimpleNode ) FilterParser.parse( "(uid=#f1)" );
=======
SimpleNode |
| Solution content |
|---|
@Test
public void testEqualsFilterWithPoundInValue() throws ParseException
{
SimpleNode |
| File |
|---|
| FilterParserTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Cast expression |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertTrue( node instanceof EqualityNode );
}
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* Test that special and non allowed chars into an assertionValue are not
* accepted. ((cf DIRSERVER-1196) |
| Solution content |
|---|
assertTrue( node instanceof EqualityNode );
}
/**
* Test that special and non allowed chars into an assertionValue are not
* accepted. ((cf DIRSERVER-1196) |
| File |
|---|
| FilterParserTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
AttributesImpl attrs = new AttributesImpl( "objectClass", "person", true );
attrs.get( "objectClass" ).add( "uidObject" );
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
AttributeImpl attr = new AttributeImpl( "cn" );
attr.add( "john doe" ); |
| Solution content |
|---|
AttributesImpl attrs = new AttributesImpl( "objectClass", "person", true );
attrs.get( "objectClass" ).add( "uidObject" );
AttributeImpl attr = new AttributeImpl( "cn" );
attr.add( "john doe" ); |
| File |
|---|
| LdifUtilsTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
attr.add( "jack doe" );
attrs.put( attr );
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
attrs.put( "sn", "doe" );
attrs.put( "uid", "jdoe" );
|
| Solution content |
|---|
attr.add( "jack doe" );
attrs.put( attr );
attrs.put( "sn", "doe" );
attrs.put( "uid", "jdoe" );
|
| File |
|---|
| LdifUtilsTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
new DeepTrimToLowerNormalizer() ) );
oidOids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
new DeepTrimToLowerNormalizer() ) );
<<<<<<< HEAD
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
oidOids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) ); |
| Solution content |
|---|
new DeepTrimToLowerNormalizer() ) );
oidOids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25",
new DeepTrimToLowerNormalizer() ) );
oidOids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) ); |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Blank |
| Chunk |
|---|
| Conflicting content |
|---|
oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
}
<<<<<<< HEAD
=======
// ~ Methods
// ------------------------------------------------------------------------------------
// CONSTRUCTOR functions --------------------------------------------------
/**
* Test a null DN
*/
@Test
public void testLdapDNNull()
{
LdapDN dn = new LdapDN();
assertEquals( "", dn.getUpName() );
assertTrue( dn.isEmpty() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
// ~ Methods
// ------------------------------------------------------------------------------------ |
| Solution content |
|---|
oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
}
// ~ Methods
// ------------------------------------------------------------------------------------ |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
// CONSTRUCTOR functions --------------------------------------------------
/**
<<<<<<< HEAD
* Test a null DN
*/
@Test
public void testLdapDNNull()
{
LdapDN dn = new LdapDN();
=======
* test an empty DN
*/
@Test
public void testLdapDNEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "" );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertEquals( "", dn.getUpName() );
assertTrue( dn.isEmpty() );
} |
| Solution content |
|---|
// CONSTRUCTOR functions --------------------------------------------------
/**
* Test a null DN
*/
@Test
public void testLdapDNNull()
{
LdapDN dn = new LdapDN();
assertEquals( "", dn.getUpName() );
assertTrue( dn.isEmpty() );
} |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
/**
<<<<<<< HEAD
* test an empty DN
*/
@Test
public void testLdapDNEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "" );
assertEquals( "", dn.getUpName() );
assertTrue( dn.isEmpty() );
}
/**
* test a simple DN : a = b
*/
@Test
public void testLdapDNSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
assertTrue( LdapDN.isValid( "a = b" ) );
assertEquals( "a = b", dn.getUpName() );
assertEquals( "a=b", dn.toString() );
}
=======
* test a simple DN : a = b
*/
@Test
public void testLdapDNSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
assertTrue( LdapDN.isValid( "a = b" ) );
assertEquals( "a = b", dn.getUpName() );
assertEquals( "a=b", dn.toString() );
}
* test a simple DN with some spaces : "a = b "
*/
@Test
public void testLdapDNSimpleWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b " );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a = b " ) );
assertEquals( "a = b ", dn.getUpName() ); |
| Solution content |
|---|
/**
* test an empty DN
*/
@Test
public void testLdapDNEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "" );
assertEquals( "", dn.getUpName() );
assertTrue( dn.isEmpty() );
}
/**
* test a simple DN : a = b
*/
@Test
public void testLdapDNSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
assertTrue( LdapDN.isValid( "a = b" ) );
assertEquals( "a = b", dn.getUpName() );
assertEquals( "a=b", dn.toString() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a=b", dn.toString() );
}
<<<<<<< HEAD
/**
* test a simple DN with some spaces : "a = b "
*/
@Test
public void testLdapDNSimpleWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b " );
assertTrue( LdapDN.isValid( "a = b " ) );
assertEquals( "a = b ", dn.getUpName() );
assertEquals( "a=b", dn.toString() );
}
=======
/**
* test a composite DN : a = b, d = e
*/
@Test
public void testLdapDNComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a = b, c = d" ) );
assertEquals( "a=b,c=d", dn.toString() ); |
| Solution content |
|---|
/**
* test a simple DN with some spaces : "a = b "
*/
@Test
public void testLdapDNSimpleWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b " );
assertTrue( LdapDN.isValid( "a = b " ) );
assertEquals( "a = b ", dn.getUpName() );
assertEquals( "a=b", dn.toString() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a = b, c = d", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a composite DN : a = b, d = e
*/
@Test
public void testLdapDNComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
assertTrue( LdapDN.isValid( "a = b, c = d" ) );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a = b, c = d", dn.getUpName() );
}
=======
/**
* test a composite DN with spaces : a = b , d = e
*/
@Test
public void testLdapDNCompositeWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b , c = d" );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a = b , c = d" ) );
assertEquals( "a=b,c=d", dn.toString() ); |
| Solution content |
|---|
/**
* test a composite DN : a = b, d = e
*/
@Test
public void testLdapDNComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
assertTrue( LdapDN.isValid( "a = b, c = d" ) );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a = b, c = d", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a = b , c = d", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a composite DN with spaces : a = b , d = e
*/
@Test
public void testLdapDNCompositeWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b , c = d" );
assertTrue( LdapDN.isValid( "a = b , c = d" ) );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a = b , c = d", dn.getUpName() );
}
=======
/**
* test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
*/
@Test
public void testLdapDNCompositeWithSpace() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, a =b, a= b, a = b, a = b" );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a=b, a =b, a= b, a = b, a = b" ) );
assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.toString() ); |
| Solution content |
|---|
/**
* test a composite DN with spaces : a = b , d = e
*/
@Test
public void testLdapDNCompositeWithSpaces() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b , c = d" );
assertTrue( LdapDN.isValid( "a = b , c = d" ) );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a = b , c = d", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a=b, a =b, a= b, a = b, a = b", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
*/
@Test
public void testLdapDNCompositeWithSpace() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, a =b, a= b, a = b, a = b" );
assertTrue( LdapDN.isValid( "a=b, a =b, a= b, a = b, a = b" ) );
assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.toString() );
assertEquals( "a=b, a =b, a= b, a = b, a = b", dn.getUpName() );
}
=======
/**
* test a composite DN with differents separators : a=b;c=d,e=f It should
* return a=b,c=d,e=f (the ';' is replaced by a ',')
*/
@Test
public void testLdapDNCompositeSepators() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b;c=d,e=f" );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a=b;c=d,e=f" ) );
assertEquals( "a=b,c=d,e=f", dn.toString() ); |
| Solution content |
|---|
/**
* test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
*/
@Test
public void testLdapDNCompositeWithSpace() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, a =b, a= b, a = b, a = b" );
assertTrue( LdapDN.isValid( "a=b, a =b, a= b, a = b, a = b" ) );
assertEquals( "a=b,a=b,a=b,a=b,a=b", dn.toString() );
assertEquals( "a=b, a =b, a= b, a = b, a = b", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a=b;c=d,e=f", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a composite DN with differents separators : a=b;c=d,e=f It should
* return a=b,c=d,e=f (the ';' is replaced by a ',')
*/
@Test
public void testLdapDNCompositeSepators() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b;c=d,e=f" );
assertTrue( LdapDN.isValid( "a=b;c=d,e=f" ) );
assertEquals( "a=b,c=d,e=f", dn.toString() );
assertEquals( "a=b;c=d,e=f", dn.getUpName() );
=======
/**
* test a simple DN with multiple NameComponents : a = b + c = d
*/
@Test
public void testLdapDNSimpleMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b + c = d" );
assertTrue( LdapDN.isValid( "a = b + c = d" ) );
assertEquals( "a=b+c=d", dn.toString() );
assertEquals( "a = b + c = d", dn.getUpName() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
/**
* test a composite DN with differents separators : a=b;c=d,e=f It should
* return a=b,c=d,e=f (the ';' is replaced by a ',')
*/
@Test
public void testLdapDNCompositeSepators() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b;c=d,e=f" );
assertTrue( LdapDN.isValid( "a=b;c=d,e=f" ) );
assertEquals( "a=b,c=d,e=f", dn.toString() );
assertEquals( "a=b;c=d,e=f", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* test a simple DN with multiple NameComponents : a = b + c = d
*/
@Test
public void testLdapDNSimpleMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b + c = d" );
assertTrue( LdapDN.isValid( "a = b + c = d" ) );
assertEquals( "a=b+c=d", dn.toString() );
assertEquals( "a = b + c = d", dn.getUpName() );
=======
* test a composite DN with multiple NC and separators : a=b+c=d, e=f + g=h +
* i=j
*/
@Test
public void testLdapDNCompositeMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, e=f + g=h + i=j" );
assertTrue( LdapDN.isValid( "a=b+c=d, e=f + g=h + i=j" ) );
assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.toString() );
assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getUpName() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
/**
* test a simple DN with multiple NameComponents : a = b + c = d
*/
@Test
public void testLdapDNSimpleMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b + c = d" );
assertTrue( LdapDN.isValid( "a = b + c = d" ) );
assertEquals( "a=b+c=d", dn.toString() );
assertEquals( "a = b + c = d", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* test a composite DN with multiple NC and separators : a=b+c=d, e=f + g=h +
* i=j
*/
@Test
public void testLdapDNCompositeMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, e=f + g=h + i=j" );
assertTrue( LdapDN.isValid( "a=b+c=d, e=f + g=h + i=j" ) );
assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.toString() );
assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getUpName() );
=======
* Test to see if a DN with multiRdn values is preserved after an addAll.
*/
@Test
public void testAddAllWithMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "cn=Kate Bush+sn=Bush,ou=system" );
LdapDN target = new LdapDN();
assertTrue( LdapDN.isValid( "cn=Kate Bush+sn=Bush,ou=system" ) );
target.addAll( target.size(), dn );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.toString() );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.getUpName() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
/**
* test a composite DN with multiple NC and separators : a=b+c=d, e=f + g=h +
* i=j
*/
@Test
public void testLdapDNCompositeMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, e=f + g=h + i=j" );
assertTrue( LdapDN.isValid( "a=b+c=d, e=f + g=h + i=j" ) );
assertEquals( "a=b+c=d,e=f+g=h+i=j", dn.toString() );
assertEquals( "a=b+c=d, e=f + g=h + i=j", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* Test to see if a DN with multiRdn values is preserved after an addAll.
*/
@Test
public void testAddAllWithMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "cn=Kate Bush+sn=Bush,ou=system" );
LdapDN target = new LdapDN();
assertTrue( LdapDN.isValid( "cn=Kate Bush+sn=Bush,ou=system" ) );
target.addAll( target.size(), dn );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.toString() );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.getUpName() );
}
/**
* test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
*/
@Test
public void testLdapDNOidUpper() throws InvalidNameException
{
LdapDN dn = new LdapDN( "OID.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "OID.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "OID.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
*/
@Test
public void testLdapDNOidLower() throws InvalidNameException
{
LdapDN dn = new LdapDN( "oid.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "oid.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "oid.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid attribut without oid prefix : 12.34.56 =
* azerty
*/
@Test
public void testLdapDNOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty" ) );
assertEquals( "12.34.56=azerty", dn.toString() );
assertEquals( "12.34.56 = azerty", dn.getUpName() );
}
=======
* test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
*/
@Test
public void testLdapDNOidUpper() throws InvalidNameException
{
LdapDN dn = new LdapDN( "OID.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "OID.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "OID.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
*/
@Test
public void testLdapDNOidLower() throws InvalidNameException
{
LdapDN dn = new LdapDN( "oid.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "oid.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "oid.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid attribut without oid prefix : 12.34.56 =
* azerty
*/
@Test
public void testLdapDNOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty" ) );
assertEquals( "12.34.56=azerty", dn.toString() );
assertEquals( "12.34.56 = azerty", dn.getUpName() );
}
/**
* test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 =
* azerty; 7.8 = test
*/
@Test
public void testLdapDNCompositeOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty; 7.8 = test" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty; 7.8 = test" ) );
assertEquals( "12.34.56=azerty,7.8=test", dn.toString() );
assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C4\8D" |
| Solution content |
|---|
/**
* Test to see if a DN with multiRdn values is preserved after an addAll.
*/
@Test
public void testAddAllWithMultivaluedAttribute() throws InvalidNameException
{
LdapDN dn = new LdapDN( "cn=Kate Bush+sn=Bush,ou=system" );
LdapDN target = new LdapDN();
assertTrue( LdapDN.isValid( "cn=Kate Bush+sn=Bush,ou=system" ) );
target.addAll( target.size(), dn );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.toString() );
assertEquals( "cn=Kate Bush+sn=Bush,ou=system", target.getUpName() );
}
/**
* test a simple DN with an oid prefix (uppercase) : OID.12.34.56 = azerty
*/
@Test
public void testLdapDNOidUpper() throws InvalidNameException
{
LdapDN dn = new LdapDN( "OID.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "OID.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "OID.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid prefix (lowercase) : oid.12.34.56 = azerty
*/
@Test
public void testLdapDNOidLower() throws InvalidNameException
{
LdapDN dn = new LdapDN( "oid.12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "oid.12.34.56 = azerty" ) );
assertEquals( "oid.12.34.56=azerty", dn.toString() );
assertEquals( "oid.12.34.56 = azerty", dn.getUpName() );
}
/**
* test a simple DN with an oid attribut without oid prefix : 12.34.56 =
* azerty
*/
@Test
public void testLdapDNOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty" ) );
assertEquals( "12.34.56=azerty", dn.toString() );
assertEquals( "12.34.56 = azerty", dn.getUpName() );
}
/**
* test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 =
* azerty; 7.8 = test
*/
@Test
public void testLdapDNCompositeOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty; 7.8 = test" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty; 7.8 = test" ) );
assertEquals( "12.34.56=azerty,7.8=test", dn.toString() );
assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getUpName() );
}
/**
* test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C4\8D" |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
public void testLdapDNPairCharAttributeValue() throws InvalidNameException
{
<<<<<<< HEAD
/**
* test a composite DN with an oid attribut wiithout oid prefix : 12.34.56 =
* azerty; 7.8 = test
*/
@Test
public void testLdapDNCompositeOidWithoutPrefix() throws InvalidNameException
{
LdapDN dn = new LdapDN( "12.34.56 = azerty; 7.8 = test" );
assertTrue( LdapDN.isValid( "12.34.56 = azerty; 7.8 = test" ) );
assertEquals( "12.34.56=azerty,7.8=test", dn.toString() );
assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getUpName() );
=======
LdapDN dn = new LdapDN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" );
assertTrue( LdapDN.isValid( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" ) );
assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\\C4\\8D", dn.toString() );
assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D", dn.getUpName() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
public void testLdapDNPairCharAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" );
assertTrue( LdapDN.isValid( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" ) );
assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\\C4\\8D", dn.toString() );
assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* test a simple DN with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C4\8D"
*/
@Test
public void testLdapDNPairCharAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" );
=======
* test a simple DN with pair char attribute value : "SN=Lu\C4\8Di\C4\87"
*/
@Test
public void testLdapDNRFC253_Lucic() throws InvalidNameException
{
LdapDN dn = new LdapDN( "SN=Lu\\C4\\8Di\\C4\\87" );
assertTrue( LdapDN.isValid( "SN=Lu\\C4\\8Di\\C4\\87" ) );
assertEquals( "sn=Lu\\C4\\8Di\\C4\\87", dn.toString() );
assertEquals( "SN=Lu\\C4\\8Di\\C4\\87", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D" ) );
assertEquals( "a=\\,=\\+\\<\\>#\\;\\\\\\\"\\C4\\8D", dn.toString() ); |
| Solution content |
|---|
/**
* test a simple DN with pair char attribute value : "SN=Lu\C4\8Di\C4\87"
*/
@Test
public void testLdapDNRFC253_Lucic() throws InvalidNameException
{
LdapDN dn = new LdapDN( "SN=Lu\\C4\\8Di\\C4\\87" );
assertTrue( LdapDN.isValid( "SN=Lu\\C4\\8Di\\C4\\87" ) );
assertEquals( "sn=Lu\\C4\\8Di\\C4\\87", dn.toString() );
assertEquals( "SN=Lu\\C4\\8Di\\C4\\87", dn.getUpName() );
}
/**
* test a simple DN with hexString attribute value : a = #0010A0AAFF
*/
@Test
public void testLdapDNHexStringAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = #0010A0AAFF" );
assertTrue( LdapDN.isValid( "a = #0010A0AAFF" ) );
assertEquals( "a=#0010A0AAFF", dn.toString() );
assertEquals( "a = #0010A0AAFF", dn.getUpName() );
}
/**
* test a simple DN with a # on first position
*/
@Test
public void testLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "a = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "a = \\#this is a sharp" ) );
assertEquals( "a=\\#this is a sharp", dn.toString() );
assertEquals( "a = \\#this is a sharp", dn.getUpName() );
Rdn rdn = dn.getRdn();
assertEquals( "a = \\#this is a sharp", rdn.getUpName() );
}
/**
* Normalize a simple DN with a # on first position
*/
@Test
public void testNormalizeLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "ou = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "ou = \\#this is a sharp" ) );
assertEquals( "ou=\\#this is a sharp", dn.toString() );
assertEquals( "ou = \\#this is a sharp", dn.getUpName() );
{
/**
// Check the normalization now
LdapDN ndn = dn.normalize( oidOids );
assertEquals( "ou = \\#this is a sharp", ndn.getUpName() );
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() );
}
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
*/
}
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
@Test
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
public void testLdapDNStartsWithEmpty() throws InvalidNameException
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
@Test
@Test
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C4\\8D", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a simple DN with pair char attribute value : "SN=Lu\C4\8Di\C4\87"
*/
@Test
public void testLdapDNRFC253_Lucic() throws InvalidNameException
{
LdapDN dn = new LdapDN( "SN=Lu\\C4\\8Di\\C4\\87" );
=======
/**
* test a simple DN with hexString attribute value : a = #0010A0AAFF
*/
@Test
public void testLdapDNHexStringAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = #0010A0AAFF" );
assertTrue( LdapDN.isValid( "a = #0010A0AAFF" ) );
assertEquals( "a=#0010A0AAFF", dn.toString() );
assertEquals( "a = #0010A0AAFF", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "SN=Lu\\C4\\8Di\\C4\\87" ) );
assertEquals( "sn=Lu\\C4\\8Di\\C4\\87", dn.toString() ); |
| Solution content |
|---|
/**
* test a simple DN with hexString attribute value : a = #0010A0AAFF
*/
@Test
public void testLdapDNHexStringAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = #0010A0AAFF" );
assertTrue( LdapDN.isValid( "a = #0010A0AAFF" ) );
assertEquals( "a=#0010A0AAFF", dn.toString() );
assertEquals( "a = #0010A0AAFF", dn.getUpName() );
}
/**
* test a simple DN with a # on first position
*/
@Test
public void testLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "a = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "a = \\#this is a sharp" ) );
assertEquals( "a=\\#this is a sharp", dn.toString() );
assertEquals( "a = \\#this is a sharp", dn.getUpName() );
Rdn rdn = dn.getRdn();
assertEquals( "a = \\#this is a sharp", rdn.getUpName() );
}
/**
* Normalize a simple DN with a # on first position
*/
@Test
public void testNormalizeLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "ou = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "ou = \\#this is a sharp" ) );
assertEquals( "ou=\\#this is a sharp", dn.toString() );
assertEquals( "ou = \\#this is a sharp", dn.getUpName() );
// Check the normalization now
LdapDN ndn = dn.normalize( oidOids );
assertEquals( "ou = \\#this is a sharp", ndn.getUpName() );
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() );
}
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
*/
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
* @throws Exception
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "SN=Lu\\C4\\8Di\\C4\\87", dn.getUpName() );
}
<<<<<<< HEAD
/**
* test a simple DN with hexString attribute value : a = #0010A0AAFF
*/
@Test
public void testLdapDNHexStringAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = #0010A0AAFF" );
assertTrue( LdapDN.isValid( "a = #0010A0AAFF" ) );
assertEquals( "a=#0010A0AAFF", dn.toString() );
assertEquals( "a = #0010A0AAFF", dn.getUpName() );
=======
/**
* test a simple DN with a # on first position
*/
@Test
public void testLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "a = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "a = \\#this is a sharp" ) );
assertEquals( "a=\\#this is a sharp", dn.toString() );
assertEquals( "a = \\#this is a sharp", dn.getUpName() );
Rdn rdn = dn.getRdn();
assertEquals( "a = \\#this is a sharp", rdn.getUpName() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
/**
* test a simple DN with a # on first position
*/
@Test
public void testLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "a = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "a = \\#this is a sharp" ) );
assertEquals( "a=\\#this is a sharp", dn.toString() );
assertEquals( "a = \\#this is a sharp", dn.getUpName() );
Rdn rdn = dn.getRdn();
assertEquals( "a = \\#this is a sharp", rdn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* test a simple DN with a # on first position
*/
@Test
public void testLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "a = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "a = \\#this is a sharp" ) );
assertEquals( "a=\\#this is a sharp", dn.toString() );
assertEquals( "a = \\#this is a sharp", dn.getUpName() );
Rdn rdn = dn.getRdn();
assertEquals( "a = \\#this is a sharp", rdn.getUpName() );
}
=======
* Normalize a simple DN with a # on first position
*/
@Test
public void testNormalizeLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "ou = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "ou = \\#this is a sharp" ) );
assertEquals( "ou=\\#this is a sharp", dn.toString() );
assertEquals( "ou = \\#this is a sharp", dn.getUpName() );
// Check the normalization now
LdapDN ndn = dn.normalize( oidOids );
assertEquals( "ou = \\#this is a sharp", ndn.getUpName() );
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* Normalize a simple DN with a # on first position |
| Solution content |
|---|
*
/**
/**
* Normalize a simple DN with a # on first position
*/
@Test
public void testNormalizeLdapDNSharpFirst() throws InvalidNameException, NamingException
{
LdapDN dn = new LdapDN( "ou = \\#this is a sharp" );
assertTrue( LdapDN.isValid( "ou = \\#this is a sharp" ) );
assertEquals( "ou=\\#this is a sharp", dn.toString() );
assertEquals( "ou = \\#this is a sharp", dn.getUpName() );
// Check the normalization now
LdapDN ndn = dn.normalize( oidOids );
assertEquals( "ou = \\#this is a sharp", ndn.getUpName() );
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() );
}
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
* anything goes wrong
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "ou = \\#this is a sharp" );
<<<<<<< HEAD
assertTrue( LdapDN.isValid( "ou = \\#this is a sharp" ) );
assertEquals( "ou=\\#this is a sharp", dn.toString() );
assertEquals( "ou = \\#this is a sharp", dn.getUpName() );
// Check the normalization now
}
LdapDN ndn = dn.normalize( oidOids );
=======
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertEquals( "ou = \\#this is a sharp", ndn.getUpName() );
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() ); |
| Solution content |
|---|
{
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testNameEqualsIsInsensitiveToAttributesOrder() throws Exception
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
@Test
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( "2.5.4.11=\\#this is a sharp", ndn.toString() );
}
<<<<<<< HEAD
/**
* test a simple DN with a wrong hexString attribute value : a = #0010Z0AAFF
*/
@Test
public void testLdapDNWrongHexStringAttributeValue()
{
try
{
new LdapDN( "a = #0010Z0AAFF" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #0010Z0AAFF" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
=======
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a simple DN with quoted attribute value : a = \" quoted value \" |
| Solution content |
|---|
*/
/**
* test a simple DN with a wrong hexString attribute value : a = #AABBCCDD3
*/
@Test
public void testLdapDNWrongHexStringAttributeValue2()
{
try
{
new LdapDN( "a = #AABBCCDD3" );
fail();
}
catch ( InvalidNameException ine )
{
assertFalse( LdapDN.isValid( "a = #AABBCCDD3" ) );
assertTrue( true );
}
}
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
*/
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
@Test
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
@Test
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
<<<<<<< HEAD
/**
* test a simple DN with a quote in attribute value : a = quoted \"value\"
*/
@Test
public void testLdapDNQuoteInAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = quoted \\\"value\\\"" );
assertTrue( LdapDN.isValid( "a = quoted \\\"value\\\"" ) );
assertEquals( "a=quoted \\\"value\\\"", dn.toString() );
assertEquals( "a = quoted \\\"value\\\"", dn.getUpName() );
}
=======
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a simple DN with a comma at the end |
| Solution content |
|---|
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.directory.shared.ldap.name; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.naming.CompoundName; import javax.naming.InvalidNameException; import javax.naming.Name; import javax.naming.NamingException; import javax.naming.ldap.LdapName; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.LdapDnParser; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer; import org.apache.directory.shared.ldap.schema.OidNormalizer; import org.apache.directory.shared.ldap.util.StringTools; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import static org.junit.Assert.assertSame; /** * Test the class LdapDN * * @author Apache Directory Project * @version $Rev$, $Date$, */ public class LdapDNTest { private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
<<<<<<< HEAD
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
=======
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
// REMOVE operation -------------------------------------------------------
|
| Solution content |
|---|
/**
* test a simple DN with quoted attribute value : a = \" quoted value \"
*/
@Test
public void testLdapDNQuotedAttributeValue() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = \\\" quoted value \\\"" );
assertTrue( LdapDN.isValid( "a = \\\" quoted value \\\"" ) );
assertEquals( "a=\\\" quoted value \\\"", dn.toString() );
assertEquals( "a = \\\" quoted value \\\"", dn.getUpName() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Try statement |
| Chunk |
|---|
| Conflicting content |
|---|
// REMOVE operation -------------------------------------------------------
/**
<<<<<<< HEAD
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
=======
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a remove from position 2 |
| Solution content |
|---|
/**
* test a simple DN with a comma at the end
*/
@Test
public void testLdapDNComaAtEnd()
{
assertFalse( LdapDN.isValid( "a = b," ) );
assertFalse( LdapDN.isValid( "a = b, " ) );
try
{
new LdapDN( "a = b," );
fail();
}
catch ( InvalidNameException ine )
{
assertTrue( true );
}
}
// REMOVE operation -------------------------------------------------------
/**
* test a remove from position 0
*/
@Test
public void testLdapDNRemove0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
@Test
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "e=f", dn.remove( 0 ).toString() );
assertEquals( "a=b,c=d", dn.toString() );
assertEquals( "a=b, c=d", dn.getUpName() );
}
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
/**
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
* @throws InvalidNameException
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
*/
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
*/
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
// STARTS WITH operations
@Test
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
*/
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
<<<<<<< HEAD
/**
* test a remove from position 1
*/
@Test
public void testLdapDNRemove1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
=======
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a remove from position 1 whith semi colon |
| Solution content |
|---|
@Test /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.directory.shared.ldap.name; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.naming.CompoundName; import javax.naming.InvalidNameException; import javax.naming.Name; import javax.naming.NamingException; import javax.naming.ldap.LdapName; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.LdapDnParser; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer; import org.apache.directory.shared.ldap.schema.OidNormalizer; import org.apache.directory.shared.ldap.util.StringTools; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import static org.junit.Assert.assertSame; /** * Test the class LdapDN * * @author Apache Directory Project * @version $Rev$, $Date$, */ public class LdapDNTest { private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
<<<<<<< HEAD
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
=======
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a remove out of bound |
| Solution content |
|---|
{
/**
* test a remove from position 2
*/
@Test
public void testLdapDNRemove2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( "a=b", dn.remove( 2 ).toString() );
assertEquals( " c=d, e=f", dn.getUpName() );
}
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
*/
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
* Get the suffix of an empty LdapName
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
*/
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
<<<<<<< HEAD
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
=======
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{
dn.remove( 4 );
// We whould never reach this point
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
try
{ |
| Solution content |
|---|
/**
* test a remove from position 1 whith semi colon
*/
@Test
public void testLdapDNRemove1WithSemiColon() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
assertEquals( "c=d", dn.remove( 1 ).toString() );
assertEquals( "a=b, e=f", dn.getUpName() );
}
/**
* test a remove out of bound
*/
@Test
public void testLdapDNRemoveOutOfBound() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d; e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d; e=f" ) );
try
{ |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
}
<<<<<<< HEAD
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
=======
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test a 3 size |
| Solution content |
|---|
}
}
// SIZE operations
/**
* test a 0 size
*/
@Test
public void testLdapDNSize0()
{
LdapDN dn = new LdapDN();
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
*/
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
<<<<<<< HEAD
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
=======
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() ); |
| Solution content |
|---|
{
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertSame;
/**
* Test the class LdapDN
*
* @author Apache Directory Project
* @version $Rev$, $Date$,
*/
public class LdapDNTest
{
private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( 1, dn.size() );
}
<<<<<<< HEAD
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
=======
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test size after operations |
| Solution content |
|---|
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.directory.shared.ldap.name; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import javax.naming.CompoundName; import javax.naming.InvalidNameException; import javax.naming.Name; import javax.naming.NamingException; import javax.naming.ldap.LdapName; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.name.LdapDnParser; import org.apache.directory.shared.ldap.name.Rdn; import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer; import org.apache.directory.shared.ldap.schema.OidNormalizer; import org.apache.directory.shared.ldap.util.StringTools; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import static org.junit.Assert.assertSame; /** * Test the class LdapDN * * @author Apache Directory Project * @version $Rev$, $Date$, */ public class LdapDNTest { private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
<<<<<<< HEAD
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
=======
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
dn.remove( 0 );
assertEquals( 0, dn.size() ); |
| Solution content |
|---|
import java.io.ByteArrayInputStream;
}
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertSame;
/**
* Test the class LdapDN
*
* @author Apache Directory Project
* @version $Rev$, $Date$,
*/
public class LdapDNTest
{
private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( 0, dn.size() );
}
<<<<<<< HEAD
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
=======
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() ); |
| Solution content |
|---|
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertSame;
/**
@Test
* test a composite DN with or without spaces: a=b, a =b, a= b, a = b, a = b
* Test the class LdapDN
*
* @author Apache Directory Project
* @version $Rev$, $Date$,
*/
public class LdapDNTest
{
private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( 1, dn.size() );
}
<<<<<<< HEAD
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
=======
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
assertEquals( 3, dn.size() );
}
|
| Solution content |
|---|
/*
* Licensed to the Apache Software Foundation (ASF) under one
// ~ Methods
oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
}
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertSame;
/**
* Test the class LdapDN
*
* @author Apache Directory Project
* @version $Rev$, $Date$,
*/
public class LdapDNTest
{
private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
=======
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
/**
* test Add at the start of an existing LdapDN |
| Solution content |
|---|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
oids = new HashMap |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
{
LdapDN dn = new LdapDN( "a=b, c=d" );
<<<<<<< HEAD
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
=======
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() ); |
| Solution content |
|---|
/**
/**
oids.put( "domaincomponent", new OidNormalizer( "dc", new DeepTrimToLowerNormalizer() ) );
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
}
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.directory.shared.ldap.name;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.naming.CompoundName;
import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.ldap.LdapName;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.LdapDnParser;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertSame;
/**
* Test the class LdapDN
*
* @author Apache Directory Project
* @version $Rev$, $Date$,
*/
public class LdapDNTest
{
private Map |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( 3, dn.size() );
}
<<<<<<< HEAD
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
=======
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
}
*/
@Test
// GET operations
/**
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
@Test
@Test
*/
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
/**
* Test a startsWith a complex LdapDN
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
@Test
@Test
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| Solution content |
|---|
assertTrue( LdapDN.isValid( "" ) );
assertEquals( 0, dn.size() );
}
/**
* test a 1 size
*/
@Test
public void testLdapDNSize1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertTrue( LdapDN.isValid( "a=b" ) );
assertEquals( 1, dn.size() );
}
/**
* test a 3 size
*/
@Test
public void testLdapDNSize3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test a 3 size with NameComponents
*/
@Test
public void testLdapDNSize3NC() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b+c=d, c=d, e=f" );
assertTrue( LdapDN.isValid( "a=b+c=d, c=d, e=f" ) );
assertEquals( 3, dn.size() );
}
/**
* test size after operations
*/
@Test
public void testLdapResizing() throws InvalidNameException
{
LdapDN dn = new LdapDN();
assertEquals( 0, dn.size() );
dn.add( "e = f" );
assertEquals( 1, dn.size() );
dn.add( "c = d" );
assertEquals( 2, dn.size() );
dn.remove( 0 );
assertEquals( 1, dn.size() );
dn.remove( 0 );
assertEquals( 0, dn.size() );
}
// ADD Operations
/**
* test Add on a new LdapDN
*/
@Test
public void testLdapEmptyAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN();
dn.add( "e = f" );
assertEquals( "e=f", dn.toString() );
assertEquals( "e = f", dn.getUpName() );
assertEquals( 1, dn.size() );
}
/**
* test Add to an existing LdapDN
*/
@Test
public void testLdapDNAdd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f" );
assertEquals( "e=f,a=b,c=d", dn.toString() );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add a composite RDN to an existing LdapDN
*/
@Test
public void testLdapDNAddComposite() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( "e = f + g = h" );
// Warning ! The order of AVAs has changed during the parsing
// This has no impact on the correctness of the DN, but the
// String used to do the comparizon should be inverted.
assertEquals( "e=f+g=h,a=b,c=d", dn.toString() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the end of an existing LdapDN
*/
@Test
public void testLdapDNAddEnd() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( dn.size(), "e = f" );
assertEquals( "e = f,a=b, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
/**
* test Add at the start of an existing LdapDN
*/
@Test
public void testLdapDNAddStart() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 0, "e = f" );
assertEquals( "a=b, c=d,e = f", dn.getUpName() );
assertEquals( 3, dn.size() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
/**
@Test
/**
<<<<<<< HEAD
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
// GET PREFIX actions
/**
* Get the prefix at pos 0
*/
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
/**
*/
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
/**
* Get the suffix at pos 0
*/
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
@Test
LdapDN dn = new LdapDN( "a=b" );
// GET ALL operations
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| Solution content |
|---|
/**
* test Add at the middle of an existing LdapDN
*/
@Test
public void testLdapDNAddMiddle() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.add( 1, "e = f" );
assertEquals( "a=b,e = f, c=d", dn.getUpName() );
assertEquals( 3, dn.size() );
}
// ADD ALL Operations
/**
* Test AddAll
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll with an empty added name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( dn2 );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt0AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 0, dn2 );
assertEquals( "a = b,c = d", dn.getUpName() );
}
/**
* Test AddAll at position 1
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAt1AddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN( "c = d" );
dn.addAll( 1, dn2 );
assertEquals( "c = d,a = b", dn.getUpName() );
}
/**
* Test AddAll at the middle
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAtTheMiddleAddAll() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b, c = d" );
LdapDN dn2 = new LdapDN( "e = f" );
dn.addAll( 1, dn2 );
assertEquals( "a = b,e = f, c = d", dn.getUpName() );
}
/**
*/
/**
*/
* Get the suffix at pos 0
// GET PREFIX actions
/**
* Get the prefix at pos 0
* Test AddAll with an empty added name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0AddedNameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a = b" );
LdapDN dn2 = new LdapDN();
dn.addAll( 0, dn2 );
assertEquals( "a=b", dn.toString() );
assertEquals( "a = b", dn.getUpName() );
}
/**
* Test AddAll to an empty name at position 0
*
* @throws InvalidNameException
*/
@Test
public void testLdapDNAddAllAt0NameEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN();
LdapDN dn2 = new LdapDN( "a = b" );
dn.addAll( 0, dn2 );
assertEquals( "a = b", dn.getUpName() );
}
@Test
public void testLdapDNGetPrefixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the prefix at pos 1
*/
@Test
public void testLdapDNGetPrefixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 1 ) );
assertEquals( "e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 2
*/
@Test
public void testLdapDNGetPrefixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 2 ) );
assertEquals( " c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix at pos 3
*/
@Test
public void testLdapDNGetPrefixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 3 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the prefix out of bound
*/
@Test
public void testLdapDNGetPrefixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getPrefix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the prefix of an empty LdapName
*/
@Test
public void testLdapDNGetPrefixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getPrefix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// GET SUFFIX operations
@Test
public void testLdapDNGetSuffixPos0() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "a=b, c=d,e = f", newDn.getUpName() );
}
/**
* Get the suffix at pos 1
*/
@Test
public void testLdapDNGetSuffixPos1() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 1 ) );
assertEquals( "a=b, c=d", newDn.getUpName() );
}
/**
* Get the suffix at pos 2
*/
@Test
public void testLdapDNGetSuffixPos2() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 2 ) );
assertEquals( "a=b", newDn.getUpName() );
}
/**
* Get the suffix at pos 3
*/
@Test
public void testLdapDNGetSuffixPos3() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 3 ) );
assertEquals( "", newDn.getUpName() );
}
/**
* Get the suffix out of bound
*/
@Test
public void testLdapDNGetSuffixPos4() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
try
{
dn.getSuffix( 4 );
// We should not reach this point.
fail();
}
catch ( ArrayIndexOutOfBoundsException aoobe )
{
assertTrue( true );
}
}
/**
* Get the suffix of an empty LdapName
*/
@Test
public void testLdapDNGetSuffixEmptyDN()
{
LdapDN dn = new LdapDN();
LdapDN newDn = ( ( LdapDN ) dn.getSuffix( 0 ) );
assertEquals( "", newDn.getUpName() );
}
// IS EMPTY operations
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNIsEmpty()
{
LdapDN dn = new LdapDN();
assertEquals( true, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNNotEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b" );
assertEquals( false, dn.isEmpty() );
}
/**
* Test that a LdapDN is empty
*/
@Test
public void testLdapDNRemoveIsEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d" );
dn.remove( 0 );
dn.remove( 0 );
assertEquals( true, dn.isEmpty() );
}
// STARTS WITH operations
* Test a startsWith a complex LdapDN
/**
* Test a startsWith a null LdapDN
*/
@Test
public void testLdapDNStartsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( null ) );
}
/**
* Test a startsWith an empty LdapDN
*/
@Test
public void testLdapDNStartsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN() ) );
}
/**
* Test a startsWith an simple LdapDN
*/
@Test
public void testLdapDNStartsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "e=f" ) ) );
}
/**
*/
@Test
public void testLdapDNStartsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "c = d, e = f" ) ) );
}
/**
* Test a startsWith a complex LdapDN
*/
@Test
public void testLdapDNStartsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = D, E = f" ) ) );
}
/**
* Test a startsWith a full LdapDN
*/
@Test
public void testLdapDNStartsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.startsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a startsWith which returns false
*/
@Test
public void testLdapDNStartsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.startsWith( new LdapDN( "c = t, e = f" ) ) );
}
// ENDS WITH operations
/**
* Test a endsWith a null LdapDN
*/
@Test
public void testLdapDNEndsWithNull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( null ) );
}
/**
* Test a endsWith an empty LdapDN
*/
@Test
public void testLdapDNEndsWithEmpty() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN() ) );
}
/**
* Test a endsWith an simple LdapDN
*/
@Test
public void testLdapDNEndsWithSimple() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a=b" ) ) );
}
/**
* Test a endsWith a complex LdapDN
@Test
*/
@Test
public void testLdapDNEndsWithComplex() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a = b, c = d" ) ) );
}
/**
* Test a endsWith a complex LdapDN
*/
@Test
public void testLdapDNEndsWithComplexMixedCase() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = B, C = d" ) ) );
}
/**
* Test a endsWith a full LdapDN
*/
@Test
public void testLdapDNEndsWithFull() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( true, dn.endsWith( new LdapDN( "a= b; c = d, e = f" ) ) );
}
/**
* Test a endsWith which returns false
*/
public void testLdapDNEndsWithWrong() throws InvalidNameException
{
LdapDN dn = new LdapDN( "a=b, c=d,e = f" );
assertEquals( false, dn.endsWith( new LdapDN( "a = b, e = f" ) ) );
}
// GET ALL operations
/**
* test a getAll operation on a null DN
*/
@Test
public void testLdapDNGetAllNull()
{
LdapDN dn = new LdapDN();
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
* if anything goes wrong.
*/
@Test
<<<<<<< HEAD
public void testSize() throws Exception
=======
public void testIsEmpty() throws Exception
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
Name name0 = new LdapDN( "" );
Name name1 = new LdapDN( "ou=East" ); |
| Solution content |
|---|
* if anything goes wrong.
*/
@Test
public void testSize() throws Exception
{
Name name0 = new LdapDN( "" );
Name name1 = new LdapDN( "ou=East" ); |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
assertEquals( false, name5.isEmpty() );
Name name5 = new LdapDN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Name name6 = new LdapDN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
<<<<<<< HEAD
assertEquals( 0, name0.size() );
assertEquals( 1, name1.size() );
assertEquals( 2, name2.size() );
assertEquals( 3, name3.size() );
assertEquals( 4, name4.size() );
assertEquals( 5, name5.size() );
assertEquals( 6, name6.size() );
=======
assertEquals( true, name0.isEmpty() );
assertEquals( false, name1.isEmpty() );
assertEquals( false, name2.isEmpty() );
assertEquals( false, name3.isEmpty() );
assertEquals( false, name4.isEmpty() );
assertEquals( false, name6.isEmpty() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
Name name5 = new LdapDN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Name name6 = new LdapDN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
assertEquals( 0, name0.size() );
assertEquals( 1, name1.size() );
assertEquals( 2, name2.size() );
assertEquals( 3, name3.size() );
assertEquals( 4, name4.size() );
assertEquals( 5, name5.size() );
assertEquals( 6, name6.size() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
* Class to test for isEmpty
=======
* Class to test for getAll
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
*
* @throws Exception
* if anything goes wrong. |
| Solution content |
|---|
/**
* Class to test for isEmpty
*
* @throws Exception
* if anything goes wrong. |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| Chunk |
|---|
| Conflicting content |
|---|
* if anything goes wrong.
*/
@Test
<<<<<<< HEAD
public void testIsEmpty() throws Exception
=======
public void testGetAll() throws Exception
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
{
Name name0 = new LdapDN( "" );
Name name1 = new LdapDN( "ou=East" ); |
| Solution content |
|---|
* if anything goes wrong.
*/
@Test
public void testIsEmpty() throws Exception
{
Name name0 = new LdapDN( "" );
Name name1 = new LdapDN( "ou=East" ); |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
Name name4 = new LdapDN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
Name name5 = new LdapDN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Name name6 = new LdapDN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
<<<<<<< HEAD
assertEquals( true, name0.isEmpty() );
assertEquals( false, name1.isEmpty() );
assertEquals( false, name2.isEmpty() );
assertEquals( false, name3.isEmpty() );
assertEquals( false, name4.isEmpty() );
assertEquals( false, name5.isEmpty() );
assertEquals( false, name6.isEmpty() );
}
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
Enumeration |
| Solution content |
|---|
Name name4 = new LdapDN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
Name name5 = new LdapDN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Name name6 = new LdapDN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
assertEquals( true, name0.isEmpty() );
assertEquals( false, name1.isEmpty() );
assertEquals( false, name2.isEmpty() );
assertEquals( false, name3.isEmpty() );
assertEquals( false, name4.isEmpty() );
assertEquals( false, name5.isEmpty() );
assertEquals( false, name6.isEmpty() );
}
|
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
Enumeration |
| Solution content |
|---|
{
assertEquals( "ou=East", element );
}
}
/**
* Class to test for getAll
*
* @throws Exception
* if anything goes wrong.
*/
@Test
public void testGetAll() throws Exception
{
Name name0 = new LdapDN( "" );
Name name1 = new LdapDN( "ou=East" );
Name name2 = new LdapDN( "ou=Marketing,ou=East" );
Name name3 = new LdapDN( "cn=John,ou=Marketing,ou=East" );
Name name4 = new LdapDN( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
Name name5 = new LdapDN( "cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Name name6 = new LdapDN( "cn=Airline,cn=Website,cn=HomeDir,cn=John,ou=Marketing,ou=West" );
Enumeration |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| For statement |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
ObjectOutputStream out = new ObjectOutputStream( baos );
LdapDNSerializer.serialize( dn, out );
<<<<<<< HEAD
=======
out.flush();
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
byte[] data = baos.toByteArray();
ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) ); |
| Solution content |
|---|
ObjectOutputStream out = new ObjectOutputStream( baos );
LdapDNSerializer.serialize( dn, out );
out.flush();
byte[] data = baos.toByteArray();
ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) ); |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
ObjectOutputStream out = new ObjectOutputStream( baos );
LdapDNSerializer.serialize( dn, out );
<<<<<<< HEAD
=======
out.flush();
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
byte[] data = baos.toByteArray();
ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) ); |
| Solution content |
|---|
ObjectOutputStream out = new ObjectOutputStream( baos );
LdapDNSerializer.serialize( dn, out );
out.flush();
byte[] data = baos.toByteArray();
ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) ); |
| File |
|---|
| LdapDNTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
assertTrue( rdn5.compareTo( rdn6 ) < 0 );
assertTrue( rdn6.compareTo( rdn5 ) > 0 );
assertEquals( 0, rdn5.compareTo( rdn6 ) + rdn6.compareTo( rdn5 ) );
<<<<<<< HEAD
}
/**
* Test for DIRSHARED-2.
* The compare operation should return a correct value (1 or -1)
* depending on the ATAVs, not on their position.
*
* @throws InvalidNameException
*/
@Test
public void testCompareIndependentFromOrder() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b + c = d " );
Rdn rdn2 = new Rdn( " c = d + a = b " );
assertEquals( 0, rdn1.compareTo( rdn2 ) );
rdn1 = new Rdn( " a = b + c = e " );
rdn2 = new Rdn( " c = d + a = b " );
assertTrue( rdn1.compareTo( rdn2 ) > 0 );
assertTrue( rdn2.compareTo( rdn1 ) < 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
rdn1 = new Rdn( " a = b + c = d " );
rdn2 = new Rdn( " e = f + g = h " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
}
/**
* Test for DIRSHARED-3.
* Tests that compareTo() is invertable for single-valued RDNs.
*
* @throws InvalidNameException
*/
@Test
public void testCompareInvertableNC2NC() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b " );
Rdn rdn2 = new Rdn( " a = c " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
assertTrue( rdn6.compareTo( rdn5 ) > 0 );
assertEquals( 0, rdn5.compareTo( rdn6 ) + rdn6.compareTo( rdn5 ) );
assertTrue( rdn5.compareTo( rdn6 ) < 0 );
}
/**
* Test for DIRSHARED-2.
* The compare operation should return a correct value (1 or -1)
* depending on the ATAVs, not on their position.
*
* @throws InvalidNameException
*/
@Test
public void testCompareIndependentFromOrder() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b + c = d " );
Rdn rdn2 = new Rdn( " c = d + a = b " );
assertEquals( 0, rdn1.compareTo( rdn2 ) );
rdn1 = new Rdn( " a = b + c = e " );
rdn2 = new Rdn( " c = d + a = b " );
assertTrue( rdn1.compareTo( rdn2 ) > 0 );
assertTrue( rdn2.compareTo( rdn1 ) < 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
rdn1 = new Rdn( " a = b + c = d " );
rdn2 = new Rdn( " e = f + g = h " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
}
/**
* Test for DIRSHARED-3.
* Tests that compareTo() is invertable for single-valued RDNs.
*
* @throws InvalidNameException
*/
@Test
public void testCompareInvertableNC2NC() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b " );
Rdn rdn2 = new Rdn( " a = c " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
}
|
| File |
|---|
| RdnTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
<<<<<<< HEAD
=======
* Test for DIRSHARED-2.
* The compare operation should return a correct value (1 or -1)
* depending on the ATAVs, not on their position.
*
* @throws InvalidNameException
*/
@Test
public void testCompareIndependentFromOrder() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b + c = d " );
Rdn rdn2 = new Rdn( " c = d + a = b " );
assertEquals( 0, rdn1.compareTo( rdn2 ) );
rdn1 = new Rdn( " a = b + c = e " );
rdn2 = new Rdn( " c = d + a = b " );
assertTrue( rdn1.compareTo( rdn2 ) > 0 );
assertTrue( rdn2.compareTo( rdn1 ) < 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
rdn1 = new Rdn( " a = b + c = d " );
rdn2 = new Rdn( " e = f + g = h " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
}
/**
* Test for DIRSHARED-3.
* Tests that compareTo() is invertable for single-valued RDNs.
*
* @throws InvalidNameException
*/
@Test
public void testCompareInvertableNC2NC() throws InvalidNameException
{
Rdn rdn1 = new Rdn( " a = b " );
Rdn rdn2 = new Rdn( " a = c " );
assertTrue( rdn1.compareTo( rdn2 ) < 0 );
assertTrue( rdn2.compareTo( rdn1 ) > 0 );
assertEquals( 0, rdn1.compareTo( rdn2 ) + rdn2.compareTo( rdn1 ) );
}
/**
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
* Test for DIRSHARED-3.
* Tests that compareTo() is invertable for multi-valued RDNs with different values.
* |
| Solution content |
|---|
/**
* Test for DIRSHARED-3.
* Tests that compareTo() is invertable for multi-valued RDNs with different values.
* |
| File |
|---|
| RdnTest.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
assertTrue( RdnParser.isValid( "a=\"b\\,c\"" ) );
Rdn rdn = new Rdn( "a=\"b\\,c\"" );
<<<<<<< HEAD
assertEquals( "a=\"b\\,c\"", new Rdn( "a=\"b\\,c\"" ).getUpName() );
assertEquals( "a=b\\,c", new Rdn( "a=\"b\\,c\"" ).toString() );
=======
assertEquals( "a=\"b\\,c\"", rdn.getUpName() );
assertEquals( "a=b\\,c", rdn.toString() );
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
}
|
| Solution content |
|---|
assertTrue( RdnParser.isValid( "a=\"b\\,c\"" ) );
Rdn rdn = new Rdn( "a=\"b\\,c\"" );
assertEquals( "a=\"b\\,c\"", rdn.getUpName() );
assertEquals( "a=b\\,c", rdn.toString() );
}
|
| File |
|---|
| RdnTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
static class SyntaxImpl extends AbstractSyntax
{
<<<<<<< HEAD
@SuppressWarnings ( { "AnalyzingVariableNaming" } )
=======
>>>>>>> 24aa11f9a3ba90c4ae12b678db88b8e69462a903
private static final long serialVersionUID = 1L;
protected SyntaxImpl(String oid) |
| Solution content |
|---|
static class SyntaxImpl extends AbstractSyntax
{
private static final long serialVersionUID = 1L;
protected SyntaxImpl(String oid) |
| File |
|---|
| SchemaUtilsTest.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Annotation |