use of com.yahoo.elide.core.datastore.DataStore in project elide by yahoo.
the class MultiplexTransactionTest method testGetProperty.
@Test
public void testGetProperty() throws Exception {
DataStore store1 = mock(HashMapDataStore.class);
DataStore store2 = mock(DataStore.class);
DataStoreTransaction tx1 = mock(HashMapStoreTransaction.class);
DataStoreTransaction tx2 = mock(DataStoreTransaction.class);
when(store1.beginReadTransaction()).thenReturn(tx1);
when(store2.beginReadTransaction()).thenReturn(tx2);
when(tx1.getProperty(any())).thenReturn(null);
when(tx2.getProperty(any())).thenReturn("Foo");
MultiplexManager store = new MultiplexManager(store1, store2);
DataStoreTransaction multiplexTx = store.beginReadTransaction();
String propertyName = "com.yahoo.elide.core.datastore.Bar";
String result = multiplexTx.getProperty(propertyName);
verify(tx1, Mockito.never()).getProperty(eq(propertyName));
verify(tx2, Mockito.times(1)).getProperty(eq(propertyName));
assertEquals("Foo", result);
}
use of com.yahoo.elide.core.datastore.DataStore in project elide by yahoo.
the class NoopDataStoreTest method testPopulateEntityDictionary.
@Test
public void testPopulateEntityDictionary() throws Exception {
DataStore store = new NoopDataStore(Arrays.asList(NoopBean.class));
EntityDictionary dictionary = EntityDictionary.builder().build();
store.populateEntityDictionary(dictionary);
assertEquals(ClassType.of(NoopBean.class), dictionary.getEntityClass("theNoopBean", EntityDictionary.NO_VERSION));
}
use of com.yahoo.elide.core.datastore.DataStore in project elide by yahoo.
the class NoopDataStoreTest method testBeginTransaction.
@Test
public void testBeginTransaction() throws Exception {
DataStore store = new NoopDataStore(Arrays.asList(NoopBean.class));
DataStoreTransaction tx = store.beginReadTransaction();
assertTrue(tx instanceof NoopTransaction);
}
Aggregations