// Test: put item with HashKey @Test public void putItemWithHashKey() { createTable(hashTableName, createStringAttributeDefinition("code")); TestClassWithHashKey value = new TestClassWithHashKey(); value.setCode("hash1"); value.setStringData("string1"); value.setIntData(1); value.setStringSetData(set("stringSetVal1", "stringSetVal2")); value.setNumberSetData(set(1, 2)); mapper.save(value); }
@Test public void utf8Test() { createGenericTable(hashTableName, "code"); TestClassWithHashKey value = new TestClassWithHashKey(); value.setCode("éáűőúöüóí"); value.setStringData("űáéúőóüöí"); mapper.save(value); TestClassWithHashKey readValue = mapper.load(TestClassWithHashKey.class, "éáűőúöüóí"); Assert.assertEquals("éáűőúöüóí", readValue.getCode()); Assert.assertEquals("űáéúőóüöí", readValue.getStringData()); }
@Test public void putItemWithHashKeyOverwriteItem() { try { createTable(hashTableName, createStringAttributeDefinition("code")); } catch (ResourceInUseException riue) { // The table is already created, do nothing } TestClassWithHashKey value2a = new TestClassWithHashKey(); value2a.setCode("hash2"); value2a.setStringData("string2a"); value2a.setIntData(21); value2a.setStringSetData(set("stringSetVal2a1", "stringSetVal2a2")); value2a.setNumberSetData(set(3, 4)); mapper.save(value2a); TestClassWithHashKey value2b = new TestClassWithHashKey(); value2b.setCode("hash2"); value2b.setStringData("string2b"); value2b.setIntData(22); value2b.setStringSetData(set("stringSetVal2b1", "stringSetVal2b2")); value2b.setNumberSetData(set(5, 6)); mapper.save(value2b); }