@Test
public void testKeyVersionToString() {
byte[] keyBytes = { 0, 1, 2, 17, 4 };
ByteArray key = new ByteArray(keyBytes);
long now = System.currentTimeMillis();
VectorClock vc1 = new VectorClock(now);
VectorClock vc2 = new VectorClock(now + 1);
Versioned<byte[]> versioned = new Versioned<byte[]>(value1, vc1);
ConsistencyCheck.Value v1 = new ConsistencyCheck.VersionValue(new Versioned<byte[]>(value1,
vc1));
ConsistencyCheck.Value v2 = new ConsistencyCheck.VersionValue(new Versioned<byte[]>(value2,
vc2));
// make Prefix Nodes
Set<ClusterNode> set = new HashSet<ClusterNode>();
set.add(cn0_1);
set.add(cn1_2);
set.add(cn0_3);
// test vector clock
Map<ConsistencyCheck.Value, Set<ClusterNode>> mapVector = new HashMap<ConsistencyCheck.Value, Set<ClusterNode>>();
mapVector.put(v1, set);
vc1.incrementVersion(1, now);
v1 = new ConsistencyCheck.VersionValue(new Versioned<byte[]>(value1, vc1));
String sVector = ConsistencyCheck.keyVersionToString(key, mapVector, "testStore", 99);
assertEquals("BAD_KEY,testStore,99,0001021104," + set.toString().replace(", ", ";") + ","
+ now + ",[1:1]", sVector);
// test two lines
vc2.incrementVersion(1, now);
vc2.incrementVersion(1, now + 1);
v2 = new ConsistencyCheck.VersionValue(new Versioned<byte[]>(value2, vc2));
mapVector.put(v2, set);
String sVector2 = ConsistencyCheck.keyVersionToString(key, mapVector, "testStore", 99);
String s1 = "BAD_KEY,testStore,99,0001021104," + set.toString().replace(", ", ";") + ","