use of com.aerospike.client.Bin in project aerospike-client-java by aerospike.
the class TestQueryInteger method prepare.
@BeforeClass
public static void prepare() {
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask task = client.createIndex(policy, args.namespace, args.set, indexName, binName, IndexType.NUMERIC);
task.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
for (int i = 1; i <= size; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
Bin bin = new Bin(binName, i);
client.put(null, key, bin);
}
}
use of com.aerospike.client.Bin in project aerospike-client-java by aerospike.
the class TestQueryRPS method bgQueryWithOps.
@Ignore
@Test
public void bgQueryWithOps() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setFilter(Filter.range(binName1, 0, n_records));
stmt.setRecordsPerSecond(rps);
ExecuteTask task = client.execute(null, stmt, Operation.put(new Bin(binName3, 1)));
task.waitTillComplete();
for (Node n : client.getNodes()) {
checkRuntime(n, stmt);
}
}
use of com.aerospike.client.Bin in project aerospike-client-java by aerospike.
the class TestQuerySum method prepare.
@BeforeClass
public static void prepare() {
RegisterTask rtask = client.register(null, TestQuerySum.class.getClassLoader(), "udf/sum_example.lua", "sum_example.lua", Language.LUA);
rtask.waitTillComplete();
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask itask = client.createIndex(policy, args.namespace, args.set, indexName, binName, IndexType.NUMERIC);
itask.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
for (int i = 1; i <= size; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
Bin bin = new Bin(binName, i);
client.put(null, key, bin);
}
}
use of com.aerospike.client.Bin in project aerospike-client-java by aerospike.
the class TestQueryAverage method prepare.
@BeforeClass
public static void prepare() {
RegisterTask rtask = client.register(null, TestQueryAverage.class.getClassLoader(), "udf/average_example.lua", "average_example.lua", Language.LUA);
rtask.waitTillComplete();
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
try {
IndexTask itask = client.createIndex(policy, args.namespace, args.set, indexName, binName, IndexType.NUMERIC);
itask.waitTillComplete();
} catch (AerospikeException ae) {
if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) {
throw ae;
}
}
for (int i = 1; i <= size; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
Bin bin = new Bin("l1", i);
client.put(null, key, bin, new Bin("l2", 1));
}
}
use of com.aerospike.client.Bin in project aerospike-client-java by aerospike.
the class ListMap method testMapStrings.
/**
* Write/Read HashMap<String,String> directly instead of relying on java serializer.
*/
private void testMapStrings(AerospikeClient client, Parameters params) throws Exception {
console.info("Read/Write HashMap<String,String>");
Key key = new Key(params.namespace, params.set, "mapkey1");
client.delete(params.writePolicy, key);
HashMap<String, String> map = new HashMap<String, String>();
map.put("key1", "string1");
map.put("key2", "string2");
map.put("key3", "string3");
Bin bin = new Bin(params.getBinName("mapbin1"), map);
client.put(params.writePolicy, key, bin);
Record record = client.get(params.policy, key, bin.name);
Map<?, ?> receivedMap = (Map<?, ?>) record.getValue(bin.name);
validateSize(3, receivedMap.size());
validate("string1", receivedMap.get("key1"));
validate("string2", receivedMap.get("key2"));
validate("string3", receivedMap.get("key3"));
console.info("Read/Write HashMap<String,String> successful");
}
Aggregations