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 2010/05/15 13:07:34 UTC

svn commit: r944612 - in /synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp: HttpCoreNIOListenerTest.java HttpTransportDescriptionFactory.java

Author: veithen
Date: Sat May 15 11:07:33 2010
New Revision: 944612

URL: http://svn.apache.org/viewvc?rev=944612&view=rev
Log:
Adapted the NHTTP transport tests to recent change in the testkit (dynamic allocation of HTTP server port). This should solve some of the build problems with Hudson.

Added:
    synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java   (with props)
Modified:
    synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListenerTest.java

Modified: synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListenerTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListenerTest.java?rev=944612&r1=944611&r2=944612&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListenerTest.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListenerTest.java Sat May 15 11:07:33 2010
@@ -23,7 +23,6 @@ import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.apache.axis2.transport.testkit.ManagedTestSuite;
-import org.apache.axis2.transport.testkit.axis2.SimpleTransportDescriptionFactory;
 import org.apache.axis2.transport.testkit.axis2.TransportDescriptionFactory;
 import org.apache.axis2.transport.testkit.http.HttpTransportTestSuiteBuilder;
 
@@ -34,9 +33,7 @@ public class HttpCoreNIOListenerTest ext
         // These tests don't work because of a problem similar to SYNAPSE-418
         suite.addExclude("(test=EchoXML)");
         
-        TransportDescriptionFactory tdfNIO =
-            new SimpleTransportDescriptionFactory("http", HttpCoreNIOListener.class, 
-                                                  HttpCoreNIOSender.class);
+        TransportDescriptionFactory tdfNIO = new HttpTransportDescriptionFactory();
         
         HttpTransportTestSuiteBuilder builder = new HttpTransportTestSuiteBuilder(suite, tdfNIO);
         

Added: synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java?rev=944612&view=auto
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java (added)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java Sat May 15 11:07:33 2010
@@ -0,0 +1,49 @@
+/*
+ *  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.nhttp;
+
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.transport.testkit.axis2.TransportDescriptionFactory;
+import org.apache.axis2.transport.testkit.http.HttpTestEnvironment;
+import org.apache.axis2.transport.testkit.tests.Setup;
+
+public class HttpTransportDescriptionFactory implements TransportDescriptionFactory {
+    private int port;
+    
+    @Setup @SuppressWarnings("unused")
+    private void setUp(HttpTestEnvironment env) {
+        port = env.getServerPort();
+    }
+
+    public TransportInDescription createTransportInDescription() throws Exception {
+        TransportInDescription desc = new TransportInDescription("http");
+        desc.setReceiver(new HttpCoreNIOListener());
+        desc.addParameter(new Parameter(HttpCoreNIOListener.PARAM_PORT, String.valueOf(port)));
+        return desc;
+    }
+
+    public TransportOutDescription createTransportOutDescription() throws Exception {
+        TransportOutDescription desc = new TransportOutDescription("http");
+        desc.setSender(new HttpCoreNIOSender());
+        return desc;
+    }
+}

Propchange: synapse/trunk/java/modules/transports/core/nhttp/src/test/java/org/apache/synapse/transport/nhttp/HttpTransportDescriptionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native