Search in sources :

Example 66 with HashMap

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);
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) ConfigType(com.sequenceiq.ambari.shell.completion.ConfigType) File(java.io.File) Test(org.junit.Test)

Example 67 with HashMap

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);
    }
}
Also used : CSVReader(au.com.bytecode.opencsv.CSVReader) HashMap(java.util.HashMap)

Example 68 with HashMap

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);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OAuth2Request(org.springframework.security.oauth2.provider.OAuth2Request) HashMap(java.util.HashMap) OAuth2Authentication(org.springframework.security.oauth2.provider.OAuth2Authentication) Authentication(org.springframework.security.core.Authentication) OAuth2Authentication(org.springframework.security.oauth2.provider.OAuth2Authentication) Collection(java.util.Collection)

Example 69 with HashMap

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());
}
Also used : HttpEntity(org.springframework.http.HttpEntity) HashMap(java.util.HashMap) ParameterizedTypeReference(org.springframework.core.ParameterizedTypeReference) OAuth2Authentication(org.springframework.security.oauth2.provider.OAuth2Authentication) Matchers.anyString(org.mockito.Matchers.anyString) HttpMethod(org.springframework.http.HttpMethod) Test(org.junit.Test)

Example 70 with HashMap

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;
}
Also used : InsnNode(jadx.core.dex.nodes.InsnNode) RegisterArg(jadx.core.dex.instructions.args.RegisterArg) PhiInsn(jadx.core.dex.instructions.PhiInsn) HashMap(java.util.HashMap) InsnArg(jadx.core.dex.instructions.args.InsnArg) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)29051 ArrayList (java.util.ArrayList)7306 Map (java.util.Map)6569 Test (org.junit.Test)6315 List (java.util.List)3204 IOException (java.io.IOException)2753 HashSet (java.util.HashSet)2366 Set (java.util.Set)1616 File (java.io.File)1440 LinkedHashMap (java.util.LinkedHashMap)1417 Iterator (java.util.Iterator)1273 Test (org.testng.annotations.Test)1048 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)865 ApiResponse (io.kubernetes.client.ApiResponse)707 Pair (io.kubernetes.client.Pair)707 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)707 Date (java.util.Date)590 LinkedList (java.util.LinkedList)574 Properties (java.util.Properties)507 URI (java.net.URI)474