Author: rdonkin
Date: Wed Nov 26 13:04:03 2008
New Revision: 720976

URL: http://svn.apache.org/viewvc?rev=720976&view=rev
Log:
Check that code still works

Added:
    
james/protocol-tester/trunk/main/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java

Added: 
james/protocol-tester/trunk/main/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
URL: 
http://svn.apache.org/viewvc/james/protocol-tester/trunk/main/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java?rev=720976&view=auto
==============================================================================
--- 
james/protocol-tester/trunk/main/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
 (added)
+++ 
james/protocol-tester/trunk/main/src/test/java/org/apache/james/mpt/TestExternalHostSystem.java
 Wed Nov 26 13:04:03 2008
@@ -0,0 +1,67 @@
+/****************************************************************
+ * 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.james.mpt;
+
+import org.apache.james.mpt.HostSystem.Continuation;
+
+import junit.framework.TestCase;
+
+public class TestExternalHostSystem extends TestCase {
+
+    
+    private static final String SHABANG = "This Is The Shabang";
+
+    private static final int PORT = 10001;
+    
+    private DiscardProtocol protocol;
+    
+    private DiscardProtocol.Record record;
+    
+    //@Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        protocol = new DiscardProtocol(PORT);
+        protocol.start();
+        record = protocol.recordNext();
+    }
+
+    //@Override
+    protected void tearDown() throws Exception {
+        protocol.stop();
+        super.tearDown();
+    }
+    
+    public void testWrite() throws Exception {
+        ExternalHostSystem.Session session = newSession(SHABANG);
+        final String in = "Hello, World";
+        session.writeLine(in);
+        session.stop();
+        assertEquals(in + "\r\n", record.complete());
+    }
+
+    private ExternalHostSystem.Session newSession(final String shabang) throws 
Exception {
+        ExternalHostSystem system = new ExternalHostSystem("localhost", PORT ,
+                new SystemLoggingMonitor(), shabang);
+        ExternalHostSystem.Session session = system.newSession(new 
Continuation() {
+            public void doContinue() {}
+        });
+        return session;
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to