Scarab commit: svn commit: r10527 - trunk/src/test/org/tigris/scarab/om

[email protected]
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: ronvoe122
Date: 2007-12-26 01:55:43-0800
New Revision: 10527

Removed:
   trunk/src/test/org/tigris/scarab/om/AttachmentTest2.java
Modified:
   trunk/src/test/org/tigris/scarab/om/AttachmentTest.java

Log:
Fixed AttachmentTest and removed its duplicate AttachmentTest2.

Modified: trunk/src/test/org/tigris/scarab/om/AttachmentTest.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/test/org/tigris/scarab/om/AttachmentTest.java?view=diff&rev=10527&p1=trunk/src/test/org/tigris/scarab/om/AttachmentTest.java&p2=trunk/src/test/org/tigris/scarab/om/AttachmentTest.java&r1=10526&r2=10527
==============================================================================
--- trunk/src/test/org/tigris/scarab/om/AttachmentTest.java	(original)
+++ trunk/src/test/org/tigris/scarab/om/AttachmentTest.java	2007-12-26 01:55:43-0800
@@ -48,11 +48,9 @@
 
 import java.io.File;
 
-import org.apache.commons.configuration.BaseConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.fileupload.DefaultFileItemFactory;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.torque.om.NumberKey;
 import org.tigris.scarab.test.BaseTurbineTestCase;
 
@@ -98,15 +96,16 @@
     public void saveFile() throws Exception
     {
         //FileItem fileItem = new DefaultFileItem(scarab/images/", "logo.gif", "image/jpeg", 6480, 10000);
-        FileItemFactory factory = new DefaultFileItemFactory(6480, null);
+        FileItemFactory factory = new DiskFileItemFactory(6480, null);
         String textFieldName = "textField";
 
         FileItem fileItem = factory.createItem(
                 textFieldName,
                 "image/jpeg",
                 true,
-                "logo.gif"
+                "images/logo.gif"
         );
+        fileItem.getOutputStream();
         fileAttachment.setFile(fileItem);
         fileAttachment.setName(fileItem.getName());
         fileAttachment.setMimeType("image/jpeg");
@@ -115,18 +114,14 @@
         issue.save();
         // need to save the attachments AFTER the issue has been created
         issue.doSaveFileAttachments(testUsers.getUser1());
-        System.out.println("filename=" + fileAttachment.getFileName());
     }
 
     public void testGetRepositoryDirectory() throws Exception
     {
         
-        Configuration c = new BaseConfiguration();
-        c.addProperty("scarab.attachments.repository","WEB-INF/attachements");
-        Attachment.setConfiguration(c);
-        String control = new String("WEB-INF" + File.separator + "attachments");
+        String attachmentDir = new String("attachments");
         File testPath = new File(Attachment.getRepositoryDirectory());
-        assertTrue("testpath was:" + testPath.getPath(),testPath.getPath().endsWith(control));
+        assertTrue(testPath.getPath(),testPath.getPath().endsWith(attachmentDir));
     }
 
     public void testGetRelativePath() throws Exception

Removed: trunk/src/test/org/tigris/scarab/om/AttachmentTest2.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/test/org/tigris/scarab/om/AttachmentTest2.java?view=auto&rev=10526
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.