Skip to Content.
Sympa Menu

mace-opensaml-users - Re: SAMLNameIdentifier.equals

Subject: OpenSAML user discussion

List archive

Re: SAMLNameIdentifier.equals


Chronological Thread 
  • From: Tom Scavo <>
  • To: Scott Cantor <>
  • Cc: OpenSAML <>
  • Subject: Re: SAMLNameIdentifier.equals
  • Date: Fri, 13 Jan 2006 15:40:11 -0500
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=d/Lkt4L4ZpJdAEjjccfp2ZOiSOuso5qBLckKYgtMP/4qjh+uiKCccFjXeua5WDYL2jDjs2N/k0QafxHUkmqlaItZ97ubhDaQ6Vx8l5vL6BLq2JCX1251XZvMGNpY5rafItrA7G53mLgBUdw6m4sUMCK+YnK71xVcDaUx7fTjYpk=

On 1/13/06, Scott Cantor
<>
wrote:
>
> Right now, they all work exactly the same and two copies of the same data
> are simply not equal.

Well, you wrote this line of code in SAMLNameIdentifierTest:

assertEquals("names do not serialize equal",n.toString(),n2.toString());

which seems to imply a working notion of equals. All I'm suggesting
is that this be made explicit by wrapping it in an equals method
(which is standard practice). Whatever the implementation, it should
satisfy this test:

public void testEquals() throws Exception {
String name = "any name";
String nameQualifier = "any name qualifier";

SAMLNameIdentifier nameid1, nameid2;
nameid1 = new SAMLNameIdentifier(name, nameQualifier, null);
nameid2 = new SAMLNameIdentifier(name, nameQualifier,
FORMAT_UNSPECIFIED);

assertEquals("NameIdentifiers not equal", nameid1, nameid1);
assertEquals("NameIdentifiers not equal", nameid1, nameid2);
assertEquals("NameIdentifiers not equal", nameid2, nameid1);
assertEquals("NameIdentifiers not equal", nameid2, nameid2);
}

Btw, unit testing inherently relies on some notion of object
equivalence, so equals methods should be included in subclasses of
SAMLObject for testing purposes, if for no other reason.

> I don't see that changing.

I was afraid you'd say that. :-) Okay, there's no need to argue about
it further.

Cheers,
Tom



Archive powered by MHonArc 2.6.16.

Top of Page