added persistence to moveDescriptionElmentsToDescription
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 8 Feb 2011 22:56:56 +0000 (22:56 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 8 Feb 2011 22:56:56 +0000 (22:56 +0000)
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImplTest.java

index 21a405dbfd9900d5f428c3f8bcc685a5300a142b..e2e0de2c242b6198a007e39464fe2e54e7a1aa9f 100644 (file)
@@ -19,7 +19,6 @@ import java.util.UUID;
 import junit.framework.Assert;\r
 \r
 import org.apache.log4j.Logger;\r
-import org.junit.Ignore;\r
 import org.junit.Test;\r
 import org.unitils.dbunit.annotation.DataSet;\r
 import org.unitils.spring.annotation.SpringBeanByType;\r
@@ -91,7 +90,6 @@ public class DescriptionServiceImplTest extends CdmIntegrationTest {
        }\r
        \r
        @Test\r
-//     @Ignore // Remove when implemented\r
        public void testMoveDescriptionElementsToTaxon(){\r
                \r
                TaxonDescription sourceDescription = TaxonDescription.NewInstance();\r
@@ -108,6 +106,8 @@ public class DescriptionServiceImplTest extends CdmIntegrationTest {
                Assert.assertEquals(3, sourceDescription.getElements().size());\r
                \r
                TaxonDescription targetDescription = TaxonDescription.NewInstance();\r
+               this.service.save(sourceDescription);\r
+               this.service.save(targetDescription);\r
                \r
                service.moveDescriptionElementsToDescription(sourceCollection, targetDescription, false);\r
                \r
@@ -117,7 +117,9 @@ public class DescriptionServiceImplTest extends CdmIntegrationTest {
                Assert.assertTrue("The moved element2 should be in the new description", targetDescription.getElements().contains(element2));\r
                Assert.assertFalse("Element3 should not be in the new description", targetDescription.getElements().contains(element3));\r
                Assert.assertTrue("Element3 should remain in the old description", targetDescription.getElements().contains(element));\r
-\r
+               this.service.save(sourceDescription);\r
+               this.service.save(targetDescription);\r
+               \r
                try {\r
                        service.moveDescriptionElementsToDescription(targetDescription.getElements(), sourceDescription, false);\r
                } catch (Exception e) {\r
@@ -127,6 +129,8 @@ public class DescriptionServiceImplTest extends CdmIntegrationTest {
                \r
                Assert.assertEquals("Source descirption should have 3 elements again", 3, sourceDescription.getElements().size());\r
                Assert.assertEquals("Destination descirption should have no elements again", 0, targetDescription.getElements().size());\r
+               this.service.save(sourceDescription);\r
+               this.service.save(targetDescription);\r
                \r
                //test paste\r
                sourceCollection.add(sourceDescription.getElements().iterator().next());\r
@@ -137,6 +141,9 @@ public class DescriptionServiceImplTest extends CdmIntegrationTest {
                for (DescriptionElementBase targetElement : targetDescription.getElements()){\r
                        Assert.assertFalse("Target elements may not be in sourced description as they are only clones (but not same).", sourceDescription.getElements().contains(targetElement));\r
                }\r
+               this.service.save(targetDescription);\r
+               this.service.save(sourceDescription);\r
+               \r
 \r
        }\r
 }\r