corrected / moved existing tests
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 20 May 2015 12:16:41 +0000 (12:16 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 20 May 2015 12:16:41 +0000 (12:16 +0000)
.gitattributes
eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNodeTest.xml [deleted file]
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java [moved from eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNodeTest.java with 53% similarity]
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManagerTest.java
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/MockSessionOwner.java

index 1cddc1698e3e3496f4240d129ec23560a7a7a1cf..dca319a506bb3ca130b4016589d4ee12c94a1d87 100644 (file)
@@ -1854,13 +1854,15 @@ eu.etaxonomy.taxeditor.test/.settings/org.eclipse.jdt.core.prefs -text
 eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF -text
 eu.etaxonomy.taxeditor.test/build.properties -text
 eu.etaxonomy.taxeditor.test/ide/eclipse/EDITor[!!-~]Tests.launch -text
+eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar -text
 eu.etaxonomy.taxeditor.test/pom.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/cdmlib-ehcache.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/datasources.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/PolytomousKeyTest.xml -text
-eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNodeTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
 eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml -text
@@ -1873,7 +1875,8 @@ eu.etaxonomy.taxeditor.test/src/main/resources/unitils.properties -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmModelGetMethodCacherTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/PolytomousKeyTest.java -text
-eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNodeTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/application/menu/general/NewMenuTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java -text
@@ -1889,6 +1892,7 @@ eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/Rem
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/navigation/navigator/contextmenu/ClassificationTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizardTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ITestService.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceInterceptorTest.java -text
 eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceRebasingTest.java -text
diff --git a/eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar b/eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar
new file mode 100644 (file)
index 0000000..2b1447a
Binary files /dev/null and b/eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar differ
diff --git a/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml b/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml
new file mode 100644 (file)
index 0000000..5834898
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  generated by Jailer 4.3, Wed Mar 04 16:11:14 CET 2015 from cmathew@cmbgbm-t530
+  
+  Extraction Model:  all rows from Classification (extractionmodel/by-example/SbE-Classification-16-11-06-737.csv)
+  Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
+  Database User:     root
+  
+  Exported Rows:     31
+      Classification                 1
+      HomotypicalGroup               2
+      SynonymRelationship            1
+      TaxonBase                      5
+      TaxonNameBase                  3
+      TaxonNode                      19
+  
+--><dataset>
+  
+  
+  <TaxonNode id="347" created="2010-12-21 15:09:45.0" uuid="d425a971-1abe-4895-9e1f-1e5c8ff1c84c" countchildren="0"  classification_id="10"  taxon_id="387" treeIndex="#t10#4032#49#346#345#347#" sortIndex="1"/>  
+  <TaxonNode id="351" created="2010-12-21 15:09:46.0" uuid="ce54c396-3694-47f2-abb0-1d7b7e057985" countchildren="0"  classification_id="10"  taxon_id="394" treeIndex="#t10#4032#49#346#345#351#" sortIndex="4"/>
+  
+  <HomotypicalGroup id="368" created="2010-12-21 15:09:45.0" uuid="d7eaa174-4efd-4d09-a427-dce4ed6513f7" />
+  <HomotypicalGroup id="375" created="2010-12-21 15:09:46.0" uuid="62ed57d6-2c69-4404-bb95-248a1c9bb24c" />
+
+  <TaxonNameBase DTYPE="BotanicalName" id="387" created="2010-12-21 15:09:45.0" uuid="d25985c7-6fb4-4b31-8a94-5d7c5ba6ad16" protectedtitlecache="false" titleCache="Asplenium ceterach L." fullTitleCache="Asplenium ceterach L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium ceterach" protectedauthorshipcache="false" protectednamecache="false" specificepithet="ceterach" trinomhybrid="false" anamorphic="false"  homotypicalgroup_id="368" rank_id="778" />
+  <TaxonNameBase DTYPE="BotanicalName" id="388" created="2010-12-21 15:09:45.0" uuid="747021f1-cf5f-4249-a825-228da3368399" protectedtitlecache="true" titleCache="Asplenium cyprium Viane &amp; Van den heede" fullTitleCache="Asplenium cyprium Viane &amp; Van den heede" parsingproblem="16" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" hybridformula="false" monomhybrid="false" namecache="Asplenium cyprium Viane &amp; Van den heede" protectedauthorshipcache="false" protectednamecache="true" trinomhybrid="false" anamorphic="false" />
+  <TaxonNameBase DTYPE="BotanicalName" id="394" created="2010-12-21 15:09:46.0" uuid="08f8f376-c9a4-4ea9-950d-3ac30b7fa689" protectedtitlecache="false" titleCache="Asplenium viride Huds." fullTitleCache="Asplenium viride Huds." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Huds." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium viride" protectedauthorshipcache="false" protectednamecache="false" specificepithet="viride" trinomhybrid="false" anamorphic="false"  homotypicalgroup_id="375" rank_id="778" />
+
+  <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" protectedtitlecache="false" titleCache="Cyprus"  name_id="10" reference_id="10" />
+  <TaxonBase DTYPE="Taxon" id="387" created="2011-03-01 20:11:27.0" uuid="9763e5f0-6cd4-4d96-b8a4-4420854f7727" protectedtitlecache="false" titleCache="Asplenium ceterach L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"  name_id="387" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Synonym" id="388" created="2010-12-21 15:09:45.0" uuid="1eb173bd-b174-4162-8ff5-5136d8f1e746" protectedtitlecache="false" titleCache="Asplenium cyprium Viane &amp; Van den heede sec. Cyprus" doubtful="false" usenamecache="false"  name_id="388" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="394" created="2011-03-01 20:11:27.0" uuid="aff4fa6f-9aa8-463d-ac07-ec8a1925eb57" protectedtitlecache="false" titleCache="Asplenium viride Huds. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false"  name_id="394" sec_id="10" publish="true"/>
+
+  <SynonymRelationship id="50" created="2010-12-21 15:09:45.0" uuid="60d1466f-5823-4a69-a071-1887d0c1e72b" doubtful="false" partial="false" proparte="false"  relatedfrom_id="388" relatedto_id="387" />
+
+  
+</dataset>
diff --git a/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml b/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml
new file mode 100644 (file)
index 0000000..32f7003
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+  generated by Jailer 4.3, Mon Mar 09 12:52:22 CET 2015 from cmathew@cmbgbm-t530
+  
+  Extraction Model:  all rows from Classification (extractionmodel/by-example/SbE-Classification-12-51-51-866.csv)
+  Database URL:      jdbc:mysql://127.0.0.1:3306/local-cyprus
+  Database User:     root
+  
+  Exported Rows:     26
+      Classification                 1
+      TaxonBase                      6
+      TaxonNameBase                  6
+      TaxonNode                      13
+  
+--><dataset>
+  <TaxonNode id="13" created="2010-12-21 15:09:43.0" uuid="0ac32f24-6d55-44ae-8519-c86c83faa938" countchildren="122" createdby_id="11" classification_id="10" parent_id="4032" taxon_id="11" treeIndex="#t10#4032#13#" sortIndex="0"/>
+  <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" createdby_id="11" classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="1"/>
+  <TaxonNode id="344" created="2010-12-21 15:09:45.0" uuid="894bc754-235b-4fa1-aa0c-a2b62e3f684c" countchildren="0" createdby_id="11" classification_id="10" parent_id="345" taxon_id="384" treeIndex="#t10#4032#49#346#345#344#" sortIndex="0"/>
+  <TaxonNode id="345" created="2010-12-21 15:09:45.0" uuid="8667c9d7-18e4-4711-a2be-9d468635744d" countchildren="5" createdby_id="11" classification_id="10" parent_id="346" taxon_id="386" treeIndex="#t10#4032#49#346#345#" sortIndex="0"/>
+  <TaxonNode id="346" created="2010-12-21 15:09:45.0" uuid="ffc9b1ec-278e-4298-8bc2-d36bdb2c33b8" countchildren="1" createdby_id="11" classification_id="10" parent_id="49" taxon_id="385" treeIndex="#t10#4032#49#346#" sortIndex="1"/>
+  <TaxonNode id="347" created="2010-12-21 15:09:45.0" uuid="d425a971-1abe-4895-9e1f-1e5c8ff1c84c" countchildren="0" createdby_id="11" classification_id="10" parent_id="345" taxon_id="387" treeIndex="#t10#4032#49#346#345#347#" sortIndex="1"/>
+  <TaxonNode id="348" created="2010-12-21 15:09:46.0" uuid="3bb05d37-51fa-48f6-9f49-0162f2893dd5" countchildren="0" createdby_id="11" classification_id="10" parent_id="345" taxon_id="391" treeIndex="#t10#4032#49#346#345#348#" sortIndex="2"/>
+  <TaxonNode id="350" created="2010-12-21 15:09:46.0" uuid="3f47c04f-4a84-4f53-95ce-840309900db7" countchildren="1" createdby_id="11" classification_id="10" parent_id="345" taxon_id="393" treeIndex="#t10#4032#49#346#345#350#" sortIndex="3"/>
+  <TaxonNode id="351" created="2010-12-21 15:09:46.0" uuid="ce54c396-3694-47f2-abb0-1d7b7e057985" countchildren="0" createdby_id="11" classification_id="10" parent_id="345" taxon_id="394" treeIndex="#t10#4032#49#346#345#351#" sortIndex="4"/>
+  <TaxonNode id="942" created="2010-12-21 15:09:50.0" uuid="713baf41-c76b-4ba6-be82-ffabb7f895c5" countchildren="0" createdby_id="11" classification_id="10" parent_id="943" taxon_id="1070" treeIndex="#t10#4032#49#3880#943#942#" sortIndex="0"/>
+  <TaxonNode id="943" created="2010-12-21 15:09:50.0" uuid="47336df4-af4b-4b40-84de-34fc445d762c" countchildren="1" createdby_id="11" classification_id="10" parent_id="3880" taxon_id="1072" treeIndex="#t10#4032#49#3880#943#" sortIndex="0"/>
+  <TaxonNode id="3880" created="2012-07-19 21:43:16.0" uuid="05102134-ce13-4a0e-be2e-48aa08ecbea5" countchildren="1" createdby_id="30" classification_id="10" parent_id="49" taxon_id="6110" treeIndex="#t10#4032#49#3880#" sortIndex="9"/>
+  <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="2" classification_id="10" treeIndex="#t10#4032#"/>
+
+  <TaxonNameBase DTYPE="BotanicalName" id="384" created="2010-12-21 15:09:45.0" uuid="0a89c1d4-b8b9-4bbe-8e25-03cef7179b6d" protectedtitlecache="false" titleCache="Asplenium adiantum-nigrum L." fullTitleCache="Asplenium adiantum-nigrum L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium adiantum-nigrum" protectedauthorshipcache="false" protectednamecache="false" specificepithet="adiantum-nigrum" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="365" rank_id="778" combinationauthorteam_id="7220"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="387" created="2010-12-21 15:09:45.0" uuid="d25985c7-6fb4-4b31-8a94-5d7c5ba6ad16" protectedtitlecache="false" titleCache="Asplenium ceterach L." fullTitleCache="Asplenium ceterach L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium ceterach" protectedauthorshipcache="false" protectednamecache="false" specificepithet="ceterach" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="368" rank_id="778" combinationauthorteam_id="674"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="391" created="2010-12-21 15:09:46.0" uuid="bb33b929-77f4-47fd-ac6b-265e947871be" protectedtitlecache="false" titleCache="Asplenium onopteris L." fullTitleCache="Asplenium onopteris L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium onopteris" protectedauthorshipcache="false" protectednamecache="false" specificepithet="onopteris" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="372" rank_id="778" combinationauthorteam_id="678"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="393" created="2010-12-21 15:09:46.0" uuid="d0d8df45-6d47-4dbf-8554-ea1aa1e00dc9" protectedtitlecache="false" titleCache="Asplenium trichomanes L." fullTitleCache="Asplenium trichomanes L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium trichomanes" protectedauthorshipcache="false" protectednamecache="false" specificepithet="trichomanes" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="374" rank_id="778" combinationauthorteam_id="7390"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="394" created="2010-12-21 15:09:46.0" uuid="08f8f376-c9a4-4ea9-950d-3ac30b7fa689" protectedtitlecache="false" titleCache="Asplenium viride Huds." fullTitleCache="Asplenium viride Huds." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Huds." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium viride" protectedauthorshipcache="false" protectednamecache="false" specificepithet="viride" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="375" rank_id="778" combinationauthorteam_id="682"/>
+  <TaxonNameBase DTYPE="BotanicalName" id="1070" created="2010-12-21 15:09:50.0" uuid="d23fca33-18c6-4b5c-81d7-93359afd76e1" protectedtitlecache="false" titleCache="Cystopteris fragilis (L.) Bernh." fullTitleCache="Cystopteris fragilis (L.) Bernh." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Bernh." binomhybrid="false" genusoruninomial="Cystopteris" hybridformula="false" monomhybrid="false" namecache="Cystopteris fragilis" protectedauthorshipcache="false" protectednamecache="false" specificepithet="fragilis" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="1004" rank_id="778" basionymauthorteam_id="2019" combinationauthorteam_id="2021"/>
+
+  <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" protectedtitlecache="false" titleCache="Cyprus" createdby_id="11" name_id="10" reference_id="10" rootnode_id="4032"/>
+
+  <TaxonBase DTYPE="Taxon" id="384" created="2011-03-01 20:11:27.0" uuid="b9f1429d-137c-4c23-a11f-7808b50bde4b" protectedtitlecache="false" titleCache="Asplenium adiantum-nigrum L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="384" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="387" created="2011-03-01 20:11:27.0" uuid="9763e5f0-6cd4-4d96-b8a4-4420854f7727" protectedtitlecache="false" titleCache="Asplenium ceterach L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="387" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="391" created="2011-03-01 20:11:27.0" uuid="42c42377-3847-4d85-811f-743ab3d3f0a3" protectedtitlecache="false" titleCache="Asplenium onopteris L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="391" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="393" created="2010-12-21 15:09:46.0" uuid="c1263710-0225-4429-b2b7-518e6db564c5" protectedtitlecache="false" titleCache="Asplenium trichomanes L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="393" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="394" created="2011-03-01 20:11:27.0" uuid="aff4fa6f-9aa8-463d-ac07-ec8a1925eb57" protectedtitlecache="false" titleCache="Asplenium viride Huds. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="394" sec_id="10" publish="true"/>
+  <TaxonBase DTYPE="Taxon" id="1070" created="2011-03-01 20:11:30.0" uuid="f380f8ff-2dab-4ea7-a3c9-4758f963eb6b" protectedtitlecache="false" titleCache="Cystopteris fragilis (L.) Bernh. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="1070" sec_id="10" publish="true"/>
+
+  
+</dataset>
diff --git a/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNodeTest.xml b/eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNodeTest.xml
deleted file mode 100644 (file)
index ce275f1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<dataset>
-    <REFERENCE ID="1" UUID="de7d1205-291f-45d9-9059-ca83fc7ade14" PROTECTEDTITLECACHE="false" REFTYPE="GEN" PROTECTEDABBREVTITLECACHE="false" ABBREVTITLECACHE="Sp. Pl." ABBREVTITLE="Sp. Pl." NOMENCLATURALLYRELEVANT="false" PARSINGPROBLEM="0" PROBLEMENDS="-1" PROBLEMSTARTS="-1" />
-    <CLASSIFICATION ID="1" UUID="6c2bc8d9-ee62-4222-be89-4a8e31770878"  PROTECTEDTITLECACHE="true" ROOTNODE_ID = "1"/>
-   <!-- <CLASSIFICATION_TAXONNODE CLASSIFICATION_ID="1" ROOTNODES_ID="1" SORTINDEX="0"/> --> 
-
-    <TAXONNODE ID="1" TAXON_ID="[null]" PARENT_ID="[null]" SORTINDEX="[null]" CLASSIFICATION_ID="1" UUID="324a1a77-689c-44be-8e65-347d835f4111" COUNTCHILDREN="2" TREEINDEX="#t1#1#"/>
-    <TAXONNODE ID="2" TAXON_ID="1" PARENT_ID="1" SORTINDEX="0" CLASSIFICATION_ID="1" UUID="484a1a77-689c-44be-8e65-347d835f47e8"  COUNTCHILDREN="0" TREEINDEX="#t1#1#2#"/>
-    <TAXONNODE ID="3" TAXON_ID="2" PARENT_ID="1" SORTINDEX="1" CLASSIFICATION_ID="1" UUID="2d41f0c2-b785-4f73-a436-cc2d5e93cc5b"  COUNTCHILDREN="0" TREEINDEX="#t1#1#3#"/>
-
-    <TAXONBASE DTYPE="Taxon" ID="1" NAME_ID="1" UUID="55c3e41a-c629-40e6-aa6a-ff274ac6ddb1"     PROTECTEDTITLECACHE="false" DOUBTFUL="false" PUBLISH="true" USENAMECACHE="false" EXCLUDED="false" TAXONSTATUSUNKNOWN="false" UNPLACED="false" TAXONOMICCHILDRENCOUNT="0"/>
-    <TAXONBASE DTYPE="Taxon" ID="2"  NAME_ID="2" UUID="2659a7e0-ff35-4ee4-8493-b453756ab955"    PROTECTEDTITLECACHE="false" DOUBTFUL="false" PUBLISH="true" USENAMECACHE="false" EXCLUDED="false" TAXONSTATUSUNKNOWN="false" UNPLACED="false" TAXONOMICCHILDRENCOUNT="0"/>
-    <TAXONBASE DTYPE="Synonym" ID="3" NAME_ID="3" UUID="3034249e-9491-4439-bcb6-9c7d68e29bce"   PROTECTEDTITLECACHE="false" DOUBTFUL="false" PUBLISH="true" USENAMECACHE="false" EXCLUDED="[null]" TAXONSTATUSUNKNOWN="[null]" UNPLACED="[null]" TAXONOMICCHILDRENCOUNT="[null]"/>
-    <TAXONBASE DTYPE="Synonym" ID="4" NAME_ID="4" UUID="ac6c5bb1-d36d-4068-af7c-4f0bb009880d"   PROTECTEDTITLECACHE="false" DOUBTFUL="false" PUBLISH="true" USENAMECACHE="false" EXCLUDED="[null]" TAXONSTATUSUNKNOWN="[null]" UNPLACED="[null]" TAXONOMICCHILDRENCOUNT="[null]"/>
-
-    <TAXONNAMEBASE DTYPE="BotanicalName" ID="1" UUID="54a1d7f9-79ab-4fb3-bff5-152e1046cf75" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" HOMOTYPICALGROUP_ID="1" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" HYBRIDFORMULA="false" MONOMHYBRID="false" BINOMHYBRID="false" TRINOMHYBRID="false" ANAMORPHIC="false" RANK_ID="765"/>
-    <TAXONNAMEBASE DTYPE="BotanicalName" ID="2" UUID="e7f50b04-9648-479b-bc8a-ffebf295dce9" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" HOMOTYPICALGROUP_ID="2" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" HYBRIDFORMULA="false" MONOMHYBRID="false" BINOMHYBRID="false" TRINOMHYBRID="false" ANAMORPHIC="false" RANK_ID="765"/>
-    <TAXONNAMEBASE DTYPE="BotanicalName" ID="3" UUID="c0439dd6-8d2b-4428-86f4-37f4a90d4583" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" HOMOTYPICALGROUP_ID="3" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" HYBRIDFORMULA="false" MONOMHYBRID="false" BINOMHYBRID="false" TRINOMHYBRID="false" ANAMORPHIC="false" RANK_ID="765"/>
-    <TAXONNAMEBASE DTYPE="BotanicalName" ID="4" UUID="6a5774bd-c8aa-42dc-91dd-d62d27e7ea2a" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" HOMOTYPICALGROUP_ID="4" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" HYBRIDFORMULA="false" MONOMHYBRID="false" BINOMHYBRID="false" TRINOMHYBRID="false" ANAMORPHIC="false" RANK_ID="765"/>
-    <HOMOTYPICALGROUP ID="1" CREATED="2011-10-12 19:57:31.0" UUID="d8652fa0-eff9-460d-8990-aed0ebf1322e"/>
-    <HOMOTYPICALGROUP ID="2" CREATED="2011-10-12 19:57:31.0" UUID="2a1b0776-b4b5-462a-9be7-f88378ebd732"/>
-    <HOMOTYPICALGROUP ID="3" CREATED="2011-10-12 19:57:31.0" UUID="3ac4e376-31cd-47fd-9dd6-eaff415ff0e7"/>
-    <HOMOTYPICALGROUP ID="4" CREATED="2011-10-12 19:57:31.0" UUID="76258671-07cf-40f3-a9eb-af286b5945ec"/>
-
-    <SYNONYMRELATIONSHIP ID="1" UUID="cc769418-3ba4-4c1f-a4cb-b18bf42ec8e9" CITATION_ID="1" RELATEDFROM_ID="3" RELATEDTO_ID="1" DOUBTFUL="false" PARTIAL="false" PROPARTE="false"/>
-    <DESCRIPTIONBASE ID="1" UUID="56cf0c8c-18e3-4bea-9525-b9804cf57c5d" DTYPE="TaxonDescription" TAXON_ID="1" PROTECTEDTITLECACHE="false" IMAGEGALLERY="false" />
-    <DESCRIPTIONBASE ID="2" UUID="36af5c7c-18e3-4bec-6535-a9804cf57c6e" DTYPE="TaxonDescription" TAXON_ID="1" PROTECTEDTITLECACHE="false" IMAGEGALLERY="false" />
-    <DESCRIPTIONELEMENTBASE DTYPE="TextData" ID="1" INDESCRIPTION_ID="1" ORDERRELEVANT="false"/>
-    <DESCRIPTIONELEMENTBASE DTYPE="TextData" ID="2" INDESCRIPTION_ID="2" ORDERRELEVANT="false"/>
-    <DESCRIPTIONELEMENTBASE_LANGUAGESTRING DESCRIPTIONELEMENTBASE_ID="1" MULTILANGUAGETEXT_ID="1" MULTILANGUAGETEXT_MAPKEY_ID="406" />
-    <DESCRIPTIONELEMENTBASE_LANGUAGESTRING DESCRIPTIONELEMENTBASE_ID="2" MULTILANGUAGETEXT_ID="2" MULTILANGUAGETEXT_MAPKEY_ID="406" />
-    <LANGUAGESTRING ID="1" TEXT="Any text" LANGUAGE_ID="406"/>
-    <LANGUAGESTRING ID="2" TEXT="Second text" LANGUAGE_ID="406"/>
-
-</dataset>
\ No newline at end of file
index ec7da5417f2f8f3560733940f7528f7f1d0ab229..095262f32cf7d8c35b6621b921c0b7adb87761e7 100644 (file)
@@ -100,7 +100,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //      |- root : polytomous key node
        // in a recursive call
         PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
 
         // checking to make sure the root object is in the session cache
         Assert.assertSame(pkey1.getRoot(), cacher.getFromCache(pkey1.getRoot()));
@@ -118,7 +118,6 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
        // in a recursive call
         PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-        pkey = cdmEntitySession.load(pkey);
         CdmTransientEntityCacher cacher = getCacher(sessionOwner);
         // checking to make sure the root object is in the session cache
         Assert.assertSame(pkey.getRoot(), cacher.getFromCache(pkey.getRoot()));
@@ -140,7 +139,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- question : KeyStatement
        //              |- statement : KeyStatement
         PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
         CdmTransientEntityCacher cacher = getCacher(sessionOwner);
 
     }
