Search in sources :

Example 86 with LinkedHashSet

use of java.util.LinkedHashSet in project OpenAM by OpenRock.

the class SAMLv2Base method populateAuthenticationContext.

/**
     * For the given set of authContexts read from the extended metadata, populate the table and dropdown menu
     * @param authContexts The set of SAMLv2AuthContexts read from the extended metadata
     * @param tblAuthContextsModel The table model to populate
     * @param dropdownContextRef The name of the context dropdown menu component to populate
     */
protected void populateAuthenticationContext(SAMLv2AuthContexts authContexts, CCActionTableModel tblAuthContextsModel, String dropdownContextRef) {
    // Create lists from defaults that can be updated as there maybe custom entries from the extended metadata.
    Set<String> contextNames = new LinkedHashSet<String>(DEFAULT_AUTH_CONTEXT_REF_NAMES);
    OptionList options = new OptionList();
    // Used to indicate no default context
    options.add(getLabel("none"), "none");
    for (String name : contextNames) {
        options.add(getLabel(name), name);
    }
    // Need to compare the list from the metadata to the default list and any that are missing should be added
    // to the set being shown in the console as they will be custom entries
    Map<String, SAMLv2AuthContexts.SAMLv2AuthContext> contexts = authContexts.getCollections();
    for (SAMLv2AuthContexts.SAMLv2AuthContext value : contexts.values()) {
        if (contextNames.add(value.name)) {
            options.add(getLabel(value.name), value.name);
        }
    }
    CCDropDownMenu ac = (CCDropDownMenu) getChild(dropdownContextRef);
    ac.setOptions(options);
    tblAuthContextsModel.clear();
    int i = 0;
    for (String name : contextNames) {
        populateAuthenticationContext(name, authContexts, i++, tblAuthContextsModel, dropdownContextRef);
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 87 with LinkedHashSet

use of java.util.LinkedHashSet in project ORCID-Source by ORCID.

the class OrcidProfileManagerImpl method dedupeWorks.

@Override
public OrcidWorks dedupeWorks(OrcidWorks orcidWorks) {
    Set<OrcidWork> workSet = new LinkedHashSet<OrcidWork>();
    for (OrcidWork orcidWork : orcidWorks.getOrcidWork()) {
        orcidProfileCleaner.clean(orcidWork);
        workSet.add(orcidWork);
    }
    OrcidWorks dedupedOrcidWorks = new OrcidWorks();
    dedupedOrcidWorks.getOrcidWork().addAll(workSet);
    return dedupedOrcidWorks;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 88 with LinkedHashSet

use of java.util.LinkedHashSet in project android_frameworks_base by DirtyUnicorns.

the class NetworkPolicyManagerServiceTest method testLastCycleSane.

public void testLastCycleSane() throws Exception {
    final NetworkPolicy policy = new NetworkPolicy(sTemplateWifi, 31, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED, false);
    final LinkedHashSet<Long> seen = new LinkedHashSet<Long>();
    // walk backwards, ensuring that cycle boundaries look sane
    long currentCycle = computeLastCycleBoundary(parseTime("2011-08-04T00:00:00.000Z"), policy);
    for (int i = 0; i < 128; i++) {
        long lastCycle = computeLastCycleBoundary(currentCycle, policy);
        assertEqualsFuzzy(DAY_IN_MILLIS * 30, currentCycle - lastCycle, DAY_IN_MILLIS * 3);
        assertUnique(seen, lastCycle);
        currentCycle = lastCycle;
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) NetworkPolicy(android.net.NetworkPolicy) EasyMock.anyLong(org.easymock.EasyMock.anyLong)

Example 89 with LinkedHashSet

use of java.util.LinkedHashSet in project android_frameworks_base by DirtyUnicorns.

the class NetworkPolicyManagerServiceTest method testNextCycleSane.

public void testNextCycleSane() throws Exception {
    final NetworkPolicy policy = new NetworkPolicy(sTemplateWifi, 31, TIMEZONE_UTC, WARNING_DISABLED, LIMIT_DISABLED, false);
    final LinkedHashSet<Long> seen = new LinkedHashSet<Long>();
    // walk forwards, ensuring that cycle boundaries don't get stuck
    long currentCycle = computeNextCycleBoundary(parseTime("2011-08-01T00:00:00.000Z"), policy);
    for (int i = 0; i < 128; i++) {
        long nextCycle = computeNextCycleBoundary(currentCycle, policy);
        assertEqualsFuzzy(DAY_IN_MILLIS * 30, nextCycle - currentCycle, DAY_IN_MILLIS * 3);
        assertUnique(seen, nextCycle);
        currentCycle = nextCycle;
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) NetworkPolicy(android.net.NetworkPolicy) EasyMock.anyLong(org.easymock.EasyMock.anyLong)

Example 90 with LinkedHashSet

use of java.util.LinkedHashSet in project jedis by xetorthio.

the class SortedSetCommandsTest method zrangeWithScores.

@Test
public void zrangeWithScores() {
    jedis.zadd("foo", 1d, "a");
    jedis.zadd("foo", 10d, "b");
    jedis.zadd("foo", 0.1d, "c");
    jedis.zadd("foo", 2d, "a");
    Set<Tuple> expected = new LinkedHashSet<Tuple>();
    expected.add(new Tuple("c", 0.1d));
    expected.add(new Tuple("a", 2d));
    Set<Tuple> range = jedis.zrangeWithScores("foo", 0, 1);
    assertEquals(expected, range);
    expected.add(new Tuple("b", 10d));
    range = jedis.zrangeWithScores("foo", 0, 100);
    assertEquals(expected, range);
    // Binary
    jedis.zadd(bfoo, 1d, ba);
    jedis.zadd(bfoo, 10d, bb);
    jedis.zadd(bfoo, 0.1d, bc);
    jedis.zadd(bfoo, 2d, ba);
    Set<Tuple> bexpected = new LinkedHashSet<Tuple>();
    bexpected.add(new Tuple(bc, 0.1d));
    bexpected.add(new Tuple(ba, 2d));
    Set<Tuple> brange = jedis.zrangeWithScores(bfoo, 0, 1);
    assertEquals(bexpected, brange);
    bexpected.add(new Tuple(bb, 10d));
    brange = jedis.zrangeWithScores(bfoo, 0, 100);
    assertEquals(bexpected, brange);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Tuple(redis.clients.jedis.Tuple) Test(org.junit.Test)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)3111 ArrayList (java.util.ArrayList)632 Set (java.util.Set)410 HashSet (java.util.HashSet)334 HashMap (java.util.HashMap)312 Map (java.util.Map)284 List (java.util.List)269 File (java.io.File)266 LinkedHashMap (java.util.LinkedHashMap)257 IOException (java.io.IOException)240 Test (org.junit.Test)239 LinkedList (java.util.LinkedList)139 Collection (java.util.Collection)103 URL (java.net.URL)83 ProcessResult (org.asqatasun.entity.audit.ProcessResult)76 Iterator (java.util.Iterator)73 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)73 TreeMap (java.util.TreeMap)70 TreeSet (java.util.TreeSet)70 Collectors (java.util.stream.Collectors)69