use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestBase method testPut.
@Test
public void testPut() throws Exception {
log.info("test method: testPut");
Employee employee = DataStoreTestUtil.testPutEmployee(employeeStore);
assertPut(employee);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testGetEmployee.
public static void testGetEmployee(DataStore<String, Employee> dataStore) throws Exception {
dataStore.createSchema();
Employee employee = DataStoreTestUtil.createEmployee();
String ssn = employee.getSsn().toString();
dataStore.put(ssn, employee);
dataStore.flush();
Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
assertEqualEmployeeObjects(employee, after);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testPutEmployee.
public static Employee testPutEmployee(DataStore<String, Employee> dataStore) throws Exception {
dataStore.createSchema();
Employee employee = DataStoreTestUtil.createEmployee();
return employee;
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testGetEmployeeDoubleRecursive.
public static void testGetEmployeeDoubleRecursive(DataStore<String, Employee> dataStore) throws Exception {
Employee employee = DataStoreTestUtil.createEmployee();
Employee boss = DataStoreTestUtil.createBoss();
Employee uberBoss = DataStoreTestUtil.createBoss();
uberBoss.setName(new Utf8("Überboss"));
boss.setBoss(uberBoss);
employee.setBoss(boss);
String ssn = employee.getSsn().toString();
dataStore.put(ssn, employee);
dataStore.flush();
Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
assertEqualEmployeeObjects(employee, after);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testEmptyUpdateEmployee.
public static void testEmptyUpdateEmployee(DataStore<String, Employee> dataStore) throws Exception {
dataStore.createSchema();
long ssn = 1234567890L;
String ssnStr = Long.toString(ssn);
long now = System.currentTimeMillis();
Employee employee = dataStore.newPersistent();
employee.setName(new Utf8("John Doe"));
employee.setDateOfBirth(now - 20L * YEAR_IN_MS);
employee.setSalary(100000);
employee.setSsn(new Utf8(ssnStr));
dataStore.put(employee.getSsn().toString(), employee);
dataStore.flush();
employee = dataStore.get(ssnStr);
dataStore.put(ssnStr, employee);
dataStore.flush();
employee = dataStore.newPersistent();
dataStore.put(Long.toString(ssn + 1), employee);
dataStore.flush();
employee = dataStore.get(Long.toString(ssn + 1));
assertNull(employee);
}
Aggregations