@@ -158,7 +157,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //      |- root : polytomous key node
        // in a recursive call
         PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
         CdmTransientEntityCacher cacher = getCacher(sessionOwner);
 
        // this call will load into the session cache the graph and update the objects in the sub-graph for a
@@ -167,7 +166,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- question : KeyStatement
        //              |- statement : KeyStatement
         PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-        pkey2 = cdmEntitySession.load(pkey2);
+
 
         Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement()));
         Assert.assertSame(pkey1.getRoot().getStatement(), pkey2.getRoot().getStatement());
@@ -188,14 +187,14 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- question : KeyStatement
        //              |- statement : KeyStatement
         PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
         CdmTransientEntityCacher cacher = getCacher(sessionOwner);
 
        // this call will load into the session cache the graph and update the objects in the sub-graph for a
        // polytomous key
        //      |- root : polytomous key node
         PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
-        pkey2 = cdmEntitySession.load(pkey2);
+
 
         Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement()));
         Assert.assertSame(pkey1.getRoot().getStatement(), pkey2.getRoot().getStatement());
@@ -215,7 +214,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- question : KeyStatement
        //              |- statement : KeyStatement
         PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
         CdmTransientEntityCacher cacher = getCacher(sessionOwner);
 
         // checking that the root is not null and
@@ -229,7 +228,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        // polytomous key
        //      |- root : polytomous key node
         PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
