use of org.apache.gora.examples.generated.Metadata 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