brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geom...@apache.org
Subject [1/6] brooklyn-server git commit: Add LogWatcher.EventPredicates.containsMessages
Date Thu, 13 Jul 2017 10:01:20 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 1dfde7a4b -> 0e35b6151


Add LogWatcher.EventPredicates.containsMessages

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/93b7e188
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/93b7e188
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/93b7e188

Branch: refs/heads/master
Commit: 93b7e188fc391e00436459282b4d4595fe9b96b5
Parents: b97942d
Author: Aled Sage <aled.sage@gmail.com>
Authored: Thu Jun 8 14:59:04 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Fri Jun 16 13:01:51 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/brooklyn/test/LogWatcher.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/93b7e188/test-support/src/main/java/org/apache/brooklyn/test/LogWatcher.java
----------------------------------------------------------------------
diff --git a/test-support/src/main/java/org/apache/brooklyn/test/LogWatcher.java b/test-support/src/main/java/org/apache/brooklyn/test/LogWatcher.java
index e72383e..c35aadc 100644
--- a/test-support/src/main/java/org/apache/brooklyn/test/LogWatcher.java
+++ b/test-support/src/main/java/org/apache/brooklyn/test/LogWatcher.java
@@ -62,15 +62,22 @@ public class LogWatcher implements Closeable {
 
     public static class EventPredicates {
         public static Predicate<ILoggingEvent> containsMessage(final String expected)
{
+            return containsMessages(expected);
+        }
+    
+        public static Predicate<ILoggingEvent> containsMessages(final String... expecteds)
{
             return new Predicate<ILoggingEvent>() {
                 @Override public boolean apply(ILoggingEvent input) {
                     if (input == null) return false;
                     String msg = input.getFormattedMessage();
-                    return (msg != null) && msg.contains(expected);
+                    if (msg == null) return false;
+                    for (String expected : expecteds) {
+                        if (!msg.contains(expected)) return false;
+                    }
+                    return true;
                 }
             };
         }
-    
         public static Predicate<ILoggingEvent> containsExceptionStackLine(final Class<?>
clazz, final String methodName) {
             return new Predicate<ILoggingEvent>() {
                 @Override public boolean apply(ILoggingEvent input) {


Mime
View raw message