Search in sources :

Example 6 with BeanFactoryImpl

use of org.apache.gora.persistency.impl.BeanFactoryImpl in project gora by apache.

the class MemStoreTest method testGetWithFields.

@Test
public void testGetWithFields() throws Exception {
    DataStore<String, WebPage> store = new MemStore<>();
    BeanFactory<String, WebPage> beanFactory = new BeanFactoryImpl<>(String.class, WebPage.class);
    store.setBeanFactory(beanFactory);
    WebPageDataCreator.createWebPageData(store);
    String[] interestFields = new String[2];
    interestFields[0] = "url";
    interestFields[1] = "content";
    WebPage page = store.get(URLS[1], interestFields);
    assertNotNull(page);
    assertNotNull(page.getUrl());
    assertEquals(page.getUrl().toString(), URLS[1]);
    assertNotNull(page.getContent());
    assertEquals("Map of Outlinks should have a size of '0' as it is omitted at retrieval", 0, page.getOutlinks().size());
    assertEquals("Map of Parsed Content should have a size of '0' as it is omitted at retrieval", 0, page.getParsedContent().size());
}
Also used : WebPage(org.apache.gora.examples.generated.WebPage) BeanFactoryImpl(org.apache.gora.persistency.impl.BeanFactoryImpl) Test(org.junit.Test)

Aggregations

BeanFactoryImpl (org.apache.gora.persistency.impl.BeanFactoryImpl)6 WebPage (org.apache.gora.examples.generated.WebPage)4 Test (org.junit.Test)4 Schema (org.apache.avro.Schema)2 Field (org.apache.avro.Schema.Field)2 PersistentBase (org.apache.gora.persistency.impl.PersistentBase)2 DocumentFieldType (org.apache.gora.mongodb.store.MongoMapping.DocumentFieldType)1 BSONDecorator (org.apache.gora.mongodb.utils.BSONDecorator)1