// Path: src/main/java/org/rakam/util/HLLWrapper.java
// public class HLLWrapper {
//     final private static int SEED = 123456;
//     private HLL hll;
// 
//     public HLLWrapper() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// 
//     public HLLWrapper(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public long cardinality() {
//         return hll.cardinality();
//     }
// 
//     public void union(HLLWrapper hll) {
//         this.hll.union(hll.hll);
//     }
// 
//     public void addAll(Collection<String> coll) {
//         for (String a : coll) {
//             byte[] s = a.getBytes();
//             hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//         }
//     }
// 
//     public void add(String obj) {
//         if (obj == null)
//             throw new IllegalArgumentException();
//         byte[] s = obj.getBytes();
// 
//         hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//     }
// 
//     public void set(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public byte[] bytes() {
//         return hll.toBytes();
//     }
// 
//     public void reset() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// }


import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import org.junit.*;
import org.rakam.util.HLLWrapper;
import java.io.IOException;
import java.util.ArrayList;
import static junit.framework.Assert.assertEquals;

        assertEquals(1, hll0.cardinality());
        assertEquals(1, hll1.cardinality());
        assertEquals(1, hllClient.cardinality());
    }

    @Test
    public void addAll_testAcrossServers() throws Exception {
        hll0 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);
        hll1 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);

        ArrayList<String> list = new ArrayList<String>() {{
            add("TEST0");
            add("TEST1");
            add("TEST2");
        }};
        hll0.addAll(list);
        hll1.addAll(list);

        assertEquals(3, hll0.cardinality());
        assertEquals(3, hll1.cardinality());
        assertEquals(3, hllClient.cardinality());
    }

    @Test
    public void union_testAcrossServers() throws Exception {
        hll0 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);
        hll1 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);

        hll0.add("TEST1");
// Path: src/main/java/org/rakam/util/HLLWrapper.java
// public class HLLWrapper {
//     final private static int SEED = 123456;
//     private HLL hll;
// 
//     public HLLWrapper() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// 
//     public HLLWrapper(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public long cardinality() {
//         return hll.cardinality();
//     }
// 
//     public void union(HLLWrapper hll) {
//         this.hll.union(hll.hll);
//     }
// 
//     public void addAll(Collection<String> coll) {
//         for (String a : coll) {
//             byte[] s = a.getBytes();
//             hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//         }
//     }
// 
//     public void add(String obj) {
//         if (obj == null)
//             throw new IllegalArgumentException();
//         byte[] s = obj.getBytes();
// 
//         hll.addRaw(MurmurHash3.murmurhash3x8632(s, 0, s.length, SEED));
//     }
// 
//     public void set(byte[] bytes) {
//         hll = HLL.fromBytes(bytes);
//     }
// 
//     public byte[] bytes() {
//         return hll.toBytes();
//     }
// 
//     public void reset() {
//         hll = new HLL(13/*log2m*/, 5/*registerWidth*/);
//     }
// }


// Path: src/test/java/org/rakam/cache/hazelcast/hyperloglog/HLLTest.java
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import org.junit.*;
import org.rakam.util.HLLWrapper;
import java.io.IOException;
import java.util.ArrayList;
import static junit.framework.Assert.assertEquals;


        assertEquals(1, hll0.cardinality());
        assertEquals(1, hll1.cardinality());
        assertEquals(1, hllClient.cardinality());
    }

    @Test
    public void addAll_testAcrossServers() throws Exception {
        hll0 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);
        hll1 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);

        ArrayList<String> list = new ArrayList<String>() {{
            add("TEST0");
            add("TEST1");
            add("TEST2");
        }};
        hll0.addAll(list);
        hll1.addAll(list);

        assertEquals(3, hll0.cardinality());
        assertEquals(3, hll1.cardinality());
        assertEquals(3, hllClient.cardinality());
    }

    @Test
    public void union_testAcrossServers() throws Exception {
        hll0 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);
        hll1 = server0.getDistributedObject(HyperLogLogService.SERVICE_NAME, name);

        hll0.add("TEST1");
        HLLWrapper hll = new HLLWrapper();