camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r683115 - in /activemq/camel/trunk/components/camel-mina/src: main/java/org/apache/camel/component/mina/MinaConsumer.java test/java/org/apache/camel/component/mina/MinaConsumerTest.java
Date Wed, 06 Aug 2008 05:44:56 GMT
Author: davsclaus
Date: Tue Aug  5 22:44:55 2008
New Revision: 683115

URL: http://svn.apache.org/viewvc?rev=683115&view=rev
Log:
CAMEL-783: INFO logging for mina consumer so we can see what services camel exposes at startup.
Added wiki samples.

Added:
    activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
  (with props)
Modified:
    activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java

Modified: activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java?rev=683115&r1=683114&r2=683115&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
(original)
+++ activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
Tue Aug  5 22:44:55 2008
@@ -51,8 +51,8 @@
     @Override
     protected void doStart() throws Exception {
         super.doStart();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Binding to server address: " + address + " using acceptor: " + acceptor);
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Binding to server address: " + address + " using acceptor: " + acceptor);
         }
 
         IoHandler handler = new ReceiveHandler();
@@ -61,8 +61,8 @@
 
     @Override
     protected void doStop() throws Exception {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Unbinding from server address: " + address + " using acceptor: " +
acceptor);
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Unbinding from server address: " + address + " using acceptor: " +
acceptor);
         }
         acceptor.unbind(address);
         super.doStop();

Added: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java?rev=683115&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
(added)
+++ activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
Tue Aug  5 22:44:55 2008
@@ -0,0 +1,50 @@
+package org.apache.camel.component.mina;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Processor;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * Unit test for wiki documentation
+ */
+public class MinaConsumerTest extends ContextTestSupport {
+
+    public void testSendTextlineText() throws Exception {
+        // START SNIPPET: e2
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+
+        template.sendBody("mina:tcp://localhost:6200?textline=true", "Hello World\n");
+
+        assertMockEndpointsSatisifed();
+        // END SNIPPET: e2
+    }
+
+    public void testSendTextlineSyncText() throws Exception {
+        // START SNIPPET: e4
+        String response = (String)template.sendBody("mina:tcp://localhost:6201?textline=true&sync=true",
"World\n");
+        assertEquals("Bye World", response);
+        // END SNIPPET: e4
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // START SNIPPET: e1
+                from("mina:tcp://localhost:6200?textline=true").to("mock:result");
+                // END SNIPPET: e1
+
+                // START SNIPPET: e3
+                from("mina:tcp://localhost:6201?textline=true&sync=true").process(new
Processor() {
+                    public void process(Exchange exchange) throws Exception {
+                        String body = exchange.getIn().getBody(String.class);
+                        exchange.getOut().setBody("Bye " + body + "\n");
+                    }
+                });
+                // END SNIPPET: e3
+            }
+        };
+    }
+}

Propchange: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message