Skip to content

Commit

Permalink
[SHIBUI-1772]
Browse files Browse the repository at this point in the history
update test (missed field)
hashcode enhancement for request initiator
  • Loading branch information
jj committed Apr 5, 2021
1 parent 70159e3 commit 9f8f007
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
import javax.xml.namespace.QName;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@Entity
@EqualsAndHashCode(callSuper = true, exclude = {"storageAttributeMap"})
@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
public class RequestInitiator extends AbstractElementExtensibleXMLObject implements org.opensaml.saml.ext.saml2mdreqinit.RequestInitiator {
@EqualsAndHashCode.Include
private String binding;
@Override
public String getBinding() {
Expand All @@ -27,6 +29,7 @@ public void setBinding(String binding) {
this.binding = binding;
}

@EqualsAndHashCode.Include
private String location;

@Override
Expand All @@ -39,6 +42,7 @@ public void setLocation(String location) {
this.location = location;
}

@EqualsAndHashCode.Include
private String responseLocation;

@Override
Expand All @@ -57,6 +61,11 @@ public void setResponseLocation(String location) {
@Transient
private AttributeMap attributeMap = new AttributeMap(this);

@EqualsAndHashCode.Include
private Set<Map.Entry<QName, String>> attributeMapEntrySet() {
return this.attributeMap.entrySet();
}

@PrePersist
void prePersist() {
this.storageAttributeMap = this.attributeMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ class VersioningTests extends Specification{

def "test that two loaded entity descriptors gets the same version when load from the same file"() {
given:
def resourceId = "testme"
def xmlBytes = this.class.getResource('/metadata/SHIBUI-1723-1.xml').bytes
def ed1 = openSamlObjects.unmarshalFromXml(xmlBytes)
ed1.resourceId = resourceId
def ed2 = openSamlObjects.unmarshalFromXml(xmlBytes)
ed2.resourceId = resourceId

expect:
ed1.hashCode() == ed2.hashCode()
Expand Down

0 comments on commit 9f8f007

Please sign in to comment.