camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r814475 - in /camel/trunk/examples/camel-example-management: ./ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/camel/ src/test/java/org/apache/camel/example/ src/test/java/org/apache/camel/exa...
Date Mon, 14 Sep 2009 05:33:22 GMT
Author: davsclaus
Date: Mon Sep 14 05:33:22 2009
New Revision: 814475

URL: http://svn.apache.org/viewvc?rev=814475&view=rev
Log:
MR-251: Added unit test for management example.

Added:
    camel/trunk/examples/camel-example-management/src/test/
    camel/trunk/examples/camel-example-management/src/test/java/
    camel/trunk/examples/camel-example-management/src/test/java/org/
    camel/trunk/examples/camel-example-management/src/test/java/org/apache/
    camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/
    camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/
    camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/
    camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
  (with props)
    camel/trunk/examples/camel-example-management/src/test/resources/
    camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties   (with
props)
Modified:
    camel/trunk/examples/camel-example-management/pom.xml

Modified: camel/trunk/examples/camel-example-management/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/pom.xml?rev=814475&r1=814474&r2=814475&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-management/pom.xml (original)
+++ camel/trunk/examples/camel-example-management/pom.xml Mon Sep 14 05:33:22 2009
@@ -59,6 +59,11 @@
 
         <!-- for testing -->
         <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Added: camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java?rev=814475&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
(added)
+++ camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
Mon Sep 14 05:33:22 2009
@@ -0,0 +1,54 @@
+/**
+ * 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.example.management;
+
+import java.util.Set;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class ManagementExampleTest extends CamelSpringTestSupport {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testManagementExample() throws Exception {
+        // give it a bit of time to run
+        Thread.sleep(2000);
+
+        MBeanServer mbeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
+
+        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"),
null);
+        assertEquals(3, set.size());
+
+        // stop routes
+        for (ObjectName on : set) {
+            mbeanServer.invoke(on, "stop", null, null);
+        }
+    }
+
+}

Propchange: camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-management/src/test/java/org/apache/camel/example/management/ManagementExampleTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties?rev=814475&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties (added)
+++ camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties Mon
Sep 14 05:33:22 2009
@@ -0,0 +1,37 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+#
+# The logging properties used for eclipse testing, We want to see INFO output on the console.
+#
+log4j.rootLogger=INFO, file
+
+#
+# uncomment the following line to enable debugging of Camel
+#
+#log4j.logger.org.apache.camel=DEBUG
+
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.file.file=target/camel-example-management-test.log
+log4j.appender.file.append=true

Propchange: camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/examples/camel-example-management/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message