/** * Constructs a new MultiKeyMap that decorates a <code>HashedMap</code>. */ public MultiKeyMap() { super(); map = new HashedMap(); }
/** * Create an instance of the map used for storage when in delegation mode. * <p> * This can be overridden by subclasses to provide a different map implementation. * Not every AbstractHashedMap is suitable, identity and reference based maps * would be poor choices. * * @return a new AbstractHashedMap or subclass * @since Commons Collections 3.1 */ protected AbstractHashedMap createDelegateMap() { return new HashedMap(); }
/** * Constructs a new MultiKeyMap that decorates a <code>HashedMap</code>. */ public MultiKeyMap() { super(); map = new HashedMap(); }
/** * Create an instance of the map used for storage when in delegation mode. * <p> * This can be overridden by subclasses to provide a different map implementation. * Not every AbstractHashedMap is suitable, identity and reference based maps * would be poor choices. * * @return a new AbstractHashedMap or subclass * @since Commons Collections 3.1 */ protected AbstractHashedMap createDelegateMap() { return new HashedMap(); }
public Map makeEmptyMap() { return new HashedMap(); }
public TestDefaultRebalanceStrategy(HelixManager helixManager) { super(helixManager); tagToInstances = new HashedMap(); }
public TestRealtimeSegmentRelocator(PinotHelixResourceManager pinotHelixResourceManager, ControllerConf config, ControllerMetrics controllerMetrics) { super(pinotHelixResourceManager, config, controllerMetrics); tagToInstances = new HashedMap(); }
public Set makeEmptySet() { return MapBackedSet.decorate(new HashedMap()); }
/** * getStringClusterInfoMap * * @param virtualClusterDomain * @return */ private Map<String, ClusterInfo> getStringClusterInfoMap(VirtualClusterDomain virtualClusterDomain) { Map<String, ClusterInfo> clusterInfoMap = new HashedMap(); virtualClusterDomain.getClusterMap().forEach((clusterName, cluster) -> { ClusterInfo clusterInfo = new ClusterInfo(); List<IpAddressInfo> ipAddressInfos = getIpAddressInfos(cluster.allIPs()); clusterInfo.setHosts(ipAddressInfos); clusterInfoMap.put(clusterName, clusterInfo); }); return clusterInfoMap; }
public void testClone() { HashedMap map = new HashedMap(10); map.put("1", "1"); Map cloned = (Map) map.clone(); assertEquals(map.size(), cloned.size()); assertSame(map.get("1"), cloned.get("1")); }
@Test void testRevocablePasswordGrantTokenForDefaultZone() throws Exception { String tokenKey = "access_token"; Map<String, Object> tokenResponse = testRevocablePasswordGrantTokenForDefaultZone(new HashedMap()); assertNotNull("Token must be present", tokenResponse.get(tokenKey)); assertTrue("Token must be a string", tokenResponse.get(tokenKey) instanceof String); String token = (String) tokenResponse.get(tokenKey); Jwt jwt = JwtHelper.decode(token); Map<String, Object> claims = JsonUtils.readValue(jwt.getClaims(), new TypeReference<Map<String, Object>>() { }); assertNotNull("Token revocation signature must exist", claims.get(ClaimConstants.REVOCATION_SIGNATURE)); assertTrue("Token revocation signature must be a string", claims.get(ClaimConstants.REVOCATION_SIGNATURE) instanceof String); assertTrue("Token revocation signature must have data", StringUtils.hasText((String) claims.get(ClaimConstants.REVOCATION_SIGNATURE))); }
@BeforeClass public static void setUpClass() { GroovyEvaluator groovyEvaluator = new GroovyEvaluator( "id", "sid", cellExecutor(), EvaluatorTest.getTestTempFolderFactory(), new EvaluatorParameters(new HashedMap()), new EvaluatorTest.BeakexClientTestImpl(), new MagicCommandAutocompletePatternsMock() ); groovyKernel = new GroovyKernelMock("sid", groovyEvaluator); }
public void testInternalState() { HashedMap map = new HashedMap(42, 0.75f); assertEquals(0.75f, map.loadFactor, 0.1f); assertEquals(0, map.size); assertEquals(64, map.data.length); assertEquals(48, map.threshold); assertEquals(0, map.modCount); }
@Test public void ensure_that_duplicates_get_the_last_object() { JsonWebKeySet<JsonWebKey> keys = JsonUtils.readValue(sampleRsaKeys, new TypeReference<JsonWebKeySet<JsonWebKey>>() { }); List<JsonWebKey> list = new ArrayList<>(keys.getKeys()); list.addAll(keys.getKeys()); assertEquals(6, list.size()); Map<String, Object> p = new HashedMap(list.get(5).getKeyProperties()); p.put("issuer", ISSUER); list.add(new VerificationKeyResponse(p)); assertEquals(7, list.size()); keys = new JsonWebKeySet<>(list); keys = deserialize_azure_keys(JsonUtils.writeValueAsString(keys)); assertEquals(ISSUER, keys.getKeys().get(2).getKeyProperties().get("issuer")); }
@Test void testPasswordGrantTokenForDefaultZone_Opaque() throws Exception { Map<String, String> parameters = new HashedMap(); parameters.put(REQUEST_TOKEN_FORMAT, OPAQUE.getStringValue()); String tokenKey = "access_token"; Map<String, Object> tokenResponse = testRevocablePasswordGrantTokenForDefaultZone(parameters); assertNotNull("Token must be present", tokenResponse.get(tokenKey)); assertTrue("Token must be a string", tokenResponse.get(tokenKey) instanceof String); String token = (String) tokenResponse.get(tokenKey); assertThat("Token must be shorter than 37 characters", token.length(), lessThanOrEqualTo(36)); RevocableToken revocableToken = webApplicationContext.getBean(RevocableTokenProvisioning.class).retrieve(token, IdentityZoneHolder.get().getId()); assertNotNull("Token should have been stored in the DB", revocableToken); Jwt jwt = JwtHelper.decode(revocableToken.getValue()); Map<String, Object> claims = JsonUtils.readValue(jwt.getClaims(), new TypeReference<Map<String, Object>>() { }); assertNotNull("Revocable claim must exist", claims.get(ClaimConstants.REVOCABLE)); assertTrue("Token revocable claim must be set to true", (Boolean) claims.get(ClaimConstants.REVOCABLE)); }
@Test void testDefaultZone_Jwt_Revocable() throws Exception { IdentityZoneProvisioning zoneProvisioning = webApplicationContext.getBean(IdentityZoneProvisioning.class); IdentityZone defaultZone = zoneProvisioning.retrieve(IdentityZone.getUaa().getId()); try { defaultZone.getConfig().getTokenPolicy().setJwtRevocable(true); zoneProvisioning.update(defaultZone); Map<String, String> parameters = new HashedMap(); Map<String, Object> tokenResponse = testRevocablePasswordGrantTokenForDefaultZone(parameters); validateRevocableJwtToken(tokenResponse, defaultZone); } finally { defaultZone.getConfig().getTokenPolicy().setJwtRevocable(false); zoneProvisioning.update(defaultZone); } }
public Map<String, Object> toMap() { Map<String, Object> map = new HashedMap(); map.put(VmInstanceConstant.Capability.LiveMigration.toString(), isSupportLiveMigration()); map.put(VmInstanceConstant.Capability.VolumeMigration.toString(), isSupportVolumeMigration()); map.put(VmInstanceConstant.Capability.Reimage.toString(), isSupportReimage()); return map; } }
@Test public void testSetDetailsWithRootCredentials() { final HostResponse hostResponse = new HostResponse(); final Map details = new HashMap<>(); details.put(VALID_KEY, VALID_VALUE); details.put("username", "test"); details.put("password", "password"); final Map expectedDetails = new HashedMap(); expectedDetails.put(VALID_KEY, VALID_VALUE); hostResponse.setDetails(details); final Map actualDetails = hostResponse.getDetails(); assertTrue(details != actualDetails); assertEquals(expectedDetails, actualDetails); }
@Test public void testSetDetailsWithoutRootCredentials() { final HostResponse hostResponse = new HostResponse(); final Map details = new HashMap<>(); details.put(VALID_KEY, VALID_VALUE); final Map expectedDetails = new HashedMap(); expectedDetails.put(VALID_KEY, VALID_VALUE); hostResponse.setDetails(details); final Map actualDetails = hostResponse.getDetails(); assertTrue(details != actualDetails); assertEquals(expectedDetails, actualDetails); } }
void createLDAPProvider(IdentityProvider<LdapIdentityProviderDefinition> identityProvider, FieldDescriptor[] fields, String name) throws Exception { Map<String, Object> attributeMappings = new HashedMap(identityProvider.getConfig().getAttributeMappings()); attributeMappings.put(EMAIL_VERIFIED_ATTRIBUTE_NAME, "emailVerified"); identityProvider.getConfig().setAttributeMappings(attributeMappings);