You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/03/11 09:51:28 UTC

[1/9] git commit: Removed test that cause CI servers to fail

Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 90fac6609 -> 83e80c5ed
  refs/heads/master 8653f41a1 -> 932f4098f


Removed test that cause CI servers to fail


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cd40f683
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cd40f683
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cd40f683

Branch: refs/heads/master
Commit: cd40f68370b32caeb3f258739eac9b3ec16dbfa8
Parents: 8653f41
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 08:56:04 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 08:56:04 2014 +0100

----------------------------------------------------------------------
 components/camel-csv/pom.xml                    |   6 -
 .../camel/dataformat/csv/CsvIteratorTest.java   | 111 -------------------
 2 files changed, 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cd40f683/components/camel-csv/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-csv/pom.xml b/components/camel-csv/pom.xml
index 2904163..c55bfde 100644
--- a/components/camel-csv/pom.xml
+++ b/components/camel-csv/pom.xml
@@ -57,12 +57,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.googlecode.jmockit</groupId>
-      <artifactId>jmockit</artifactId>
-      <version>${jmockit-version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/camel/blob/cd40f683/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvIteratorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvIteratorTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvIteratorTest.java
deleted file mode 100644
index fedc5a3..0000000
--- a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvIteratorTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * 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.dataformat.csv;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import mockit.Expectations;
-import mockit.Injectable;
-import org.apache.commons.csv.CSVParser;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CsvIteratorTest {
-
-    public static final String HDD_CRASH = "HDD crash";
-
-    @Test
-    public void closeIfError(@Injectable final InputStreamReader reader, @Injectable final CSVParser parser) throws IOException {
-        new Expectations() {
-            {
-                parser.getLine();
-                result = new String[]{"1"};
-
-                parser.getLine();
-                result = new String[]{"2"};
-
-                parser.getLine();
-                result = new IOException(HDD_CRASH);
-
-                // The reader will be closed when there is nothing left
-                reader.close();
-            }
-        };
-
-        @SuppressWarnings("resource")
-        CsvIterator<List<String>> iterator = new CsvIterator<List<String>>(parser, reader, CsvLineConverters.getListConverter());
-        Assert.assertTrue(iterator.hasNext());
-        Assert.assertEquals(Arrays.asList("1"), iterator.next());
-        Assert.assertTrue(iterator.hasNext());
-
-        try {
-            iterator.next();
-            Assert.fail("exception expected");
-        } catch (IllegalStateException e) {
-            Assert.assertEquals(HDD_CRASH, e.getCause().getMessage());
-        }
-
-        Assert.assertFalse(iterator.hasNext());
-
-        try {
-            iterator.next();
-            Assert.fail("exception expected");
-        } catch (NoSuchElementException e) {
-            // okay
-        }
-    }
-
-    @Test
-    public void normalCycle(@Injectable final InputStreamReader reader, @Injectable final CSVParser parser) throws IOException {
-        new Expectations() {
-            {
-                parser.getLine();
-                result = new String[]{"1"};
-
-                parser.getLine();
-                result = new String[]{"2"};
-
-                parser.getLine();
-                result = null;
-
-                // The reader will be closed when there is nothing left
-                reader.close();
-            }
-        };
-
-        @SuppressWarnings("resource")
-        CsvIterator<List<String>> iterator = new CsvIterator<List<String>>(parser, reader, CsvLineConverters.getListConverter());
-        Assert.assertTrue(iterator.hasNext());
-        Assert.assertEquals(Arrays.asList("1"), iterator.next());
-
-        Assert.assertTrue(iterator.hasNext());
-        Assert.assertEquals(Arrays.asList("2"), iterator.next());
-
-        Assert.assertFalse(iterator.hasNext());
-
-        try {
-            iterator.next();
-            Assert.fail("exception expected");
-        } catch (NoSuchElementException e) {
-            // okay
-        }
-    }
-}


[8/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3f47a99a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3f47a99a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3f47a99a

Branch: refs/heads/camel-2.12.x
Commit: 3f47a99aabff2875da223468f46cf8a301867b94
Parents: e7f9695
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:35:35 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:53:47 2014 +0100

----------------------------------------------------------------------
 .../sjms/producer/QueueProducerQoSTest.java     | 109 ++++++++++++++++++
 .../sjms/producer/QueueProduerQoSTest.java      | 112 -------------------
 .../component/sjms/support/JmsTestSupport.java  |   2 +
 3 files changed, 111 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3f47a99a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
new file mode 100644
index 0000000..c82842a
--- /dev/null
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
@@ -0,0 +1,109 @@
+/**
+ * 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.component.sjms.producer;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.DestinationViewMBean;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.sjms.support.JmsTestSupport;
+import org.junit.Test;
+
+public class QueueProducerQoSTest extends JmsTestSupport {
+
+    private static final String TEST_INONLY_DESTINATION_NAME = "queue.producer.test.qos.inonly";
+    private static final String TEST_INOUT_DESTINATION_NAME = "queue.producer.test.qos.inout";
+
+    private static final String EXPIRED_MESSAGE_ROUTE_ID = "expiredAdvisoryRoute";
+
+    @Test
+    public void testInOutQueueProducerTTL() throws Exception {
+
+        NotifyBuilder expireMatcher = new NotifyBuilder(context)
+                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
+
+        String endpoint = String.format("sjms:queue:%s?ttl=1000&exchangePattern=InOut&responseTimeOut=500", TEST_INOUT_DESTINATION_NAME);
+
+        try {
+            template.requestBody(endpoint, "test message");
+            fail("we aren't expecting any consumers, so should not succeed");
+        } catch (Exception e) {
+            // we are expecting an exception here because there are no consumers on this queue,
+            // so we will not be able to do a real InOut/request-response, but that's okay
+            // we're just interested in the message becoming expired
+        }
+
+        // we should delay a bit so broker can run its expiration processes...
+        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));
+
+        DestinationViewMBean queue = getQueueMBean(TEST_INOUT_DESTINATION_NAME);
+        assertEquals("There were unexpected messages left in the queue: " + TEST_INOUT_DESTINATION_NAME,
+                0, queue.getQueueSize());
+    }
+
+    @Test
+    public void testInOnlyQueueProducerTTL() throws Exception {
+        NotifyBuilder expireMatcher = new NotifyBuilder(context)
+                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
+
+        String endpoint = String.format("sjms:queue:%s?ttl=1000", TEST_INONLY_DESTINATION_NAME);
+        template.sendBody(endpoint, "test message");
+
+        // we should delay a bit so broker can run its expiration processes...
+        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));
+
+        DestinationViewMBean queue = getQueueMBean(TEST_INONLY_DESTINATION_NAME);
+        assertEquals("There were unexpected messages left in the queue: " + TEST_INONLY_DESTINATION_NAME,
+                0, queue.getQueueSize());
+    }
+
+    @Override
+    protected void configureBroker(BrokerService broker) throws Exception {
+        broker.setUseJmx(true);
+        broker.setPersistent(true);
+        broker.setDataDirectory("target/activemq-data");
+        broker.deleteAllMessages();
+        broker.setAdvisorySupport(true);
+        broker.addConnector(brokerUri);
+
+        // configure expiration rate
+        ActiveMQQueue queueName = new ActiveMQQueue(">");
+        PolicyEntry entry = new PolicyEntry();
+        entry.setDestination(queueName);
+        entry.setExpireMessagesPeriod(1000);
+
+        PolicyMap policyMap = new PolicyMap();
+        policyMap.put(queueName, entry);
+        broker.setDestinationPolicy(policyMap);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("sjms:topic:ActiveMQ.Advisory.Expired.Queue.>")
+                        .routeId(EXPIRED_MESSAGE_ROUTE_ID)
+                        .to("mock:expiredAdvisory");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3f47a99a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
deleted file mode 100644
index 36d0827..0000000
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.component.sjms.producer;
-
-
-import java.util.concurrent.TimeUnit;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.DestinationViewMBean;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.sjms.support.JmsTestSupport;
-import org.junit.Test;
-
-
-public class QueueProduerQoSTest extends JmsTestSupport {
-
-    private static final String TEST_INONLY_DESTINATION_NAME = "queue.producer.test.qos.inonly";
-    private static final String TEST_INOUT_DESTINATION_NAME = "queue.producer.test.qos.inout";
-
-    private static final String EXPIRED_MESSAGE_ROUTE_ID = "expiredAdvisoryRoute";
-
-    @Test
-    public void testInOutQueueProducerTTL() throws Exception {
-
-        NotifyBuilder expireMatcher = new NotifyBuilder(context)
-                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
-
-        String endpoint = String.format("sjms:queue:%s?ttl=1000&exchangePattern=InOut&responseTimeOut=500", TEST_INOUT_DESTINATION_NAME);
-
-        try {
-            template.requestBody(endpoint, "test message");
-            fail("we aren't expecting any consumers, so should not succeed");
-        } catch (Exception e) {
-            // we are expecting an exception here because there are no consumers on this queue,
-            // so we will not be able to do a real InOut/request-response, but that's okay
-            // we're just interested in the message becoming expired
-        }
-
-        // we should delay a bit so broker can run its expiration processes...
-        expireMatcher.matches(2, TimeUnit.SECONDS);
-
-        DestinationViewMBean queue = getQueueMBean(TEST_INOUT_DESTINATION_NAME);
-        assertEquals("There were unexpected messages left in the queue: " + TEST_INOUT_DESTINATION_NAME,
-                0, queue.getQueueSize());
-    }
-
-    @Test
-    public void testInOnlyQueueProducerTTL() throws Exception {
-        NotifyBuilder expireMatcher = new NotifyBuilder(context)
-                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
-
-        String endpoint = String.format("sjms:queue:%s?ttl=1000", TEST_INONLY_DESTINATION_NAME);
-        template.sendBody(endpoint, "test message");
-
-        // we should delay a bit so broker can run its expiration processes...
-        expireMatcher.matches(2, TimeUnit.SECONDS);
-
-
-        DestinationViewMBean queue = getQueueMBean(TEST_INONLY_DESTINATION_NAME);
-        assertEquals("There were unexpected messages left in the queue: " + TEST_INONLY_DESTINATION_NAME,
-                0, queue.getQueueSize());
-    }
-
-    @Override
-    protected void configureBroker(BrokerService broker) throws Exception {
-        broker.setUseJmx(true);
-        broker.setPersistent(true);
-        broker.setDataDirectory("target/activemq-data");
-        broker.deleteAllMessages();
-        broker.setAdvisorySupport(true);
-        broker.addConnector(brokerUri);
-
-        // configure expiration rate
-        ActiveMQQueue queueName = new ActiveMQQueue(">");
-        PolicyEntry entry = new PolicyEntry();
-        entry.setDestination(queueName);
-        entry.setExpireMessagesPeriod(1000);
-
-        PolicyMap policyMap = new PolicyMap();
-        policyMap.put(queueName, entry);
-        broker.setDestinationPolicy(policyMap);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("sjms:topic:ActiveMQ.Advisory.Expired.Queue.>")
-                        .routeId(EXPIRED_MESSAGE_ROUTE_ID)
-                        .to("mock:expiredAdvisory");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/3f47a99a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
index 6bf4ff8..7b3e1f7 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
@@ -55,6 +55,8 @@ public class JmsTestSupport extends CamelTestSupport {
      */
     @Override
     protected void doPreSetup() throws Exception {
+        deleteDirectory("target/activemq-data");
+
         brokerUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable(33333);
 
         broker = new BrokerService();


[3/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d22d33ae
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d22d33ae
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d22d33ae

Branch: refs/heads/master
Commit: d22d33ae49946d8ed2586590872d19eb16b3acf5
Parents: f622f8e
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:22:43 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:22:43 2014 +0100

----------------------------------------------------------------------
 .../component/quartz2/QuartzRouteFireNowTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d22d33ae/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
index c45b3c4..d45f21d 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
@@ -17,11 +17,26 @@
 package org.apache.camel.component.quartz2;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
 
 /**
  * @version 
  */
 public class QuartzRouteFireNowTest extends BaseQuartzTest {
+
+    protected MockEndpoint resultEndpoint;
+
+    @Test
+    public void testQuartzRoute() throws Exception {
+        resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedMessageCount(2);
+        resultEndpoint.message(0).header("triggerName").isEqualTo("myTimerName");
+        resultEndpoint.message(0).header("triggerGroup").isEqualTo("myGroup");
+
+        // lets test the receive worked
+        resultEndpoint.assertIsSatisfied();
+    }
     
     @Override
     protected RouteBuilder createRouteBuilder() {


[2/9] git commit: Fixing test and polished.

Posted by da...@apache.org.
Fixing test and polished.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f622f8e7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f622f8e7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f622f8e7

Branch: refs/heads/master
Commit: f622f8e736694ffe205b536998847535dad87c66
Parents: cd40f68
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:15:26 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:15:26 2014 +0100

----------------------------------------------------------------------
 .../dataformat/zipfile/ZipFileDataFormat.java   |  3 +-
 .../camel/dataformat/zipfile/ZipIterator.java   | 12 +++-----
 .../camel/dataformat/zipfile/ZipSplitter.java   |  1 -
 .../zipfile/ZipAggregationStrategyTest.java     | 32 ++++++++++++--------
 4 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f622f8e7/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
index 78336f4..884c608 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
@@ -86,8 +86,7 @@ public class ZipFileDataFormat implements DataFormat {
 
                 entry = zis.getNextEntry();
                 if (entry != null) {
-                    throw new IllegalStateException(
-                            "Zip file has more than 1 entry.");
+                    throw new IllegalStateException("Zip file has more than 1 entry.");
                 }
 
                 return baos.toByteArray();

http://git-wip-us.apache.org/repos/asf/camel/blob/f622f8e7/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
index d4ac227..dc8b714 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.impl.DefaultMessage;
+import org.apache.camel.util.IOHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,7 +71,7 @@ class ZipIterator implements Iterator<Message> {
             }
             return availableDataInCurrentEntry;            
         } catch (IOException e) {
-            LOGGER.error("Fail hasNext()", e);
+            LOGGER.warn("Fail hasNext()", e);
             return false;            
         }
     }
@@ -114,13 +115,8 @@ class ZipIterator implements Iterator<Message> {
 
     public void checkNullAnswer(Message answer) {
         if (answer == null && zipInputStream != null) {
-            try {
-                zipInputStream.close();
-            } catch (IOException ignore) {
-                // Do nothing here
-            } finally {
-                zipInputStream = null;
-            }            
+            IOHelper.close(zipInputStream);
+            zipInputStream = null;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f622f8e7/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
index df195f2..04e7ec6 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
@@ -25,7 +25,6 @@ import org.apache.camel.Message;
  * Based on the thread <a href=
  * "http://camel.465427.n5.nabble.com/zip-file-best-practices-td5713437.html"
  * >zip file best practices</a>
- * 
  */
 public class ZipSplitter implements Expression {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f622f8e7/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
index be473fe..9141984 100644
--- a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
+++ b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
@@ -16,35 +16,40 @@
  */
 package org.apache.camel.processor.aggregate.zipfile;
 
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.file.GenericFileMessage;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.junit.Test;
 
 public class ZipAggregationStrategyTest extends CamelTestSupport {
 
     private static final int EXPECTED_NO_FILES = 3;
 
+    @Override
+    public void setUp() throws Exception {
+        deleteDirectory("target/out");
+        super.setUp();
+    }
+
     @Test
     public void testSplitter() throws Exception {
-        MockEndpoint aggregateToZipEntry = getMockEndpoint("mock:aggregateToZipEntry");
-        aggregateToZipEntry.expectedMessageCount(1);
+        MockEndpoint mock = getMockEndpoint("mock:aggregateToZipEntry");
+        mock.expectedMessageCount(1);
+
         assertMockEndpointsSatisfied();
 
-        Exchange out = aggregateToZipEntry.getExchanges().get(0);
-        assertTrue("Result message does not contain GenericFileMessage", GenericFileMessage.class.isAssignableFrom(out.getIn().getClass()));
-        File resultFile = out.getIn().getBody(File.class);
-        assertNotNull(resultFile);
-        assertTrue("Zip file should exist", resultFile.isFile());
-        assertTrue("Result file name does not end with .zip", resultFile.getName().endsWith(".zip"));
+        Thread.sleep(500);
+
+        File[] files = new File("target/out").listFiles();
+        assertTrue("Should be a file in target/out directory", files.length > 0);
+
+        File resultFile = files[0];
 
         ZipInputStream zin = new ZipInputStream(new FileInputStream(resultFile));
         try {
@@ -55,7 +60,7 @@ public class ZipAggregationStrategyTest extends CamelTestSupport {
             assertTrue("Zip file should contains " + ZipAggregationStrategyTest.EXPECTED_NO_FILES + " files",
                        fileCount == ZipAggregationStrategyTest.EXPECTED_NO_FILES);
         } finally {
-            zin.close();
+            IOHelper.close(zin);
         }
     }
 
@@ -70,8 +75,9 @@ public class ZipAggregationStrategyTest extends CamelTestSupport {
                         .constant(true)
                         .completionFromBatchConsumer()
                         .eagerCheckCompletion()
+                    .to("file:target/out")
                     .to("mock:aggregateToZipEntry")
-                    .log("Done processing big file: ${header.CamelFileName}");
+                    .log("Done processing zip file: ${header.CamelFileName}");
             }
         };
 


[4/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6c0f9bef
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6c0f9bef
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6c0f9bef

Branch: refs/heads/master
Commit: 6c0f9bef6ec60938e03a3dd388b2e373d71f6bd7
Parents: d22d33a
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:35:35 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:35:35 2014 +0100

----------------------------------------------------------------------
 .../sjms/producer/QueueProducerQoSTest.java     | 109 ++++++++++++++++++
 .../sjms/producer/QueueProduerQoSTest.java      | 112 -------------------
 .../component/sjms/support/JmsTestSupport.java  |   2 +
 3 files changed, 111 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6c0f9bef/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
new file mode 100644
index 0000000..c82842a
--- /dev/null
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProducerQoSTest.java
@@ -0,0 +1,109 @@
+/**
+ * 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.component.sjms.producer;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.DestinationViewMBean;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.sjms.support.JmsTestSupport;
+import org.junit.Test;
+
+public class QueueProducerQoSTest extends JmsTestSupport {
+
+    private static final String TEST_INONLY_DESTINATION_NAME = "queue.producer.test.qos.inonly";
+    private static final String TEST_INOUT_DESTINATION_NAME = "queue.producer.test.qos.inout";
+
+    private static final String EXPIRED_MESSAGE_ROUTE_ID = "expiredAdvisoryRoute";
+
+    @Test
+    public void testInOutQueueProducerTTL() throws Exception {
+
+        NotifyBuilder expireMatcher = new NotifyBuilder(context)
+                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
+
+        String endpoint = String.format("sjms:queue:%s?ttl=1000&exchangePattern=InOut&responseTimeOut=500", TEST_INOUT_DESTINATION_NAME);
+
+        try {
+            template.requestBody(endpoint, "test message");
+            fail("we aren't expecting any consumers, so should not succeed");
+        } catch (Exception e) {
+            // we are expecting an exception here because there are no consumers on this queue,
+            // so we will not be able to do a real InOut/request-response, but that's okay
+            // we're just interested in the message becoming expired
+        }
+
+        // we should delay a bit so broker can run its expiration processes...
+        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));
+
+        DestinationViewMBean queue = getQueueMBean(TEST_INOUT_DESTINATION_NAME);
+        assertEquals("There were unexpected messages left in the queue: " + TEST_INOUT_DESTINATION_NAME,
+                0, queue.getQueueSize());
+    }
+
+    @Test
+    public void testInOnlyQueueProducerTTL() throws Exception {
+        NotifyBuilder expireMatcher = new NotifyBuilder(context)
+                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
+
+        String endpoint = String.format("sjms:queue:%s?ttl=1000", TEST_INONLY_DESTINATION_NAME);
+        template.sendBody(endpoint, "test message");
+
+        // we should delay a bit so broker can run its expiration processes...
+        assertFalse(expireMatcher.matches(2, TimeUnit.SECONDS));
+
+        DestinationViewMBean queue = getQueueMBean(TEST_INONLY_DESTINATION_NAME);
+        assertEquals("There were unexpected messages left in the queue: " + TEST_INONLY_DESTINATION_NAME,
+                0, queue.getQueueSize());
+    }
+
+    @Override
+    protected void configureBroker(BrokerService broker) throws Exception {
+        broker.setUseJmx(true);
+        broker.setPersistent(true);
+        broker.setDataDirectory("target/activemq-data");
+        broker.deleteAllMessages();
+        broker.setAdvisorySupport(true);
+        broker.addConnector(brokerUri);
+
+        // configure expiration rate
+        ActiveMQQueue queueName = new ActiveMQQueue(">");
+        PolicyEntry entry = new PolicyEntry();
+        entry.setDestination(queueName);
+        entry.setExpireMessagesPeriod(1000);
+
+        PolicyMap policyMap = new PolicyMap();
+        policyMap.put(queueName, entry);
+        broker.setDestinationPolicy(policyMap);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("sjms:topic:ActiveMQ.Advisory.Expired.Queue.>")
+                        .routeId(EXPIRED_MESSAGE_ROUTE_ID)
+                        .to("mock:expiredAdvisory");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/6c0f9bef/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
deleted file mode 100644
index 36d0827..0000000
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/QueueProduerQoSTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.component.sjms.producer;
-
-
-import java.util.concurrent.TimeUnit;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.DestinationViewMBean;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.sjms.support.JmsTestSupport;
-import org.junit.Test;
-
-
-public class QueueProduerQoSTest extends JmsTestSupport {
-
-    private static final String TEST_INONLY_DESTINATION_NAME = "queue.producer.test.qos.inonly";
-    private static final String TEST_INOUT_DESTINATION_NAME = "queue.producer.test.qos.inout";
-
-    private static final String EXPIRED_MESSAGE_ROUTE_ID = "expiredAdvisoryRoute";
-
-    @Test
-    public void testInOutQueueProducerTTL() throws Exception {
-
-        NotifyBuilder expireMatcher = new NotifyBuilder(context)
-                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
-
-        String endpoint = String.format("sjms:queue:%s?ttl=1000&exchangePattern=InOut&responseTimeOut=500", TEST_INOUT_DESTINATION_NAME);
-
-        try {
-            template.requestBody(endpoint, "test message");
-            fail("we aren't expecting any consumers, so should not succeed");
-        } catch (Exception e) {
-            // we are expecting an exception here because there are no consumers on this queue,
-            // so we will not be able to do a real InOut/request-response, but that's okay
-            // we're just interested in the message becoming expired
-        }
-
-        // we should delay a bit so broker can run its expiration processes...
-        expireMatcher.matches(2, TimeUnit.SECONDS);
-
-        DestinationViewMBean queue = getQueueMBean(TEST_INOUT_DESTINATION_NAME);
-        assertEquals("There were unexpected messages left in the queue: " + TEST_INOUT_DESTINATION_NAME,
-                0, queue.getQueueSize());
-    }
-
-    @Test
-    public void testInOnlyQueueProducerTTL() throws Exception {
-        NotifyBuilder expireMatcher = new NotifyBuilder(context)
-                .fromRoute(EXPIRED_MESSAGE_ROUTE_ID).whenCompleted(1).create();
-
-        String endpoint = String.format("sjms:queue:%s?ttl=1000", TEST_INONLY_DESTINATION_NAME);
-        template.sendBody(endpoint, "test message");
-
-        // we should delay a bit so broker can run its expiration processes...
-        expireMatcher.matches(2, TimeUnit.SECONDS);
-
-
-        DestinationViewMBean queue = getQueueMBean(TEST_INONLY_DESTINATION_NAME);
-        assertEquals("There were unexpected messages left in the queue: " + TEST_INONLY_DESTINATION_NAME,
-                0, queue.getQueueSize());
-    }
-
-    @Override
-    protected void configureBroker(BrokerService broker) throws Exception {
-        broker.setUseJmx(true);
-        broker.setPersistent(true);
-        broker.setDataDirectory("target/activemq-data");
-        broker.deleteAllMessages();
-        broker.setAdvisorySupport(true);
-        broker.addConnector(brokerUri);
-
-        // configure expiration rate
-        ActiveMQQueue queueName = new ActiveMQQueue(">");
-        PolicyEntry entry = new PolicyEntry();
-        entry.setDestination(queueName);
-        entry.setExpireMessagesPeriod(1000);
-
-        PolicyMap policyMap = new PolicyMap();
-        policyMap.put(queueName, entry);
-        broker.setDestinationPolicy(policyMap);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("sjms:topic:ActiveMQ.Advisory.Expired.Queue.>")
-                        .routeId(EXPIRED_MESSAGE_ROUTE_ID)
-                        .to("mock:expiredAdvisory");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/6c0f9bef/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
index 6bf4ff8..7b3e1f7 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/JmsTestSupport.java
@@ -55,6 +55,8 @@ public class JmsTestSupport extends CamelTestSupport {
      */
     @Override
     protected void doPreSetup() throws Exception {
+        deleteDirectory("target/activemq-data");
+
         brokerUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable(33333);
 
         broker = new BrokerService();


[9/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/83e80c5e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/83e80c5e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/83e80c5e

Branch: refs/heads/camel-2.12.x
Commit: 83e80c5ed645f194fe7bc8e0fee45eb78d231eb3
Parents: 3f47a99
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:47:57 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:53:53 2014 +0100

----------------------------------------------------------------------
 .../component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/83e80c5e/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
index bb30ab1..a2e3a91 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
@@ -65,9 +65,14 @@ public class JmsInOnlyWithReplyToHeaderTopicTest extends CamelTestSupport {
             public void configure() throws Exception {
                 from("activemq:queue:foo")
                     .transform(body().prepend("Hello "))
+                    .to("log:result")
                     .to("mock:result");
 
-                from("activemq:topic:bar").to("mock:bar");
+                // we should disable reply to to avoid sending the message back to our self
+                // after we have consumed it
+                from("activemq:topic:bar?disableReplyTo=true")
+                    .to("log:bar")
+                    .to("mock:bar");
             }
         };
     }


[6/9] git commit: Fixing test and polished.

Posted by da...@apache.org.
Fixing test and polished.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d8017044
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d8017044
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d8017044

Branch: refs/heads/camel-2.12.x
Commit: d80170440f5a0d267b97d159cf51382c2e859760
Parents: 90fac66
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:15:26 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:49:20 2014 +0100

----------------------------------------------------------------------
 .../dataformat/zipfile/ZipFileDataFormat.java   |  3 +-
 .../camel/dataformat/zipfile/ZipIterator.java   | 12 +++-----
 .../camel/dataformat/zipfile/ZipSplitter.java   |  1 -
 .../zipfile/ZipAggregationStrategyTest.java     | 32 ++++++++++++--------
 4 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d8017044/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
index 78336f4..884c608 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java
@@ -86,8 +86,7 @@ public class ZipFileDataFormat implements DataFormat {
 
                 entry = zis.getNextEntry();
                 if (entry != null) {
-                    throw new IllegalStateException(
-                            "Zip file has more than 1 entry.");
+                    throw new IllegalStateException("Zip file has more than 1 entry.");
                 }
 
                 return baos.toByteArray();

http://git-wip-us.apache.org/repos/asf/camel/blob/d8017044/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
index d4ac227..dc8b714 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java
@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.impl.DefaultMessage;
+import org.apache.camel.util.IOHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,7 +71,7 @@ class ZipIterator implements Iterator<Message> {
             }
             return availableDataInCurrentEntry;            
         } catch (IOException e) {
-            LOGGER.error("Fail hasNext()", e);
+            LOGGER.warn("Fail hasNext()", e);
             return false;            
         }
     }
@@ -114,13 +115,8 @@ class ZipIterator implements Iterator<Message> {
 
     public void checkNullAnswer(Message answer) {
         if (answer == null && zipInputStream != null) {
-            try {
-                zipInputStream.close();
-            } catch (IOException ignore) {
-                // Do nothing here
-            } finally {
-                zipInputStream = null;
-            }            
+            IOHelper.close(zipInputStream);
+            zipInputStream = null;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d8017044/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
index df195f2..04e7ec6 100644
--- a/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
+++ b/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipSplitter.java
@@ -25,7 +25,6 @@ import org.apache.camel.Message;
  * Based on the thread <a href=
  * "http://camel.465427.n5.nabble.com/zip-file-best-practices-td5713437.html"
  * >zip file best practices</a>
- * 
  */
 public class ZipSplitter implements Expression {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d8017044/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
index be473fe..9141984 100644
--- a/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
+++ b/components/camel-zipfile/src/test/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategyTest.java
@@ -16,35 +16,40 @@
  */
 package org.apache.camel.processor.aggregate.zipfile;
 
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.file.GenericFileMessage;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IOHelper;
 import org.junit.Test;
 
 public class ZipAggregationStrategyTest extends CamelTestSupport {
 
     private static final int EXPECTED_NO_FILES = 3;
 
+    @Override
+    public void setUp() throws Exception {
+        deleteDirectory("target/out");
+        super.setUp();
+    }
+
     @Test
     public void testSplitter() throws Exception {
-        MockEndpoint aggregateToZipEntry = getMockEndpoint("mock:aggregateToZipEntry");
-        aggregateToZipEntry.expectedMessageCount(1);
+        MockEndpoint mock = getMockEndpoint("mock:aggregateToZipEntry");
+        mock.expectedMessageCount(1);
+
         assertMockEndpointsSatisfied();
 
-        Exchange out = aggregateToZipEntry.getExchanges().get(0);
-        assertTrue("Result message does not contain GenericFileMessage", GenericFileMessage.class.isAssignableFrom(out.getIn().getClass()));
-        File resultFile = out.getIn().getBody(File.class);
-        assertNotNull(resultFile);
-        assertTrue("Zip file should exist", resultFile.isFile());
-        assertTrue("Result file name does not end with .zip", resultFile.getName().endsWith(".zip"));
+        Thread.sleep(500);
+
+        File[] files = new File("target/out").listFiles();
+        assertTrue("Should be a file in target/out directory", files.length > 0);
+
+        File resultFile = files[0];
 
         ZipInputStream zin = new ZipInputStream(new FileInputStream(resultFile));
         try {
@@ -55,7 +60,7 @@ public class ZipAggregationStrategyTest extends CamelTestSupport {
             assertTrue("Zip file should contains " + ZipAggregationStrategyTest.EXPECTED_NO_FILES + " files",
                        fileCount == ZipAggregationStrategyTest.EXPECTED_NO_FILES);
         } finally {
-            zin.close();
+            IOHelper.close(zin);
         }
     }
 
@@ -70,8 +75,9 @@ public class ZipAggregationStrategyTest extends CamelTestSupport {
                         .constant(true)
                         .completionFromBatchConsumer()
                         .eagerCheckCompletion()
+                    .to("file:target/out")
                     .to("mock:aggregateToZipEntry")
-                    .log("Done processing big file: ${header.CamelFileName}");
+                    .log("Done processing zip file: ${header.CamelFileName}");
             }
         };
 


[5/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/932f4098
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/932f4098
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/932f4098

Branch: refs/heads/master
Commit: 932f4098fe000af97b07af406b2bc15620f342ea
Parents: 6c0f9be
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:47:57 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:47:57 2014 +0100

----------------------------------------------------------------------
 .../component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/932f4098/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
index bb30ab1..a2e3a91 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOnlyWithReplyToHeaderTopicTest.java
@@ -65,9 +65,14 @@ public class JmsInOnlyWithReplyToHeaderTopicTest extends CamelTestSupport {
             public void configure() throws Exception {
                 from("activemq:queue:foo")
                     .transform(body().prepend("Hello "))
+                    .to("log:result")
                     .to("mock:result");
 
-                from("activemq:topic:bar").to("mock:bar");
+                // we should disable reply to to avoid sending the message back to our self
+                // after we have consumed it
+                from("activemq:topic:bar?disableReplyTo=true")
+                    .to("log:bar")
+                    .to("mock:bar");
             }
         };
     }


[7/9] git commit: Fixed test

Posted by da...@apache.org.
Fixed test

Conflicts:
	components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e7f96950
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e7f96950
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e7f96950

Branch: refs/heads/camel-2.12.x
Commit: e7f9695092b56475d95a07741669330c9905dfe4
Parents: d801704
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Mar 11 09:22:43 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 11 09:53:28 2014 +0100

----------------------------------------------------------------------
 .../component/quartz2/QuartzRouteFireNowTest.java | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e7f96950/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
index b7e4273..1d480ef 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzRouteFireNowTest.java
@@ -17,11 +17,27 @@
 package org.apache.camel.component.quartz2;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
 
 /**
  * @version 
  */
-public class QuartzRouteFireNowTest extends QuartzRouteTest {
+public class QuartzRouteFireNowTest extends CamelTestSupport {
+
+    protected MockEndpoint resultEndpoint;
+
+    @Test
+    public void testQuartzRoute() throws Exception {
+        resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedMessageCount(2);
+        resultEndpoint.message(0).header("triggerName").isEqualTo("myTimerName");
+        resultEndpoint.message(0).header("triggerGroup").isEqualTo("myGroup");
+
+        // lets test the receive worked
+        resultEndpoint.assertIsSatisfied();
+    }
     
     @Override
     protected RouteBuilder createRouteBuilder() {