use of java.util.HashMap in project ambari-shell by sequenceiq.
the class ConfigCommandsTest method testSetConfigForFile.
@Test
public void testSetConfigForFile() throws IOException {
ConfigType configType = mock(ConfigType.class);
File file = new File("src/test/resources/core-site.xml");
when(configType.getName()).thenReturn(CORE_SITE);
configCommands.setConfig(configType, "", file);
Map<String, String> config = new HashMap<String, String>();
config.put("fs.trash.interval", "350");
config.put("ipc.client.connection.maxidletime", "30000");
verify(client).modifyConfiguration(CORE_SITE, config);
}
use of java.util.HashMap in project dbeaver by serge-rider.
the class ConfigImportWizardPageCustomConnections method importCSV.
private void importCSV(ImportData importData, ImportDriverInfo driver, Reader reader) throws IOException {
final CSVReader csvReader = new CSVReader(reader);
final String[] header = csvReader.readNext();
if (ArrayUtils.isEmpty(header)) {
setErrorMessage("No connection found");
return;
}
for (; ; ) {
final String[] line = csvReader.readNext();
if (ArrayUtils.isEmpty(line)) {
break;
}
Map<String, String> conProps = new HashMap<>();
for (int i = 0; i < line.length; i++) {
if (i >= header.length) {
break;
}
conProps.put(header[i], line[i]);
}
makeConnectionFromProps(importData, driver, conProps);
}
}
use of java.util.HashMap in project spring-security-oauth2-google by skate056.
the class GoogleAccessTokenConverter method extractAuthentication.
public OAuth2Authentication extractAuthentication(Map<String, ?> map) {
Map<String, String> parameters = new HashMap<>();
Set<String> scope = parseScopes(map);
Authentication user = userTokenConverter.extractAuthentication(map);
String clientId = (String) map.get(CLIENT_ID);
parameters.put(CLIENT_ID, clientId);
Set<String> resourceIds = new LinkedHashSet<>(map.containsKey(AUD) ? (Collection<String>) map.get(AUD) : Collections.<String>emptySet());
OAuth2Request request = new OAuth2Request(parameters, clientId, null, true, scope, resourceIds, null, null, null);
return new OAuth2Authentication(request, user);
}
use of java.util.HashMap in project spring-security-oauth2-google by skate056.
the class GoogleTokenServicesTest method shouldLoadAuthenticationAndTransformValuesToStandardValuesAndAddDomainRole.
@Test
public void shouldLoadAuthenticationAndTransformValuesToStandardValuesAndAddDomainRole() throws Exception {
Map<String, String> body = new HashMap<>();
body.put("issued_to", "blh");
body.put("user_id", "user@domain.google.com");
body.put("email", "user@domain.google.com");
given(response.getBody()).willReturn(body);
given(restTemplate.exchange(anyString(), any(HttpMethod.class), any(HttpEntity.class), any(ParameterizedTypeReference.class))).willReturn(response);
googleTokenServices.setRestTemplate(restTemplate);
googleTokenServices.setCheckTokenEndpointUrl("//");
DefaultUserAuthenticationConverter defaultUserAuthenticationConverter = new DefaultUserAuthenticationConverter();
defaultUserAuthenticationConverter.setAuthorityGranter(authorityGranter);
GoogleAccessTokenConverter realAccessTokenConverter = new GoogleAccessTokenConverter();
realAccessTokenConverter.setUserTokenConverter(defaultUserAuthenticationConverter);
googleTokenServices.setAccessTokenConverter(realAccessTokenConverter);
OAuth2Authentication authentication = googleTokenServices.loadAuthentication(null);
assertThat(authentication, notNullValue());
verify(authorityGranter).getAuthorities(anyMap());
}
use of java.util.HashMap in project jadx by skylot.
the class TernaryMod method checkLineStats.
/**
* Return 'true' if there are several args with same source lines
*/
private static boolean checkLineStats(InsnNode t, InsnNode e) {
if (t.getResult() == null || e.getResult() == null) {
return false;
}
PhiInsn tPhi = t.getResult().getSVar().getUsedInPhi();
PhiInsn ePhi = e.getResult().getSVar().getUsedInPhi();
if (tPhi == null || ePhi == null || tPhi != ePhi) {
return false;
}
Map<Integer, Integer> map = new HashMap<Integer, Integer>(tPhi.getArgsCount());
for (InsnArg arg : tPhi.getArguments()) {
if (!arg.isRegister()) {
continue;
}
InsnNode assignInsn = ((RegisterArg) arg).getAssignInsn();
if (assignInsn == null) {
continue;
}
int sourceLine = assignInsn.getSourceLine();
if (sourceLine != 0) {
Integer count = map.get(sourceLine);
if (count != null) {
map.put(sourceLine, count + 1);
} else {
map.put(sourceLine, 1);
}
}
}
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
if (entry.getValue() >= 2) {
return true;
}
}
return false;
}
Aggregations