double builder should build from string
This commit is contained in:
@@ -14,7 +14,7 @@ import redis.clients.util.SafeEncoder;
|
||||
public class BuilderFactory {
|
||||
public static final Builder<Double> DOUBLE = new Builder<Double>() {
|
||||
public Double build(Object data) {
|
||||
return Double.valueOf((Long) data);
|
||||
return Double.valueOf(STRING.build(data));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package redis.clients.jedis.tests;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.BuilderFactory;
|
||||
|
||||
public class BuilderFactoryTest extends Assert {
|
||||
@Test
|
||||
public void buildDouble() {
|
||||
Double build = BuilderFactory.DOUBLE.build("1.0".getBytes());
|
||||
assertEquals(new Double(1.0), build);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package redis.clients.jedis.tests;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -84,4 +85,24 @@ public class PipeliningTest extends Assert {
|
||||
string.get();
|
||||
p.sync();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lala() {
|
||||
|
||||
Pipeline p = jedis.pipelined();
|
||||
|
||||
HashMap<String, Integer> mydata = new HashMap<String, Integer>();
|
||||
|
||||
mydata.put("test1", 1);
|
||||
mydata.put("test2", 1);
|
||||
mydata.put("test3", 1);
|
||||
mydata.put("test4", 1);
|
||||
mydata.put("test5", 1);
|
||||
|
||||
for (String txtfield : mydata.keySet()) {
|
||||
p.zadd("somekey", mydata.get(txtfield), txtfield);
|
||||
p.zincrby("SUPERUNION", mydata.get(txtfield), txtfield);
|
||||
}
|
||||
p.sync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user