Search in sources :

Example 1 with DefaultDbRowOpSorter

use of org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter in project cayenne by apache.

the class DefaultDbRowOpSorterTest method createSorter.

@Before
public void createSorter() {
    entitySorter = mock(EntitySorter.class);
    EntityResolver entityResolver = mock(EntityResolver.class);
    when(entitySorter.getDbEntityComparator()).thenReturn(Comparator.comparing(DbEntity::getName));
    when(entitySorter.isReflexive(argThat(ent -> ent.getName().equals("reflexive")))).thenReturn(true);
    DataDomain dataDomain = mock(DataDomain.class);
    when(dataDomain.getEntitySorter()).thenReturn(entitySorter);
    when(dataDomain.getEntityResolver()).thenReturn(entityResolver);
    sorter = new DefaultDbRowOpSorter(() -> dataDomain);
}
Also used : Arrays(java.util.Arrays) ArgumentMatchers(org.mockito.ArgumentMatchers) Test(org.junit.Test) Persistent(org.apache.cayenne.Persistent) DbRowOp(org.apache.cayenne.access.flush.operation.DbRowOp) DbAttribute(org.apache.cayenne.map.DbAttribute) ArrayList(java.util.ArrayList) Mockito(org.mockito.Mockito) List(java.util.List) DefaultDbRowOpSorter(org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter) ObjectId(org.apache.cayenne.ObjectId) DataDomain(org.apache.cayenne.access.DataDomain) EntityResolver(org.apache.cayenne.map.EntityResolver) DeleteDbRowOp(org.apache.cayenne.access.flush.operation.DeleteDbRowOp) DbEntity(org.apache.cayenne.map.DbEntity) Comparator(java.util.Comparator) Assert(org.junit.Assert) PersistenceState(org.apache.cayenne.PersistenceState) BaseDbRowOp(org.apache.cayenne.access.flush.operation.BaseDbRowOp) DbRowOpSorter(org.apache.cayenne.access.flush.operation.DbRowOpSorter) UpdateDbRowOp(org.apache.cayenne.access.flush.operation.UpdateDbRowOp) EntitySorter(org.apache.cayenne.map.EntitySorter) InsertDbRowOp(org.apache.cayenne.access.flush.operation.InsertDbRowOp) Before(org.junit.Before) EntitySorter(org.apache.cayenne.map.EntitySorter) DataDomain(org.apache.cayenne.access.DataDomain) DefaultDbRowOpSorter(org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter) EntityResolver(org.apache.cayenne.map.EntityResolver) Before(org.junit.Before)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Comparator (java.util.Comparator)1 List (java.util.List)1 ObjectId (org.apache.cayenne.ObjectId)1 PersistenceState (org.apache.cayenne.PersistenceState)1 Persistent (org.apache.cayenne.Persistent)1 DataDomain (org.apache.cayenne.access.DataDomain)1 BaseDbRowOp (org.apache.cayenne.access.flush.operation.BaseDbRowOp)1 DbRowOp (org.apache.cayenne.access.flush.operation.DbRowOp)1 DbRowOpSorter (org.apache.cayenne.access.flush.operation.DbRowOpSorter)1 DefaultDbRowOpSorter (org.apache.cayenne.access.flush.operation.DefaultDbRowOpSorter)1 DeleteDbRowOp (org.apache.cayenne.access.flush.operation.DeleteDbRowOp)1 InsertDbRowOp (org.apache.cayenne.access.flush.operation.InsertDbRowOp)1 UpdateDbRowOp (org.apache.cayenne.access.flush.operation.UpdateDbRowOp)1 DbAttribute (org.apache.cayenne.map.DbAttribute)1 DbEntity (org.apache.cayenne.map.DbEntity)1 EntityResolver (org.apache.cayenne.map.EntityResolver)1 EntitySorter (org.apache.cayenne.map.EntitySorter)1 Assert (org.junit.Assert)1