Author: davsclaus
Date: Sat Nov  6 18:43:03 2010
New Revision: 1032130

URL: http://svn.apache.org/viewvc?rev=1032130&view=rev
Log:
CAMEL-3236: Fixed tests. Thanks to Mark Ford for patch.

Added:
    
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/beans/SimpleBeanMBean.java
Modified:
    
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXConsumerTest.java
    
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
    
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java

Modified: 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXConsumerTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXConsumerTest.java?rev=1032130&r1=1032129&r2=1032130&view=diff
==============================================================================
--- 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXConsumerTest.java
 (original)
+++ 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXConsumerTest.java
 Sat Nov  6 18:43:03 2010
@@ -27,7 +27,6 @@ import org.junit.Test;
  * Tests that trigger notification events on our simple bean without
  * requiring any special setup.
  */
-...@ignore("TODO: Fails with timestamp diff error")
 public class JMXConsumerTest extends SimpleBeanFixture {
 
     ISimpleMXBean simpleBean;

Modified: 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java?rev=1032130&r1=1032129&r2=1032130&view=diff
==============================================================================
--- 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
 (original)
+++ 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
 Sat Nov  6 18:43:03 2010
@@ -20,13 +20,13 @@ import java.io.File;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import java.util.Collections;
+
 import javax.management.MBeanServerFactory;
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
 
 import org.junit.After;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -37,7 +37,6 @@ import org.junit.Test;
  * same as the platform server. May want to refactor the exisiting tests to
  * run the full suite on the local platform and this "remote" setup.
  */
-...@ignore("TODO: Fails with timestamp diff error")
 public class JMXRemoteTest extends SimpleBeanFixture {
 
     JMXServiceURL url;

Modified: 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java?rev=1032130&r1=1032129&r2=1032130&view=diff
==============================================================================
--- 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
 (original)
+++ 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
 Sat Nov  6 18:43:03 2010
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.jmx;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 import java.io.File;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
@@ -38,6 +35,8 @@ import javax.xml.namespace.NamespaceCont
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 
+import org.w3c.dom.Document;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;
@@ -48,7 +47,9 @@ import org.apache.camel.impl.DefaultCame
 import org.apache.camel.impl.SimpleRegistry;
 import org.junit.After;
 import org.junit.Before;
-import org.w3c.dom.Document;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 /**
  * MBean that is registered for the unit tests. The fixture will register a 
bean
@@ -274,7 +275,7 @@ public class SimpleBeanFixture {
         // instead, we'll assert that the values exist.
         XPathFactory xpf = XPathFactory.newInstance();
         XPath xp = xpf.newXPath();
-        xp.setNamespaceContext(new NamespaceContext(){
+        xp.setNamespaceContext(new NamespaceContext() {
             public String getNamespaceURI(String aArg0) {
                 return "urn:org.apache.camel.component:jmx";
             }
@@ -285,7 +286,7 @@ public class SimpleBeanFixture {
                 return null;
             }
         });
-        assertEquals("1262878215000", xp.evaluate("string(//jmx:timestamp)", 
actual));
+        assertEquals("1", xp.evaluate("count(//jmx:timestamp)", actual));
         assertEquals("1", xp.evaluate("count(//jmx:dateTime)", actual));
         resetMockEndpoint();
     }

Added: 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/beans/SimpleBeanMBean.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/beans/SimpleBeanMBean.java?rev=1032130&view=auto
==============================================================================
--- 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/beans/SimpleBeanMBean.java
 (added)
+++ 
camel/trunk/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/beans/SimpleBeanMBean.java
 Sat Nov  6 18:43:03 2010
@@ -0,0 +1,40 @@
+/**
+ * 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.component.jmx.beans;
+
+import java.io.Serializable;
+
+public interface SimpleBeanMBean extends Serializable {
+
+    String getStringValue();
+
+    void setStringValue(String aValue);
+
+    void touch();
+
+    void userData(String aUserData);
+
+    void triggerConnectionNotification();
+
+    void triggerMBeanServerNotification() throws Exception;
+
+    void triggerRelationNotification() throws Exception;
+
+    void triggerTimerNotification();
+
+    int getMonitorNumber();
+}


Reply via email to