-        pkey2 = cdmEntitySession.load(pkey2);
+
 
 
         Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement()));
@@ -250,7 +249,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //      |- root : polytomous key node
 
        PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
-        pkey1 = cdmEntitySession.load(pkey1);
+
 
         // lazy initialising root.statement
         KeyStatement st = CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class);
@@ -271,7 +270,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
 
        PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-       pkey2 = cdmEntitySession.load(pkey2);
+
 
        Assert.assertSame(pkey2.getRoot().getStatement(), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
        Assert.assertSame(st, pkey2.getRoot().getStatement());
@@ -291,13 +290,13 @@ public class CdmClientCachingTest extends BaseRemotingTest {
 
        // this call will load into the session cache a polytomous key node object
        PolytomousKeyNode rootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid1),PolytomousKeyNode.class);
-       rootPKNode = cdmEntitySession.load(rootPKNode);
+
 
        Assert.assertNotNull(rootPKNode);
        Assert.assertSame(rootPKNode, cacher.getFromCache(rootPKNode));
 
        PolytomousKeyNode childOfRootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid2),PolytomousKeyNode.class);
-       childOfRootPKNode = cdmEntitySession.load(childOfRootPKNode);
+
 
        Assert.assertNotNull(childOfRootPKNode);
        Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
@@ -309,7 +308,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
 
        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-       pkey = cdmEntitySession.load(pkey);
