Search in sources :

Example 26 with DataStoreTransaction

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

the class TransactionWrapperTest method testLoadObjects.

@Test
public void testLoadObjects() throws Exception {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    DataStoreIterable<Object> expected = mock(DataStoreIterable.class);
    when(wrapped.loadObjects(any(), any())).thenReturn(expected);
    Iterable<Object> actual = wrapper.loadObjects(null, null);
    verify(wrapped, times(1)).loadObjects(any(), any());
    assertEquals(expected, actual);
}
Also used : DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) Test(org.junit.jupiter.api.Test)

Example 27 with DataStoreTransaction

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

the class TransactionWrapperTest method testSetAttribute.

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

Example 28 with DataStoreTransaction

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

the class TransactionWrapperTest method testUpdateToManyRelation.

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

Example 29 with DataStoreTransaction

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

the class TransactionWrapperTest method testGetToOneRelation.

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

Example 30 with DataStoreTransaction

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

the class TransactionWrapperTest method testDelete.

@Test
public void testDelete() {
    DataStoreTransaction wrapped = mock(DataStoreTransaction.class);
    DataStoreTransaction wrapper = new TestTransactionWrapper(wrapped);
    wrapper.delete(null, null);
    verify(wrapped, times(1)).delete(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