move vocabulary tests to vocabulary service and fix @Ignore, remove deprecated method...
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 7 Aug 2014 16:25:33 +0000 (16:25 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 7 Aug 2014 16:25:33 +0000 (16:25 +0000)
.gitattributes
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/INameService.java
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/NameServiceImpl.java
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/NameServiceImplTest.java
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImplTest.java [new file with mode: 0644]

index 0ef0ff368154af10175f76ceba3986ce53cea730..be7cc54d7f865a070732d69e190dc26ab79b3975 100644 (file)
@@ -2358,6 +2358,7 @@ cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceSearchTes
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TermServiceImplTest.java -text
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TransmissionEngineDistributionTest.java -text
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/UserAndGroupServiceImplTest.java -text
+cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImplTest.java -text
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/lsid/LSIDAuthorityServiceTest.java -text
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/lsid/LSIDDataServiceTest.java -text
 cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/lsid/LSIDMetadataServiceTest.java -text
index 0e661b1d5122e278b035492e0fc1f250f6c1ffea..dc5f0ad7f679cd124fbe457e92480a1a419ccb60 100644 (file)
@@ -263,15 +263,15 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
        @Deprecated\r
     public List<RelationshipBase> getAllRelationships(int limit, int start);\r
 \r
-       /**\r
-        * Returns all Ranks\r
-        * @return\r
-        * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead,\r
-        *   this is not possible since  VocabularyService#getVocabulary(VocabularyEnum)\r
-        *   is not returning a OrderedTermVocabulary !!! see also http://dev.e-taxonomy.eu/trac/ticket/3327\r
-        */\r
-       @Deprecated\r
-    public OrderedTermVocabulary<Rank> getRankVocabulary();\r
+//     /**\r
+//      * Returns all Ranks\r
+//      * @return\r
+//      * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead,\r
+//      *   this is not possible since  VocabularyService#getVocabulary(VocabularyEnum)\r
+//      *   is not returning a OrderedTermVocabulary !!! see also http://dev.e-taxonomy.eu/trac/ticket/3327\r
+//      */\r
+//     @Deprecated\r
+//    public OrderedTermVocabulary<Rank> getRankVocabulary();\r
 \r
        /**\r
         * Returns all NomenclaturalStatusTypes\r
@@ -280,14 +280,14 @@ public interface INameService extends IIdentifiableEntityService<TaxonNameBase>
         */\r
        @Deprecated\r
     public TermVocabulary<NomenclaturalStatusType> getStatusTypeVocabulary();\r
-\r
-       /**\r
-        * Returns TypeDesignationStatus vocabulary\r
-        * @return\r
-        * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead\r
-        */\r
-       @Deprecated\r
-    public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatusVocabulary();\r
+//\r
+//     /**\r
+//      * Returns TypeDesignationStatus vocabulary\r
+//      * @return\r
+//      * @deprecated use VocabularyService#getVocabulary(VocabularyEnum) instead\r
+//      */\r
+//     @Deprecated\r
+//    public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatusVocabulary();\r
 \r
        /**\r
         * Returns TypeDesignationStatus ordered vocabulary\r
index b6ccef5b0e3707b3ab9dfb4ed08fd4e5e1acb583..04a8fd5f8e3ef11eb6b095794905d692e8e3eb39 100644 (file)
@@ -518,22 +518,22 @@ public class NameServiceImpl extends IdentifiableServiceBase<TaxonNameBase,ITaxo
         return dao.getAllRelationships(limit, start);\r
     }\r
 \r
-    /**\r
-     * FIXME Candidate for harmonization\r
-     * is this not the same as termService.getVocabulary(VocabularyEnum.Rank)\r
-     * since this returns OrderedTermVocabulary\r
-     *\r
-     * (non-Javadoc)\r
-     * @see eu.etaxonomy.cdm.api.service.INameService#getRankVocabulary()\r
-     */\r
-    @Override\r
-    public OrderedTermVocabulary<Rank> getRankVocabulary() {\r
-        String uuidString = "ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b";\r
-        UUID uuid = UUID.fromString(uuidString);\r
-        OrderedTermVocabulary<Rank> rankVocabulary =\r
-            (OrderedTermVocabulary)orderedVocabularyDao.findByUuid(uuid);\r
-        return rankVocabulary;\r
-    }\r
+//    /**\r
+//     * FIXME Candidate for harmonization\r
+//     * is this not the same as termService.getVocabulary(VocabularyEnum.Rank)\r
+//     * since this returns OrderedTermVocabulary\r
+//     *\r
+//     * (non-Javadoc)\r
+//     * @see eu.etaxonomy.cdm.api.service.INameService#getRankVocabulary()\r
+//     */\r
+//    @Override\r
+//    public OrderedTermVocabulary<Rank> getRankVocabulary() {\r
+//        String uuidString = "ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b";\r
+//        UUID uuid = UUID.fromString(uuidString);\r
+//        OrderedTermVocabulary<Rank> rankVocabulary =\r
+//            (OrderedTermVocabulary)orderedVocabularyDao.findByUuid(uuid);\r
+//        return rankVocabulary;\r
+//    }\r
 \r
     /**\r
       * FIXME Candidate for harmonization\r
@@ -553,8 +553,6 @@ public class NameServiceImpl extends IdentifiableServiceBase<TaxonNameBase,ITaxo
     /**\r
       * FIXME Candidate for harmonization\r
      * is this the same as termService.getVocabulary(VocabularyEnum.StatusType)\r
-     * (non-Javadoc)\r
-     * @see eu.etaxonomy.cdm.api.service.INameService#getStatusTypeVocabulary()\r
      */\r
     @Override\r
     public TermVocabulary<NomenclaturalStatusType> getStatusTypeVocabulary() {\r
@@ -565,20 +563,20 @@ public class NameServiceImpl extends IdentifiableServiceBase<TaxonNameBase,ITaxo
         return nomStatusTypeVocabulary;\r
     }\r
 \r
-    /**\r
-      * FIXME Candidate for harmonization\r
-     * is this the same as termService.getVocabulary(VocabularyEnum.SpecimenTypeDesignationStatus)\r
-     *  (non-Javadoc)\r
-     * @see eu.etaxonomy.cdm.api.service.INameService#getTypeDesignationStatusVocabulary()\r
-     */\r
-    @Override\r
-    public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatusVocabulary() {\r
-        String uuidString = "ab177bd7-d3c8-4e58-a388-226fff6ba3c2";\r
-        UUID uuid = UUID.fromString(uuidString);\r
-        TermVocabulary<SpecimenTypeDesignationStatus> typeDesigStatusVocabulary =\r
-            vocabularyDao.findByUuid(uuid);\r
-        return typeDesigStatusVocabulary;\r
-    }\r
+//    /**\r
+//      * FIXME Candidate for harmonization\r
+//     * is this the same as termService.getVocabulary(VocabularyEnum.SpecimenTypeDesignationStatus)\r
+//     *  (non-Javadoc)\r
+//     * @see eu.etaxonomy.cdm.api.service.INameService#getTypeDesignationStatusVocabulary()\r
+//     */\r
+//    @Override\r
+//    public TermVocabulary<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatusVocabulary() {\r
+//        String uuidString = "ab177bd7-d3c8-4e58-a388-226fff6ba3c2";\r
+//        UUID uuid = UUID.fromString(uuidString);\r
+//        TermVocabulary<SpecimenTypeDesignationStatus> typeDesigStatusVocabulary =\r
+//            vocabularyDao.findByUuid(uuid);\r
+//        return typeDesigStatusVocabulary;\r
+//    }\r
 \r
     /**\r
        * FIXME Candidate for harmonization\r
index e90f243d9023d2fc0c70427e802ee30448347bfc..98f4af3c4fe1eeae10fc2e032e41e518d30a9015 100644 (file)
@@ -105,40 +105,7 @@ public class NameServiceImplTest extends CdmTransactionalIntegrationTest {
         logger.warn("Not yet implemented");\r
     }\r
 \r
-    /**\r
-     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getRankVocabulary()}.\r
-     */\r
-    @Test\r
-    @Ignore //FIXME assertSame does not work yet\r
-    public void testGetRankVocabulary() {\r
-        //TODO move test to vocabulary service\r
-        OrderedTermVocabulary<Rank> rankVocabulary = nameService.getRankVocabulary();\r
-        assertNotNull(rankVocabulary);\r
-        assertEquals(66, rankVocabulary.size());\r
-        Rank highestRank = rankVocabulary.getHighestTerm();\r
-        assertEquals(Rank.EMPIRE(), highestRank);\r
-        assertEquals(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank));\r
-        assertSame(Rank.EMPIRE(), highestRank);\r
-        assertSame(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank));\r
-    }\r
 \r
