camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r936197 - in /camel/trunk/camel-core: pom.xml src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
Date Wed, 21 Apr 2010 08:16:58 GMT
Author: ningjiang
Date: Wed Apr 21 08:16:58 2010
New Revision: 936197

URL: http://svn.apache.org/viewvc?rev=936197&view=rev
Log:
CAMEL-2496 Added SplitterStreamCacheTest will fixed when we rewrite the StreamCache

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
  (with props)
Modified:
    camel/trunk/camel-core/pom.xml
    camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java

Modified: camel/trunk/camel-core/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/pom.xml?rev=936197&r1=936196&r2=936197&view=diff
==============================================================================
--- camel/trunk/camel-core/pom.xml (original)
+++ camel/trunk/camel-core/pom.xml Wed Apr 21 08:16:58 2010
@@ -140,7 +140,8 @@
           <forkMode>pertest</forkMode>
           <excludes>
             <!-- TODO FIXME ASAP -->
-            <exclude>**/XXXTest.*</exclude>            
+	    <!-- need to fix this issue when we rewrite the stream cache-->
+            <exclude>**/SplitterStreamCacheTest.*</exclude>            
           </excludes>
         </configuration>
       </plugin>

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java?rev=936197&r1=936196&r2=936197&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/CachedOutputStream.java
Wed Apr 21 08:16:58 2010
@@ -30,7 +30,6 @@ import java.util.List;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.StreamCache;
-import org.apache.camel.impl.SynchronizationAdapter;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.commons.logging.Log;

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java?rev=936197&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
(added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
Wed Apr 21 08:16:58 2010
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.camel.CamelException;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.builder.xml.XPathBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.converter.stream.CachedOutputStream;
+import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
+
+/**
+ * @version $Revision$
+ */
+public class SplitterStreamCacheTest extends ContextTestSupport {
+
+    private static final String TEST_FILE = "org/apache/camel/converter/stream/test.xml";
+    protected int numMessages = 1000;
+
+    public void testSendStreamSource() throws Exception {
+        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedMessageCount(numMessages);
+    
+        for (int c = 0; c < numMessages; c++) {
+            template.sendBody("seda:parallel", new StreamSource(getTestFileStream()));
+        }
+        
+        assertMockEndpointsSatisfied();
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                //ensure stream is spooled to disk
+                getContext().getProperties().put(CachedOutputStream.TEMP_DIR, "target/tmp");
+                getContext().getProperties().put(CachedOutputStream.THRESHOLD, "1");
+                from("seda:parallel?size=1000&concurrentConsumers=5").streamCaching().split(XPathBuilder.xpath("//person/city")).to("mock:result");
+            }
+        };
+    }
+
+    protected InputStream getTestFileStream() {
+        InputStream answer = getClass().getClassLoader().getResourceAsStream(TEST_FILE);
+        assertNotNull("Should have found the file: " + TEST_FILE + " on the classpath", answer);
+        return answer;
+    }
+}

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamCacheTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message