You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/08/04 00:21:38 UTC

svn commit: r982052 - in /tuscany/sca-java-2.x/trunk/contrib/modules: ./ host-tomcat/ host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/

Author: rfeng
Date: Tue Aug  3 22:21:38 2010
New Revision: 982052

URL: http://svn.apache.org/viewvc?rev=982052&view=rev
Log:
Adding host-tomcat to contrib/modules

Added:
    tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/
      - copied from r982035, tuscany/sca-java-2.x/contrib/modules/host-tomcat/
    tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml   (with props)
Modified:
    tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
    tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java

Modified: tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java?rev=982052&r1=982035&r2=982052&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java (original)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java Tue Aug  3 22:21:38 2010
@@ -37,6 +37,7 @@ import java.util.logging.Logger;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
 import org.apache.catalina.Container;
@@ -687,4 +688,14 @@ public class TomcatServer implements Ser
         return url;
     }
 
+    @Override
+    public ServletContext getServletContext() {
+        if (ports.isEmpty()) {
+            return null;
+        } else {
+            Port port = ports.values().iterator().next();
+            return port.getHost().map(getContextPath()).getServletContext();
+        }
+    }
+
 }

Modified: tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java?rev=982052&r1=982035&r2=982052&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java Tue Aug  3 22:21:38 2010
@@ -30,6 +30,7 @@ import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLSession;
 import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -94,6 +95,8 @@ public class TomcatServerTestCase extend
         TomcatServer service = new TomcatServer(workScheduler);
         TestServlet servlet = new TestServlet();
         service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+        ServletContext servletContext = service.getServletContext();
+        Assert.assertNotNull(servletContext);
         Socket client = new Socket("127.0.0.1", HTTP_PORT);
         OutputStream os = client.getOutputStream();
         os.write(REQUEST1.getBytes());

Added: tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml?rev=982052&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml Tue Aug  3 22:21:38 2010
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>tuscany-contrib-modules</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Tuscany SCA Contributed Modules</name>
+
+    <modules>
+        <module>databinding-protobuf</module>
+        <module>host-tomcat</module>
+    </modules>
+
+    <profiles>
+         <profile>
+            <id>eclipse</id>
+            <build>
+                <defaultGoal>org.apache.tuscany.maven.plugins:maven-bundle-plugin:eclipse</defaultGoal>
+                <!--
+                <plugins>
+	            <plugin> 	 
+	                <groupId>org.apache.tuscany.maven.plugins</groupId> 	 
+	                <artifactId>maven-bundle-plugin</artifactId> 	 
+	                <version>1.0.6</version> 	 
+	                <extensions>true</extensions> 	 
+	                <executions> 	 
+	                    <execution> 	 
+	                        <id>generate-pde</id> 	 
+	                        <phase>generate-resources</phase> 	 
+	                        <goals> 	 
+	                                <goal>eclipse</goal> 	 
+	                        </goals> 	 
+	                        <configuration> 	 
+	                        </configuration> 	 
+	                    </execution> 	 
+	                </executions> 	 
+	            </plugin> 	 
+              </plugins>
+              -->
+            </build>
+        </profile>
+    </profiles>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+               <plugin>
+                   <artifactId>maven-jar-plugin</artifactId>
+                   <configuration>
+                       <archive>
+                           <manifestFile>${basedir}/META-INF/MANIFEST.MF</manifestFile>
+                       </archive>
+                   </configuration>
+               </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+    
+</project>

Propchange: tuscany/sca-java-2.x/trunk/contrib/modules/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native