+
 
        Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
        Assert.assertSame(pkey.getRoot().getChildAt(1), childOfRootPKNode);
@@ -329,17 +328,17 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
 
        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-       pkey = cdmEntitySession.load(pkey);
+
 
        // this call will load into the session cache a polytomous key node object
        PolytomousKeyNode rootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid1),PolytomousKeyNode.class);
-       rootPKNode = cdmEntitySession.load(rootPKNode);
+
 
        Assert.assertNotNull(rootPKNode);
        Assert.assertSame(rootPKNode, cacher.getFromCache(rootPKNode));
 
        PolytomousKeyNode childOfRootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid2),PolytomousKeyNode.class);
-       childOfRootPKNode = cdmEntitySession.load(childOfRootPKNode);
+
 
        Assert.assertNotNull(childOfRootPKNode);
        Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
@@ -363,7 +362,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
 
        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
-       pkey = cdmEntitySession.load(pkey);
+
 
        PolytomousKeyNode childOfRootPKNode = pkey.getRoot().getChildAt(1);
 
@@ -400,7 +399,7 @@ public class CdmClientCachingTest extends BaseRemotingTest {
        //              |- statement : KeyStatement
 
        PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH3_INIT_STRATEGY),PolytomousKey.class);
-       pkey = cdmEntitySession.load(pkey);
+
 
        Map<Language, LanguageString> labelMap = pkey.getRoot().getStatement().getLabel();
        Set<Language> languages = labelMap.keySet();
diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java
new file mode 100644 (file)
index 0000000..f797695
--- /dev/null
@@ -0,0 +1,195 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.cdm.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionException;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
+import eu.etaxonomy.taxeditor.operations.OperationTestBase;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.session.MockSessionOwner;
+
+/**
+ * @author cmathew
+ * @date 3 Feb 2015
+ *
+ */
+@DataSet
+public class TaxonNameEditorTest extends OperationTestBase {
+
+    private static final Logger logger = Logger.getLogger(TaxonNameEditorTest.class);
+
+
+
+
+    ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+    ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+    IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
+
+
+    private CdmTransientEntityCacher cacher;
+    private ICdmEntitySessionEnabled sessionOwner;
+
+    private ICdmEntitySession cdmEntitySession;
+
+    Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+
+
+    @BeforeClass
+    public static void initializePolytomousKeyTest() {
+        logger.setLevel(Level.INFO);
+        CDMServer.getInstance().setKeepServerRunning(true);
+        initializeController("default",
+                "localhost",
+                8080,
+                "",
+                NomenclaturalCode.ICNAFP,
+                "admin",
+                "00000");
+    }
+
+    @Before
+    public void initializeSession() {
+        sessionOwner = new MockSessionOwner();
+        cdmEntitySession = cdmEntitySessionManager.newSession(sessionOwner, true);
+        cacher = getCacher(sessionOwner);
+    }
+
+    @Test
+    public void testAddHomotypicSynonym() throws ExecutionException {
+        UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+        TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+        Taxon taxon = taxonNode.getTaxon();
+        HomotypicalGroup group = taxon.getHomotypicGroup();
+        BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+        newSynonymName.setTitleCache("New Synonym", true);
+        operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+                undoContext, taxon, group, newSynonymName, postOperation);
+
+        operation.execute(monitor, info);
+        taxonNodeService.merge(taxonNode);
+        Assert.assertEquals(taxon.getHomotypicGroup().getTypifiedNames().size(), 2);
+        Assert.assertEquals(taxon.getSynonyms().size(), 1);
+        Iterator<Synonym> synonymItr = taxon.getSynonyms().iterator();
+        Synonym synonym = synonymItr.next();
+        Assert.assertTrue(taxon.getHomotypicGroup().getTypifiedNames().contains(synonym.getName()));
+    }
+
+    @Test
+    public void addHeterotypicSynonym() throws ExecutionException {
+        UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+        TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+        Taxon taxon = taxonNode.getTaxon();
+        HomotypicalGroup group = taxon.getHomotypicGroup();
+        BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+        newSynonymName.setTitleCache("New Synonym", true);
+        operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+                undoContext, taxon, group, newSynonymName, postOperation);
+
+        operation.execute(monitor, info);
+        taxonNodeService.merge(taxonNode);
+
+
+    }
+
+    @Test
+    public void addDeleteAddHomotypicSynonym() throws ExecutionException {
+        UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+        TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+        Taxon taxon = taxonNode.getTaxon();
+        HomotypicalGroup group = taxon.getHomotypicGroup();
+        BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+        newSynonymName.setTitleCache("New Synonym", true);
+        operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+                undoContext, taxon, group, newSynonymName, postOperation);
+
+        operation.execute(monitor, info);
+        taxonNodeService.merge(taxonNode);
+        Assert.assertEquals(taxon.getHomotypicGroup().getTypifiedNames().size(), 2);
+
+        Set<Synonym> synonyms = taxon.getSynonyms();
+        for(Synonym synonym : synonyms) {
+            taxonService.deleteSynonym(synonym.getUuid(), taxon.getUuid(), null);
+        }
+
+        taxonNodeService.merge(taxonNode);
+
+        newSynonymName = BotanicalName.NewInstance(null);
+        newSynonymName.setTitleCache("Another New Synonym", true);
+        operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+                undoContext, taxon, group, newSynonymName, postOperation);
+
+        operation.execute(monitor, info);
+        taxonNodeService.merge(taxonNode);
+    }
+
+    @Test
+    public void swapSynonymWithAcceptedTaxon() throws ExecutionException {
+        List<TaxonNode> rootEntities = new ArrayList<TaxonNode>();
+        UUID taxonNodeUuid = UUID.fromString("d425a971-1abe-4895-9e1f-1e5c8ff1c84c");
+        TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+        rootEntities.add(taxonNode);
+        sessionOwner = new MockSessionOwner(rootEntities);
+        cdmEntitySession = cdmEntitySessionManager.newSession(sessionOwner, true);
+
+        UUID taxonUuid = UUID.fromString("9763e5f0-6cd4-4d96-b8a4-4420854f7727");
+        Taxon taxon = (Taxon)taxonService.load(taxonUuid);
+        TaxonNameBase taxonName = taxon.getName();
+
+        UUID synonymUuid = UUID.fromString("1eb173bd-b174-4162-8ff5-5136d8f1e746");
+        Synonym synonym = (Synonym)taxonService.load(synonymUuid);
+        TaxonNameBase synonymName = synonym.getName();
+
+        taxonService.swapSynonymAndAcceptedTaxon(synonym.getUuid(), taxon.getUuid());
+
+        Assert.assertEquals(taxonName, synonym.getName());
+        Assert.assertEquals(synonymName, taxon.getName());
+    }
+
+    @Test
+    public void addTaxon() {
+        NonViralName taxonName = NonViralName.NewInstance(null);
+        Taxon taxon = Taxon.NewInstance(taxonName, null);
+        taxonService.merge(taxon);
+    }
+}
+
similarity index 53%
rename from eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNodeTest.java
rename to eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java
index 780205d32eab9a8d306045cb5083fcd6677d1619..485f27241a59d67e92f44fe9fd508e4bcd48091e 100644 (file)
@@ -9,28 +9,19 @@
 */
 package eu.etaxonomy.cdm.model;
 
