camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1307994 - in /camel/branches/camel-2.9.x: ./ camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
Date Sun, 01 Apr 2012 01:53:25 GMT
Author: hadrian
Date: Sun Apr  1 01:53:25 2012
New Revision: 1307994

URL: http://svn.apache.org/viewvc?rev=1307994&view=rev
Log:
Better ask for a mandatory conversion as otherwise a potentially failed conversion will not
be detected.

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
    svn:mergeinfo = /camel/trunk:1291256

Modified: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java?rev=1307994&r1=1307993&r2=1307994&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
Sun Apr  1 01:53:25 2012
@@ -22,6 +22,7 @@ import java.util.concurrent.ExecutorServ
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.impl.converter.StaticMethodTypeConverter;
 import org.apache.camel.util.StopWatch;
 
@@ -46,13 +47,18 @@ public class TypeConverterConcurrencyIss
             pool.submit(new Runnable() {
                 @Override
                 public void run() {
-                    MyCamelBean bean = context.getTypeConverter().convertTo(MyCamelBean.class,
"1;MyCamel");
-                    latch.countDown();
+                    try {
+                        context.getTypeConverter().mandatoryConvertTo(MyCamelBean.class,
"1;MyCamel");
+                        latch.countDown();
+                    } catch (NoTypeConversionAvailableException e) {
+                        // ignore, as the latch will not be decremented anymore so that the
assert below
+                        // will fail after the one minute timeout anyway
+                    }
                 }
             });
         }
         
-        assertTrue(latch.await(1, TimeUnit.MINUTES));
+        assertTrue("The expected mandatory conversions failed!", latch.await(1, TimeUnit.MINUTES));
         log.info("Took " + watch.stop() + " millis to convert " + size + " objects");
     }
     
@@ -63,5 +69,4 @@ public class TypeConverterConcurrencyIss
         bean.setName(data[1]);
         return bean;
     }
-
 }



Mime
View raw message