Merge branch 'develop' of wp5.e-taxonomy.eu:/var/git/taxeditor into remoting-4.0
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 24 Jun 2015 07:40:31 +0000 (09:40 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 24 Jun 2015 07:40:31 +0000 (09:40 +0200)
Conflicts:
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties

1  2 
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java
pom.xml

index 48de1b1356fa0600b60df224b2fae0fab13e2669,cd1058349ad3c212bebc4bf12b7d992fd731ca8e..b0f53bf550380eafb5bb45083871b98ac914328d
@@@ -1,10 -1,18 +1,18 @@@
  <?xml version="1.0" encoding="UTF-8"?>
  <classpath>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.3-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.3-SNAPSHOT.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 -      <classpathentry kind="src" path="src/main/java"/>
 -      <classpathentry kind="src" path="src/main/resources"/>
 -      <classpathentry kind="src" path="src/test/java/"/>
 +      <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
 +      <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
 +      <classpathentry kind="src" path="src/test/java"/>
        <classpathentry exported="true" kind="lib" path="lib/activation-1.1.1.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
index 35abb014ad50b7dc7f9db9d1707ab032c7026975,0000000000000000000000000000000000000000..81afe0628ade3155b8b63fb1482ab383c6af9b31
mode 100644,000000..100644
--- /dev/null
@@@ -1,215 -1,0 +1,215 @@@
-             name.setCombinationAuthorTeam(combAuthor);
 +/**
 + * Copyright (C) 2014 EDIT
 + * European Distributed Institute of Taxonomy
 + * http://www.e-taxonomy.eu
 + *
 + * The contents of this file are subject to the Mozilla Public License Version 1.1
 + * See LICENSE.TXT at the top of this package for the full license terms.
 + */
 +package eu.etaxonomy.taxeditor.lazyloading;
 +
 +import java.util.HashSet;
 +import java.util.Iterator;
 +import java.util.List;
 +import java.util.Set;
 +import java.util.UUID;
 +
 +import org.apache.log4j.Logger;
 +import org.junit.Assert;
 +import org.junit.BeforeClass;
 +import org.junit.Ignore;
 +import org.junit.Test;
 +import org.unitils.dbunit.annotation.DataSet;
 +
 +import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 +import eu.etaxonomy.cdm.api.service.IClassificationService;
 +import eu.etaxonomy.cdm.api.service.ITaxonService;
 +import eu.etaxonomy.cdm.model.agent.Person;
 +import eu.etaxonomy.cdm.model.agent.Team;
 +import eu.etaxonomy.cdm.model.common.CdmBase;
 +import eu.etaxonomy.cdm.model.name.BotanicalName;
 +import eu.etaxonomy.cdm.model.name.NonViralName;
 +import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 +import eu.etaxonomy.cdm.model.taxon.Classification;
 +import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
 +import eu.etaxonomy.cdm.model.taxon.Taxon;
 +import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 +import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
 +
 +
 +
 +
 +/**
 + * Class to test the {@link CdmApplicationRemoteController}
 + *
 + */
 +// FIXME:Remoting need to create a proper dataset for this test
 +//       Could be combined with RemotePersistentCollectionTest
 +@Ignore
 +@DataSet
 +public class AbstractLazyInitializerTest extends BaseRemotingTest {
 +    private static final Logger logger = Logger.getLogger(AbstractLazyInitializerTest.class);
 +
 +    private static IClassificationService classificationService;
 +    private static ITaxonService taxonService;
 +
 +    private static List<TaxonNode> taxonNodes;
 +
 +    private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
 +    private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
 +
 +
 +    @BeforeClass
 +    public static void initializeRemoteLazyLoading() {
 +
 +        taxonService = getRemoteApplicationController().getTaxonService();
 +        classificationService= getRemoteApplicationController().getClassificationService();
 +        List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
 +        Assert.assertFalse(classifications.isEmpty());
 +
 +        Classification classification = classifications.get(0);
 +        Assert.assertNotNull(classification);
 +        taxonNodes = classificationService.getAllNodes();
 +        Assert.assertFalse(taxonNodes.isEmpty());
 +
 +    }
 +
 +
 +
 +    @Test
 +    public void testCDMEntityGet() {
 +        //ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
 +        Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
 +        int maxcount = 30;
 +        int count = 0;
 +        while(taxonNodeItr.hasNext() && count <= maxcount) {
 +            TaxonNode taxonNode = taxonNodeItr.next();
 +            Assert.assertNotNull(taxonNode);
 +
 +            Taxon taxon = taxonNode.getTaxon();
 +            Assert.assertNotNull(taxon);
 +
 +            String taxonTitle = taxon.getTitleCache();
 +            logger.info("Taxon : " + taxonTitle);
 +
 +            TaxonNameBase name = taxon.getName();
 +            Assert.assertNotNull(name);
 +
 +            String nameTitle = name.getTitleCache();
 +            logger.info("Taxon Name : " + nameTitle);
 +
 +            count++;
 +        }
 +    }
 +
 +    @Test
 +    public void taxonReadTest() {
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +    }
 +
 +
 +    @Test
 +    public void testCDMEntitySave() {
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +        String oldTitleCache = taxon.getTitleCache();
 +
 +        System.out.println("Taxon title : " + oldTitleCache);
 +
 +        taxon.setTitleCache(oldTitleCache + ":updated", true);
 +        taxonService.merge(taxon);
 +
 +        Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +        System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
 +
 +        Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(taxonNew.getTitleCache()));
 +
 +
 +        taxonNew.setTitleCache(oldTitleCache, true);
 +        taxonService.merge(taxonNew);
 +
 +        Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +        System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
 +
 +        Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
 +
 +    }
 +
 +
 +        @Test
 +        public void testCDMEntitySaveLazyNew() {
 +            Team combAuthor = Team.NewInstance();
 +            combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
 +            BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
++            name.setCombinationAuthorship(combAuthor);
 +            Taxon tax1 = Taxon.NewInstance(name, null);
 +            UUID taxonUuid1 = taxonService.save(tax1);
 +
 +            Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +            NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +            String oldTitleCache = nvn.getTitleCache();
 +            logger.info("Taxon Name Title : " + oldTitleCache);
 +            nvn.setTitleCache(oldTitleCache + ":updated",false);
 +            taxonService.update(taxon);
 +
 +            Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +            NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +            logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
 +
 +            Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(nvnNew.getTitleCache()));
 +
 +            nvnNew.setTitleCache(oldTitleCache, true);
 +            taxonService.update(taxon);
 +
 +            Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +            NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +            logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
 +
 +            Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
 +        }
 +
 +        @Ignore
 +        @Test
 +        public void testCDMEntitySaveCollection() {
 +            Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +            Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
 +            Set<String> relToTitles = new HashSet<String>();
 +            Iterator<SynonymRelationship> srItr = synRelations.iterator();
 +            while(srItr.hasNext()) {
 +                SynonymRelationship sr = srItr.next();
 +                System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
 +                relToTitles.add(sr.getSynonym().getTitleCache());
 +                sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
 +
 +            }
 +            taxonService.merge(taxon);
 +
 +            Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +            Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
 +
 +            Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
 +            Iterator<String> relToTitlesItr = relToTitles.iterator();
 +            while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
 +                SynonymRelationship srNew = srItrNew.next();
 +                String relToTitle = relToTitlesItr.next();
 +                System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
 +                Assert.assertTrue("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache().equals(relToTitle));
 +                srNew.getSynonym().setTitleCache(relToTitle);
 +            }
 +
 +            Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +
 +            Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
 +            Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
 +            relToTitlesItr = relToTitles.iterator();
 +            while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
 +                SynonymRelationship srOld = srItrOld.next();
 +                String relToTitle = relToTitlesItr.next();
 +                System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
 +                Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
 +
 +            }
 +        }
 +}