-import java.util.UUID;
-
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.unitils.dbunit.annotation.DataSet;
 
-import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.name.BotanicalName;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
 import eu.etaxonomy.taxeditor.httpinvoker.CDMServer;
+import eu.etaxonomy.taxeditor.operations.OperationTestBase;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
@@ -38,29 +29,23 @@ import eu.etaxonomy.taxeditor.session.MockSessionOwner;
 
 /**
  * @author cmathew
- * @date 3 Feb 2015
+ * @date 9 Mar 2015
  *
  */
-@DataSet
-public class TaxonNodeTest extends BaseRemotingTest {
+public class TaxonNavigatorTest extends OperationTestBase {
 
-    private static final Logger logger = Logger.getLogger(TaxonNodeTest.class);
+    private static final Logger logger = Logger.getLogger(TaxonNameEditorTest.class);
 
-    UUID taxonNodeUuid = UUID.fromString("324a1a77-689c-44be-8e65-347d835f4111");
-    private static final UUID classificationUuid = UUID.fromString("6c2bc8d9-ee62-4222-be89-4a8e31770878");
 
-    private static final UUID node1Uuid= UUID.fromString("484a1a77-689c-44be-8e65-347d835f47e8");
-    private static final UUID node2Uuid = UUID.fromString("2d41f0c2-b785-4f73-a436-cc2d5e93cc5b");
 
-    private static final UUID rootNodeUuid = UUID.fromString("324a1a77-689c-44be-8e65-347d835f4111");
 
     ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+    ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
     IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
 
 
     private CdmTransientEntityCacher cacher;
     private ICdmEntitySessionEnabled sessionOwner;
-
     private ICdmEntitySession cdmEntitySession;
 
     Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
@@ -80,6 +65,7 @@ public class TaxonNodeTest extends BaseRemotingTest {
                 "00000");
     }
 
+
     @Before
     public void initializeSession() {
         sessionOwner = new MockSessionOwner();
@@ -88,21 +74,24 @@ public class TaxonNodeTest extends BaseRemotingTest {
     }
 
     @Test
-    public void deleteTaxonNode() {
-        Classification classification = classificationService.load(classificationUuid);
-        TaxonNode node1 = taxonNodeService.load(node1Uuid);
-        TaxonNode node2 = taxonNodeService.load(rootNodeUuid);
-        node1 = (TaxonNode)HibernateProxyHelper.deproxy(node1);
+    public void addNewTaxonTest() {
 
-        TaxonNode newNode = node1.addChildTaxon(Taxon.NewInstance(BotanicalName.NewInstance(Rank.SPECIES()), null), null, null);
-        newNode = taxonNodeService.merge(newNode);
-        newNode = taxonNodeService.load(newNode.getUuid());
-        UUID taxUUID = newNode.getTaxon().getUuid();
-        UUID nameUUID = newNode.getTaxon().getName().getUuid();
+    }
 
-        DeleteResult result = taxonNodeService.deleteTaxonNode(node1, null);
+    @Test
+    public void addNewClassificationTest() {
 
-        node1 = taxonNodeService.load(node1Uuid);
     }
-}
 
+    @Test
+    public void changeAcceptedTaxonToSynonymTest() {
+
+    }
+
+    @Test
+    public void moveTaxonTest() {
+
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java b/eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java
new file mode 100644 (file)
index 0000000..3a84348
--- /dev/null
@@ -0,0 +1,39 @@
+// $Id$
+/**
+* Copyright (C) 2007 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.operations;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+
+/**
+ * @author n.hoffmann
+ * @created 15.04.2009
+ * @version 1.0
+ */
+public class OperationTestBase extends BaseRemotingTest {
+
+       public static final IUndoContext undoContext = null;
+
+       public static final IProgressMonitor monitor = new NullProgressMonitor();
+       public static final IAdaptable info = null;
+       public static final IPostOperationEnabled postOperation = null;
+       public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null;
+
+       protected static AbstractPostOperation operation;
+
+}
index 85325a9ed8e193c4ede7e994f53d4c06c9cc88a6..92c00fe36bbabdb0ac593aa158bcd678e4ea7520 100644 (file)
@@ -46,15 +46,14 @@ public class CdmEntitySessionManagerTest extends BaseRemotingTest {
 
                PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
                cdmEntitySessionManager.bind(null);
-               PolytomousKey pKeyLoaded = cdmEntitySessionManager.load(pKey);
-               Assert.assertSame(pKeyLoaded, pKey);
+               Assert.assertSame(pKey, pKey);
                Assert.assertNull(getActiveSession());
        }
 
        @Test
        public void manageSessionWithObjectTest() {
                PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
-               pKey = cdmEntitySession.load(pKey);
+
                Assert.assertNotNull(getActiveSession());
                List<CdmBase> rootEntities = (List<CdmBase>)getFieldValueViaReflection(getActiveSession(), "rootEntities");
 
@@ -70,7 +69,7 @@ public class CdmEntitySessionManagerTest extends BaseRemotingTest {
 
                sessionOwner = new MockSessionOwner();
                pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
-               pKey = cdmEntitySession.load(pKey);
+
 
                Assert.assertEquals(pKey.getTitleCache(), upTitleCache);
                Assert.assertEquals(pKey.getRoot().getChildAt(0).getStatement().getLabel(english).getText(), upStatement);
@@ -79,7 +78,6 @@ public class CdmEntitySessionManagerTest extends BaseRemotingTest {
        @Test
        public void manageSessionWithListTest() {
                List<PolytomousKey> pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
-               pKeys = (List<PolytomousKey>) cdmEntitySession.load(pKeys);
                Assert.assertNotNull(getActiveSession());
                List<CdmBase> rootEntities = (List<CdmBase>)getFieldValueViaReflection(getActiveSession(), "rootEntities");
 
@@ -99,7 +97,7 @@ public class CdmEntitySessionManagerTest extends BaseRemotingTest {
 
                sessionOwner = new MockSessionOwner();
                pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
-               pKeys = (List<PolytomousKey>) cdmEntitySession.load(pKeys);
+
                Assert.assertEquals(pKeys.get(0).getTitleCache(), upTitleCache);
                Assert.assertEquals(pKeys.get(1).getRoot().getChildAt(0).getStatement().getLabel(english).getText(), upStatement);
 
index 305c97e8117f331bcd98156bb3e143c19b6d9cf7..983329fa169f07517a77768a49a859be50aa31f5 100644 (file)
@@ -6,8 +6,18 @@ import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySession;
 
-public class MockSessionOwner implements ICdmEntitySessionEnabled {
+public class MockSessionOwner<T extends CdmBase> implements ICdmEntitySessionEnabled {
 
+    List<T> rootEntities;
+
+
+    public MockSessionOwner() {
+        rootEntities = null;
+    }
+
+    public MockSessionOwner(List<T> rootEntities) {
+        this.rootEntities = rootEntities;
+    }
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
      */
@@ -28,8 +38,8 @@ public class MockSessionOwner implements ICdmEntitySessionEnabled {
      * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
      */
     @Override
-    public <T extends CdmBase> List<T> getRootEntities() {
-        return null;
+    public  List<T> getRootEntities() {
+        return rootEntities;
     }
 
 }