You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/08/10 16:55:32 UTC

svn commit: r684513 [2/2] - in /synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport: jms/ nhttp/ testkit/ testkit/listener/ testkit/message/ testkit/name/ testkit/server/ testkit/server/axis2/ testkit/tests/ testkit/tests/a...

Added: synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/testkit/tests/async/TextPlainTestCase.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/testkit/tests/async/TextPlainTestCase.java?rev=684513&view=auto
==============================================================================
--- synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/testkit/tests/async/TextPlainTestCase.java (added)
+++ synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/testkit/tests/async/TextPlainTestCase.java Sun Aug 10 07:55:31 2008
@@ -0,0 +1,56 @@
+/*
+ *  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.synapse.transport.testkit.tests.async;
+
+import org.apache.synapse.transport.testkit.listener.AsyncChannel;
+import org.apache.synapse.transport.testkit.listener.AsyncMessageSender;
+import org.apache.synapse.transport.testkit.listener.AsyncMessageTestCase;
+import org.apache.synapse.transport.testkit.listener.ContentTypeMode;
+import org.apache.synapse.transport.testkit.listener.MessageTestData;
+import org.apache.synapse.transport.testkit.listener.NameBuilder;
+import org.apache.synapse.transport.testkit.message.StringMessage;
+import org.apache.synapse.transport.testkit.name.DisplayName;
+import org.apache.synapse.transport.testkit.server.AsyncEndpointFactory;
+
+@DisplayName("AsyncTextPlain")
+public class TextPlainTestCase<C extends AsyncChannel<?>> extends AsyncMessageTestCase<C,StringMessage,StringMessage> {
+    private final MessageTestData data;
+    
+    public TextPlainTestCase(C channel, AsyncMessageSender<? super C,StringMessage> sender, AsyncEndpointFactory<? super C,StringMessage> endpointFactory, ContentTypeMode contentTypeMode, MessageTestData data) {
+        super(channel, sender, endpointFactory, contentTypeMode, "text/plain; charset=\"" + data.getCharset() + "\"", data.getCharset());
+        this.data = data;
+    }
+    
+    @Override
+    protected void buildName(NameBuilder name) {
+        super.buildName(name);
+        data.buildName(name);
+    }
+    
+    @Override
+    protected StringMessage prepareMessage() throws Exception {
+        return new StringMessage(contentType, data.getText());
+    }
+
+    @Override
+    protected void checkMessageData(StringMessage message, StringMessage messageData) throws Exception {
+        assertEquals(message.getContent(), messageData.getContent());
+    }
+}

Modified: synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/VFSTransportSenderTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/VFSTransportSenderTest.java?rev=684513&r1=684512&r2=684513&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/VFSTransportSenderTest.java (original)
+++ synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/vfs/VFSTransportSenderTest.java Sun Aug 10 07:55:31 2008
@@ -34,6 +34,7 @@
 import org.apache.synapse.transport.testkit.server.AsyncEndpoint;
 import org.apache.synapse.transport.testkit.server.AsyncEndpointFactory;
 import org.apache.synapse.transport.testkit.server.DummyServer;
+import org.apache.synapse.transport.testkit.server.Server;
 
 public class VFSTransportSenderTest extends TestCase {
     public static TestSuite suite() {
@@ -42,8 +43,14 @@
         
         VFSTestSetup setup = new VFSTestSetup();
         
+        final Server<VFSTestSetup> server = new DummyServer<VFSTestSetup>(setup);
+        
         AsyncEndpointFactory<VFSFileChannel,ByteArrayMessage> endpointFactory =
             new AsyncEndpointFactory<VFSFileChannel,ByteArrayMessage>() {
+
+            public Server<?> getServer() {
+                return server;
+            }
             
             public AsyncEndpoint<ByteArrayMessage> createAsyncEndpoint(
                     VFSFileChannel channel, String contentType)
@@ -53,7 +60,7 @@
             }
         };
         
-        VFSFileChannel channel = new VFSFileChannel(new DummyServer<VFSTestSetup>(setup), new File("target/vfs3/req/in").getAbsoluteFile());
+        VFSFileChannel channel = new VFSFileChannel(server, new File("target/vfs3/req/in").getAbsoluteFile());
         AxisAsyncMessageSender sender = new AxisAsyncMessageSender();
         
         suite.addBinaryTest(channel, adapt(sender, MessageConverter.BINARY_WRAPPER), endpointFactory, ContentTypeMode.SERVICE);