]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
tests for solving the hibernate transaction problem
authorBruno Sinou <bsinou@argeo.org>
Wed, 22 Sep 2010 17:41:34 +0000 (17:41 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 22 Sep 2010 17:41:34 +0000 (17:41 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3797 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF
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/core-osgi.xml
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java

index 8088b5f1c8ab25597c8508de3b8f4dfaeb719909..ad655215e5816a1aeb895a7cef56f533da902bda 100644 (file)
@@ -4,7 +4,12 @@ Bundle-Name: Core
 Bundle-SymbolicName: org.argeo.slc.client.core
 Bundle-Version: 1.0.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: com.springsource.org.hibernate;resolution:=optional
 Export-Package: org.argeo.slc.client.core
-Import-Package: org.argeo.slc.dao.process,
+Import-Package: org.apache.commons.io;version="1.4.0",
+ org.apache.commons.logging;version="1.1.1",
+ org.argeo.slc.dao.process,
  org.argeo.slc.process,
+ org.hibernate.hql.ast,
+ org.hibernate.jdbc,
  org.osgi.framework;version="1.3.0"
index 78af963d452e720412ee59991ad3a5e0d3ed183a..68f6d7c8519cfc9281d333acf5cf74c4e58ccea1 100644 (file)
@@ -1,12 +1,30 @@
 package org.argeo.slc.client.core;
 
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.dao.process.SlcExecutionDao;
 import org.argeo.slc.process.SlcExecution;
 
 public class ProcessListTableContent implements TableContent {
+       private static final Log log = LogFactory
+                       .getLog(ProcessListTableContent.class);
+
+       private List<SlcExecution> slcExecutions;
+
+       // IoC
+       private SlcExecutionDao slcExecutionDao;
 
        @Override
        public SlcExecution getLine(int i) {
-               // TODO Auto-generated method stub
+
+               // SlcExecution se = new SlcExecution();
+               // se.setHost("Marshall");
+               // se.setUuid("a very long uuid");
+               // se.setStatus(SlcExecution.STATUS_RUNNING);
+               // return se;
                return null;
        }
 
@@ -16,4 +34,26 @@ public class ProcessListTableContent implements TableContent {
                return "test";
        }
 
+       public List<SlcExecution> getContent() {
+               return this.slcExecutions;
+       }
+
+       public void setContent() {
+               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());
+               }
+               Iterator<SlcExecution> it = slcExecutions.iterator();
+               while (it.hasNext()) {
+                       slcExecutions.add(it.next());
+               }
+       }
+
+       // IoC
+       public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
+               this.slcExecutionDao = slcExecutionDao;
+       }
 }
index 02e750cd56aa5474eb211bfb27d2604c62c86a02..c08727593dacdb7c59adc7bedd139252c5948e08 100644 (file)
@@ -1,8 +1,16 @@
 package org.argeo.slc.client.core;
 
+import java.util.List;
+
+import org.argeo.slc.process.SlcExecution;
+
 public interface TableContent {
 
        public Object getLine(int i);
-       
+
        public String getLabel(Object o, int i);
+
+       public void setContent();
+
+       public List<SlcExecution> getContent();
 }
index f8cf3432a8d5f7c16b4e09c3a8f0a7a3cb7e6320..5e3de1d766c8543fbff64039e8ec64d3d2e0548c 100644 (file)
@@ -3,5 +3,8 @@ 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
+Import-Package: org.argeo.slc.client.core,
+ org.argeo.slc.dao.process;version="0.13.0.SNAPSHOT-r3777",
+ org.hibernate.hql.ast,
+ org.hibernate.jdbc
 
index b6a761fc8fb4acf7b1b1c27580154d0211cb42e2..fed1afced1c71609b01e1badc40b80cea65aa8ee 100644 (file)
@@ -6,7 +6,10 @@
        http://www.springframework.org/schema/beans   \r
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
 \r
-       <!-- DAO <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao" \r
-               /> -->\r
+       <!-- References Needed -->\r
+       <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao"\r
+               context-class-loader="null" />\r
+\r
+       <!-- Services exposed by the bundle -->\r
        <service ref="processListTableContent" interface="org.argeo.slc.client.core.TableContent" />\r
 </beans:beans>
\ No newline at end of file
index 0545a4c146e08f0de4a052231d3c57998e276318..29dfe3b2bb2c1ab3eabd3bb64b5993f4b7d830dc 100644 (file)
@@ -4,6 +4,8 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-       <bean id="processListTableContent" class="org.argeo.slc.client.core.ProcessListTableContent" />
+       <bean id="processListTableContent" class="org.argeo.slc.client.core.ProcessListTableContent">
+               <property name="slcExecutionDao" ref="slcExecutionDao" />
+       </bean>
 
 </beans>
