Author: davsclaus
Date: Sun Jul 24 12:54:33 2011
New Revision: 1150345
URL: http://svn.apache.org/viewvc?rev=1150345&view=rev
Log:
CAMEL-4263: Fixed issue with not registering components/endpoints/servies when
using bean annotations.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBean.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBeanRef.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.java
- copied, changed from r1150300,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxDumpRoutesAsXmlTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml
- copied, changed from r1150300,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedStatisticsLevelOffTest.xml
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=1150345&r1=1150344&r2=1150345&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
Sun Jul 24 12:54:33 2011
@@ -16,6 +16,7 @@
*/
package org.apache.camel.management;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -89,6 +90,7 @@ public class DefaultManagementLifecycleS
private static final Logger LOG =
LoggerFactory.getLogger(DefaultManagementLifecycleStrategy.class);
private final Map<Processor, KeyValueHolder<ProcessorDefinition,
InstrumentationProcessor>> wrappedProcessors =
new HashMap<Processor, KeyValueHolder<ProcessorDefinition,
InstrumentationProcessor>>();
+ private final List<PreRegisterService> preServices = new
ArrayList<PreRegisterService>();
private CamelContext camelContext;
private volatile boolean initialized;
private final Set<String> knowRouteIds = new HashSet<String>();
@@ -171,6 +173,9 @@ public class DefaultManagementLifecycleS
// yes we made it and are initialized
initialized = true;
+
+ // register any pre registered now that we are initialized
+ enlistPreRegisteredServices();
}
private String findFreeName(Object mc, CamelContextNameStrategy strategy,
String managementName) throws MalformedObjectNameException {
@@ -196,6 +201,35 @@ public class DefaultManagementLifecycleS
return name;
}
+ /**
+ * After {@link CamelContext} has been enlisted in JMX using {@link
#onContextStart(org.apache.camel.CamelContext)}
+ * then we can enlist any pre registered services as well, as we had to
wait for {@link CamelContext} to be
+ * enlisted first.
+ * <p/>
+ * A component/endpoint/service etc. can be pre registered when using
dependency injection and annotations such as
+ * {@link org.apache.camel.Produce}, {@link
org.apache.camel.EndpointInject}. Therefore we need to capture those
+ * registrations up front, and then afterwards enlist in JMX when {@link
CamelContext} is being started.
+ */
+ private void enlistPreRegisteredServices() {
+ if (preServices.isEmpty()) {
+ return;
+ }
+
+ LOG.debug("Registering {} pre registered services",
preServices.size());
+ for (PreRegisterService pre : preServices) {
+ if (pre.getComponent() != null) {
+ onComponentAdd(pre.getName(), pre.getComponent());
+ } else if (pre.getEndpoint() != null) {
+ onEndpointAdd(pre.getEndpoint());
+ } else if (pre.getService() != null) {
+ onServiceAdd(pre.getCamelContext(), pre.getService(),
pre.getRoute());
+ }
+ }
+
+ // we are done so clear the list
+ preServices.clear();
+ }
+
public void onContextStop(CamelContext context) {
// the agent hasn't been started
if (!initialized) {
@@ -215,6 +249,10 @@ public class DefaultManagementLifecycleS
public void onComponentAdd(String name, Component component) {
// always register components as there are only a few of those
if (!initialized) {
+ // pre register so we can register later when we have been
initialized
+ PreRegisterService pre = new PreRegisterService();
+ pre.onComponentAdd(name, component);
+ preServices.add(pre);
return;
}
try {
@@ -246,6 +284,14 @@ public class DefaultManagementLifecycleS
* @param endpoint the Endpoint attempted to be added
*/
public void onEndpointAdd(Endpoint endpoint) {
+ if (!initialized) {
+ // pre register so we can register later when we have been
initialized
+ PreRegisterService pre = new PreRegisterService();
+ pre.onEndpointAdd(endpoint);
+ preServices.add(pre);
+ return;
+ }
+
if (!shouldRegister(endpoint, null)) {
// avoid registering if not needed
return;
@@ -278,6 +324,14 @@ public class DefaultManagementLifecycleS
}
public void onServiceAdd(CamelContext context, Service service, Route
route) {
+ if (!initialized) {
+ // pre register so we can register later when we have been
initialized
+ PreRegisterService pre = new PreRegisterService();
+ pre.onServiceAdd(context, service, route);
+ preServices.add(pre);
+ return;
+ }
+
// services can by any kind of misc type but also processors
// so we have special logic when its a processor
@@ -614,6 +668,7 @@ public class DefaultManagementLifecycleS
public void stop() throws Exception {
initialized = false;
knowRouteIds.clear();
+ preServices.clear();
}
/**
@@ -663,5 +718,59 @@ public class DefaultManagementLifecycleS
return false;
}
+ /**
+ * Class which holds any pre registration details.
+ *
+ * @see
org.apache.camel.management.DefaultManagementLifecycleStrategy#enlistPreRegisteredServices()
+ */
+ private final class PreRegisterService {
+
+ private String name;
+ private Component component;
+ private Endpoint endpoint;
+ private CamelContext camelContext;
+ private Service service;
+ private Route route;
+
+ public void onComponentAdd(String name, Component component) {
+ this.name = name;
+ this.component = component;
+ }
+
+ public void onEndpointAdd(Endpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void onServiceAdd(CamelContext camelContext, Service service,
Route route) {
+ this.camelContext = camelContext;
+ this.service = service;
+ this.route = route;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public Endpoint getEndpoint() {
+ return endpoint;
+ }
+
+ public CamelContext getCamelContext() {
+ return camelContext;
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public Route getRoute() {
+ return route;
+ }
+ }
+
}
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBean.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBean.java?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBean.java
(added)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBean.java
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,33 @@
+/**
+ * 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.management;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+
+/**
+ *
+ */
+public class MyBean {
+
+ @EndpointInject(uri = "seda:foo")
+ private ProducerTemplate template;
+
+ public void doSomething(String body) {
+ template.sendBody(body);
+ }
+}
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBeanRef.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBeanRef.java?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBeanRef.java
(added)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/MyBeanRef.java
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,33 @@
+/**
+ * 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.management;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+
+/**
+ *
+ */
+public class MyBeanRef {
+
+ @EndpointInject(ref = "foo")
+ private ProducerTemplate template;
+
+ public void doSomething(String body) {
+ template.sendBody(body);
+ }
+}
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.java?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.java
(added)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.java
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,56 @@
+/**
+ * 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.management;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version
+ */
+public class SpringJmxEndpointInjectBeanRefTest extends SpringTestSupport {
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new
ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml");
+ }
+
+ protected MBeanServer getMBeanServer() {
+ return
context.getManagementStrategy().getManagementAgent().getMBeanServer();
+ }
+
+ public void testJmxEndpointInjectBean() throws Exception {
+ MBeanServer mbeanServer = getMBeanServer();
+
+ ObjectName on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=components,name=\"seda\"");
+ assertTrue(mbeanServer.isRegistered(on));
+
+ on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=endpoints,name=\"seda://foo\"");
+ assertTrue(mbeanServer.isRegistered(on));
+ String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
+ assertEquals("seda://foo", uri);
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+ template.sendBody("direct:start", "Hello World");
+ assertMockEndpointsSatisfied();
+ }
+
+}
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.java?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.java
(added)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.java
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,56 @@
+/**
+ * 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.management;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version
+ */
+public class SpringJmxEndpointInjectBeanRefTwoTest extends SpringTestSupport {
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new
ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml");
+ }
+
+ protected MBeanServer getMBeanServer() {
+ return
context.getManagementStrategy().getManagementAgent().getMBeanServer();
+ }
+
+ public void testJmxEndpointInjectBean() throws Exception {
+ MBeanServer mbeanServer = getMBeanServer();
+
+ ObjectName on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=components,name=\"seda\"");
+ assertTrue(mbeanServer.isRegistered(on));
+
+ on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=endpoints,name=\"seda://foo\"");
+ assertTrue(mbeanServer.isRegistered(on));
+ String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
+ assertEquals("seda://foo", uri);
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+ template.sendBody("direct:start", "Hello World");
+ assertMockEndpointsSatisfied();
+ }
+
+}
Copied:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.java
(from r1150300,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxDumpRoutesAsXmlTest.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxDumpRoutesAsXmlTest.java&r1=1150300&r2=1150345&rev=1150345&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxDumpRoutesAsXmlTest.java
(original)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.java
Sun Jul 24 12:54:33 2011
@@ -26,32 +26,31 @@ import org.springframework.context.suppo
/**
* @version
*/
-public class SpringJmxDumpRoutesAsXmlTest extends SpringTestSupport {
+public class SpringJmxEndpointInjectBeanTest extends SpringTestSupport {
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
- return new
ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringJmxDumpRouteAsXmlTest.xml");
+ return new
ClassPathXmlApplicationContext("org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml");
}
protected MBeanServer getMBeanServer() {
return
context.getManagementStrategy().getManagementAgent().getMBeanServer();
}
- public void testJmxDumpRoutesAsXml() throws Exception {
+ public void testJmxEndpointInjectBean() throws Exception {
MBeanServer mbeanServer = getMBeanServer();
- ObjectName on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=context,name=\"camel-1\"");
- String xml = (String) mbeanServer.invoke(on, "dumpRoutesAsXml", null,
null);
- assertNotNull(xml);
- log.info(xml);
-
- assertTrue(xml.contains("route"));
- assertTrue(xml.contains("myRoute"));
- assertTrue(xml.contains("myOtherRoute"));
- assertTrue(xml.contains("direct:start"));
- assertTrue(xml.contains("mock:result"));
- assertTrue(xml.contains("seda:bar"));
- assertTrue(xml.contains("mock:bar"));
+ ObjectName on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=components,name=\"seda\"");
+ assertTrue(mbeanServer.isRegistered(on));
+
+ on =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=endpoints,name=\"seda://foo\"");
+ assertTrue(mbeanServer.isRegistered(on));
+ String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
+ assertEquals("seda://foo", uri);
+
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+ template.sendBody("direct:start", "Hello World");
+ assertMockEndpointsSatisfied();
}
}
Added:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml
(added)
+++
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTest.xml
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="naming"
class="org.apache.camel.management.DefaultManagementNamingStrategy">
+ <property name="hostName" value="localhost"/>
+ <property name="domainName" value="org.apache.camel"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <!-- enable JMX -->
+ <jmxAgent id="agent" disabled="false"/>
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="bean:myBean"/>
+ </route>
+
+ <route>
+ <from uri="seda:foo" id="foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+ <bean id="myBean" class="org.apache.camel.spring.management.MyBeanRef"/>
+
+</beans>
Added:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml?rev=1150345&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml
(added)
+++
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanRefTwoTest.xml
Sun Jul 24 12:54:33 2011
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean id="naming"
class="org.apache.camel.management.DefaultManagementNamingStrategy">
+ <property name="hostName" value="localhost"/>
+ <property name="domainName" value="org.apache.camel"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <!-- enable JMX -->
+ <jmxAgent id="agent" disabled="false"/>
+
+ <!-- define endpoint -->
+ <endpoint id="foo" uri="seda:foo"/>
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="bean:myBean"/>
+ </route>
+
+ <route>
+ <from ref="foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+ <bean id="myBean" class="org.apache.camel.spring.management.MyBeanRef"/>
+
+</beans>
Copied:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml
(from r1150300,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedStatisticsLevelOffTest.xml)
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedStatisticsLevelOffTest.xml&r1=1150300&r2=1150345&rev=1150345&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedStatisticsLevelOffTest.xml
(original)
+++
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringJmxEndpointInjectBeanTest.xml
Sun Jul 24 12:54:33 2011
@@ -22,15 +22,28 @@
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <!-- START SNIPPET: example -->
- <camelContext xmlns="http://camel.apache.org/schema/spring">
- <jmxAgent id="agent" statisticsLevel="Off"/>
-
- <route>
- <from uri="direct:start"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
- <!-- END SNIPPET: example -->
+ <bean id="naming"
class="org.apache.camel.management.DefaultManagementNamingStrategy">
+ <property name="hostName" value="localhost"/>
+ <property name="domainName" value="org.apache.camel"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+ <!-- enable JMX -->
+ <jmxAgent id="agent" disabled="false"/>
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="bean:myBean"/>
+ </route>
+
+ <route>
+ <from uri="seda:foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+ <bean id="myBean" class="org.apache.camel.spring.management.MyBean"/>
</beans>