Search in sources :

Example 81 with DataStoreTransaction

use of com.yahoo.elide.core.datastore.DataStoreTransaction in project elide by yahoo.

the class TransactionWrapperTest method testLoadObject.

@Test
public void testLoadObject() {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    when(wrapped.loadObject(any(), any(), any())).thenReturn(1L);
    Object actual = wrapper.loadObject(null, null, null);
    verify(wrapped, times(1)).loadObject(any(), any(), any());
    assertEquals(1L, actual);
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Example 82 with DataStoreTransaction

use of com.yahoo.elide.core.datastore.DataStoreTransaction in project elide by yahoo.

the class TransactionWrapperTest method testGetProperty.

@Test
public void testGetProperty() {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    when(wrapped.getProperty(any())).thenReturn(1L);
    Object actual = wrapper.getProperty("foo");
    verify(wrapped, times(1)).getProperty(any());
    assertEquals(1L, actual);
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Example 83 with DataStoreTransaction

use of com.yahoo.elide.core.datastore.DataStoreTransaction in project elide by yahoo.

the class TransactionWrapperTest method testClose.

@Test
public void testClose() throws Exception {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    wrapper.close();
    verify(wrapped, times(1)).close();
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Example 84 with DataStoreTransaction

use of com.yahoo.elide.core.datastore.DataStoreTransaction in project elide by yahoo.

the class TransactionWrapperTest method testUpdateToOneRelation.

@Test
public void testUpdateToOneRelation() {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    wrapper.updateToOneRelation(null, null, null, null, null);
    verify(wrapped, times(1)).updateToOneRelation(any(), any(), any(), any(), any());
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Example 85 with DataStoreTransaction

use of com.yahoo.elide.core.datastore.DataStoreTransaction in project elide by yahoo.

the class TransactionWrapperTest method testCreateObject.

@Test
public void testCreateObject() {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    wrapper.createObject(null, null);
    verify(wrapped, times(1)).createObject(any(), any());
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Aggregations

DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)139 Test (org.junit.jupiter.api.Test)101 RequestScope (com.yahoo.elide.core.RequestScope)40 DataStore (com.yahoo.elide.core.datastore.DataStore)30 FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)28 Elide (com.yahoo.elide.Elide)27 ElideResponse (com.yahoo.elide.ElideResponse)22 EntityProjection (com.yahoo.elide.core.request.EntityProjection)22 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)18 PersistentResource (com.yahoo.elide.core.PersistentResource)17 Item (com.yahoo.elide.datastores.search.models.Item)17 Book (example.Book)13 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)9 BeforeEach (org.junit.jupiter.api.BeforeEach)9 Author (example.Author)8 FilterPredicate (com.yahoo.elide.core.filter.predicates.FilterPredicate)7 FirstBean (com.yahoo.elide.example.beans.FirstBean)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 AndFilterExpression (com.yahoo.elide.core.filter.expression.AndFilterExpression)6