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);
}
}
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;
}
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;
}
}
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;
}
}
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);
}
Aggregations