servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject [3/3] git commit: SM-2255: Add logging to troubleshoot intermittent test failure
Date Mon, 31 Mar 2014 14:30:21 GMT
SM-2255: Add logging to troubleshoot intermittent test failure

(cherry picked from commit e564caf84bec1c215f94aeb089b10ac23c0c50d7)


Project: http://git-wip-us.apache.org/repos/asf/servicemix/repo
Commit: http://git-wip-us.apache.org/repos/asf/servicemix/commit/111751f5
Tree: http://git-wip-us.apache.org/repos/asf/servicemix/tree/111751f5
Diff: http://git-wip-us.apache.org/repos/asf/servicemix/diff/111751f5

Branch: refs/heads/master
Commit: 111751f59d8c0887265fa55649527cb7ac08319a
Parents: 904689d
Author: Gert Vanthienen <gertv@apache.org>
Authored: Mon Mar 31 16:09:57 2014 +0200
Committer: Gert Vanthienen <gertv@apache.org>
Committed: Mon Mar 31 16:17:45 2014 +0200

----------------------------------------------------------------------
 examples/akka/akka-camel/pom.xml                |  6 ++
 .../src/test/resources/application.conf         | 66 ++++++++++++++++++++
 .../servicemix/examples/akka/StatsTest.scala    | 10 ++-
 3 files changed, 79 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/servicemix/blob/111751f5/examples/akka/akka-camel/pom.xml
----------------------------------------------------------------------
diff --git a/examples/akka/akka-camel/pom.xml b/examples/akka/akka-camel/pom.xml
index 103e1cb..2da2f99 100644
--- a/examples/akka/akka-camel/pom.xml
+++ b/examples/akka/akka-camel/pom.xml
@@ -73,6 +73,12 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-slf4j_2.10</artifactId>
+      <version>${akka.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/servicemix/blob/111751f5/examples/akka/akka-camel/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/examples/akka/akka-camel/src/test/resources/application.conf b/examples/akka/akka-camel/src/test/resources/application.conf
new file mode 100644
index 0000000..9891d75
--- /dev/null
+++ b/examples/akka/akka-camel/src/test/resources/application.conf
@@ -0,0 +1,66 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+
+akka {
+  actor.deployment {
+  # there's no extra configuration here at the moment, but you could
+  # configure routers, log levels, ... or whatever settings you need
+  # for your own application
+
+  }
+
+  # This is a copy of the akka-camel reference.conf
+  # TODO: work out a better solution (extender to load configs from reference.conf into the
OSGi Service Registry)
+  camel {
+    # Whether JMX should be enabled or disabled for the Camel Context
+    jmx = off
+    # enable/disable streaming cache on the Camel Context
+    streamingCache = on
+    consumer {
+      # Configured setting which determines whether one-way communications
+      # between an endpoint and this consumer actor
+      # should be auto-acknowledged or application-acknowledged.
+      # This flag has only effect when exchange is in-only.
+      auto-ack = on
+
+      # When endpoint is out-capable (can produce responses) reply-timeout is the
+      # maximum time the endpoint can take to send the response before the message
+      # exchange fails. This setting is used for out-capable, in-only,
+      # manually acknowledged communication
+      reply-timeout = 1m
+
+      # The duration of time to await activation of an endpoint.
+      activation-timeout = 10s
+    }
+
+    #Scheme to FQCN mappings for CamelMessage body conversions
+    conversions {
+      "file" = "java.io.InputStream"
+    }
+  }
+
+  loggers = ["akka.event.slf4j.Slf4jLogger"]
+  loglevel = DEBUG
+
+  debug {
+    lifecyle = on
+    event-stream = on
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/servicemix/blob/111751f5/examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala
----------------------------------------------------------------------
diff --git a/examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala
b/examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala
index f390d6e..a433327 100644
--- a/examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala
+++ b/examples/akka/akka-camel/src/test/scala/org/apache/servicemix/examples/akka/StatsTest.scala
@@ -24,6 +24,7 @@ import akka.util.Timeout
 import scala.concurrent.duration._
 import scala.concurrent.Await
 import org.apache.servicemix.examples.akka.Stats.{Input, Report}
+import org.slf4j.LoggerFactory
 import java.util.concurrent.TimeoutException
 
 /**
@@ -33,6 +34,7 @@ class StatsTest {
 
   val ITEM1 = "ITEM1"
   val MAX_ATTEMPTS = 10
+  val LOGGER = LoggerFactory.getLogger(classOf[StatsTest])
 
   val system = ActorSystem("TestSystem")
   val stats = Stats(system)
@@ -54,7 +56,7 @@ class StatsTest {
   def expectReport(expectation: String) : Unit = expectReport(expectation, MAX_ATTEMPTS)
 
   def expectReport(expectation: String, remaining: Int) : Unit = getReport.contains(expectation)
match {
-    case true                      => // do nothing here, w received our report
+    case true                      => // do nothing here, we received our report
     case false if (remaining <= 0) => fail("Did not receive reporting containing "
+ expectation)
     case false                     => expectReport(expectation, remaining - 1)
   }
@@ -64,10 +66,12 @@ class StatsTest {
    */
   def getReport : String = {
     try {
-      Await.result(stats ? Report(), 100 millis).toString
+      val result = Await.result(stats ? Report(), 100 millis).toString
+      LOGGER.debug("Report() message returned '{}'", result)
+      result
     } catch {
       //Report() only sends back a response if it actually has something to tell
-      case e: TimeoutException => ""
+      case e: TimeoutException => LOGGER.debug("Report() message returned no response");
""
     }
   }
 }


Mime
View raw message