We have a few such test entities: 1. Map: cayenne-map-to-many.xml (CayenneProjects.MAP_TO_MANY_PROJECT) 2. Set: cayenne-relationships-set-to-many.xml (CayenneProjects.RELATIONSHIPS_SET_TO_MANY_PROJECT)
Since those are in different projects, you will need to create separate test classes for them. Andrus > On Dec 13, 2015, at 2:21 PM, Johannes <jo...@posteo.de> wrote: > > Currently I am writing the unit tests for the new method. > > Most test cases are done with following class introduction (copied from > another test class in that package): > > @UseServerRuntime(CayenneProjects.TESTMAP_PROJECT) > public class CayenneDataObjectSetToMany extends ServerCase { > > @Inject > private ServerRuntime runtime; > > @Inject > private ObjectContext context; > > @Inject > private DBHelper dbHelper; > > protected TableHelper tArtist; > protected TableHelper tPainting; > ..... > > Calling artist.getPaintingArray() returns an ArrayList, which was fine > yet. Now I need to configure my test environment to return different > collection types (collection, list, map and set). > > What is the best way to achieve that? > > Best regards > Johannes > > Am 07.12.2015 um 07:33 schrieb Andrus Adamchik: >> Thanks for the new version. Looks good to me. Let's maybe write some unit >> tests and create a new pull request. >> >> Andrus >> >>> On Dec 7, 2015, at 1:07 AM, Johannes <jo...@posteo.de> wrote: >>> >>> Sure, here is a tidy commit: >>> https://github.com/apache/cayenne/commit/1358dad4e3ae2cf2735aa223b869e4b85f18508e >>> >>> Didn't know how to manipulate commits afterwards. I closed the pull >>> request and made my clean commit on a fresh reforked master version. >>> >>> Best Regards. Johannes >>> >>> Am 06.12.2015 um 10:05 schrieb Aristedes Maniatis: >>>> Great. Do you want to tidy up the commits on your pull request. >>>> >>>> https://github.com/apache/cayenne/pull/61/commits >>>> >>>> Ari >>>> >>>> On 6/12/2015 2:19am, Johannes wrote: >>>>> Dear list, >>>>> >>>>> I want to bring back my idea from February into discussion. It was about >>>>> introducing a setToManyTarget Method in the CayenneDataObject, but it >>>>> was not finished (mail archive: >>>>> http://mail-archives.apache.org/mod_mbox/cayenne-dev/201501.mbox/%3C0DBA750D-A847-4CC1-8EAC-9DCFB5A0FECA% >>>>> 40objectstyle.org%3E ) >>>>> >>>>> >>>>> My last action was, implementing Andrus advice to retrieve old >>>>> DataObjects, which can be deleted manually: >>>>> >>>>> // sync... >>>>> List<? extends DataObject> removed = >>>>> o.setToManyTarget(Artist.PAINTINGS.getName(), newPaintings, >>>>> true); >>>>> >>>>> // delete ... or not >>>>> // o.getObjectContext().deleteObjects(removed); >>>>> >>>>> >>>>> This was implemented immediatly by myself with following commit, but I >>>>> forgot to mention it on the list: >>>>> It was implemented in >>>>> https://github.com/jotpe/cayenne/commit/b930886a9ab24fa8b82a7e8efeaf6d2437bd5d96 >>>>> >>>>> >>>>> Best Regards. >>>>> Johannes >>>>> >>>> >>> >>> >