You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2011/06/16 20:27:08 UTC

svn commit: r1136586 - in /oodt/branches/protocol/protocol-imaps: ./ src/main/java/org/apache/oodt/cas/protocol/imaps/ src/main/resources/ src/main/resources/policy/ src/test/org/apache/oodt/cas/protocol/imaps/

Author: bfoster
Date: Thu Jun 16 18:27:07 2011
New Revision: 1136586

URL: http://svn.apache.org/viewvc?rev=1136586&view=rev
Log:

- added Spring file for autodetect feature

---------------
OODT-194

Added:
    oodt/branches/protocol/protocol-imaps/src/main/resources/
    oodt/branches/protocol/protocol-imaps/src/main/resources/policy/
    oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml   (with props)
Modified:
    oodt/branches/protocol/protocol-imaps/pom.xml
    oodt/branches/protocol/protocol-imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
    oodt/branches/protocol/protocol-imaps/src/test/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java

Modified: oodt/branches/protocol/protocol-imaps/pom.xml
URL: http://svn.apache.org/viewvc/oodt/branches/protocol/protocol-imaps/pom.xml?rev=1136586&r1=1136585&r2=1136586&view=diff
==============================================================================
--- oodt/branches/protocol/protocol-imaps/pom.xml (original)
+++ oodt/branches/protocol/protocol-imaps/pom.xml Thu Jun 16 18:27:07 2011
@@ -50,28 +50,17 @@
 			</build>
 		</profile>
 	</profiles>
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<version>2.2-beta-2</version>
-				<configuration>
-					<descriptors>
-						<descriptor>src/main/assembly/assembly.xml</descriptor>
-					</descriptors>
-				</configuration>
-				<executions>
-					<execution>
-						<phase>package</phase>
-						<goals>
-							<goal>single</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
+  <build>
+    <resources>
+      <resource>
+        <targetPath>org/apache/oodt/cas/protocol/imaps</targetPath>
+        <directory>${basedir}/src/main/resources/policy</directory>
+        <includes>
+          <include>imaps-protocol-config.xml</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
 	<dependencies>
 		<dependency>
 			<groupId>org.apache.oodt</groupId>

Modified: oodt/branches/protocol/protocol-imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
URL: http://svn.apache.org/viewvc/oodt/branches/protocol/protocol-imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java?rev=1136586&r1=1136585&r2=1136586&view=diff
==============================================================================
--- oodt/branches/protocol/protocol-imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java (original)
+++ oodt/branches/protocol/protocol-imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java Thu Jun 16 18:27:07 2011
@@ -22,9 +22,12 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.util.Arrays;
 import java.util.Enumeration;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 
 //Javamail imports
 import javax.mail.Address;
@@ -139,7 +142,6 @@ public class ImapsProtocol implements Pr
 //        currentFolder.close(true);
         store.close();
       } catch (Exception e) {
-      	e.printStackTrace();
         throw new ProtocolException("Failed to close connection : " + e.getMessage(), e);
       } finally {
         store = null;
@@ -194,7 +196,8 @@ public class ImapsProtocol implements Pr
       ps.print(" " + address.toString());
 
     ps.print("\nTo:");
-    Address[] recipients = message.getAllRecipients();
+		Set<Address> recipients = new LinkedHashSet<Address>(Arrays.asList(message
+				.getAllRecipients()));
     for (Address address : recipients)
       ps.print(" " + address.toString());
 

Added: oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml
URL: http://svn.apache.org/viewvc/oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml?rev=1136586&view=auto
==============================================================================
--- oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml (added)
+++ oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml Thu Jun 16 18:27:07 2011
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+	
+	Author: bfoster
+	Description: ProtocolManager Configuration
+	
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:p="http://www.springframework.org/schema/p"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+  <bean class="org.apache.oodt.cas.protocol.imaps.ImapsProtocolFactory"/>
+	
+</beans>
\ No newline at end of file

Propchange: oodt/branches/protocol/protocol-imaps/src/main/resources/policy/imaps-protocol-config.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: oodt/branches/protocol/protocol-imaps/src/test/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java
URL: http://svn.apache.org/viewvc/oodt/branches/protocol/protocol-imaps/src/test/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java?rev=1136586&r1=1136585&r2=1136586&view=diff
==============================================================================
--- oodt/branches/protocol/protocol-imaps/src/test/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java (original)
+++ oodt/branches/protocol/protocol-imaps/src/test/org/apache/oodt/cas/protocol/imaps/TestImapsProtocol.java Thu Jun 16 18:27:07 2011
@@ -16,12 +16,15 @@
  */
 package org.apache.oodt.cas.protocol.imaps;
 
-//OODT imports
+//JDK imports
 import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
+//Apache imports
 import org.apache.commons.io.FileUtils;
+
+//OODT imports
 import org.apache.oodt.cas.protocol.ProtocolFile;
 import org.apache.oodt.cas.protocol.auth.BasicAuthentication;
 import org.apache.oodt.cas.protocol.exceptions.ProtocolException;
@@ -66,9 +69,7 @@ public class TestImapsProtocol extends T
 		gMail.stop();
 		try {
 			imapsProtocol.close();
-		} catch (ProtocolException e) {
-			fail("Failed to disconnect from GreenMail IMAPS server : " + e.getMessage());
-		}
+		} catch (Exception e) {}
 		assertEquals(0, ImapsProtocol.connectCalls);
 	}
 	
@@ -96,6 +97,7 @@ public class TestImapsProtocol extends T
 		assertEquals("Subject: Test Subject", splitEmail[2]);
 		// 3 is divider text (i.e. ----- ~ Message ~ -----)
 		assertEquals("Test Body", splitEmail[4]);
+		tmpDir.delete();
 	}
 	
 	public void testDelete() throws ProtocolException {