Index: lams_tool_forum/build.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/build.properties,v
diff -u -r1.12 -r1.13
--- lams_tool_forum/build.properties 23 Aug 2005 06:25:39 -0000 1.12
+++ lams_tool_forum/build.properties 7 Sep 2005 23:40:32 -0000 1.13
@@ -10,8 +10,3 @@
signature=lafrum11
project.displayname = lams forum tool
-# path properties
-lib=${basedir}/lib
-j2eelibs=C:/Program Files/MyEclipse/eclipse/plugins/com.genuitec.eclipse.j2eedt.core_3.8.4/data/libraryset/1.4
-jboss.home=D:/jboss-3.2.6/
-
Index: lams_tool_forum/build.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/build.xml,v
diff -u -r1.20 -r1.21
--- lams_tool_forum/build.xml 30 Aug 2005 05:00:51 -0000 1.20
+++ lams_tool_forum/build.xml 7 Sep 2005 23:40:32 -0000 1.21
@@ -8,21 +8,10 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -38,39 +27,22 @@
-
-
-
-
-
-
+------------------------------------------+
- | build initializing |
- +------------------------------------------+
-
-
-
-
-
-
-
- +------------------------------------------+
| creating directory structure |
+------------------------------------------+
-
-
+
-
-
+
+
@@ -79,30 +51,30 @@
| clean |
+------------------------------------------+
-
-
-
-
-
-
-
+
+
+
+
-
- +------------------------------------------+
- | compile |
- +------------------------------------------+
-
-
+
+ destdir="${build.classes.java}"/>
+
+
+
+
+
+
+
-
+
+------------------------------------------+
| generating hibernate metadata |
+------------------------------------------+
@@ -111,47 +83,35 @@
classname="xdoclet.modules.hibernate.HibernateDocletTask"
classpathref="all-libs"/>
- Building hbm.xml files using XDoclet to ${conf.hibernate.mapping.dir} from ${src.dir}
+ Building hbm.xml files using XDoclet to ${conf.hibernate.mapping.dir} from ${src.java.dir}
-
+
-
- +------------------------------------------+
- | compile |
- +------------------------------------------+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -187,62 +147,46 @@
-
- +-------------------------------------------+
- | run junit tests and save results in /test |
- +-------------------------------------------+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +------------------------------------------+
- | merge stuff into jar file |
- +------------------------------------------+
-
-
-
-
-
+
+
+
-
+
+
+
+
-
+
+------------------------------------------+
| create jar file |
+------------------------------------------+
-
+
@@ -391,7 +335,7 @@
+ depends="init, clean, compile-java, jar, web">
+------------------------------------------+
| built war file |
+------------------------------------------+
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/core/GenericObjectFactoryImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/core/Attic/GenericObjectFactoryImpl.java,v
diff -u -r1.3 -r1.4
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/core/GenericObjectFactoryImpl.java 30 Aug 2005 05:00:04 -0000 1.3
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/core/GenericObjectFactoryImpl.java 7 Sep 2005 23:39:55 -0000 1.4
@@ -1,14 +1,10 @@
package org.lamsfoundation.lams.tool.forum.core;
+import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.apache.log4j.Priority;
-import org.apache.log4j.Logger;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
/**
* Created by IntelliJ IDEA.
* User: conradb
@@ -31,6 +27,20 @@
return genericObjectFactory;
}
+ /** Get the Spring context with a local datasource and transaction, suitable
+ * for testing. Does not use JTA so the transactions across projects could be
+ * out. Do NOT use in production code - only for junit testing.
+ */
+ public static GenericObjectFactory getTestInstance() {
+ if (genericObjectFactory == null) {
+ genericObjectFactory = new GenericObjectFactoryImpl();
+ addContext("/org/lamsfoundation/lams/localApplicationContext.xml");
+ addContext("/org/lamsfoundation/lams/contentrepository/applicationContext.xml");
+ addContext("/forumApplicationContext.xml");
+ }
+ return genericObjectFactory;
+ }
+
public static ApplicationContext addContext(String contextPath) {
try {
if (applicationContext == null) {
Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/AttachmentTest.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/Attic/AttachmentTest.java,v
diff -u -r1.3 -r1.4
--- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/AttachmentTest.java 7 Jul 2005 02:22:50 -0000 1.3
+++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/AttachmentTest.java 7 Sep 2005 23:39:55 -0000 1.4
@@ -21,11 +21,11 @@
public void testCreateAndDeleteForum() throws FactoryException {
//Populate an Attachment entity for test purposes
- AttachmentDao attachmentDao = (AttachmentDao) GenericObjectFactoryImpl.getInstance().lookup(AttachmentDao.class);
+ AttachmentDao attachmentDao = (AttachmentDao) GenericObjectFactoryImpl.getTestInstance().lookup(AttachmentDao.class);
Attachment instructions = new Attachment();
attachmentDao.saveOrUpdate(instructions);
- AttachmentDao dao = (AttachmentDao) GenericObjectFactoryImpl.getInstance().lookup(AttachmentDao.class);
+ AttachmentDao dao = (AttachmentDao) GenericObjectFactoryImpl.getTestInstance().lookup(AttachmentDao.class);
dao.saveOrUpdate(instructions);
assertNotNull(instructions.getId());
Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/ForumTest.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/Attic/ForumTest.java,v
diff -u -r1.4 -r1.5
--- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/ForumTest.java 7 Jul 2005 02:22:50 -0000 1.4
+++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/ForumTest.java 7 Sep 2005 23:39:55 -0000 1.5
@@ -33,7 +33,7 @@
Set attachments = new HashSet();
- AttachmentDao attachmentDao = (AttachmentDao) GenericObjectFactoryImpl.getInstance().lookup(AttachmentDao.class);
+ AttachmentDao attachmentDao = (AttachmentDao) GenericObjectFactoryImpl.getTestInstance().lookup(AttachmentDao.class);
Attachment instructions = new Attachment();
//instructions.setType(true);
attachments.add(instructions);
@@ -42,7 +42,7 @@
entity.setAttachments(attachments);
//save
- ForumDao dao = (ForumDao) GenericObjectFactoryImpl.getInstance().lookup(ForumDao.class);
+ ForumDao dao = (ForumDao) GenericObjectFactoryImpl.getTestInstance().lookup(ForumDao.class);
dao.saveOrUpdate(entity);
assertNotNull(entity.getId());
assertNotNull("date created is null", entity.getCreated());
Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/GenericEntityTest.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/Attic/GenericEntityTest.java,v
diff -u -r1.1 -r1.2
--- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/GenericEntityTest.java 17 Jun 2005 04:41:04 -0000 1.1
+++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/GenericEntityTest.java 7 Sep 2005 23:39:55 -0000 1.2
@@ -26,7 +26,7 @@
entity.setModifiedBy(new Long("1004"));
//save
- GenericEntityDao dao = (GenericEntityDao) GenericObjectFactoryImpl.getInstance().lookup(GenericEntityDao.class);
+ GenericEntityDao dao = (GenericEntityDao) GenericObjectFactoryImpl.getTestInstance().lookup(GenericEntityDao.class);
dao.saveOrUpdate(entity);
assertNotNull(entity.getId());
assertNotNull("date created is null", entity.getCreated());
Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/MessageTest.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/Attic/MessageTest.java,v
diff -u -r1.1 -r1.2
--- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/MessageTest.java 17 Jun 2005 04:41:04 -0000 1.1
+++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/MessageTest.java 7 Sep 2005 23:39:55 -0000 1.2
@@ -27,7 +27,7 @@
Forum forum = new Forum();
//save
- ForumDao dao = (ForumDao) GenericObjectFactoryImpl.getInstance().lookup(ForumDao.class);
+ ForumDao dao = (ForumDao) GenericObjectFactoryImpl.getTestInstance().lookup(ForumDao.class);
dao.saveOrUpdate(forum);
Message message = new Message();
@@ -39,7 +39,7 @@
message.setCreatedBy(new Long(1000));
message.setModifiedBy(new Long(1002));
- MessageDao messageDao = (MessageDao) GenericObjectFactoryImpl.getInstance().lookup(MessageDao.class);
+ MessageDao messageDao = (MessageDao) GenericObjectFactoryImpl.getTestInstance().lookup(MessageDao.class);
messageDao.saveOrUpdate(message);
assertNotNull(message.getId());
Index: lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/Attic/ForumManagerImplTest.java,v
diff -u -r1.5 -r1.6
--- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 7 Jul 2005 02:22:50 -0000 1.5
+++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 7 Sep 2005 23:39:55 -0000 1.6
@@ -22,7 +22,7 @@
protected void setUp() throws Exception {
super.setUp();
- forumManager = (ForumManager) GenericObjectFactoryImpl.getInstance().lookup("forumManager");
+ forumManager = (ForumManager) GenericObjectFactoryImpl.getTestInstance().lookup("forumManager");
}
public void testCreateAndDeleteForum() throws PersistenceException {