Changeset 8118


Ignore:
Timestamp:
29/02/12 09:18:56 (8 years ago)
Author:
mnagni
Message:

Implemented a simple MOCK class (DBTestBase) to apply JUnit over EJB. For this the DiscoveryService? has beed refactored accordingly (added a Constructor to supply the missing ApplicaitonServer? entity injection)

Tests over DB are made in memory with a HSQLDB instance. The reason is that does not exist a postgresql embeddable version. As consequence cannot test directly the database creation using the psql script (The tables on Junit are now created through JPA)

add svn:ignore to some developer specific config file

Cleaned some old/unused JPA classes

Introcuced a DependencyManagement? tag in the project parent pom.

Location:
mauRepo/revitalizationProject/branches/MEDIN
Files:
6 added
2 deleted
85 edited
1 moved

Legend:

Unmodified
Added
Removed
  • mauRepo/revitalizationProject/branches/MEDIN

    • Property svn:ignore
      •  

        old new  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
        15target 
  • mauRepo/revitalizationProject/branches/MEDIN/.settings

    • Property svn:ignore
      •  

        old new  
        1  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
         5target 
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema

    • Property svn:ignore
      •  

        old new  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
        15target 
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/.settings

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/main

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/main/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/main/java/META-INF

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/main/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/test

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/test/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dataProviderSchema/src/test/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema

    • Property svn:ignore
      •  

        old new  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
        15target 
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/.settings

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/main

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/main/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/main/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/test

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/test/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/discoverySchema/src/test/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws

    • Property svn:ignore
      •  

        old new  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
        15target 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/.classpath

    r8069 r8118  
    22<classpath> 
    33        <classpathentry kind="src" output="target/classes" path="src/main/java"/> 
    4         <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> 
     4        <classpathentry kind="src" output="target/classes" path="src/main/resources"/> 
    55        <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> 
    6         <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/> 
    7         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> 
     6        <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/> 
     7        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 
    88        <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/> 
    99        <classpathentry kind="output" path="target/classes"/> 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/.settings

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/.settings/org.eclipse.jdt.core.prefs

    r8069 r8118  
    1 #Tue Jan 24 16:36:24 GMT 2012 
     1#Tue Feb 28 14:30:46 GMT 2012 
    22eclipse.preferences.version=1 
     3org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 
    34org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 
     5org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 
    46org.eclipse.jdt.core.compiler.compliance=1.6 
     7org.eclipse.jdt.core.compiler.debug.lineNumber=generate 
     8org.eclipse.jdt.core.compiler.debug.localVariable=generate 
     9org.eclipse.jdt.core.compiler.debug.sourceFile=generate 
     10org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 
     11org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 
    512org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 
    613org.eclipse.jdt.core.compiler.source=1.6 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/.settings/org.eclipse.m2e.core.prefs

    r8070 r8118  
    1 #Wed Jan 25 14:45:04 GMT 2012 
     1#Tue Feb 28 16:44:27 GMT 2012 
    22activeProfiles= 
    33eclipse.preferences.version=1 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/pom.xml

    r8116 r8118  
    181181                </dependency> 
    182182 
    183                 <dependency> 
    184                         <groupId>junit</groupId> 
    185                         <artifactId>junit</artifactId> 
    186                         <version>4.8.1</version> 
    187                         <scope>test</scope> 
    188                 </dependency> 
     183                <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>  
     184                        <version>4.8.1</version> <scope>test</scope> </dependency> --> 
    189185 
    190186                <dependency> 
    191187                        <groupId>org.slf4j</groupId> 
    192188                        <artifactId>slf4j-api</artifactId> 
    193                         <version>1.6.1</version> 
    194189                        <scope>provided</scope> 
    195190                </dependency> 
     
    197192                        <groupId>org.slf4j</groupId> 
    198193                        <artifactId>slf4j-log4j12</artifactId> 
    199                         <version>1.6.1</version> 
    200194                        <scope>provided</scope> 
    201195                </dependency> 
     
    207201 
    208202                <dependency> 
    209                         <groupId>org.dbunit</groupId> 
    210                         <artifactId>dbunit</artifactId> 
    211                         <version>2.4.6</version> 
    212                         <scope>compile</scope> 
    213                         <exclusions> 
    214                                 <exclusion> 
    215                                         <artifactId>slf4j-api</artifactId> 
    216                                         <groupId>org.slf4j</groupId> 
    217                                 </exclusion> 
    218                                 <exclusion> 
    219                                         <artifactId>junit</artifactId> 
    220                                         <groupId>junit</groupId> 
    221                                 </exclusion> 
    222                         </exclusions> 
    223                         <optional>true</optional> 
    224                 </dependency> 
    225  
     203                        <groupId>junit</groupId> 
     204                        <artifactId>junit</artifactId> 
     205                </dependency> 
     206 
     207                <dependency> 
     208                        <groupId>org.hibernate</groupId> 
     209                        <artifactId>hibernate-entitymanager</artifactId> 
     210                        <version>3.3.1.ga</version> 
     211                        <scope>test</scope> 
     212                </dependency> 
    226213                <dependency> 
    227214                        <groupId>org.hsqldb</groupId> 
    228215                        <artifactId>hsqldb</artifactId> 
    229                         <version>1.8.0.10</version> 
     216                        <version>2.2.8</version> 
    230217                        <scope>test</scope> 
    231218                </dependency> 
     
    233220 
    234221        <artifactId>dpws</artifactId> 
     222 
    235223</project> 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/discovery

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/discovery/basic

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/discovery/basic/DiscoveryDictionaryDPWS.java

    r8116 r8118  
    2121        public final static String FULL_DOCUMENT = "fullDocument"; 
    2222        public final static String TERM_TARGET = "TermTarget"; 
     23        public final static String ORDER_BY_FIELD = "OrderByField";      
    2324 
    2425        /* 
     
    506507         * if the label does not exist 
    507508         * */    
     509        /* 
    508510        public static OrderByField getOrderByField(String fieldName){ 
    509511                OrderByField ret = null; 
     
    516518                return ret;              
    517519        } 
     520        */ 
    518521         
    519522        /** 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/jpa

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/jpa/ListNamesItem.java

    r8116 r8118  
    2121                        query="select item from ListNamesItem item where item.name=:name"), 
    2222        @NamedQuery(name="findListNamesItemByLabel",  
    23                         query="select item from ListNamesItem item where item.label=:label")                     
     23                        query="select item from ListNamesItem item where item.label=:label"), 
     24        @NamedQuery(name="findListNamesItemByParentAndName",  
     25        query="SELECT item from ListNamesItem AS item, ListNames AS ln WHERE ln.id = item.listNamesId " + 
     26                        "AND item.name=:listName AND ln.name=:itemName")         
    2427}) 
    2528public class ListNamesItem implements Serializable { 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/dictionary

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/CommonMethods.java

    r8115 r8118  
    1010import ndg.common.NdgMessage; 
    1111import ndg.common.exception.AssembleQueryException; 
     12import ndg.common.exception.NdgExecutionException; 
    1213import ndg.common.exception.NdgSQLException; 
    1314import ndg.common.exception.ResourceNotAvailable; 
    1415import ndg.services.discovery.basic.DiscoveryBasicDPWS; 
    1516import ndg.services.discovery.basic.DiscoveryDictionaryDPWS; 
     17import ndg.services.jpa.ListNamesItem; 
     18import ndg.services.revitalization.EJBBeanFactory; 
    1619import ndg.services.schemas.revitalization.discovery.DoSearchType; 
    1720import ndg.services.schemas.revitalization.discovery.DoSearchType.SearchCriteria; 
     
    2730        private final MessageFormatter mf = new MessageFormatter(); 
    2831        private Logger logger = LoggerFactory.getLogger(CommonMethods.class); 
    29          
     32 
    3033        /** 
    3134         * Return a properly build ORDER BY clause. The parameter sqlCmd represents 
    3235         * the SELECT clause where the fields used by the ORDER BY clause have to be 
    3336         * added. 
     37         * @throws AssembleQueryException  
     38         * @throws NdgExecutionException  
    3439         * */ 
    35         StringBuffer getOrderBy(RetrieveCriteriaType criteria, StringBuffer sqlCmd) { 
     40        StringBuffer getOrderBy(RetrieveCriteriaType criteria, StringBuffer sqlCmd) throws AssembleQueryException { 
    3641                StringBuffer orderSQL = new StringBuffer(); 
    3742                if (criteria != null && criteria.getOrderBy().size() > 0) { 
    3843                        // orderSQL.append(" ORDER BY "); 
    3944                        for (OrderByType order : criteria.getOrderBy()) { 
    40  
    41                                 DiscoveryDictionaryDPWS.OrderByField orderField = DiscoveryDictionaryDPWS.getOrderByField(order 
    42                                                 .getOrderByField()); 
    43                                 if (orderField == null) 
     45                                ListNamesItem listNamesItem; 
     46                                try { 
     47                                        listNamesItem = EJBBeanFactory.getDiscoveryService().getListNamesItemByParentAndName(DiscoveryDictionaryDPWS.ORDER_BY_FIELD, order.getOrderByField()); 
     48                                } catch (NdgExecutionException e) { 
     49                                        throw new AssembleQueryException(e); 
     50                                } 
     51                                if (listNamesItem == null) 
    4452                                        continue; 
    4553 
     
    4856                                        orderSQL.append(" ,"); 
    4957                                } 
    50                                 orderSQL.append(orderField.fieldName()); 
     58                                orderSQL.append(listNamesItem.getName()); 
    5159                                /* -- Append the field to the SELECT command -- */ 
    5260                                if (sqlCmd.length() > 0) { 
    5361                                        sqlCmd.append(" ,"); 
    5462                                } 
    55                                 sqlCmd.append(orderField.fieldName()); // may be check the field 
     63                                sqlCmd.append(listNamesItem.getName()); // may be check the field 
    5664                                // name? 
    5765                                if (order.getOrderByDirection() != null) { 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/DiscoveryService.java

    r8116 r8118  
    88import javax.ejb.Stateless; 
    99import javax.persistence.EntityManager; 
     10import javax.persistence.NoResultException; 
    1011import javax.persistence.PersistenceContext; 
    1112import javax.persistence.Query; 
     
    3940        private EntityManager em; 
    4041         
     42         
     43        /** 
     44         * Default constructor for the application container 
     45         */ 
     46        public DiscoveryService() { 
     47                super(); 
     48        }        
     49         
     50        /** 
     51         * Allows the execution of the bean outside of the application container 
     52         * @param em an <code>EntityManager</code> binded to the discoveryDB persistence unit 
     53         **/ 
     54        public DiscoveryService(EntityManager em) { 
     55                super(); 
     56                this.discoveryDS = null; 
     57                this.em = em; 
     58        } 
     59         
     60        /** 
     61         * Allows the execution of the bean outside of the application container 
     62         * @param discoveryDS a <code>DataSource</code> pointing at the discoveryDB 
     63         * @param em an <code>EntityManager</code> binded to the discoveryDB persistence unit 
     64         * @Deprecated to use until the code can get rid of the DataSource   
     65         **/ 
     66          
     67        public DiscoveryService(DataSource discoveryDS, EntityManager em) { 
     68                super(); 
     69                this.discoveryDS = discoveryDS; 
     70                this.em = em; 
     71        }        
     72         
    4173        @Override 
    4274        public List<?> getAllNamesList() { 
     
    4476                return query.getResultList(); 
    4577        } 
    46          
     78 
    4779        @Override 
    4880        public ListNames getNamesListByLabel(String label) { 
     
    5385         
    5486        @Override 
    55         public ListNames getNamesListByName(String name) { 
     87        public ListNames getNamesListByName(String name) throws NoResultException { 
    5688                Query query = em.createNamedQuery("findNamesListByName"); 
    5789                query.setParameter("name", name); 
     
    70102                Query query = em.createNamedQuery("findLisNamesItemtByName"); 
    71103                query.setParameter("name", name); 
     104                return ListNamesItem.class.cast(query.getSingleResult()); 
     105        }        
     106         
     107        @Override 
     108        public ListNamesItem getListNamesItemByParentAndName(String listName, String itemName) { 
     109                Query query = em.createNamedQuery("findListNamesItemByParentAndName"); 
     110                query.setParameter("listName", listName); 
     111                query.setParameter("itemName", itemName); 
    72112                return ListNamesItem.class.cast(query.getSingleResult()); 
    73113        }        
     
    101141                try { 
    102142                        conn = discoveryDS.getConnection(); 
    103                         SearchHelper helper = new SearchHelper(conn, searchType); 
     143                        SearchHelper helper = new SearchHelper(conn, searchType, this); 
    104144                        return helper.doSearch(); 
    105145                } catch (SQLException e) { 
     
    118158        }  
    119159         
     160        private <T> T executeSingleResult(Query query, Class<T> ret) { 
     161                try { 
     162                        return ret.cast(query.getSingleResult());        
     163                } catch (NoResultException nr) { 
     164                        return null; 
     165                } 
     166                 
     167        } 
     168         
    120169        private void closeConnection(Connection conn) { 
    121170                if (conn != null) { 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/PresentHelper.java

    r8115 r8118  
    5050        private final static String temporalRangeSQL = "SELECT start_time, end_time FROM temporal_data WHERE original_document_id = ?"; 
    5151 
    52         private NdgLogger logHelper = DiscoveryBasicDPWS.getInstance().getNdgInstance(SearchHelper.class.getName()); 
     52        private NdgLogger logHelper = DiscoveryBasicDPWS.getInstance().getNdgInstance(PresentHelper.class.getName()); 
    5353 
    5454        private List<String> documentsId = new ArrayList<String>(); 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/SearchHelper.java

    r8116 r8118  
    88import java.util.Comparator; 
    99import java.util.List; 
     10 
     11import javax.persistence.NoResultException; 
    1012 
    1113import ndg.common.TermParser; 
     
    2022import ndg.services.jpa.ListNamesItem; 
    2123import ndg.services.jpa.OriginalDocument; 
    22 import ndg.services.revitalization.EJBBeanFactory; 
     24import ndg.services.revitalization.ejb.interfaces.DiscoveryServiceRemote; 
    2325import ndg.services.schemas.revitalization.discovery.BoundingBoxType; 
    2426import ndg.services.schemas.revitalization.discovery.DateRangeType; 
     
    5759        private final DoSearchType searchType; 
    5860        private final Connection conn; 
    59  
    60         public SearchHelper(Connection conn, DoSearchType searchType) { 
     61        private final DiscoveryServiceRemote discoveryService;   
     62 
     63        public SearchHelper(Connection conn, DoSearchType searchType, DiscoveryServiceRemote discoveryService) { 
    6164                super(); 
    6265                this.conn = conn; 
    6366                this.searchType = searchType; 
     67                this.discoveryService = discoveryService; 
    6468        } 
    6569 
     
    193197                List<TermSearchType> retList = new ArrayList<TermSearchType>(); 
    194198                TermSearchType newTS = null; 
    195                 ObjectFactory of = new ObjectFactory(); 
    196                 ListNames listNames = EJBBeanFactory.getDiscoveryService().getNamesListByName(DiscoveryDictionaryDPWS.TERM_TARGET); 
     199                ObjectFactory of = new ObjectFactory();          
     200                ListNames listNames = null; 
     201                try { 
     202                        listNames = discoveryService.getNamesListByName(DiscoveryDictionaryDPWS.TERM_TARGET); 
     203                } catch (NoResultException ex) { 
     204                        return retList; 
     205                } 
     206                  
    197207                for (ListNamesItem tt : listNames.getListNamesItems()) { 
    198208                        newTS = of.createTermSearchType(); 
     
    249259                        term = parser.parseTerm(term);   
    250260 
    251                         ListNamesItem listNamesItem = EJBBeanFactory.getDiscoveryService().getNamesListItemByLabel(termType.getTermTarget()); 
     261                        ListNamesItem listNamesItem = discoveryService.getNamesListItemByLabel(termType.getTermTarget()); 
    252262                        //logHelper.logMessage("Search term - TermTarget: " + term + " - " + termTarget, Level.DEBUG); 
    253263 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/interfaces

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/interfaces/DiscoveryServiceLocal.java

    r8116 r8118  
    3232 
    3333import javax.ejb.Local; 
     34import javax.persistence.NoResultException; 
    3435 
    3536import ndg.common.exception.NdgExecutionException; 
     
    5253         
    5354        public List<?> getAllNamesList(); 
    54         public ListNames getNamesListByLabel(String label); 
    55         public ListNames getNamesListByName(String name);        
    56         public ListNamesItem getNamesListItemByLabel(String label); 
    57         public ListNamesItem getNamesListItemByName(String name);        
     55        public ListNames getNamesListByLabel(String label) throws NoResultException; 
     56        public ListNames getNamesListByName(String name) throws NoResultException;       
     57        public ListNamesItem getNamesListItemByLabel(String label) throws NoResultException; 
     58        public ListNamesItem getNamesListItemByName(String name) throws NoResultException; 
     59        public ListNamesItem getListNamesItemByParentAndName(String listName, String itemName) throws NoResultException;         
    5860} 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/interfaces/DiscoveryServiceRemote.java

    r8116 r8118  
    3232 
    3333import javax.ejb.Remote; 
     34import javax.persistence.NoResultException; 
    3435 
    3536import ndg.common.exception.NdgExecutionException; 
     
    5253 
    5354        public List<?> getAllNamesList(); 
    54         public ListNames getNamesListByLabel(String label); 
    55         public ListNames getNamesListByName(String name);        
    56         public ListNamesItem getNamesListItemByLabel(String label); 
    57         public ListNamesItem getNamesListItemByName(String name);                
     55        public ListNames getNamesListByLabel(String label) throws NoResultException; 
     56        public ListNames getNamesListByName(String name) throws NoResultException;       
     57        public ListNamesItem getNamesListItemByLabel(String label) throws NoResultException; 
     58        public ListNamesItem getNamesListItemByName(String name) throws NoResultException;       
     59        public ListNamesItem getListNamesItemByParentAndName(String listName, String itemName) throws NoResultException;         
    5860} 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/exception

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/executor

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/executor/DiscoveryServiceExecutor.java

    r8116 r8118  
    208208 
    209209        private void processResult(List<OriginalDocument> results, Documents documents, RecordDetail type, 
    210                         List<OrderByType> orderBy) { 
     210                        List<OrderByType> orderBy) throws NdgExecutionException { 
    211211                if (results != null && results.size() == 0) { 
    212212                        return; 
     
    250250         * retrieved after the query. Obviously if the user request included the 
    251251         * request to sort by some field. 
     252         * @throws NdgExecutionException  
    252253         **/ 
    253         private <T> void fillOrderedFieldArray(T documentType, List<OrderByType> orders, OriginalDocument result) { 
     254        private <T> void fillOrderedFieldArray(T documentType, List<OrderByType> orders, OriginalDocument result) throws NdgExecutionException { 
    254255                for (OrderByType orderType : orders) { 
    255                         OrderByField order = DiscoveryDictionaryDPWS.getOrderByField(orderType.getOrderByField()); 
    256                         if (order == null) { 
     256                        ListNamesItem listNamesItem = EJBBeanFactory.getDiscoveryService().getListNamesItemByParentAndName(DiscoveryDictionaryDPWS.ORDER_BY_FIELD, orderType.getOrderByField()); 
     257                        if (listNamesItem == null) { 
    257258                                continue; 
    258259                        }                                
     
    261262                                continue;        
    262263                        } 
    263                         newOMT.setMetricName(order.fieldLabel()); 
     264                        newOMT.setMetricName(listNamesItem.getLabel()); 
    264265                        String value = "DataError"; 
    265266                        NdgMessage msg = new NdgMessage("invocation.error", new Object[] { "Field.get(result)" }); 
    266267                        try { 
    267                                 PropertyDescriptor field = DiscoveryDictionaryDPWS.getOriginalDocumentProperty(order.getOdField()); 
     268                                PropertyDescriptor field = DiscoveryDictionaryDPWS.getOriginalDocumentProperty(listNamesItem.getOrderByFieldOdField()); 
    268269                                Object objValue = field.getReadMethod().invoke(result, new Object[0]); 
    269270                                value = (objValue != null ? objValue.toString() : ""); 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest/csw

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest/ejb

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest/ejb/interfaces

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/harvest/oai

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/jpa

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources/META-INF

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources/ndg

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources/ndg/services

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources/ndg/services/discovery

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/resources/ndg/services/revitalization

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/discovery

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/discovery/model

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb/discovery

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb/discovery/DBTest.java

    r8116 r8118  
    11package ndg.services.revitalization.ejb.discovery; 
    22 
    3 public class DBTest { 
     3import java.io.IOException; 
     4import java.util.List; 
     5 
     6import org.apache.commons.io.IOUtils; 
     7import org.junit.Assert; 
     8import org.junit.Test; 
     9 
     10public class DBTest extends DBTestBase { 
     11        @Test 
     12        public void testCanPersistUserObject() { 
     13                try { 
     14                        String creationSQL = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("Discovery.sql")); 
     15                         
     16                        getDiscoveryEntityManager().getTransaction().begin(); 
     17                        //em.createNativeQuery(creationSQL).executeUpdate(); 
     18                        getDiscoveryEntityManager().getTransaction().commit(); 
     19                         
     20                        List<?> listNames = getDiscoveryEntityManager().createNamedQuery("findAllListNames").getResultList(); 
     21                        Assert.assertNotNull(listNames); 
     22                } catch (IOException e) { 
     23                        e.printStackTrace(); 
     24                        return; 
     25                } 
     26        } 
    427 
    528} 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb/discovery/SearchAgentTest.java

    r8105 r8118  
    1 package ndg.services.discovery.model; 
     1package ndg.services.revitalization.ejb.discovery; 
    22 
    33import static org.junit.Assert.assertTrue; 
    44import ndg.common.exception.AssembleQueryException; 
     5import ndg.services.revitalization.ejb.discovery.DiscoveryService; 
    56import ndg.services.revitalization.ejb.discovery.SearchHelper; 
    67import ndg.services.schemas.revitalization.discovery.DoSearchType; 
     
    89import ndg.services.schemas.revitalization.discovery.ObjectFactory; 
    910import ndg.services.schemas.revitalization.discovery.TermSearchType; 
    10  
    11 import org.junit.Test; 
    1211 
    1312 
     
    2928 * 
    3029 */ 
    31 public class SearchAgentTest { 
     30public class SearchAgentTest extends DBTestBase { 
    3231         
    3332        private ObjectFactory of = new ObjectFactory(); 
     33        private final DiscoveryService discoveryService = new DiscoveryService(getDiscoveryDBds(), getDiscoveryEntityManager()); 
    3434         
    3535        private void dotestPrepareTermSearch(DoSearchType st, String referenceQuery) { 
    36                 SearchHelper sa = new SearchHelper(null, st);            
     36                SearchHelper sa = new SearchHelper(connection, st, discoveryService);            
    3737                try {                    
    3838                        String query = sa.assembleSearch(st); 
     
    4343        } 
    4444         
    45         @Test 
     45        //@Test 
    4646        public void testPrepareTermSearch1() { 
    4747                String referenceQuery = "SELECT distinct original_document_filename, original_document.original_document_id  " + 
     
    6161        } 
    6262 
    63         @Test 
     63        //@Test 
    6464        public void testPrepareTermSearch2() { 
    6565                String referenceQuery = "SELECT distinct original_document_filename, original_document.original_document_id  " + 
     
    8484        }        
    8585 
    86         @Test 
     86        //@Test 
    8787        public void testPrepareTermSearch3() { 
    8888                String referenceQuery = "SELECT distinct original_document_filename, original_document.original_document_id  " + 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/java/ndg/services/revitalization/ejb/discovery/SearchHelperTest.java

    r8115 r8118  
    2222import org.slf4j.LoggerFactory; 
    2323 
    24 public class SearchHelperTest { 
     24public class SearchHelperTest extends DBTestBase { 
    2525 
    2626        enum BOX_TYPE {BOUNDING_BOX, POLYGON_BOX, MULTI_POLYGON_BOX} 
     
    3636         
    3737        static final Logger log = LoggerFactory.getLogger(SearchHelperTest.class); 
     38        private DiscoveryService discoveryService = null; 
    3839         
    3940        @Test 
     
    4445        } 
    4546         
     47        private DiscoveryService getDiscoveryService() { 
     48                if (discoveryService == null) { 
     49                        discoveryService = new DiscoveryService(getDiscoveryDBds(), getDiscoveryEntityManager());  
     50                } 
     51                return discoveryService; 
     52        } 
     53         
    4654        public void doSpatialBoxSearch(BOX_TYPE box_type) { 
    4755                DoSearchType doSearchType = generateBoxSearchType(null, box_type); 
    48                 SearchHelper sh = new SearchHelper(null, doSearchType);          
     56                 
     57                SearchHelper sh = new SearchHelper(connection, doSearchType, getDiscoveryService());             
    4958                try { 
    5059                        sh.assembleSearch(doSearchType); 
    5160                } catch (AssembleQueryException e) { 
     61                        log.error("Error", e); 
    5262                        Assert.fail(e.getMessage()); 
    5363                } 
     
    5767        public void doSimpleSearch() { 
    5868                DoSearchType doSearchType = generateSimpleSearchType(); 
    59                 SearchHelper sh = new SearchHelper(null, doSearchType);          
     69                SearchHelper sh = new SearchHelper(connection, doSearchType, getDiscoveryService());             
    6070                try { 
    6171                        sh.assembleSearch(doSearchType); 
  • mauRepo/revitalizationProject/branches/MEDIN/dpws/src/test/resources

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear

    • Property svn:ignore
      •  

        old new  
         1.settings 
         2.classpath 
         3.project 
         4.directory 
        15target 
  • mauRepo/revitalizationProject/branches/MEDIN/ear/.settings

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear/EarContent

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear/EarContent/META-INF

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear/src

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear/src/main

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/ear/src/main/application

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/pom.xml

    r8105 r8118  
    1313        </modules> 
    1414 
     15        <properties> 
     16                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     17                <version.junit>4.8.1</version.junit> 
     18                <version.maven.resource.plugin>2.5</version.maven.resource.plugin> 
     19                <version.junit>4.8.1</version.junit> 
     20                <version.slf4j>1.6.1</version.slf4j>             
     21        </properties> 
     22 
     23        <dependencyManagement> 
     24                <dependencies> 
     25                        <dependency> 
     26                                <groupId>junit</groupId> 
     27                                <artifactId>junit</artifactId> 
     28                                <version>${version.junit}</version> 
     29                                <scope>test</scope> 
     30                        </dependency> 
     31                        <dependency> 
     32                                <groupId>org.slf4j</groupId> 
     33                                <artifactId>slf4j-log4j12</artifactId> 
     34                                <version>${version.slf4j}</version> 
     35                                <scope>provided</scope> 
     36                        </dependency> 
     37                        <dependency> 
     38                                <groupId>org.slf4j</groupId> 
     39                                <artifactId>slf4j-api</artifactId> 
     40                                <version>${version.slf4j}</version> 
     41                                <scope>provided</scope> 
     42                        </dependency>                    
     43                </dependencies> 
     44        </dependencyManagement> 
     45 
    1546        <build> 
    1647                <plugins> 
     
    2657                        <plugin> 
    2758                                <artifactId>maven-resources-plugin</artifactId> 
    28                                 <version>2.5</version> 
     59                                <version>${version.maven.resource.plugin}</version> 
    2960                                <executions> 
    3061                                        <execution> 
     
    5586                                                                                <include> 
    5687                                                                                        discovery-service.xml 
    57                                                                                 </include>                                                                               
     88                                                                                </include> 
    5889                                                                        </includes> 
    5990                                                                        <filtering>true</filtering> 
    60                                                                 </resource>                                                              
     91                                                                </resource> 
    6192                                                        </resources> 
    6293                                                </configuration> 
  • mauRepo/revitalizationProject/branches/MEDIN/src

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
  • mauRepo/revitalizationProject/branches/MEDIN/src/site

    • Property svn:ignore set to
      .settings
      .classpath
      .project
      .directory
      target
Note: See TracChangeset for help on using the changeset viewer.