camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1409156 - in /camel/branches/camel-2.10.x: ./ components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java
Date Wed, 14 Nov 2012 11:11:13 GMT
Author: davsclaus
Date: Wed Nov 14 11:11:12 2012
New Revision: 1409156

URL: http://svn.apache.org/viewvc?rev=1409156&view=rev
Log:
Fixed test

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1409155

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java?rev=1409156&r1=1409155&r2=1409156&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosTest.java
Wed Nov 14 11:11:12 2012
@@ -111,16 +111,20 @@ public class NagiosTest extends CamelTes
         assertEquals(2, nagios.getMessagePayloadList().size());
 
         MessagePayload payload = nagios.getMessagePayloadList().get(0);
-        assertEquals("Hello Nagios", payload.getMessage());
-        assertEquals("localhost", payload.getHostname());
-        assertEquals(Level.OK.ordinal(), payload.getLevel());
-        assertEquals(context.getName(), payload.getServiceName());
+        MessagePayload payload2 = nagios.getMessagePayloadList().get(1);
 
-        payload = nagios.getMessagePayloadList().get(1);
-        assertEquals("Bye Nagios", payload.getMessage());
         assertEquals("localhost", payload.getHostname());
         assertEquals(Level.OK.ordinal(), payload.getLevel());
         assertEquals(context.getName(), payload.getServiceName());
+        assertEquals("localhost", payload2.getHostname());
+        assertEquals(Level.OK.ordinal(), payload2.getLevel());
+        assertEquals(context.getName(), payload2.getServiceName());
+
+        // when using async they may arrive in different order
+        boolean hello = "Hello Nagios".equals(payload.getMessage()) || "Hello Nagios".equals(payload2.getMessage());
+        boolean bye = "Bye Nagios".equals(payload.getMessage()) || "Bye Nagios".equals(payload2.getMessage());
+        assertTrue("Should have received Hello Nagios message", hello);
+        assertTrue("Should have received Bye Nagios message", bye);
     }
 
     @Test



Mime
View raw message