servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r486716 - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src: main/java/org/apache/servicemix/ftp/ test/java/org/apache/servicemix/ftp/
Date Wed, 13 Dec 2006 16:31:36 GMT
Author: gnodet
Date: Wed Dec 13 08:31:35 2006
New Revision: 486716

URL: http://svn.apache.org/viewvc?view=rev&rev=486716
Log:
SM-775: Positive preliminary response from server when using FTPSender to send multiple files

Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpEndpoint.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/PollDirectoryTest.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/SpringComponentTest.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpEndpoint.java?view=diff&rev=486716&r1=486715&r2=486716
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpEndpoint.java
Wed Dec 13 08:31:35 2006
@@ -165,7 +165,6 @@
             marshaler.writeMessage(exchange, message, out, name);
         }
         finally {
-            returnClient(client);
             if (out != null) {
                 try {
                     out.close();
@@ -174,6 +173,8 @@
                     logger.error("Caught exception while closing stream on error: " + e,
e);
                 }
             }
+            client.completePendingCommand();
+            returnClient(client);
         }
     }
 

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java?view=diff&rev=486716&r1=486715&r2=486716
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
Wed Dec 13 08:31:35 2006
@@ -275,7 +275,6 @@
 
     protected void processFile(FTPClient ftp, String file) throws Exception {
         InputStream in = ftp.retrieveFileStream(file);
-        ftp.completePendingCommand();
         InOnly exchange = getExchangeFactory().createInOnlyExchange();
         configureExchangeTarget(exchange);
         NormalizedMessage message = exchange.createMessage();
@@ -283,6 +282,7 @@
         marshaler.readMessage(exchange, message, in, file);
         sendSync(exchange);
         in.close();
+        ftp.completePendingCommand();
     }
 
     public String getLocationURI() {

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/PollDirectoryTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/PollDirectoryTest.java?view=diff&rev=486716&r1=486715&r2=486716
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/PollDirectoryTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/PollDirectoryTest.java
Wed Dec 13 08:31:35 2006
@@ -36,12 +36,19 @@
     protected String directoryName = "target/pollDirectory";
     protected String dynamicURI = "file:" + directoryName;
 
-    private int NUMBER = 10;
+    private int NUMBER = 100;
+    private int SIZE = 100;
 
     public void testSendToWriterSoItCanBePolled() throws Exception {
         // now lets make a request on this endpoint
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
 
+        StringBuffer sb = new StringBuffer("<root>");
+        for (int i = 0; i < SIZE; i++) {
+            sb.append("<hello>world</hello>");
+        }
+        sb.append("</root>");
+        
         // lets send a request to be written to a file
         // which should then be polled
         for (int i = 0; i < NUMBER; i++) {
@@ -49,7 +56,7 @@
             me.setService(new QName("urn:test", "service"));
             NormalizedMessage message = me.getInMessage();
             message.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY, "test" + i + ".xml");
-            message.setContent(new StringSource("<hello>world</hello>"));
+            message.setContent(new StringSource(sb.toString()));
             client.sendSync(me);
         }
 

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/SpringComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/SpringComponentTest.java?view=diff&rev=486716&r1=486715&r2=486716
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/SpringComponentTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-ftp/src/test/java/org/apache/servicemix/ftp/SpringComponentTest.java
Wed Dec 13 08:31:35 2006
@@ -32,17 +32,21 @@
 
 public class SpringComponentTest extends SpringTestSupport {
 
-    public void testSendingToStaticEndpoint() throws Exception {
-        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
-        InOnly me = client.createInOnlyExchange();
-        me.setService(new QName("urn:test", "service"));
-        NormalizedMessage message = me.getInMessage();
-
-        message.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY, "test2.xml");
-        message.setContent(new StringSource("<hello>world</hello>"));
+    private int NUMBER = 10;
 
-        client.sendSync(me);
-        assertExchangeWorked(me);
+    public void testSendingToStaticEndpoint() throws Exception {
+        for (int i = 0; i < NUMBER; i++) {
+            DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
+            InOnly me = client.createInOnlyExchange();
+            me.setService(new QName("urn:test", "service"));
+            NormalizedMessage message = me.getInMessage();
+    
+            message.setProperty(DefaultFileMarshaler.FILE_NAME_PROPERTY, "test2.xml");
+            message.setContent(new StringSource("<hello>world</hello>"));
+    
+            client.sendSync(me);
+            assertExchangeWorked(me);
+        }
     }
 
 



Mime
View raw message