#5138 Add test for cascade error
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 1 Sep 2015 15:23:09 +0000 (17:23 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 1 Sep 2015 15:23:09 +0000 (17:23 +0200)
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionAwareTest.java
eu.etaxonomy.taxeditor.test/src/test/resources/eu/etaxonomy/taxeditor/session/CdmEntitySessionAwareTest.xml

index 1d0c74aa6efdcb99d7a62996d07c891b141b789f..a6cb0a1d7f8a1cec10601a0703b83192118b69fd 100644 (file)
@@ -24,6 +24,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.unitils.dbunit.annotation.DataSet;
 
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
@@ -32,6 +33,8 @@ import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.api.service.IVocabularyService;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Credit;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
@@ -468,4 +471,20 @@ public class CdmEntitySessionAwareTest extends RemotingSessionAwareTest {
             }
         }
     }
+
+    @Test
+    public void savePerson() {
+        TeamOrPersonBase teamOrPerson = Person.NewInstance();
+        teamOrPerson.setTitleCache("New Person", true);
+        teamOrPerson = (TeamOrPersonBase)CdmApplicationState.getCurrentAppConfig().getAgentService().merge(teamOrPerson);
+        //CdmApplicationState.getCurrentAppConfig().getAgentService().saveOrUpdate(teamOrPerson);
+
+        Person person = (Person)teamOrPerson;
+//        person.setFirstname("Some");
+//        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(teamOrPerson);
+
+        person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().find(person.getUuid());
+        person.setFirstname("Some");
+        CdmApplicationState.getCurrentAppConfig().getAgentService().merge(teamOrPerson);
+    }
 }
index 54f8d231f18eb477e9332b5c1fea52a18231e30e..1859e37138fe31d674709f99b61f6f55c48e9a70 100644 (file)
   <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550"    sourceType="PTS"/>
   <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550"    sourceType="PTS"/>
 
+  <AgentBase/>
   
 </dataset>