Search in sources :

Example 1 with MockPersistent

use of org.apache.gora.mock.persistency.MockPersistent in project gora by apache.

the class TestPartitionQueryImpl method testReadWrite.

@Test
public void testReadWrite() throws Exception {
    MockQuery baseQuery = dataStore.newQuery();
    baseQuery.setStartKey("start");
    baseQuery.setLimit(42);
    PartitionQueryImpl<String, MockPersistent> query = new PartitionQueryImpl<>(baseQuery);
    TestWritable.testWritable(query);
}
Also used : PartitionQueryImpl(org.apache.gora.query.impl.PartitionQueryImpl) MockQuery(org.apache.gora.mock.query.MockQuery) MockPersistent(org.apache.gora.mock.persistency.MockPersistent) Test(org.junit.Test)

Example 2 with MockPersistent

use of org.apache.gora.mock.persistency.MockPersistent in project gora by apache.

the class TestDataStoreFactory method testFindProperty.

@Test
public void testFindProperty() {
    Properties properties = DataStoreFactory.createProps();
    DataStore<String, MockPersistent> store = new DataFileAvroStore<>();
    String fooValue = DataStoreFactory.findProperty(properties, store, "foo_property", "foo_default");
    assertEquals("foo_value", fooValue);
    String bazValue = DataStoreFactory.findProperty(properties, store, "baz_property", "baz_default");
    assertEquals("baz_value", bazValue);
    String barValue = DataStoreFactory.findProperty(properties, store, "bar_property", "bar_default");
    assertEquals("bar_value", barValue);
    String capValue = DataStoreFactory.findProperty(properties, store, "cap_property", "cap_default");
    assertEquals("cap_value", capValue);
    String secondCapValue = DataStoreFactory.findProperty(properties, store, "CAP_property", "cap_default");
    assertEquals("cap_value", secondCapValue);
}
Also used : DataFileAvroStore(org.apache.gora.avro.store.DataFileAvroStore) Properties(java.util.Properties) MockPersistent(org.apache.gora.mock.persistency.MockPersistent) Test(org.junit.Test)

Example 3 with MockPersistent

use of org.apache.gora.mock.persistency.MockPersistent in project gora by apache.

the class TestGoraInputFormat method getInputSplits.

public List<InputSplit> getInputSplits() throws IOException, InterruptedException {
    Job job = Job.getInstance(new Configuration());
    MockDataStore store = MockDataStore.get();
    MockQuery query = store.newQuery();
    query.setFields(getEmployeeFieldNames());
    GoraInputFormat.setInput(job, query, false);
    GoraInputFormat<String, MockPersistent> inputFormat = new GoraInputFormat<>();
    inputFormat.setConf(job.getConfiguration());
    return inputFormat.getSplits(job);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) Job(org.apache.hadoop.mapreduce.Job) MockQuery(org.apache.gora.mock.query.MockQuery) MockPersistent(org.apache.gora.mock.persistency.MockPersistent) MockDataStore(org.apache.gora.mock.store.MockDataStore)

Aggregations

MockPersistent (org.apache.gora.mock.persistency.MockPersistent)3 MockQuery (org.apache.gora.mock.query.MockQuery)2 Test (org.junit.Test)2 Properties (java.util.Properties)1 DataFileAvroStore (org.apache.gora.avro.store.DataFileAvroStore)1 MockDataStore (org.apache.gora.mock.store.MockDataStore)1 PartitionQueryImpl (org.apache.gora.query.impl.PartitionQueryImpl)1 Configuration (org.apache.hadoop.conf.Configuration)1 Job (org.apache.hadoop.mapreduce.Job)1