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.1 -r1.2 --- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/ForumTest.java 17 Jun 2005 04:41:04 -0000 1.1 +++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/persistence/ForumTest.java 29 Jun 2005 06:33:38 -0000 1.2 @@ -27,7 +27,7 @@ Forum entity = new Forum(); entity.setTitle("Lams Forum"); entity.setLockWhenFinished(false); - entity.setForceOffLine(true); + entity.setForceOffline(true); entity.setAllowAnnomity(true); entity.setCreatedBy(new Long("1000")); @@ -70,7 +70,7 @@ assertEquals("date difference in database and memory", entity.getUpdated().getTime()/1000, reloaded.getUpdated().getTime()/1000); assertEquals("title should be Lams Forum", "Lams Forum", reloaded.getTitle()); assertEquals("lockWhenFinished should be false", false, reloaded.getLockWhenFinished()); - assertEquals("forceOffline should be true", true, reloaded.getForceOffLine()); + assertEquals("forceOffline should be true", true, reloaded.getForceOffline()); assertEquals("allowAnnomity should be true", true, reloaded.getAllowAnnomity()); //validate attachment relations assertEquals("should have 1 attachments", 1, reloaded.getAttachments().size()); 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.2 -r1.3 --- lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 21 Jun 2005 00:00:55 -0000 1.2 +++ lams_tool_forum/test/java/org/lamsfoundation/lams/tool/forum/service/ForumManagerImplTest.java 29 Jun 2005 06:33:38 -0000 1.3 @@ -6,9 +6,7 @@ import org.lamsfoundation.lams.tool.forum.persistence.Attachment; import org.lamsfoundation.lams.tool.forum.persistence.Message; -import java.util.List; -import java.util.ArrayList; -import java.util.Set; +import java.util.*; import junit.framework.TestCase; @@ -28,19 +26,19 @@ } public void testCreateAndDeleteForum() throws PersistenceException { - List attachments = new ArrayList(); + Map attachments = new HashMap(); Attachment attachment = new Attachment(); attachment.setData("test data".getBytes()); attachment.setType(Attachment.TYPE_ONLINE); - attachments.add(attachment); + attachments.put("test file", attachment); - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), attachments); + Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), attachments, null); assertNotNull("Forum Id is null", forum.getId()); Forum reloadedForum = forumManager.getForum(forum.getId()); assertEquals(reloadedForum.getTitle(), "TEST"); assertEquals(reloadedForum.getCreatedBy(), new Long("1002")); assertEquals(reloadedForum.getLockWhenFinished(), true); - assertEquals(reloadedForum.getForceOffLine(), true); + assertEquals(reloadedForum.getForceOffline(), true); assertEquals(reloadedForum.getAllowAnnomity(), false); assertEquals(reloadedForum.getInstructions(), "TEST INSTRUCTIONS"); assertEquals(reloadedForum.getOnlineInstructions(), "TEST ONLINEINSTRUCTIONS"); @@ -62,13 +60,13 @@ } public void testCreateAndDeleteForumWithNullAttachments() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), null); + Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), null, null); assertNotNull("Forum Id is null", forum.getId()); Forum reloadedForum = forumManager.getForum(forum.getId()); assertEquals(reloadedForum.getTitle(), "TEST"); assertEquals(reloadedForum.getCreatedBy(), new Long("1002")); assertEquals(reloadedForum.getLockWhenFinished(), true); - assertEquals(reloadedForum.getForceOffLine(), true); + assertEquals(reloadedForum.getForceOffline(), true); assertEquals(reloadedForum.getAllowAnnomity(), false); assertEquals(reloadedForum.getInstructions(), "TEST INSTRUCTIONS"); assertEquals(reloadedForum.getOnlineInstructions(), "TEST ONLINEINSTRUCTIONS"); @@ -86,13 +84,13 @@ } public void testCreateAndDeleteForumWithNullInstructions() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), false, false , false, "", "", ""), null); + Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), false, false , false, "", "", ""), null, null); assertNotNull("Forum Id is null", forum.getId()); Forum reloadedForum = forumManager.getForum(forum.getId()); assertEquals(reloadedForum.getTitle(), "TEST"); assertEquals(reloadedForum.getCreatedBy(), new Long("1002")); assertEquals(reloadedForum.getLockWhenFinished(), false); - assertEquals(reloadedForum.getForceOffLine(), false); + assertEquals(reloadedForum.getForceOffline(), false); assertEquals(reloadedForum.getAllowAnnomity(), false); assertEquals(reloadedForum.getInstructions(), ""); assertEquals(reloadedForum.getOnlineInstructions(), ""); @@ -110,7 +108,7 @@ } public void testCreateModifyAndDeleteMessage() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), new ArrayList()); + Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), new HashMap(), new HashMap()); Message message = forumManager.createMessage(forum.getId(), this.getMessage(new Long("1002"), "TEST", "TEST", true, true)); assertNotNull("Message Id is null", message.getId()); @@ -149,7 +147,7 @@ } public void testReplyToMessage() throws PersistenceException { - Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), new ArrayList()); + Forum forum = forumManager.createForum(this.getForum("TEST", new Long("1002"), true, true, false, "TEST INSTRUCTIONS", "TEST ONLINEINSTRUCTIONS", "TEST OFFLINEINSTRUCTIONS"), new HashMap(), new HashMap()); Message message = forumManager.createMessage(forum.getId(), this.getMessage(new Long("1002"), "TEST", "TEST", true, true)); assertNotNull("Message Id is null", message.getId()); Message reloaded = forumManager.getMessage(message.getId()); @@ -203,19 +201,22 @@ } protected Forum getForum(String title, Long createdBy, boolean lockWhenFinished, - boolean forceOffLine, boolean allowAnnomity, String instructions, String onlineInstructions, String offlineInstructions) { Forum forum = new Forum(); + boolean forceOffLine, boolean allowAnnomity, String instructions, + String onlineInstructions, String offlineInstructions) { + Forum forum = new Forum(); forum.setTitle(title); forum.setCreatedBy(createdBy); forum.setLockWhenFinished(lockWhenFinished); - forum.setForceOffLine(forceOffLine); + forum.setForceOffline(forceOffLine); forum.setAllowAnnomity(allowAnnomity); forum.setInstructions(instructions); forum.setOfflineInstructions(offlineInstructions); forum.setOnlineInstructions(onlineInstructions); return forum; } - protected Message getMessage(Long createdBy, String subject, String body, boolean isAnnonymous, boolean isAuthored) { + protected Message getMessage(Long createdBy, String subject, String body, boolean isAnnonymous, + boolean isAuthored) { Message message = new Message(); message.setSubject(subject); message.setBody(body);