Changeset 102 for branches/omero
- Timestamp:
- 06/09/05 12:08:03 (4 years ago)
- Location:
- branches/omero
- Files:
-
- 2 removed
- 13 modified
- 3 moved
-
components/client/.springBeans (modified) (1 diff)
-
components/client/src/client.properties (deleted)
-
components/client/test/org/openmicroscopy/omero/client/itests/OmeroGrinderTest.java (moved) (moved from branches/omero/components/client/test/org/openmicroscopy/omero/client/OmeroGrinderTest.java) (2 diffs)
-
components/client/test/org/openmicroscopy/omero/client/itests/OmeroHierarchyBrowsingIntegrationTest.java (moved) (moved from branches/omero/components/client/test/org/openmicroscopy/omero/client/OmeroHierarchyBrowsingIntegrationTest.java) (1 diff)
-
components/client/test/org/openmicroscopy/omero/client/itests/test.xml (moved) (moved from branches/omero/components/client/test/org/openmicroscopy/omero/client/test.xml) (1 diff)
-
components/client/test/org/openmicroscopy/omero/client/tests (deleted)
-
components/server/.classpath (modified) (2 diffs)
-
components/server/maven.xml (modified) (1 diff)
-
components/server/project.xml (modified) (3 diffs)
-
components/server/src/org/openmicroscopy/omero/logic/HierarchyBrowsingImpl.java (modified) (10 diffs)
-
components/server/src/org/openmicroscopy/omero/logic/queries.hbm.xml (modified) (2 diffs)
-
components/server/src/spring.properties (modified) (1 diff)
-
components/server/test/org/openmicroscopy/omero/server/itests/OmeroServiceTest.java (modified) (1 diff)
-
components/server/test/org/openmicroscopy/omero/server/utests/HierarchyBrowsingUnitTest.java (modified) (1 diff)
-
components/server/web/WEB-INF/config-test.xml (modified) (1 diff)
-
components/server/web/WEB-INF/data.xml (modified) (1 diff)
-
components/server/web/WEB-INF/web.xml (modified) (1 diff)
-
maven.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/omero/components/client/.springBeans
r98 r102 2 2 <beansProjectDescription> 3 3 <configs> 4 <config>test/org/openmicroscopy/omero/ tests/client/test.xml</config>4 <config>test/org/openmicroscopy/omero/client/itests/test.xml</config> 5 5 <config>src/org/openmicroscopy/omero/client/spring.xml</config> 6 6 </configs> -
branches/omero/components/client/test/org/openmicroscopy/omero/client/itests/OmeroGrinderTest.java
r101 r102 2 2 * Created on Jun 7, 2005 3 3 */ 4 package org.openmicroscopy.omero. tests.client;4 package org.openmicroscopy.omero.client.itests; 5 5 6 6 import org.openmicroscopy.omero.tests.AbstractOmeroHierarchyBrowserIntegrationTest; … … 21 21 return new String[]{ 22 22 "org/openmicroscopy/omero/client/spring.xml", 23 "org/openmicroscopy/omero/ tests/client/test.xml"};23 "org/openmicroscopy/omero/client/itests/test.xml"}; 24 24 } 25 25 -
branches/omero/components/client/test/org/openmicroscopy/omero/client/itests/OmeroHierarchyBrowsingIntegrationTest.java
r101 r102 2 2 * Created on Jun 7, 2005 3 3 */ 4 package org.openmicroscopy.omero. tests.client;4 package org.openmicroscopy.omero.client.itests; 5 5 6 6 import java.util.HashSet; -
branches/omero/components/client/test/org/openmicroscopy/omero/client/itests/test.xml
r101 r102 13 13 <property name="driverClassName"><value>${database.driver}</value></property> 14 14 <property name="url"><value>${database.url}</value></property> 15 <property name="username"><value>${database.user }</value></property>15 <property name="username"><value>${database.username}</value></property> 16 16 <property name="password"><value>${database.password}</value></property> 17 17 </bean> -
branches/omero/components/server/.classpath
r99 r102 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="src" path="web/WEB-INF"/> 5 <classpathentry excluding="WEB-INF/|WEB-INF/" kind="src" path="web"/> 6 <classpathentry output="target/test-classes" kind="src" path="test"/> 7 <classpathentry output="target/test-classes" kind="src" path="itest"/> 3 <classpathentry excluding=".svn" kind="src" path="src"/> 4 <classpathentry excluding=".svn" kind="src" path="web"/> 5 <classpathentry excluding=".svn" kind="src" path="test"/> 8 6 <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar"/> 9 7 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> … … 33 31 <classpathentry kind="var" path="MAVEN_REPO/dbunit/jars/dbunit-2.1.jar"/> 34 32 <classpathentry kind="var" path="MAVEN_REPO/groovy/jars/groovy-all-1.0-beta-10.jar"/> 35 <classpathentry kind="output" path="target/ classes"/>33 <classpathentry kind="output" path="target/eclipse"/> 36 34 </classpath> -
branches/omero/components/server/maven.xml
r98 r102 14 14 <attainGoal name="tomcat:install"/> 15 15 </goal> 16 17 <!-- For internal development. TODO -->18 <preGoal name="war:war">19 <attainGoal name="jar:install"/>20 </preGoal>21 16 22 17 <!-- DB STUFF: TODO Perhaps in a build.xml (or use appfuses) --> -
branches/omero/components/server/project.xml
r100 r102 179 179 </dependency> 180 180 <dependency> 181 <groupId>commons-lang</groupId> 182 <artifactId>commons-lang</artifactId> 183 <version>2.0</version> 184 </dependency> 185 <dependency> 181 186 <groupId>commons-pool</groupId> 182 187 <artifactId>commons-pool</artifactId> … … 247 252 <include>**/*Test.java</include> 248 253 </includes> 254 <resources> 255 <resource> 256 <directory>${pom.build.unitTestSourceDirectory}</directory> 257 <includes> 258 <include>**/*.xml</include> 259 <include>**/*.properties</include> 260 </includes> 261 </resource> 262 </resources> 249 263 </unitTest> 250 264 <resources> … … 253 267 <includes> 254 268 <include>**/*.hbm.xml</include> 269 <include>**/*.properties</include> 270 </includes> 271 </resource> 272 <resource> 273 <directory>web</directory> 274 <includes> 275 <include>**/*.xml</include> 255 276 </includes> 256 277 </resource> -
branches/omero/components/server/src/org/openmicroscopy/omero/logic/HierarchyBrowsingImpl.java
r95 r102 38 38 39 39 //Java imports 40 import java.lang.reflect.InvocationTargetException; 41 import java.lang.reflect.Method; 40 42 import java.util.HashMap; 41 43 import java.util.HashSet; … … 46 48 47 49 //Third-party libraries 48 50 import org.hibernate.Hibernate; 49 51 50 52 //Application-internal dependencies … … 100 102 } 101 103 102 return c ontainerDao.loadHierarchy(arg0, arg1);104 return clean(containerDao.loadHierarchy(arg0, arg1)); 103 105 104 106 } … … 115 117 } 116 118 117 return c ontainerDao.loadHierarchy(arg0, arg1);119 return clean(containerDao.loadHierarchy(arg0, arg1)); 118 120 119 121 } … … 174 176 } 175 177 176 return hierarchies;178 return (Set) clean(hierarchies); 177 179 178 180 } … … 239 241 } 240 242 241 return hierarchies;243 return (Set) clean(hierarchies); 242 244 } 243 245 … … 253 255 254 256 List result = annotationDao.findImageAnnotations(arg0); 255 return sortImageAnnotations(result);257 return (Map) clean(sortImageAnnotations(result)); 256 258 257 259 } … … 270 272 List result = annotationDao.findImageAnnotationsForExperimenter(arg0, 271 273 arg1); 272 return sortImageAnnotations(result);274 return (Map) clean(sortImageAnnotations(result)); 273 275 274 276 } … … 309 311 310 312 List result = annotationDao.findDataListAnnotations(arg0); 311 return sortDatasetAnnotations(result);313 return (Map) clean(sortDatasetAnnotations(result)); 312 314 313 315 } … … 354 356 } 355 357 358 /** top-level call. If this is not initialized abort */ 359 Object clean(Object obj){ 360 if (! Hibernate.isInitialized(obj)){ 361 throw new IllegalStateException("If the return object is not initialized then we can't send it."); 362 } 363 Set done = new HashSet(); 364 hessianClean(obj,done); 365 return obj; 366 } 367 368 void hessianClean(Object obj, Set done) { 369 370 if (null==obj) return; 371 if (done.contains(obj)) return; 372 done.add(obj); 373 374 if (obj instanceof Map) { 375 Map map = (Map) obj; 376 for (Iterator i = map.values().iterator(); i.hasNext();) { 377 Object value = i.next(); 378 hessianClean(value,done); 379 } 380 } else if (obj instanceof Set) { 381 Set set = (Set) obj; 382 for (Iterator i = set.iterator(); i.hasNext();) { 383 Object item = i.next(); 384 hessianClean(item,done); 385 } 386 } else { // TODO can check for super class when implemented 387 Method[] methods = obj.getClass().getDeclaredMethods(); 388 for (int i = 0; i < methods.length; i++) { 389 Method method = methods[i]; 390 if (method.getName().startsWith("get")){ 391 if (0==method.getParameterTypes().length){ 392 Object result=invokeGetter(obj,method); 393 if (! Hibernate.isInitialized(result)){ 394 Method setter = getSetterForGetter(methods,method); 395 if (null==setter){ 396 throw new IllegalStateException("No setter for getter; this will explode"); 397 } 398 setToNull(obj,setter); 399 } else { 400 hessianClean(result,done); 401 } 402 } 403 } 404 } 405 406 } 407 } 408 409 Method getSetterForGetter(Method[] methods, Method getter){ 410 for (int i = 0; i < methods.length; i++) { 411 Method method = methods[i]; 412 if (method.getName().startsWith("set")){ 413 if (method.getName().substring(1).equals(getter.getName().substring(1))){ 414 return method; 415 } 416 } 417 } 418 return null; 419 } 420 421 Object invokeGetter(Object target, Method getter){ 422 Object result=null; 423 try { 424 result = getter.invoke(target,new Object[]{}); 425 } catch (IllegalArgumentException e) { 426 // TODO Auto-generated catch block 427 e.printStackTrace(); 428 } catch (IllegalAccessException e) { 429 // TODO Auto-generated catch block 430 e.printStackTrace(); 431 } catch (InvocationTargetException e) { 432 // TODO Auto-generated catch block 433 e.printStackTrace(); 434 } 435 return result; 436 } 437 438 void setToNull(Object obj, Method setter){ 439 RuntimeException re = new RuntimeException("Error trying to set to null"); 440 441 try { 442 setter.invoke(obj,new Object[]{null}); 443 } catch (IllegalArgumentException e) { 444 // TODO Auto-generated catch block 445 e.printStackTrace(); 446 throw re; 447 } catch (IllegalAccessException e) { 448 // TODO Auto-generated catch block 449 e.printStackTrace(); 450 throw re; 451 } catch (InvocationTargetException e) { 452 // TODO Auto-generated catch block 453 e.printStackTrace(); 454 throw re; 455 } 456 } 356 457 357 458 -
branches/omero/components/server/src/org/openmicroscopy/omero/logic/queries.hbm.xml
r95 r102 6 6 <hibernate-mapping> 7 7 <!-- load*Hierarchy 8 TODO if all ids where called *.getId() then we could merge these 8 TODO if all ids where called *.getId() then we could merge these 9 9 --> 10 10 … … 31 31 <!-- find*Hierarchies --> 32 32 <query name="findPDI"><![CDATA[ 33 from Image as i where i in (:img_list) 33 from Image as i join fetch i.datasets as ds join fetch ds.projects as prj 34 where i in (:img_list) 34 35 ]]></query> 35 36 36 37 <query name="findCGCI"><![CDATA[ 37 from Image as i where i in (:img_list) 38 from Image as i join fetch i.classifications as cla 39 where i in (:img_list) 38 40 ]]></query> 39 41 -
branches/omero/components/server/src/spring.properties
r98 r102 1 # Database and Server properties generated from build properties TODO remove from svn 2 #Wed Jun 08 22:55:04 CEST 2005 3 database.username=josh 1 4 TODO=deprecate 2 db.url=jdbc:postgresql://localhost/ome 5 server.host=localhost 6 db.url=jdbc\:postgresql\://localhost/ome 7 database.show_sql=true 8 database.url=jdbc\:postgresql\://localhost/ome 9 local.path=/home/josh/code/omero/components/server/target/classes 10 db.driver=org.postgresql.Driver 11 server.port=8080 12 db.dialect=org.hibernate.dialect.PostgreSQLDialect 13 database.password="" 14 database.dialect=org.hibernate.dialect.PostgreSQLDialect 3 15 db.user=josh 16 database.driver=org.postgresql.Driver 4 17 db.password="" 5 db.driver=org.postgresql.Driver6 db.dialect=org.hibernate.dialect.PostgreSQLDialect7 #show_sql=false -
branches/omero/components/server/test/org/openmicroscopy/omero/server/itests/OmeroServiceTest.java
r99 r102 19 19 */ 20 20 protected String[] getConfigLocations() { 21 System.out.println(System.getProperty("user.dir")); 21 22 22 return new String[]{ 23 23 "WEB-INF/services.xml", 24 "org/openmicroscopy/omero/tests/client/test.xml", 25 "WEB-INF/dao.xml"}; 24 "WEB-INF/dao.xml", 25 "WEB-INF/data.xml", 26 "WEB-INF/config-test.xml"}; 26 27 } 27 28 -
branches/omero/components/server/test/org/openmicroscopy/omero/server/utests/HierarchyBrowsingUnitTest.java
r95 r102 1 package org.openmicroscopy.omero. tests;1 package org.openmicroscopy.omero.server.utests; 2 2 3 3 import java.util.ArrayList; -
branches/omero/components/server/web/WEB-INF/config-test.xml
r49 r102 9 9 <property name="locations"> 10 10 <list> 11 <value> target/classes/spring.properties</value>11 <value>spring.properties</value> 12 12 </list> 13 13 </property> 14 14 </bean> 15 15 16 <!-- Add this config file to the getConfigLocations() of your tests 17 if you want data and interfaces injected --> 18 <bean id="data" class="org.openmicroscopy.omero.tests.OMEPerformanceData" init-method="init"> 19 <property name="dataSource" ref="dataSource"/> 20 </bean> 21 16 22 </beans> -
branches/omero/components/server/web/WEB-INF/data.xml
r99 r102 46 46 <property name="driverClassName"><value>${database.driver}</value></property> 47 47 <property name="url"><value>${database.url}</value></property> 48 <property name="username"><value>${database.user }</value></property>48 <property name="username"><value>${database.username}</value></property> 49 49 <property name="password"><value>${database.password}</value></property> 50 50 </bean> -
branches/omero/components/server/web/WEB-INF/web.xml
r98 r102 58 58 /WEB-INF/services.xml 59 59 /WEB-INF/dao.xml 60 /WEB-INF/data.xml 60 61 <!-- /WEB-INF/security.xml --> 61 62 </param-value> -
branches/omero/maven.xml
r100 r102 43 43 <ant:mkdir dir="${maven.build.dest}"/> 44 44 <ant:propertyfile 45 comment=" Database and Server properties generated from build properties" 46 file="${maven.build.dest}/spring.properties"> 45 comment=" Database and Server properties generated from build 46 properties TODO remove from svn" 47 file="${basedir}/src/spring.properties"> 47 48 <ant:entry key="database.driver" value="${database.driver}"/> 48 49 <ant:entry key="database.url" value="${database.url}"/> … … 67 68 </goal> 68 69 70 <!-- from: http://java2.5341.com/msg/33178.html --> 69 71 <goal name="filterTests"> 70 72 <j:set var="testModeX" value="${maven.test.mode}X" />
