use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class InfinispanStoreTest method setUp.
@Before
public void setUp() throws Exception {
GoraInfinispanTestDriver driver = getTestDriver();
conf = driver.getConfiguration();
conf.set(ISPN_CONNECTION_STRING_KEY, getTestDriver().connectionString());
super.setUp();
employeeDataStore = (InfinispanStore<String, Employee>) employeeStore;
webPageDataStore = (InfinispanStore<String, WebPage>) webPageStore;
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class TestPersistentSerialization method testSerdeEmployee.
/**
* Creates an Employee object in-memory setting several fields to dirty.
* Asserts that it can be serialized and
* deserialzed without loosing data. We do this by asserting
* what we get 'before' and 'after' (de)serialization processes.
* @throws Exception
*/
@SuppressWarnings("unchecked")
@Test
public void testSerdeEmployee() throws Exception {
MemStore<String, Employee> store = DataStoreFactory.getDataStore(MemStore.class, String.class, Employee.class, new Configuration());
Employee employee = DataStoreTestUtil.createEmployee();
TestIOUtils.testSerializeDeserialize(employee);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class TestPersistentSerialization method testSerdeEmployeeTwoFields.
/**
* Creates an Employee object setting only two fields as dirty.
* We then do (de)serialization and check 'before' and 'after'
* states.
* @throws Exception
*/
@Test
public void testSerdeEmployeeTwoFields() throws Exception {
Employee employee = Employee.newBuilder().build();
employee.setSsn(new Utf8("11111"));
employee.setSalary(100);
TestIOUtils.testSerializeDeserialize(employee);
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class TestPersistentBase method testFieldsWithTwoClasses.
/**
* Assert that field positions as found within the SCHEMA array
* are as we would expect by accessing them directly.
* This tests for both WebPage and Employee data beans.
*/
@Test
public void testFieldsWithTwoClasses() {
WebPage page = WebPage.newBuilder().build();
for (int i = 0; i < WebPage.SCHEMA$.getFields().toArray().length; i++) {
int index = page.getSchema().getFields().get(i).pos();
assertEquals(i, index);
}
Employee employee = Employee.newBuilder().build();
for (int i = 0; i < Employee.SCHEMA$.getFields().toArray().length; i++) {
int index = employee.getSchema().getFields().get(i).pos();
assertEquals(i, index);
}
}
use of org.apache.gora.examples.generated.Employee in project gora by apache.
the class TestPersistentBase method testClone.
/**
* Tests and asserts that an in-memory representation of the
* Employee object is Equal to a clone of the same object.
* @throws IOException
* @throws Exception
*/
@Test
public void testClone() throws Exception {
//more tests for clone are in TestPersistentDatumReader
@SuppressWarnings("unchecked") MemStore<String, Employee> store = DataStoreFactory.getDataStore(MemStore.class, String.class, Employee.class, new Configuration());
Employee employee = DataStoreTestUtil.createEmployee();
assertEquals(employee, Employee.newBuilder(employee).build());
}
Aggregations