camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r681093 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/model/ProcessorType.java test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
Date Wed, 30 Jul 2008 15:51:43 GMT
Author: davsclaus
Date: Wed Jul 30 08:51:43 2008
New Revision: 681093

URL: http://svn.apache.org/viewvc?rev=681093&view=rev
Log:
CAMEL-771: A little better feedback on route mis configuration

Added:
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
  (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=681093&r1=681092&r2=681093&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Wed Jul 30 08:51:43 2008
@@ -1534,7 +1534,7 @@
     protected Processor wrapProcessorInInterceptors(RouteContext routeContext, Processor
target) throws Exception {
         // The target is required.
         if (target == null) {
-            throw new RuntimeCamelException("target not provided.");
+            throw new IllegalArgumentException("target not provided on node: " + this);
         }
 
         List<InterceptStrategy> strategies = new ArrayList<InterceptStrategy>();
@@ -1583,7 +1583,7 @@
     protected Processor wrapInErrorHandler(RouteContext routeContext, Processor target) throws
Exception {
         // The target is required.
         if (target == null) {
-            throw new RuntimeCamelException("target not provided.");
+            throw new IllegalArgumentException("target not provided on node: " + this);
         }
 
         ErrorHandlerWrappingStrategy strategy = routeContext.getErrorHandlerWrappingStrategy();

Added: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java?rev=681093&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
(added)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
Wed Jul 30 08:51:43 2008
@@ -0,0 +1,41 @@
+/**
+ * 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.model;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * Unit test to verify end-user exceptions for miss configuration
+ */
+public class ProcessorTypeConfigurationTest extends ContextTestSupport {
+
+    public void testProcessorRefMissConfigured() throws Exception {
+        try {
+            context.addRoutes(new RouteBuilder() {
+                public void configure() throws Exception {
+                    from("direct:in").processRef("hello");
+                }
+            });
+            fail("Should have thrown RuntimeCamelException");
+        } catch (IllegalArgumentException e) {
+            assertEquals("target not provided on node: Processor[ref:  hello]", e.getMessage());
+        }
+    }
+
+}

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/model/ProcessorTypeConfigurationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message