blob: 44d71d688c109e9893ce7699d41360ee8c899870 [file] [log] [blame]
Jonathan Hart6df90172014-04-03 10:13:11 -07001package net.onrc.onos.core.datastore.hazelcast;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -07002
Jonathan Harta88fd242014-04-03 11:24:54 -07003import static org.junit.Assert.assertArrayEquals;
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertNotEquals;
6import static org.junit.Assert.assertNotNull;
7import static org.junit.Assert.assertNull;
8import static org.junit.Assert.assertTrue;
9import static org.junit.Assert.fail;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070010
11import java.nio.charset.StandardCharsets;
12import java.util.Map;
13import java.util.TreeMap;
Yuta HIGUCHI3e7994c2014-05-12 21:01:33 -070014import java.util.UUID;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070015
Jonathan Harta88fd242014-04-03 11:24:54 -070016import net.onrc.onos.core.datastore.IKVTable.IKVEntry;
Jonathan Hart6df90172014-04-03 10:13:11 -070017import net.onrc.onos.core.datastore.ObjectDoesntExistException;
18import net.onrc.onos.core.datastore.ObjectExistsException;
19import net.onrc.onos.core.datastore.WrongVersionException;
Jonathan Hart6df90172014-04-03 10:13:11 -070020import net.onrc.onos.core.datastore.hazelcast.HZTable.VersionedValue;
21import net.onrc.onos.core.datastore.utils.ByteArrayComparator;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070022
23import org.junit.After;
24import org.junit.Before;
25import org.junit.Ignore;
26import org.junit.Rule;
27import org.junit.Test;
28import org.junit.rules.TestName;
29
30public class HZTableTest {
31 @Rule
Ray Milkey269ffb92014-04-03 14:43:30 -070032 public TestName name = new TestName();
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070033
Yuta HIGUCHIceb21b62014-04-17 15:46:05 -070034 static {
35 // configuration to quickly fall back to instance mode for faster test run
36 System.setProperty("net.onrc.onos.core.datastore.hazelcast.client.attemptLimit", "0");
37 }
38
Yuta HIGUCHI3e7994c2014-05-12 21:01:33 -070039 static final String TEST_TABLE_NAME = "TableForUnitTest" + UUID.randomUUID();
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070040 HZTable table;
41
42 @Before
43 public void setUp() throws Exception {
Ray Milkey269ffb92014-04-03 14:43:30 -070044 table = (HZTable) HZClient.getClient().getTable(TEST_TABLE_NAME);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070045 }
46
47 @After
48 public void tearDown() throws Exception {
Ray Milkey269ffb92014-04-03 14:43:30 -070049 HZClient.getClient().dropTable(table);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070050 }
51
52 public void assertEntryInTable(final byte[] key, final byte[] value, final long version) {
Ray Milkey269ffb92014-04-03 14:43:30 -070053 VersionedValue valueblob = table.getBackendMap().get(key);
54 assertNotNull(valueblob);
55 assertArrayEquals(value, valueblob.getValue());
56 assertEquals(version, valueblob.getVersion());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070057 }
58
59 public void assertKeyNotInTable(final byte[] key) {
Ray Milkey269ffb92014-04-03 14:43:30 -070060 VersionedValue valueblob = table.getBackendMap().get(key);
61 assertNull(valueblob);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070062 }
63
64 @Test
65 public void testGetInitialVersion() {
Ray Milkey269ffb92014-04-03 14:43:30 -070066 final long version1 = HZTable.getInitialVersion();
67 assertNotEquals(HZClient.VERSION_NONEXISTENT, version1);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070068
Ray Milkey269ffb92014-04-03 14:43:30 -070069 final long version2 = HZTable.getInitialVersion();
70 assertNotEquals(HZClient.VERSION_NONEXISTENT, version2);
71 assertNotEquals(version1, version2);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070072 }
73
74 @Test
75 public void testGetNextVersion() {
Ray Milkey269ffb92014-04-03 14:43:30 -070076 final long nextVersion = HZTable.getNextVersion(1);
77 assertNotEquals(nextVersion, HZClient.VERSION_NONEXISTENT);
78 assertNotEquals(nextVersion, 1);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070079
Ray Milkey269ffb92014-04-03 14:43:30 -070080 final long nextVersion1 = HZTable.getNextVersion(Long.MAX_VALUE);
81 assertNotEquals(nextVersion1, HZClient.VERSION_NONEXISTENT);
82 assertNotEquals(nextVersion1, Long.MAX_VALUE);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070083
Ray Milkey269ffb92014-04-03 14:43:30 -070084 final long nextVersion11 = HZTable.getNextVersion(HZClient.VERSION_NONEXISTENT - 1);
85 assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT);
86 assertNotEquals(nextVersion11, HZClient.VERSION_NONEXISTENT - 1);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070087 }
88
89 @Ignore // nothing to test for now
90 @Test
91 public void testHZTable() {
Ray Milkey269ffb92014-04-03 14:43:30 -070092 fail("Not yet implemented");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070093 }
94
95 @Test
96 public void testGetTableName() {
Ray Milkey269ffb92014-04-03 14:43:30 -070097 assertEquals(TEST_TABLE_NAME, table.getTableName());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -070098 }
99
100 @Test
101 public void testVERSION_NONEXISTENT() {
Ray Milkey7531a342014-04-11 15:08:12 -0700102 assertEquals(HZClient.VERSION_NONEXISTENT, table.getVersionNonexistant());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700103 }
104
105 @Test
106 public void testGetTableId() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700107 // for Hazelcast implementation IKVTableID is table itself
108 assertEquals(table, table.getTableId());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700109 }
110
111 @Test
112 public void testCreate() throws ObjectExistsException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700113 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
114 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700115
Ray Milkey269ffb92014-04-03 14:43:30 -0700116 final long version = table.create(key, value);
117 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700118
Ray Milkey269ffb92014-04-03 14:43:30 -0700119 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700120 }
121
122 @Test(expected = ObjectExistsException.class)
123 public void testCreateConflict() throws ObjectExistsException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700124 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
125 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700126
Ray Milkey269ffb92014-04-03 14:43:30 -0700127 final long version = table.create(key, value);
128 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700129
Ray Milkey269ffb92014-04-03 14:43:30 -0700130 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700131
Ray Milkey269ffb92014-04-03 14:43:30 -0700132 table.create(key, value);
133 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700134 }
135
136 @Test
137 public void testForceCreate() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700138 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
139 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700140
Ray Milkey269ffb92014-04-03 14:43:30 -0700141 final long version = table.forceCreate(key, value);
142 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
143 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700144
145
Ray Milkey269ffb92014-04-03 14:43:30 -0700146 final long version1 = table.forceCreate(key, value);
147 assertNotEquals(HZClient.VERSION_NONEXISTENT, version1);
148 assertNotEquals(version, version1);
149 assertEntryInTable(key, value, version1);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700150 }
151
152 @Test
153 public void testRead() throws ObjectDoesntExistException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700154 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
155 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700156
Ray Milkey269ffb92014-04-03 14:43:30 -0700157 // put data to read
158 final long version = table.forceCreate(key, value);
159 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
160 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700161
Ray Milkey269ffb92014-04-03 14:43:30 -0700162 // test body
163 final IKVEntry readValue = table.read(key);
164 assertArrayEquals(key, readValue.getKey());
165 assertArrayEquals(value, readValue.getValue());
166 assertEquals(version, readValue.getVersion());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700167 }
168
169
170 @Test(expected = ObjectDoesntExistException.class)
171 public void testReadNotExist() throws ObjectDoesntExistException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700172 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700173
Ray Milkey269ffb92014-04-03 14:43:30 -0700174 table.read(key);
175 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700176 }
177
178 @Test
179 public void testUpdateByteArrayByteArrayLongSuccess() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700180 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
181 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
182 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700183
Ray Milkey269ffb92014-04-03 14:43:30 -0700184 // put data to update
185 final long oldVersion = table.forceCreate(key, oldValue);
186 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
187 assertEntryInTable(key, oldValue, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700188
Ray Milkey269ffb92014-04-03 14:43:30 -0700189 final long version = table.update(key, value, oldVersion);
190 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
191 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700192 }
193
194 @Test(expected = ObjectDoesntExistException.class)
195 public void testUpdateByteArrayByteArrayLongFailNoOldValue() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700196 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
197 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700198
Ray Milkey269ffb92014-04-03 14:43:30 -0700199 final long oldVersion = 0xDEAD;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700200
Ray Milkey269ffb92014-04-03 14:43:30 -0700201 final long version = table.update(key, value, oldVersion);
202 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
203 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700204 }
205
206 @Test(expected = WrongVersionException.class)
207 public void testUpdateByteArrayByteArrayLongFailWrongVersion() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700208 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
209 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
210 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700211
Ray Milkey269ffb92014-04-03 14:43:30 -0700212 // put data to update
213 final long oldVersion = table.forceCreate(key, oldValue);
214 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
215 assertEntryInTable(key, oldValue, oldVersion);
216 // some one updates (from different thread/process in reality)
217 table.forceCreate(key, oldValue);
218 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700219
220
Ray Milkey269ffb92014-04-03 14:43:30 -0700221 table.update(key, value, oldVersion);
222 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700223 }
224
225 @Test
226 public void testUpdateByteArrayByteArraySuccess() throws ObjectDoesntExistException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700227 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
228 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
229 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700230
Ray Milkey269ffb92014-04-03 14:43:30 -0700231 // put data to update
232 final long oldVersion = table.forceCreate(key, oldValue);
233 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
234 assertEntryInTable(key, oldValue, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700235
Ray Milkey269ffb92014-04-03 14:43:30 -0700236 final long version = table.update(key, value);
237 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
238 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700239 }
240
241 @Test(expected = ObjectDoesntExistException.class)
242 public void testUpdateByteArrayByteArrayFailNoOldValue() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700243 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
244 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700245
Ray Milkey269ffb92014-04-03 14:43:30 -0700246 final long version = table.update(key, value);
247 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
248 assertEntryInTable(key, value, version);
249 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700250 }
251
252 @Test
253 public void testUpdateByteArrayByteArraySuccessIgnoreVersion() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700254 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
255 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
256 final byte[] value = "SomeValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700257
Ray Milkey269ffb92014-04-03 14:43:30 -0700258 // put data to update
259 final long oldVersion = table.forceCreate(key, oldValue);
260 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
261 assertEntryInTable(key, oldValue, oldVersion);
262 // someone updates (from different thread/process in reality)
263 table.forceCreate(key, oldValue);
264 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700265
266
Ray Milkey269ffb92014-04-03 14:43:30 -0700267 final long version = table.update(key, value);
268 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
269 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700270 }
271
272 @Test
273 public void testDelete() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700274 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
275 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700276
Ray Milkey269ffb92014-04-03 14:43:30 -0700277 // put data to delete
278 final long oldVersion = table.forceCreate(key, oldValue);
279 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
280 assertEntryInTable(key, oldValue, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700281
Ray Milkey269ffb92014-04-03 14:43:30 -0700282 long version = table.delete(key, oldVersion);
283 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
284 assertEquals(oldVersion, version);
285 assertKeyNotInTable(key);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700286 }
287
288 @Test(expected = ObjectDoesntExistException.class)
289 public void testDeleteFailNoEntry() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700290 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700291
Ray Milkey269ffb92014-04-03 14:43:30 -0700292 final long oldVersion = 0xDEAD;
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700293
Ray Milkey269ffb92014-04-03 14:43:30 -0700294 try {
295 table.delete(key, oldVersion);
296 } catch (ObjectDoesntExistException | WrongVersionException e) {
297 assertKeyNotInTable(key);
298 throw e;
299 }
300 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700301 }
302
303 @Test(expected = WrongVersionException.class)
304 public void testDeleteFailWrongVersion() throws ObjectDoesntExistException, WrongVersionException {
Ray Milkey269ffb92014-04-03 14:43:30 -0700305 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
306 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700307
Ray Milkey269ffb92014-04-03 14:43:30 -0700308 // put data to delete
309 final long oldVersion = table.forceCreate(key, oldValue);
310 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
311 assertEntryInTable(key, oldValue, oldVersion);
312 // someone updates (from different thread/process in reality)
313 final long latestVersion = table.forceCreate(key, oldValue);
314 assertNotEquals(HZClient.VERSION_NONEXISTENT, latestVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700315
Ray Milkey269ffb92014-04-03 14:43:30 -0700316 try {
317 table.delete(key, oldVersion);
318 } catch (ObjectDoesntExistException | WrongVersionException e) {
319 assertEntryInTable(key, oldValue, latestVersion);
320 throw e;
321 }
322 fail("Should have thrown exception");
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700323 }
324
325
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700326 @Test
327 public void testForceDelete() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700328 final byte[] key = name.getMethodName().getBytes(StandardCharsets.UTF_8);
329 final byte[] oldValue = "OldValue".getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700330
Ray Milkey269ffb92014-04-03 14:43:30 -0700331 // put data to delete
332 final long oldVersion = table.forceCreate(key, oldValue);
333 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
334 assertEntryInTable(key, oldValue, oldVersion);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700335
Ray Milkey269ffb92014-04-03 14:43:30 -0700336 long version = table.forceDelete(key);
337 assertNotEquals(HZClient.VERSION_NONEXISTENT, oldVersion);
338 assertEquals(oldVersion, version);
339 assertKeyNotInTable(key);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700340 }
341
342 @Test
343 public void testGetAllEntries() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700344 final int DATASETSIZE = 100;
345 final Map<byte[], VersionedValue> testdata = new TreeMap<>(ByteArrayComparator.BYTEARRAY_COMPARATOR);
346 for (int i = 0; i < DATASETSIZE; ++i) {
347 final byte[] key = (name.getMethodName() + i).getBytes(StandardCharsets.UTF_8);
348 final byte[] value = ("Value" + i).getBytes(StandardCharsets.UTF_8);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700349
Ray Milkey269ffb92014-04-03 14:43:30 -0700350 // put data to delete
351 final long version = table.forceCreate(key, value);
352 assertNotEquals(HZClient.VERSION_NONEXISTENT, version);
353 assertEntryInTable(key, value, version);
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700354
Ray Milkey269ffb92014-04-03 14:43:30 -0700355 testdata.put(key, new VersionedValue(value, version));
356 }
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700357
Ray Milkey269ffb92014-04-03 14:43:30 -0700358 Iterable<IKVEntry> datastore = table.getAllEntries();
359 for (IKVEntry entry : datastore) {
360 VersionedValue expectedValue = testdata.get(entry.getKey());
361 assertNotNull(expectedValue);
362 assertArrayEquals(expectedValue.getValue(), entry.getValue());
363 assertEquals(expectedValue.getVersion(), entry.getVersion());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700364
Ray Milkey269ffb92014-04-03 14:43:30 -0700365 testdata.remove(entry.getKey());
366 }
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700367
Ray Milkey269ffb92014-04-03 14:43:30 -0700368 assertTrue(testdata.isEmpty());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700369 }
370
371 @Test
372 public void testToString() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700373 assertEquals("[HZTable " + TEST_TABLE_NAME + "]", table.toString());
Yuta HIGUCHI6a643132014-03-18 22:39:27 -0700374 }
375
376}