CAMEL-7999: apt compiler to generate json schema documentation for the model, whcih we later use to enrich the xml xsd to include documentation. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8081351f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8081351f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8081351f Branch: refs/heads/master Commit: 8081351ffae8da09d82b0339c7d5a1a667cc34c1 Parents: f93e1d5 Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Dec 31 15:33:35 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Dec 31 15:33:35 2014 +0100 ---------------------------------------------------------------------- .../management/ManagedCamelContextTest.java | 68 +----------- .../SpringManagedCamelContextTest.java | 104 +++++++++++++++++++ .../SpringManagedCamelContextTest.xml | 39 +++++++ 3 files changed, 144 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8081351f/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java index dd69908..b86766b 100644 --- a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java +++ b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextTest.java @@ -204,7 +204,7 @@ public class ManagedCamelContextTest extends ManagementTestSupport { Map<String, Properties> info = (Map<String, Properties>) mbeanServer.invoke(on, "findComponents", null, null); assertNotNull(info); - assertEquals(23, info.size()); + assertTrue(info.size() > 20); Properties prop = info.get("seda"); assertNotNull(prop); assertEquals("seda", prop.get("name")); @@ -212,72 +212,6 @@ public class ManagedCamelContextTest extends ManagementTestSupport { assertEquals("camel-core", prop.get("artifactId")); } - @Ignore("need to be tested outside camel-core") - public void testFindEipNames() throws Exception { - // JMX tests dont work well on AIX CI servers (hangs them) - if (isPlatform("aix")) { - return; - } - - MBeanServer mbeanServer = getMBeanServer(); - - ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); - - assertTrue("Should be registered", mbeanServer.isRegistered(on)); - - @SuppressWarnings("unchecked") - List<String> info = (List<String>) mbeanServer.invoke(on, "findEipNames", null, null); - assertNotNull(info); - - assertEquals(152, info.size()); - assertTrue(info.contains("transform")); - assertTrue(info.contains("split")); - assertTrue(info.contains("from")); - } - - @Ignore("need to be tested outside camel-core") - public void testFindEips() throws Exception { - // JMX tests dont work well on AIX CI servers (hangs them) - if (isPlatform("aix")) { - return; - } - - MBeanServer mbeanServer = getMBeanServer(); - - ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); - - assertTrue("Should be registered", mbeanServer.isRegistered(on)); - - @SuppressWarnings("unchecked") - Map<String, Properties> info = (Map<String, Properties>) mbeanServer.invoke(on, "findEips", null, null); - assertNotNull(info); - - assertEquals(152, info.size()); - Properties prop = info.get("transform"); - assertNotNull(prop); - assertEquals("transform", prop.get("name")); - assertEquals("org.apache.camel.model.TransformDefinition", prop.get("class")); - } - - @Ignore("need to be tested outside camel-core") - public void testListEips() throws Exception { - // JMX tests dont work well on AIX CI servers (hangs them) - if (isPlatform("aix")) { - return; - } - - MBeanServer mbeanServer = getMBeanServer(); - - ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); - - assertTrue("Should be registered", mbeanServer.isRegistered(on)); - - @SuppressWarnings("unchecked") - TabularData data = (TabularData) mbeanServer.invoke(on, "listEips", null, null); - assertNotNull(data); - assertEquals(152, data.size()); - } - public void testManagedCamelContextCreateRouteStaticEndpointJson() throws Exception { // JMX tests dont work well on AIX CI servers (hangs them) if (isPlatform("aix")) { http://git-wip-us.apache.org/repos/asf/camel/blob/8081351f/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedCamelContextTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedCamelContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedCamelContextTest.java new file mode 100644 index 0000000..ff0b38b --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedCamelContextTest.java @@ -0,0 +1,104 @@ +/** + * 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 java.util.List; +import java.util.Map; +import java.util.Properties; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.management.openmbean.TabularData; + +import org.apache.camel.CamelContext; +import org.apache.camel.management.ManagedCamelContextTest; +import org.junit.Test; + +import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext; + +public class SpringManagedCamelContextTest extends ManagedCamelContextTest { + + protected CamelContext createCamelContext() throws Exception { + return createSpringCamelContext(this, "org/apache/camel/spring/management/SpringManagedCamelContextTest.xml"); + } + + @Test + public void testFindEipNames() throws Exception { + // JMX tests dont work well on AIX CI servers (hangs them) + if (isPlatform("aix")) { + return; + } + + MBeanServer mbeanServer = getMBeanServer(); + + ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); + + assertTrue("Should be registered", mbeanServer.isRegistered(on)); + + @SuppressWarnings("unchecked") + List<String> info = (List<String>) mbeanServer.invoke(on, "findEipNames", null, null); + assertNotNull(info); + + assertEquals(152, info.size()); + assertTrue(info.contains("transform")); + assertTrue(info.contains("split")); + assertTrue(info.contains("from")); + } + + @Test + public void testFindEips() throws Exception { + // JMX tests dont work well on AIX CI servers (hangs them) + if (isPlatform("aix")) { + return; + } + + MBeanServer mbeanServer = getMBeanServer(); + + ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); + + assertTrue("Should be registered", mbeanServer.isRegistered(on)); + + @SuppressWarnings("unchecked") + Map<String, Properties> info = (Map<String, Properties>) mbeanServer.invoke(on, "findEips", null, null); + assertNotNull(info); + + assertEquals(152, info.size()); + Properties prop = info.get("transform"); + assertNotNull(prop); + assertEquals("transform", prop.get("name")); + assertEquals("org.apache.camel.model.TransformDefinition", prop.get("class")); + } + + @Test + public void testListEips() throws Exception { + // JMX tests dont work well on AIX CI servers (hangs them) + if (isPlatform("aix")) { + return; + } + + MBeanServer mbeanServer = getMBeanServer(); + + ObjectName on = ObjectName.getInstance("org.apache.camel:context=19-camel-1,type=context,name=\"camel-1\""); + + assertTrue("Should be registered", mbeanServer.isRegistered(on)); + + @SuppressWarnings("unchecked") + TabularData data = (TabularData) mbeanServer.invoke(on, "listEips", null, null); + assertNotNull(data); + assertEquals(152, data.size()); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/8081351f/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedCamelContextTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedCamelContextTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedCamelContextTest.xml new file mode 100644 index 0000000..e470ab2 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedCamelContextTest.xml @@ -0,0 +1,39 @@ +<?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 + "> + + <camelContext id="camel-1" managementNamePattern="19-#name#" xmlns="http://camel.apache.org/schema/spring"> + <jmxAgent id="agent"/> + <route> + <from uri="direct:start"/> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:foo"/> + <transform> + <constant>Bye World</constant> + </transform> + </route> + </camelContext> + +</beans>