-    /**\r
-     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.\r
-     */\r
-    @Test\r
-    @Ignore  //not yet correctly implemented\r
-    public void testGetTypeDesignationVocabulary() {\r
-        //TODO move test to vocabulary service\r
-        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary =\r
-            nameService.getSpecimenTypeDesignationVocabulary();\r
-        assertNotNull(typeDesignationVocabulary);\r
-        assertEquals(20, typeDesignationVocabulary.size());\r
-        SpecimenTypeDesignationStatus highestType = typeDesignationVocabulary.getHighestTerm();\r
-        assertEquals(SpecimenTypeDesignationStatus.EPITYPE(), highestType);\r
-        assertEquals(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));\r
-        assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType);\r
-        assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));\r
-    }\r
 \r
     /**\r
      * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#generateTitleCache()}.\r
diff --git a/cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImplTest.java b/cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/VocabularyServiceImplTest.java
new file mode 100644 (file)
index 0000000..c1575dd
--- /dev/null
@@ -0,0 +1,91 @@
+// $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.cdm.api.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.unitils.spring.annotation.SpringBeanByType;
+
+import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.name.Rank;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
+import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
+
+/**
+ * @author a.mueller
+ * @created Aug 07, 2014
+ */
+//@SpringApplicationContext("file:./target/test-classes/eu/etaxonomy/cdm/applicationContext-test.xml")
+public class VocabularyServiceImplTest extends CdmTransactionalIntegrationTest{
+
+       
+       @SpringBeanByType
+       private IVocabularyService vocabularyService;
+
+       
+
+
+       /**
+        * @throws java.lang.Exception
+        */
+       @Before
+       public void setUp() throws Exception {
+       }
+
+
+    /**
+     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getRankVocabulary()}.
+     */
+    @Test
+//    @Ignore //FIXME assertSame does not work yet
+    public void testGetRankVocabulary() {
+        List<TermVocabulary<Rank>> rankVocabularyList = vocabularyService.findByTermType(TermType.Rank);
+        assertTrue(rankVocabularyList.size() == 1);
+        OrderedTermVocabulary<Rank> rankVocabulary = (OrderedTermVocabulary<Rank>)rankVocabularyList.get(0);
+        assertNotNull(rankVocabulary);
+        assertEquals(62, rankVocabulary.size());
+        Rank highestRank = rankVocabulary.getHighestTerm();
+        assertEquals(Rank.EMPIRE(), highestRank);
+        assertEquals(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank));
+//        assertSame(Rank.EMPIRE(), highestRank);  //as we do not use second level cache this is not required
+//        assertSame(Rank.DOMAIN(), rankVocabulary.getNextLowerTerm(highestRank)); //as we do not use second level cache this is not required
+    }
+
+    /**
+     * Test method for {@link eu.etaxonomy.cdm.api.service.NameServiceImpl#getTypeDesignationVocabulary()}.
+     */
+    @Test
+//    @Ignore  //not yet correctly implemented
+    public void testGetTypeDesignationVocabulary() {
+        List<TermVocabulary<SpecimenTypeDesignationStatus>> typeDesignationVocabularyList =
+                       vocabularyService.findByTermType(TermType.SpecimenTypeDesignationStatus);
+        assertTrue(typeDesignationVocabularyList.size() == 1);
+        OrderedTermVocabulary<SpecimenTypeDesignationStatus> typeDesignationVocabulary = (OrderedTermVocabulary<SpecimenTypeDesignationStatus>)typeDesignationVocabularyList.get(0);
+        
+        assertNotNull(typeDesignationVocabulary);
+        assertEquals(16, typeDesignationVocabulary.size());
+        SpecimenTypeDesignationStatus highestType = typeDesignationVocabulary.getHighestTerm();
+        assertEquals(SpecimenTypeDesignationStatus.HOLOTYPE(), highestType);
+        assertEquals(SpecimenTypeDesignationStatus.LECTOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));
+//      assertSame(SpecimenTypeDesignationStatus.EPITYPE(), highestType);   //as we do not use second level cache this is not required
+//      assertSame(SpecimenTypeDesignationStatus.HOLOTYPE(), typeDesignationVocabulary.getNextLowerTerm(highestType));   //as we do not use second level cache this is not required
+    }
+
+}