use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class ValidationErrorHandler method getAttributeValuePair.
/**
* Method to get Values within AttributeValuePair as a java.util.Set
* If <class>unescape<class> is set to false, xml escaped chars will not
* be unescaped.
*/
public static Set getAttributeValuePair(Node node, boolean unescape) {
if (!node.getNodeName().equals(ATTR_VALUE_PAIR_NODE)) {
return (null);
}
Set retVal = new OrderedSet();
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node n = children.item(i);
if (n.getNodeName().equalsIgnoreCase(VALUE_NODE)) {
retVal.add(getValueOfValueNode(n, unescape));
}
}
return (retVal);
}
use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class IOUtilsTest method testDeserializeValid.
@Test
public void testDeserializeValid() throws Exception {
// This assumes that the fallback list is in place
final Map validCollection = new HashMap();
validCollection.put("key1", "value1");
OrderedSet value2 = new OrderedSet();
value2.add("A");
value2.add("B");
value2.add("C");
value2.add("D");
validCollection.put("key2", value2);
Set<String> value3 = new HashSet<>();
value3.add("value3.1");
value3.add("value3.2");
value3.add("value3.3");
validCollection.put("key3", value3);
List<String> value4 = new ArrayList<>();
value4.add("value4.1");
value4.add("value4.2");
value4.add("value4.3");
value4.add("value4.4");
validCollection.put("key4", value4);
Map value5 = new HashMap();
value5.put("value2", value2);
value5.put("value3", value3);
value5.put("value4", value4);
validCollection.put("key5", value5);
validCollection.put("key6", Collections.emptyMap());
validCollection.put("key7", new Integer(7));
validCollection.put("key8", new Boolean(true));
validCollection.put("key9", new String[] { "1", "2" });
validCollection.put("key10", new Integer[] { 1, 2 });
validCollection.put("key11", new byte[] { 0, 1 });
validCollection.put("key12", new char[] { 0, 1 });
validCollection.put("key13", new short[] { 0, 1 });
validCollection.put("key14", new int[] { 0, 1 });
validCollection.put("key15", new long[] { 0, 1 });
validCollection.put("key16", new float[] { 0.0f, 1.0f });
validCollection.put("key17", new double[] { 0.0f, 1.0f });
validCollection.put("key18", new boolean[] { true, false });
validCollection.put("key19", new int[][] { { 1, 1 }, { 2, 2 } });
final byte[] bytes = getObjectStreamBytes(validCollection, true);
// can't use assertEquals here due to the way the primitives are checked for being equal
Assert.assertNotNull(IOUtils.deserialise(bytes, true));
}
Aggregations