Search in sources :

Example 36 with RequestPrime

use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.

the class EndToEndUtils method createParameterizedQuery.

public static RequestPrime createParameterizedQuery(String query, Map<String, Object> params, Result then) {
    LinkedHashMap<String, String> paramTypes = new LinkedHashMap<>();
    paramTypes.put("country_code", "varchar");
    paramTypes.put("country_name", "varchar");
    paramTypes.put("beginning_ip_address", "inet");
    paramTypes.put("ending_ip_address", "inet");
    paramTypes.put("beginning_ip_number", "bigint");
    paramTypes.put("ending_ip_number", "bigint");
    LinkedHashMap<String, Object> defaultParams = new LinkedHashMap<>();
    defaultParams.put("country_code", "*");
    defaultParams.put("country_name", "*");
    defaultParams.put("beginning_ip_address", "*");
    defaultParams.put("ending_ip_address", "*");
    defaultParams.put("beginning_ip_number", "*");
    defaultParams.put("ending_ip_number", "*");
    for (String key : params.keySet()) {
        defaultParams.put(key, params.get(key));
    }
    Query when = new Query(query, Collections.emptyList(), defaultParams, paramTypes);
    return new RequestPrime(when, then);
}
Also used : Query(com.datastax.oss.simulacron.common.request.Query) RequestPrime(com.datastax.oss.simulacron.common.cluster.RequestPrime) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

RequestPrime (com.datastax.oss.simulacron.common.cluster.RequestPrime)36 Prime (com.datastax.oss.simulacron.common.stubbing.Prime)32 DataStaxBulkLoader (com.datastax.oss.dsbulk.runner.DataStaxBulkLoader)30 ExitStatus (com.datastax.oss.dsbulk.runner.ExitStatus)30 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)30 Test (org.junit.jupiter.api.Test)28 LinkedHashMap (java.util.LinkedHashMap)7 Query (com.datastax.oss.simulacron.common.request.Query)6 SuccessResult (com.datastax.oss.simulacron.common.result.SuccessResult)6 SyntaxErrorResult (com.datastax.oss.simulacron.common.result.SyntaxErrorResult)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Record (com.datastax.oss.dsbulk.connectors.api.Record)2 ErrorResult (com.datastax.oss.simulacron.common.result.ErrorResult)2 FunctionFailureResult (com.datastax.oss.simulacron.common.result.FunctionFailureResult)2 ReadTimeoutResult (com.datastax.oss.simulacron.common.result.ReadTimeoutResult)2 ServerErrorResult (com.datastax.oss.simulacron.common.result.ServerErrorResult)2 WriteFailureResult (com.datastax.oss.simulacron.common.result.WriteFailureResult)2 WriteTimeoutResult (com.datastax.oss.simulacron.common.result.WriteTimeoutResult)2 Config (com.typesafe.config.Config)2