Search in sources :

Example 86 with OrderedSet

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);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node)

Example 87 with OrderedSet

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));
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Aggregations

OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)87 Map (java.util.Map)52 Set (java.util.Set)36 Iterator (java.util.Iterator)20 HashMap (java.util.HashMap)17 HashSet (java.util.HashSet)16 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)13 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)13 CCActionTable (com.sun.web.ui.view.table.CCActionTable)12 AMServiceProfileModel (com.sun.identity.console.base.model.AMServiceProfileModel)6 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)5 ArrayList (java.util.ArrayList)5 LinkedHashSet (java.util.LinkedHashSet)5 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)4 List (java.util.List)4 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)3 WSAuthHandlerEntry (com.sun.identity.console.webservices.model.WSAuthHandlerEntry)3 IdRepo (com.sun.identity.idm.IdRepo)3 Issuer (com.sun.identity.saml2.assertion.Issuer)3 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)3