index 706c4a37cbe3e38fcda48384d93e14550ef1f700,0000000000000000000000000000000000000000..b0e1c9bccad551815779b713f3919ab4fab4821c
mode 100644,000000..100644
--- /dev/null
@@@ -1,276 -1,0 +1,276 @@@
-         name.setCombinationAuthorTeam(combAuthor);
 +/**
 + * Copyright (C) 2014 EDIT
 + * European Distributed Institute of Taxonomy
 + * http://www.e-taxonomy.eu
 + *
 + * The contents of this file are subject to the Mozilla Public License Version 1.1
 + * See LICENSE.TXT at the top of this package for the full license terms.
 + */
 +
 +package eu.etaxonomy.taxeditor.lazyloading;
 +
 +import java.util.Arrays;
 +import java.util.HashSet;
 +import java.util.Iterator;
 +import java.util.List;
 +import java.util.Set;
 +import java.util.UUID;
 +
 +import org.apache.log4j.Logger;
 +import org.junit.Assert;
 +import org.junit.BeforeClass;
 +import org.junit.Ignore;
 +import org.junit.Test;
 +
 +import eu.etaxonomy.cdm.api.service.IClassificationService;
 +import eu.etaxonomy.cdm.api.service.ITaxonService;
 +import eu.etaxonomy.cdm.model.agent.Person;
 +import eu.etaxonomy.cdm.model.agent.Team;
 +import eu.etaxonomy.cdm.model.common.CdmBase;
 +import eu.etaxonomy.cdm.model.name.BotanicalName;
 +import eu.etaxonomy.cdm.model.name.NonViralName;
 +import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 +import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
 +import eu.etaxonomy.cdm.model.taxon.Taxon;
 +import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 +import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
 +
 +
 +
 +/**
 + * Test class which tests remoting for persistent cdm entities.
 + *
 + * FIXME:Remoting saving tests are ignored until the merge development is underway
 + * @author c.mathew
 + *
 + */
 +//FIXME:Remoting need to create a proper dataset for this test
 +//Could be combined with AbstractLazyInitializerTest
 +@Ignore
 +public class RemoteLazyLoadingTest extends BaseRemotingTest {
 +
 +    private static final Logger logger = Logger.getLogger(RemoteLazyLoadingTest.class);
 +
 +    private static IClassificationService classificationService;
 +    private static ITaxonService taxonService;
 +
 +    private static List<TaxonNode> taxonNodes;
 +
 +    private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
 +    private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
 +
 +
 +    @BeforeClass
 +    public static void initializeRemoteLazyLoading() {
 +        taxonService = getRemoteApplicationController().getTaxonService();
 +
 +        classificationService= getRemoteApplicationController().getClassificationService();
 +        //List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
 +//        Assert.assertFalse(classifications.isEmpty());
 +//
 +//        Classification classification = classifications.get(0);
 +//        Assert.assertNotNull(classification);
 +        taxonNodes = classificationService.getAllNodes();
 +        Assert.assertFalse(taxonNodes.isEmpty());
 +
 +    }
 +
 +
 +
 +    @Test
 +    public void testCDMEntityGet() {
 +        Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
 +        int maxcount = 30;
 +        int count = 0;
 +        while(taxonNodeItr.hasNext() && count <= maxcount) {
 +            TaxonNode taxonNode = taxonNodeItr.next();
 +            Assert.assertNotNull(taxonNode);
 +
 +            Taxon taxon = taxonNode.getTaxon();
 +            Assert.assertNotNull(taxon);
 +
 +            String taxonTitle = taxon.getTitleCache();
 +            logger.info("Taxon : " + taxonTitle);
 +
 +            TaxonNameBase name = taxon.getName();
 +            Assert.assertNotNull(name);
 +
 +            String nameTitle = name.getTitleCache();
 +            logger.info("Taxon Name : " + nameTitle);
 +
 +            count++;
 +        }
 +
 +
 +    }
 +
 +    @Test
 +    public void test() {
 +
 +    }
 +
 +    @Test
 +    public void testCDMEntitySaveEager() {
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +        String oldTitleCache = taxon.getTitleCache();
 +
 +        System.out.println("Taxon title : " + oldTitleCache);
 +
 +        taxon.setTitleCache(oldTitleCache + ":updated");
 +        taxonService.merge(taxon);
 +
 +        Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +        System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
 +
 +        Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(taxonNew.getTitleCache()));
 +
 +        taxonNew.setTitleCache(oldTitleCache);
 +        taxonService.merge(taxonNew);
 +
 +        Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +        System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
 +
 +        Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
 +
 +    }
 +
 +
 +    @Test
 +    public void testCDMEntityUpdate() {
 +
 +        Team combAuthor = Team.NewInstance();
 +        combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
 +        BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
-         Team team = CdmBase.deproxy(nvn.getCombinationAuthorTeam(),Team.class);
++        name.setCombinationAuthorship(combAuthor);
 +        Taxon taxon = Taxon.NewInstance(name, null);
 +        UUID taxonUuid = taxonService.save(taxon);
 +
 +        //        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +        //        NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        //        String oldTitleCache = nvn.getTitleCache();
 +        //        System.out.println("Taxon Name Title : " + oldTitleCache);
 +        //        nvn.setTitleCache(oldTitleCache + ":updated", true);
 +        //
 +        //        taxon.setTitleCache(oldTitleCache + ":updated",true);
 +        //        try {
 +        //            taxonService.update(taxon);
 +        //        } catch (LazyInitializationException lie) {
 +        //            lie.printStackTrace();
 +        //        }
 +
 +        List<String> TAXON_INIT_STRATEGY = Arrays.asList(new String[] {
 +                "name"
 +        });
 +        Taxon taxonNew = (Taxon)taxonService.findTaxonByUuid(taxonUuid,TAXON_INIT_STRATEGY);
 +        NonViralName nvn = CdmBase.deproxy(taxonNew.getName(),NonViralName.class);
-         name.setCombinationAuthorTeam(combAuthor);
++        Team team = CdmBase.deproxy(nvn.getCombinationAuthorship(),Team.class);
 +        String oldTitleCache = nvn.getTitleCache();
 +        System.out.println("Taxon Name Title : " + oldTitleCache);
 +        nvn.setTitleCache(oldTitleCache + ":updated", true);
 +        taxonService.update(taxonNew);
 +
 +    }
 +
 +
 +    @Test
 +    public void testCDMEntitySaveLazy() {
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +        NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        String oldTitleCache = nvn.getTitleCache();
 +        System.out.println("Taxon Name Title : " + oldTitleCache);
 +        nvn.setTitleCache(oldTitleCache + ":updated", true);
 +        taxonService.update(taxon);
 +
 +        //            Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +        //            NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        //            System.out.println("New Taxon Name Title : " + nvnNew.getTitleCache());
 +        //
 +        //            Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,nvnNew.getTitleCache());
 +        //
 +        //            nvnNew.setTitleCache(oldTitleCache, true);
 +        //            taxonService.update(taxon);
 +        //
 +        //            Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +        //            NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        //            System.out.println("Old Taxon Name Title : " + nvnNew.getTitleCache());
 +        //
 +        //            Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
 +    }
 +
 +    @Test
 +    public void testCDMEntitySaveLazyNew() {
 +        Team combAuthor = Team.NewInstance();
 +        combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
 +        BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
++        name.setCombinationAuthorship(combAuthor);
 +        Taxon tax1 = Taxon.NewInstance(name, null);
 +        UUID taxonUuid1 = taxonService.save(tax1);
 +
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +        NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        String oldTitleCache = nvn.getTitleCache();
 +        logger.info("Taxon Name Title : " + oldTitleCache);
 +        nvn.setTitleCache(oldTitleCache + ":updated",false);
 +        taxonService.update(taxon);
 +
 +        Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +        NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
 +
 +        Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(nvnNew.getTitleCache()));
 +
 +        nvnNew.setTitleCache(oldTitleCache, true);
 +        taxonService.update(taxon);
 +
 +        Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +        NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
 +        logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
 +
 +        Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
 +    }
 +    @Ignore
 +    @Test
 +    public void testCDMEntitySaveCollection() {
 +        Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
 +
 +        Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
 +        Set<String> relToTitles = new HashSet<String>();
 +        Iterator<SynonymRelationship> srItr = synRelations.iterator();
 +        while(srItr.hasNext()) {
 +            SynonymRelationship sr = srItr.next();
 +            System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
 +            relToTitles.add(sr.getSynonym().getTitleCache());
 +            sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
 +
 +        }
 +        taxonService.merge(taxon);
 +
 +        Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
 +        Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
 +
 +        Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
 +        Iterator<String> relToTitlesItr = relToTitles.iterator();
 +        while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
 +            SynonymRelationship srNew = srItrNew.next();
 +            String relToTitle = relToTitlesItr.next();
 +            System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
 +            Assert.assertTrue("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache().equals(relToTitle));
 +            srNew.getSynonym().setTitleCache(relToTitle);
 +        }
 +
 +        Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
 +
 +        Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
 +        Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
 +        relToTitlesItr = relToTitles.iterator();
 +        while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
 +            SynonymRelationship srOld = srItrOld.next();
 +            String relToTitle = relToTitlesItr.next();
 +            System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
 +            Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
 +
 +        }
 +    }
 +}
diff --cc pom.xml
Simple merge