dev@grizzly.java.net

[Fwd: svn commit: r651312 - in /mina/sandbox/jvermillard/grizzly: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/mina/ src/main/java/org/apache/mina/grizzlyecho/ src/test/ src/test/java/ src/test/java/o...]

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 24 Apr 2008 12:52:42 -0400

-------- Original Message --------
Subject: svn commit: r651312 - in /mina/sandbox/jvermillard/grizzly: ./
src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/mina/
src/main/java/org/apache/mina/grizzlyecho/ src/test/ src/test/java/
src/test/java/o...
Date: Thu, 24 Apr 2008 16:39:16 +0000
From: jvermillard_at_apache.org
Reply-To: dev_at_mina.apache.org
To: commits_at_mina.apache.org

Author: jvermillard
Date: Thu Apr 24 09:39:04 2008
New Revision: 651312

URL: http://svn.apache.org/viewvc?rev=651312&view=rev
Log:
some grizzly dummy echo server

Added:
     mina/sandbox/jvermillard/grizzly/pom.xml
     mina/sandbox/jvermillard/grizzly/src/
     mina/sandbox/jvermillard/grizzly/src/main/
     mina/sandbox/jvermillard/grizzly/src/main/java/
     mina/sandbox/jvermillard/grizzly/src/main/java/org/
     mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/
     mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/
 
mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/
 
mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/EchoServer.java
     mina/sandbox/jvermillard/grizzly/src/test/
     mina/sandbox/jvermillard/grizzly/src/test/java/
     mina/sandbox/jvermillard/grizzly/src/test/java/org/
     mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/
     mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/
 
mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/
 
mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/AppTest.java
Modified:
     mina/sandbox/jvermillard/grizzly/ (props changed)

Propchange: mina/sandbox/jvermillard/grizzly/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 24 09:39:04 2008
@@ -0,0 +1 @@
+target

Added: mina/sandbox/jvermillard/grizzly/pom.xml
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/grizzly/pom.xml?rev=651312&view=auto
==============================================================================
--- mina/sandbox/jvermillard/grizzly/pom.xml (added)
+++ mina/sandbox/jvermillard/grizzly/pom.xml Thu Apr 24 09:39:04 2008
@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.mina</groupId>
+ <artifactId>grizzlyecho</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>grizzlyecho</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.grizzly</groupId>
+ <artifactId>grizzly-framework</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>

Added:
mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/EchoServer.java
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/EchoServer.java?rev=651312&view=auto
==============================================================================
---
mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/EchoServer.java
(added)
+++
mina/sandbox/jvermillard/grizzly/src/main/java/org/apache/mina/grizzlyecho/EchoServer.java
Thu Apr 24 09:39:04 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.mina.grizzlyecho;
+
+import com.sun.grizzly.Controller;
+import com.sun.grizzly.DefaultPipeline;
+import com.sun.grizzly.DefaultProtocolChain;
+import com.sun.grizzly.Pipeline;
+import com.sun.grizzly.ProtocolChain;
+import com.sun.grizzly.ProtocolChainInstanceHandler;
+import com.sun.grizzly.TCPSelectorHandler;
+import com.sun.grizzly.filter.EchoFilter;
+import com.sun.grizzly.filter.ReadFilter;
+import java.io.IOException;
+
+public class EchoServer {
+
+ public static void main(String[] args) {
+ System.out.println("Preparing echo server");
+ Controller controller = new Controller();
+
+ TCPSelectorHandler tcpSelector = new TCPSelectorHandler();
+ tcpSelector.setPort(8080);
+ controller.addSelectorHandler(tcpSelector);
+
+ Pipeline mySharedPipeline = new DefaultPipeline();
+ mySharedPipeline.setMaxThreads(5);
+
+ controller.setPipeline(mySharedPipeline);
+
+ ProtocolChainInstanceHandler handler =
+ new ProtocolChainInstanceHandler() {
+
+ final private ProtocolChain protocolChain = new
DefaultProtocolChain();
+
+ public ProtocolChain poll() {
+ return protocolChain;
+ }
+
+ public boolean offer(ProtocolChain instance) {
+ return true;
+ }
+ };
+ controller.setProtocolChainInstanceHandler(handler);
+
+ ProtocolChain protocolChain = handler.poll();
+ protocolChain.addFilter(new ReadFilter());
+ protocolChain.addFilter(new EchoFilter());
+ try {
+ System.out.println("Starting !");
+ controller.start();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+}

Added:
mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/AppTest.java
URL:
http://svn.apache.org/viewvc/mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/AppTest.java?rev=651312&view=auto
==============================================================================
---
mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/AppTest.java
(added)
+++
mina/sandbox/jvermillard/grizzly/src/test/java/org/apache/mina/grizzlyecho/AppTest.java
Thu Apr 24 09:39:04 2008
@@ -0,0 +1,38 @@
+package org.apache.mina.grizzlyecho;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ EchoServer.main(null);
+ }
+}