tests for solving the hibernate transaction problem
authorBruno Sinou <bsinou@argeo.org>
Thu, 23 Sep 2010 11:12:52 +0000 (11:12 +0000)
committerBruno Sinou <bsinou@argeo.org>
Thu, 23 Sep 2010 11:12:52 +0000 (11:12 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3800 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/ProcessListTableContent.java
eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/TableContent.java
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml [new file with mode: 0644]

index 2561eea9e64d234021b2b3a98e67fb438b35a2a4..79e2efe6fd15259af3501cde48ebd4e45d110bab 100644 (file)
@@ -19,14 +19,8 @@ public class ProcessListTableContent implements TableContent {
        private SlcExecutionDao slcExecutionDao;
 
        @Override
-       public SlcExecution getLine(int i) {
-
-               // SlcExecution se = new SlcExecution();
-               // se.setHost("Marshall");
-               // se.setUuid("a very long uuid");
-               // se.setStatus(SlcExecution.STATUS_RUNNING);
-               // return se;
-               return null;
+       public SlcExecution getLine(int index) {
+               return slcExecutions.get(index);
        }
 
        @Override
@@ -35,13 +29,13 @@ public class ProcessListTableContent implements TableContent {
                switch (i) {
 
                case 0:
-                       return "DATE";
+                       return se.getStartDate().toString();
                case 1:
                        return se.getHost();
                case 2:
                        return se.getUuid();
                case 3:
-                       return "TYPE";
+                       return se.getStatus();
                }
                return "test";
        }
@@ -54,10 +48,12 @@ public class ProcessListTableContent implements TableContent {
                // Thread.currentThread().setContextClassLoader(null);
                List<SlcExecution> lst = slcExecutionDao.listSlcExecutions();
                if (lst.get(0) != null) {
-                       // log.debug(lst.get(0).getStartDate());
-                       log.debug(lst.get(0).getHost());
-                       log.debug(lst.get(0).getStatus());
-                       log.debug(lst.get(0).getUuid());
+                       log.debug("======================== set CONTENT =====================");
+                       log.debug("Lst Size : " + lst.size());
+                       log.debug("Date : " + lst.get(0).getStartDate());
+                       log.debug("Host : " + lst.get(0).getHost());
+                       log.debug("Status : " + lst.get(0).getStatus());
+                       log.debug("UUID : " + lst.get(0).getUuid());
                }
 
                slcExecutions.clear();
index c08727593dacdb7c59adc7bedd139252c5948e08..df480c3258e05f9bb970168bd792f65ef4aaaff7 100644 (file)
@@ -6,9 +6,9 @@ import org.argeo.slc.process.SlcExecution;
 
 public interface TableContent {
 
-       public Object getLine(int i);
+       public Object getLine(int index);
 
-       public String getLabel(Object o, int i);
+       public String getLabel(Object o, int index);
 
        public void setContent();
 
index 4efd22a12141fb15705843a81cf4f726a604354c..91c937807e25826c1cd228c6f0e09d1dedc71bf1 100644 (file)
@@ -3,5 +3,9 @@ Bundle-ManifestVersion: 2
 Bundle-Name: Hibernate Interface for RCP Client
 Bundle-SymbolicName: org.argeo.slc.client.hibernate
 Bundle-Version: 1.0.0.qualifier
-Import-Package: org.argeo.slc.client.core,
- org.argeo.slc.dao.process;version="0.13.0.SNAPSHOT-r3777"
+Import-Package: org.aopalliance.aop;version="1.0.0",
+ org.argeo.slc.client.core,
+ org.argeo.slc.dao.process;version="0.13.0.SNAPSHOT-r3777",
+ org.springframework.aop;version="2.5.6.SEC01",
+ org.springframework.aop.framework;version="2.5.6.SEC01",
+ org.springframework.transaction;version="2.5.6.SEC01"
diff --git a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml
new file mode 100644 (file)
index 0000000..3cd4bac
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
+       http://www.springframework.org/schema/beans   
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+       <reference id="transactionManager"
+               interface="org.springframework.transaction.PlatformTransactionManager"
+               context-class-loader="service-provider" />
+</beans:beans>
\ No newline at end of file
diff --git a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml
new file mode 100644 (file)
index 0000000..6d02d2a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
+
+       <!-- AOP Configuration -->
+       <aop:config>
+               <aop:pointcut id="tableContentMethods"
+                       expression="execution(* 
+               org.argeo.slc.client.core.TableContent.*(..))" />
+               <aop:advisor advice-ref="daoAdvice" pointcut-ref="tableContentMethods" />
+       </aop:config>
+       <tx:advice id="daoAdvice" transaction-manager="transactionManager">
+               <tx:attributes>
+                       <tx:method name="get*" propagation="REQUIRED" read-only="true" />
+                       <tx:method name="*" propagation="REQUIRED" />
+               </tx:attributes>
+       </tx:advice>
+</beans>
\ No newline at end of file