index e73da5a8e7e28822201a5dec5ae8682c41f5c3d8..0632203ba030a478cedc0f6ecb0a0e8eb9772bd5 100644 (file)
@@ -9,8 +9,7 @@
        <!-- DAO -->\r
        <reference id="testResultCollectionDao"\r
                interface="org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao" />\r
-       <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao" />\r
-\r
+       \r
        <!-- Services -->\r
        <reference id="slcExecutionService" interface="org.argeo.slc.services.SlcExecutionService" />\r
        <reference id="testManagerService" interface="org.argeo.slc.services.TestManagerService" />\r
index b262382b3f26d5a8a982728db66c8cfa810abb9d..596a2a03487994dcdd6936db91b3e4500c3a5bd5 100644 (file)
@@ -17,7 +17,7 @@
 
        <bean id="org.argeo.slc.client.ui.processListView" class="org.argeo.slc.client.ui.views.ProcessListView"
                scope="prototype">
-               <property name="slcExecutionDao" ref="slcExecutionDao" />
+               <property name="tableContent" ref="processListTableContent" />
                <!-- <property name="sessionFactory" ref="sessionFactory" /> -->
        </bean>
 
index 713f3a0bf487a9981b2971c4076076fb790c4c0a..fb424a4dc329e0783767b812887dddda2e54b454 100644 (file)
@@ -1,5 +1,6 @@
 package org.argeo.slc.client.ui.commands;
 
+import org.argeo.slc.client.ui.views.ProcessListView;
 import org.argeo.slc.client.ui.views.ResultListView;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -13,10 +14,10 @@ public class RefreshHandler extends AbstractHandler {
                                .getActiveWorkbenchWindow(event).getActivePage().findView(
                                                ResultListView.ID);
                view.retrieveResults();
-               // ProcessListView pView = (ProcessListView) HandlerUtil
-               // .getActiveWorkbenchWindow(event).getActivePage().findView(
-               // ProcessListView.ID);
-               // pView.retrieveResults();
+               ProcessListView pView = (ProcessListView) HandlerUtil
+                               .getActiveWorkbenchWindow(event).getActivePage()
+                               .findView(ProcessListView.ID);
+               pView.retrieveResults();
                return null;
        }
 
index 12a450057aaafa4bee5072e5dd2b098d9f92bd5a..b0b1d2067528b3995b8e45289c86c3761fb9483f 100644 (file)
@@ -5,7 +5,6 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.client.core.TableContent;
-import org.argeo.slc.dao.process.SlcExecutionDao;
 import org.argeo.slc.process.SlcExecution;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -28,9 +27,11 @@ public class ProcessListView extends ViewPart {
        private TableViewer viewer;
 
        // IoC
-       private SlcExecutionDao slcExecutionDao;
        private TableContent tableContent;
 
+       // tests
+       private List<SlcExecution> slcExecutions;
+
        public void createPartControl(Composite parent) {
                Table table = createTable(parent);
                viewer = new TableViewer(table);
@@ -96,20 +97,7 @@ public class ProcessListView extends ViewPart {
        protected class ViewLabelProvider extends LabelProvider implements
                        ITableLabelProvider {
                public String getColumnText(Object obj, int index) {
-                       SlcExecution se = (SlcExecution) obj;
-                       // switch (index) {
-                       //
-                       // case 0:
-                       // return getText(se.getStartDate());
-                       // case 1:
-                       // return se.getHost();
-                       // case 2:
-                       // return se.getUuid();
-                       // case 3:
-                       // return se.currentStep().getType();
-                       // }
-                       // return getText(obj);
-                       return tableContent.getLabel(null, 0);
+                       return tableContent.getLabel(obj, index);
                }
 
                public Image getColumnImage(Object obj, int index) {
@@ -124,11 +112,8 @@ public class ProcessListView extends ViewPart {
 
        public void retrieveResults() {
                try {
-                       List<SlcExecution> lst = slcExecutionDao.listSlcExecutions();
-
-                       if (log.isTraceEnabled())
-                               log.trace("Slc Execution count: " + lst.size());
-                       viewer.setInput(lst);
+                       tableContent.setContent();
+                       viewer.setInput(tableContent.getContent());
                        // viewer.refresh();
                } catch (Exception e) {
                        // TODO Auto-generated catch block
@@ -136,8 +121,9 @@ public class ProcessListView extends ViewPart {
                }
        }
 
-       public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
-               this.slcExecutionDao = slcExecutionDao;
+       // IoC
+       public void setTableContent(TableContent tableContent) {
+               this.tableContent = tableContent;
        }
 
 }