git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@384
ab3bd59b-922f-494d-bb5f-
6f0a3c29deca
continue;
}
if (attributes[i].denyAnyValue()) {
continue;
}
if (attributes[i].denyAnyValue()) {
- ((Rule.Attribute) canonicalSpec.get(attributes[i].getName())).setAnyValueDeny(true);
+ ((Rule.Attribute) canonicalSpec.get(attributes[i].getName().toString())).setAnyValueDeny(true);
continue;
}
if (attributes[i].releaseAnyValue()) {
continue;
}
if (attributes[i].releaseAnyValue()) {
import java.net.URL;
import java.security.Principal;
import java.util.Arrays;
import java.net.URL;
import java.security.Principal;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.Properties;
import junit.framework.TestCase;
import java.util.Properties;
import junit.framework.TestCase;
principal1,
"shar.example.edu",
url1);
principal1,
"shar.example.edu",
url1);
- for (int i = 0; releaseAttributes.length > i; i++) {
- Object[] values = releaseAttributes[i].getValues();
- for (int j = 0; values.length > j; j++) {
- System.err.println(values[j]);
- }
- }
- System.err.println("---");
+ assertEquals(
+ "ARP not applied as expected.",
+ new HashSet(Arrays.asList(releaseAttributes)),
+ new HashSet(Arrays.asList(new ArpAttribute[] { testAttribute1 })));
+
//Test with site and user ARPs
inStream = new FileInputStream("test/arp7.xml");
parser.parse(new InputSource(inStream));
//Test with site and user ARPs
inStream = new FileInputStream("test/arp7.xml");
parser.parse(new InputSource(inStream));
principal1,
"shar.example.edu",
url1);
principal1,
"shar.example.edu",
url1);
- for (int i = 0; releaseAttributes.length > i; i++) {
- Object[] values = releaseAttributes[i].getValues();
- for (int j = 0; values.length > j; j++) {
- System.err.println(values[j]);
- }
- }
- System.err.println("---");
+ assertEquals(
+ "ARP not applied as expected.",
+ new HashSet(Arrays.asList(releaseAttributes)),
+ new HashSet(Arrays.asList(new ArpAttribute[] { testAttribute1, testAttribute2 })));
+
+ //Test with site and user ARPs
releaseAttributes =
engine.filterAttributes(
new ArpAttribute[] { testAttribute1, testAttribute2 },
principal1,
"shar1.example.edu",
url1);
releaseAttributes =
engine.filterAttributes(
new ArpAttribute[] { testAttribute1, testAttribute2 },
principal1,
"shar1.example.edu",
url1);
- for (int i = 0; releaseAttributes.length > i; i++) {
- Object[] values = releaseAttributes[i].getValues();
- for (int j = 0; values.length > j; j++) {
- System.err.println(values[j]);
- }
- }
- System.err.println("---");
+ assertEquals(
+ "ARP not applied as expected.",
+ new HashSet(Arrays.asList(releaseAttributes)),
+ new HashSet(Arrays.asList(new ArpAttribute[] { testAttribute1 })));
+
+ //Test with site and user ARPs
inStream = new FileInputStream("test/arp6.xml");
parser.parse(new InputSource(inStream));
Arp arp6 = new Arp();
inStream = new FileInputStream("test/arp6.xml");
parser.parse(new InputSource(inStream));
Arp arp6 = new Arp();
principal1,
"shar.example.edu",
url1);
principal1,
"shar.example.edu",
url1);
- for (int i = 0; releaseAttributes.length > i; i++) {
- Object[] values = releaseAttributes[i].getValues();
- for (int j = 0; values.length > j; j++) {
- System.err.println(values[j]);
- }
- }
+ assertEquals(
+ "ARP not applied as expected.",
+ new HashSet(Arrays.asList(releaseAttributes)),
+ new HashSet());
} catch (Exception e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
public void setValues(Object[] values) {
this.values = values;
}
public void setValues(Object[] values) {
this.values = values;
}
public boolean equals(Object object) {
if (!(object instanceof TestAttribute)) {
return false;
}
//finish this
public boolean equals(Object object) {
if (!(object instanceof TestAttribute)) {
return false;
}
//finish this
- return super.equals(object);
+ return (new HashSet(Arrays.asList(values))).equals(
+ Arrays.asList(((TestAttribute) object).getValues()));