Author: ningjiang
Date: Sun Jul 27 21:10:48 2008
New Revision: 680249

URL: http://svn.apache.org/viewvc?rev=680249&view=rev
Log:
CAMEL-763 fixed the issue of setting ErrorHandler when the jmsAgent is disabled

Removed:
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringSetHeaderWithChildProcessorTest.java
Modified:
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLifecycleStrategy.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
    
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ContextErrorHandlerTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderTest.java
    
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLifecycleStrategy.java?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLifecycleStrategy.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultLifecycleStrategy.java
 Sun Jul 27 21:10:48 2008
@@ -16,13 +16,21 @@
  */
 package org.apache.camel.impl;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Route;
 import org.apache.camel.Service;
+import org.apache.camel.builder.DeadLetterChannelBuilder;
+import org.apache.camel.management.InstrumentationErrorHandlerWrappingStrategy;
+import org.apache.camel.management.InstrumentationProcessor;
+import org.apache.camel.model.ExceptionType;
+import org.apache.camel.model.ProcessorType;
+import org.apache.camel.model.RouteType;
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.RouteContext;
 
@@ -48,6 +56,21 @@
     }
 
     public void onRouteContextCreate(RouteContext routeContext) {
-        // do nothing
+
+        RouteType routeType = routeContext.getRoute();
+        if (routeType.getInputs() != null && !routeType.getInputs().isEmpty()) 
{
+            // configure the outputs
+            List<ProcessorType<?>> outputs = new 
ArrayList<ProcessorType<?>>(routeType.getOutputs());
+
+            // clearing the outputs
+            routeType.clearOutput();
+
+            // add the output configure the outputs with the routeType
+            for (ProcessorType<?> processorType : outputs) {
+                routeType.addOutput(processorType);
+            }
+
+        }
+
     }
 }

Modified: 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
 Sun Jul 27 21:10:48 2008
@@ -180,7 +180,7 @@
                 PerformanceCounter pc = new PerformanceCounter();
                 agent.register(pc, name);
 
-                // add to map now that it has ben registered
+                // add to map now that it has been registered
                 counterMap.put(processor, pc);
             } catch (MalformedObjectNameException e) {
                 LOG.warn("Could not create MBean name: " + name, e);

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=680249&r1=680248&r2=680249&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
 Sun Jul 27 21:10:48 2008
@@ -279,7 +279,7 @@
     }
 
     /**
-     * Creates an [EMAIL PROTECTED] 
org.apache.camel.processor.idempotent.IdempotentConsumer} 
+     * Creates an [EMAIL PROTECTED] 
org.apache.camel.processor.idempotent.IdempotentConsumer}
      * to avoid duplicate messages
      */
     public IdempotentConsumerType idempotentConsumer(Expression 
messageIdExpression,
@@ -1599,7 +1599,7 @@
         if (errorHandlerRef != null) {
             return new ErrorHandlerBuilderRef(errorHandlerRef);
         }
-        if (isInheritErrorHandler()) {            
+        if (isInheritErrorHandler()) {
             return new DeadLetterChannelBuilder();
         } else {
             return new NoErrorHandlerBuilder();

Modified: 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ContextErrorHandlerTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ContextErrorHandlerTest.java?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ContextErrorHandlerTest.java
 (original)
+++ 
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/ContextErrorHandlerTest.java
 Sun Jul 27 21:10:48 2008
@@ -90,14 +90,13 @@
         RouteBuilder builder = new RouteBuilder() {
             public void configure() {
                 from("seda:a").to("seda:b");
+                from("direct:c").to("direct:d");
             }
         };
 
         List<Route> list = getRouteList(builder);
-        assertEquals("Number routes created" + list, 1, list.size());
+        assertEquals("Number routes created" + list, 2, list.size());
         for (Route route : list) {
-            Endpoint key = route.getEndpoint();
-            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
 
             EventDrivenConsumerRoute consumerRoute = 
assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
             Processor processor = consumerRoute.getProcessor();

Modified: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
 Sun Jul 27 21:10:48 2008
@@ -36,16 +36,15 @@
     public void testEndpointConfiguration() throws Exception {
         CamelContext context = getMandatoryBean(CamelContext.class, "camel");
         List<Route> list = context.getRoutes();
-        assertEquals("Number routes created" + list, 1, list.size());
+        assertEquals("Number routes created" + list, 2, list.size());
         for (Route route : list) {
-            Endpoint key = route.getEndpoint();
-            assertEquals("From endpoint", "seda:a", key.getEndpointUri());
 
             EventDrivenConsumerRoute consumerRoute = 
assertIsInstanceOf(EventDrivenConsumerRoute.class, route);
             Processor processor = consumerRoute.getProcessor();
             processor = unwrap(processor);
 
             DeadLetterChannel deadLetterChannel = 
assertIsInstanceOf(DeadLetterChannel.class, processor);
+            System.out.println("The deadLetterChannel is " + 
deadLetterChannel);
 
             RedeliveryPolicy redeliveryPolicy = 
deadLetterChannel.getRedeliveryPolicy();
 

Modified: 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderTest.java?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringXPathHeaderTest.java
 Sun Jul 27 21:10:48 2008
@@ -1,10 +1,28 @@
+/**
+ * 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.spring.processor;
 
-import org.apache.camel.ContextTestSupport;
+
 import org.apache.camel.CamelContext;
-import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+import org.apache.camel.ContextTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 
+import static 
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
 /**
  * Spring basesd XPathHeaderTest.
  */

Modified: 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml?rev=680249&r1=680248&r2=680249&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
 (original)
+++ 
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/errorHandler.xml
 Sun Jul 27 21:10:48 2008
@@ -25,10 +25,15 @@
 
   <camelContext id="camel" errorHandlerRef="deadLetterErrorHandler"
    xmlns="http://activemq.apache.org/camel/schema/spring";>
+    <jmxAgent id="agent" disabled="true"/>
     <route>
       <from uri="seda:a"/>
       <to uri="seda:b"/>
     </route>
+    <route>
+       <from uri="direct:c"/>
+       <to uri="direct:d"/>
+    </route>
   </camelContext>
 
   <bean id="deadLetterErrorHandler"


Reply via email to