use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testGetEmployeeNonExisting.
public static void testGetEmployeeNonExisting(DataStore<String, Employee> dataStore) throws Exception {
Employee employee = dataStore.get("_NON_EXISTING_SSN_FOR_EMPLOYEE_");
assertNull(employee);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testGetEmployee3UnionField.
public static void testGetEmployee3UnionField(DataStore<String, Employee> dataStore) throws Exception {
Employee employee = DataStoreTestUtil.createEmployee();
employee.setBoss(new Utf8("Real boss"));
String ssn = employee.getSsn().toString();
dataStore.put(ssn, employee);
dataStore.flush();
Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
assertEqualEmployeeObjects(employee, after);
assertEquals("Real boss", after.getBoss().toString());
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class DataStoreTestUtil method testGetEmployeeNested.
public static void testGetEmployeeNested(DataStore<String, Employee> dataStore) throws Exception {
Employee employee = DataStoreTestUtil.createEmployee();
WebPage webpage = new BeanFactoryImpl<>(String.class, WebPage.class).newPersistent();
webpage.setUrl(new Utf8("url.."));
webpage.setContent(ByteBuffer.wrap("test content".getBytes(Charset.defaultCharset())));
webpage.setParsedContent(new ArrayList<CharSequence>());
Metadata metadata = new BeanFactoryImpl<>(String.class, Metadata.class).newPersistent();
webpage.setMetadata(metadata);
employee.setWebpage(webpage);
String ssn = employee.getSsn().toString();
dataStore.put(ssn, employee);
dataStore.flush();
Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
assertEqualEmployeeObjects(employee, after);
assertEqualWebPageObjects(webpage, after.getWebpage());
}
Aggregations