dataStore.createSchema();
long ssn = 1234567890L;
long now = System.currentTimeMillis();
for (int i = 0; i < 5; i++) {
Employee employee = dataStore.newPersistent();
employee.setName(new Utf8("John Doe " + i));
employee.setDateOfBirth(now - 20L * YEAR_IN_MS);
employee.setSalary(100000);
employee.setSsn(new Utf8(Long.toString(ssn + i)));
dataStore.put(employee.getSsn().toString(), employee);
}
dataStore.flush();
for (int i = 0; i < 1; i++) {
Employee employee = dataStore.newPersistent();
employee.setName(new Utf8("John Doe " + (i + 5)));
employee.setDateOfBirth(now - 18L * YEAR_IN_MS);
employee.setSalary(120000);
employee.setSsn(new Utf8(Long.toString(ssn + i)));
dataStore.put(employee.getSsn().toString(), employee);
}
dataStore.flush();
for (int i = 0; i < 1; i++) {
String key = Long.toString(ssn + i);
Employee employee = dataStore.get(key);
Assert.assertEquals(now - 18L * YEAR_IN_MS, employee.getDateOfBirth());
Assert.assertEquals("John Doe " + (i + 5), employee.getName().toString());
Assert.assertEquals(120000, employee.getSalary());
}
}