You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/11/13 13:44:08 UTC

[01/10] incubator-brooklyn git commit: Un-sed Tomcat configuration

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 297f60808 -> 50e3cbce1


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/46dfc410/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/web.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/web.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/web.xml
new file mode 100644
index 0000000..558ea07
--- /dev/null
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/web.xml
@@ -0,0 +1,4615 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  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.
+-->
+<!-- Brooklyn note: This file is a modified copy of web.xml from Tomcat v7.0.56.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                      http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+  version="3.0">
+
+  <!-- ======================== Introduction ============================== -->
+  <!-- This document defines default values for *all* web applications      -->
+  <!-- loaded into this instance of Tomcat.  As each application is         -->
+  <!-- deployed, this file is processed, followed by the                    -->
+  <!-- "/WEB-INF/web.xml" deployment descriptor from your own               -->
+  <!-- applications.                                                        -->
+  <!--                                                                      -->
+  <!-- WARNING:  Do not configure application-specific resources here!      -->
+  <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->
+
+
+  <!-- ================== Built In Servlet Definitions ==================== -->
+
+
+  <!-- The default servlet for all web applications, that serves static     -->
+  <!-- resources.  It processes all requests that are not mapped to other   -->
+  <!-- servlets with servlet mappings (defined either here or in your own   -->
+  <!-- web.xml file).  This servlet supports the following initialization   -->
+  <!-- parameters (default values are in square brackets):                  -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet.  [0]                          -->
+  <!--                                                                      -->
+  <!--   fileEncoding        Encoding to be used to read static resources   -->
+  <!--                       [platform default]                             -->
+  <!--                                                                      -->
+  <!--   input               Input buffer size (in bytes) when reading      -->
+  <!--                       resources to be served.  [2048]                -->
+  <!--                                                                      -->
+  <!--   listings            Should directory listings be produced if there -->
+  <!--                       is no welcome file in this directory?  [false] -->
+  <!--                       WARNING: Listings for directories with many    -->
+  <!--                       entries can be slow and may consume            -->
+  <!--                       significant proportions of server resources.   -->
+  <!--                                                                      -->
+  <!--   output              Output buffer size (in bytes) when writing     -->
+  <!--                       resources to be served.  [2048]                -->
+  <!--                                                                      -->
+  <!--   readonly            Is this context "read only", so HTTP           -->
+  <!--                       commands like PUT and DELETE are               -->
+  <!--                       rejected?  [true]                              -->
+  <!--                                                                      -->
+  <!--   readmeFile          File to display together with the directory    -->
+  <!--                       contents. [null]                               -->
+  <!--                                                                      -->
+  <!--   sendfileSize        If the connector used supports sendfile, this  -->
+  <!--                       represents the minimal file size in KB for     -->
+  <!--                       which sendfile will be used. Use a negative    -->
+  <!--                       value to always disable sendfile.  [48]        -->
+  <!--                                                                      -->
+  <!--   useAcceptRanges     Should the Accept-Ranges header be included    -->
+  <!--                       in responses where appropriate? [true]         -->
+  <!--                                                                      -->
+  <!--  For directory listing customization. Checks localXsltFile, then     -->
+  <!--  globalXsltFile, then defaults to original behavior.                 -->
+  <!--                                                                      -->
+  <!--   localXsltFile       Make directory listings an XML doc and         -->
+  <!--                       pass the result to this style sheet residing   -->
+  <!--                       in that directory. This overrides              -->
+  <!--                       contextXsltFile and globalXsltFile[null]       -->
+  <!--                                                                      -->
+  <!--   contextXsltFile     Make directory listings an XML doc and         -->
+  <!--                       pass the result to this style sheet which is   -->
+  <!--                       relative to the context root. This overrides   -->
+  <!--                       globalXsltFile[null]                           -->
+  <!--                                                                      -->
+  <!--   globalXsltFile      Site wide configuration version of             -->
+  <!--                       localXsltFile. This argument must either be an -->
+  <!--                       absolute or relative (to either                -->
+  <!--                       $CATALINA_BASE/conf or $CATALINA_HOME/conf)    -->
+  <!--                       path that points to a location below either    -->
+  <!--                       $CATALINA_BASE/conf (checked first) or         -->
+  <!--                       $CATALINA_HOME/conf (checked second).[null]    -->
+  <!--                                                                      -->
+  <!--   showServerInfo      Should server information be presented in the  -->
+  <!--                       response sent to clients when directory        -->
+  <!--                       listings is enabled? [true]                    -->
+
+    <servlet>
+        <servlet-name>default</servlet-name>
+        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
+        <init-param>
+            <param-name>debug</param-name>
+            <param-value>0</param-value>
+        </init-param>
+        <init-param>
+            <param-name>listings</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+
+  <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
+  <!-- used by Tomcat to support JSP pages.  Traditionally, this servlet    -->
+  <!-- is mapped to the URL pattern "*.jsp".  This servlet supports the     -->
+  <!-- following initialization parameters (default values are in square    -->
+  <!-- brackets):                                                           -->
+  <!--                                                                      -->
+  <!--   checkInterval       If development is false and checkInterval is   -->
+  <!--                       greater than zero, background compilations are -->
+  <!--                       enabled. checkInterval is the time in seconds  -->
+  <!--                       between checks to see if a JSP page (and its   -->
+  <!--                       dependent files) needs to  be recompiled. [0]  -->
+  <!--                                                                      -->
+  <!--   classdebuginfo      Should the class file be compiled with         -->
+  <!--                       debugging information?  [true]                 -->
+  <!--                                                                      -->
+  <!--   classpath           What class path should I use while compiling   -->
+  <!--                       generated servlets?  [Created dynamically      -->
+  <!--                       based on the current web application]          -->
+  <!--                                                                      -->
+  <!--   compiler            Which compiler Ant should use to compile JSP   -->
+  <!--                       pages.  See the jasper documentation for more  -->
+  <!--                       information.                                   -->
+  <!--                                                                      -->
+  <!--   compilerSourceVM    Compiler source VM. [1.6]                      -->
+  <!--                                                                      -->
+  <!--   compilerTargetVM    Compiler target VM. [1.6]                      -->
+  <!--                                                                      -->
+  <!--   development         Is Jasper used in development mode? If true,   -->
+  <!--                       the frequency at which JSPs are checked for    -->
+  <!--                       modification may be specified via the          -->
+  <!--                       modificationTestInterval parameter. [true]     -->
+  <!--                                                                      -->
+  <!--   displaySourceFragment                                              -->
+  <!--                       Should a source fragment be included in        -->
+  <!--                       exception messages? [true]                     -->
+  <!--                                                                      -->
+  <!--   dumpSmap            Should the SMAP info for JSR45 debugging be    -->
+  <!--                       dumped to a file? [false]                      -->
+  <!--                       False if suppressSmap is true                  -->
+  <!--                                                                      -->
+  <!--   enablePooling       Determines whether tag handler pooling is      -->
+  <!--                       enabled. This is a compilation option. It will -->
+  <!--                       not alter the behaviour of JSPs that have      -->
+  <!--                       already been compiled. [true]                  -->
+  <!--                                                                      -->
+  <!--   engineOptionsClass  Allows specifying the Options class used to    -->
+  <!--                       configure Jasper. If not present, the default  -->
+  <!--                       EmbeddedServletOptions will be used.           -->
+  <!--                                                                      -->
+  <!--   errorOnUseBeanInvalidClassAttribute                                -->
+  <!--                       Should Jasper issue an error when the value of -->
+  <!--                       the class attribute in an useBean action is    -->
+  <!--                       not a valid bean class?  [true]                -->
+  <!--                                                                      -->
+  <!--   fork                Tell Ant to fork compiles of JSP pages so that -->
+  <!--                       a separate JVM is used for JSP page compiles   -->
+  <!--                       from the one Tomcat is running in. [true]      -->
+  <!--                                                                      -->
+  <!--   genStringAsCharArray                                               -->
+  <!--                       Should text strings be generated as char       -->
+  <!--                       arrays, to improve performance in some cases?  -->
+  <!--                       [false]                                        -->
+  <!--                                                                      -->
+  <!--   ieClassId           The class-id value to be sent to Internet      -->
+  <!--                       Explorer when using <jsp:plugin> tags.         -->
+  <!--                       [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93]   -->
+  <!--                                                                      -->
+  <!--   javaEncoding        Java file encoding to use for generating java  -->
+  <!--                       source files. [UTF8]                           -->
+  <!--                                                                      -->
+  <!--   keepgenerated       Should we keep the generated Java source code  -->
+  <!--                       for each page instead of deleting it? [true]   -->
+  <!--                                                                      -->
+  <!--   mappedfile          Should we generate static content with one     -->
+  <!--                       print statement per input line, to ease        -->
+  <!--                       debugging?  [true]                             -->
+  <!--                                                                      -->
+  <!--   maxLoadedJsps       The maximum number of JSPs that will be loaded -->
+  <!--                       for a web application. If more than this       -->
+  <!--                       number of JSPs are loaded, the least recently  -->
+  <!--                       used JSPs will be unloaded so that the number  -->
+  <!--                       of JSPs loaded at any one time does not exceed -->
+  <!--                       this limit. A value of zero or less indicates  -->
+  <!--                       no limit. [-1]                                 -->
+  <!--                                                                      -->
+  <!--   jspIdleTimeout      The amount of time in seconds a JSP can be     -->
+  <!--                       idle before it is unloaded. A value of zero    -->
+  <!--                       or less indicates never unload. [-1]           -->
+  <!--                                                                      -->
+  <!--   modificationTestInterval                                           -->
+  <!--                       Causes a JSP (and its dependent files) to not  -->
+  <!--                       be checked for modification during the         -->
+  <!--                       specified time interval (in seconds) from the  -->
+  <!--                       last time the JSP was checked for              -->
+  <!--                       modification. A value of 0 will cause the JSP  -->
+  <!--                       to be checked on every access.                 -->
+  <!--                       Used in development mode only. [4]             -->
+  <!--                                                                      -->
+  <!--   recompileOnFail     If a JSP compilation fails should the          -->
+  <!--                       modificationTestInterval be ignored and the    -->
+  <!--                       next access trigger a re-compilation attempt?  -->
+  <!--                       Used in development mode only and is disabled  -->
+  <!--                       by default as compilation may be expensive and -->
+  <!--                       could lead to excessive resource usage.        -->
+  <!--                       [false]                                        -->
+  <!--                                                                      -->
+  <!--   scratchdir          What scratch directory should we use when      -->
+  <!--                       compiling JSP pages?  [default work directory  -->
+  <!--                       for the current web application]               -->
+  <!--                                                                      -->
+  <!--   suppressSmap        Should the generation of SMAP info for JSR45   -->
+  <!--                       debugging be suppressed?  [false]              -->
+  <!--                                                                      -->
+  <!--   trimSpaces          Should white spaces in template text between   -->
+  <!--                       actions or directives be trimmed?  [false]     -->
+  <!--                                                                      -->
+  <!--   xpoweredBy          Determines whether X-Powered-By response       -->
+  <!--                       header is added by generated servlet.  [false] -->
+
+    <servlet>
+        <servlet-name>jsp</servlet-name>
+        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+        <init-param>
+            <param-name>fork</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <init-param>
+            <param-name>xpoweredBy</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>3</load-on-startup>
+    </servlet>
+
+
+  <!-- NOTE: An SSI Filter is also available as an alternative SSI          -->
+  <!-- implementation. Use either the Servlet or the Filter but NOT both.   -->
+  <!--                                                                      -->
+  <!-- Server Side Includes processing servlet, which processes SSI         -->
+  <!-- directives in HTML pages consistent with similar support in web      -->
+  <!-- servers like Apache.  Traditionally, this servlet is mapped to the   -->
+  <!-- URL pattern "*.shtml".  This servlet supports the following          -->
+  <!-- initialization parameters (default values are in square brackets):   -->
+  <!--                                                                      -->
+  <!--   buffered            Should output from this servlet be buffered?   -->
+  <!--                       (0=false, 1=true)  [0]                         -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet.  [0]                          -->
+  <!--                                                                      -->
+  <!--   expires             The number of seconds before a page with SSI   -->
+  <!--                       directives will expire.  [No default]          -->
+  <!--                                                                      -->
+  <!--   isVirtualWebappRelative                                            -->
+  <!--                       Should "virtual" paths be interpreted as       -->
+  <!--                       relative to the context root, instead of       -->
+  <!--                       the server root? [false]                       -->
+  <!--                                                                      -->
+  <!--   inputEncoding       The encoding to assume for SSI resources if    -->
+  <!--                       one is not available from the resource.        -->
+  <!--                       [Platform default]                             -->
+  <!--                                                                      -->
+  <!--   outputEncoding      The encoding to use for the page that results  -->
+  <!--                       from the SSI processing. [UTF-8]               -->
+  <!--                                                                      -->
+  <!--   allowExec           Is use of the exec command enabled? [false]    -->
+
+<!--
+    <servlet>
+        <servlet-name>ssi</servlet-name>
+        <servlet-class>
+          org.apache.catalina.ssi.SSIServlet
+        </servlet-class>
+        <init-param>
+          <param-name>buffered</param-name>
+          <param-value>1</param-value>
+        </init-param>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>expires</param-name>
+          <param-value>666</param-value>
+        </init-param>
+        <init-param>
+          <param-name>isVirtualWebappRelative</param-name>
+          <param-value>false</param-value>
+        </init-param>
+        <load-on-startup>4</load-on-startup>
+    </servlet>
+-->
+
+
+  <!-- Common Gateway Includes (CGI) processing servlet, which supports     -->
+  <!-- execution of external applications that conform to the CGI spec      -->
+  <!-- requirements.  Typically, this servlet is mapped to the URL pattern  -->
+  <!-- "/cgi-bin/*", which means that any CGI applications that are         -->
+  <!-- executed must be present within the web application.  This servlet   -->
+  <!-- supports the following initialization parameters (default values     -->
+  <!-- are in square brackets):                                             -->
+  <!--                                                                      -->
+  <!--   cgiPathPrefix        The CGI search path will start at             -->
+  <!--                        webAppRootDir + File.separator + this prefix. -->
+  <!--                        [WEB-INF/cgi]                                 -->
+  <!--                                                                      -->
+  <!--   debug                Debugging detail level for messages logged    -->
+  <!--                        by this servlet.  [0]                         -->
+  <!--                                                                      -->
+  <!--   executable           Name of the executable used to run the        -->
+  <!--                        script. [perl]                                -->
+  <!--                                                                      -->
+  <!--   parameterEncoding    Name of parameter encoding to be used with    -->
+  <!--                        CGI servlet.                                  -->
+  <!--                        [System.getProperty("file.encoding","UTF-8")] -->
+  <!--                                                                      -->
+  <!--   passShellEnvironment Should the shell environment variables (if    -->
+  <!--                        any) be passed to the CGI script? [false]     -->
+  <!--                                                                      -->
+  <!--   stderrTimeout        The time (in milliseconds) to wait for the    -->
+  <!--                        reading of stderr to complete before          -->
+  <!--                        terminating the CGI process. [2000]           -->
+
+<!--
+    <servlet>
+        <servlet-name>cgi</servlet-name>
+        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>cgiPathPrefix</param-name>
+          <param-value>WEB-INF/cgi</param-value>
+        </init-param>
+         <load-on-startup>5</load-on-startup>
+    </servlet>
+-->
+
+
+  <!-- ================ Built In Servlet Mappings ========================= -->
+
+
+  <!-- The servlet mappings for the built in servlets defined above.  Note  -->
+  <!-- that, by default, the CGI and SSI servlets are *not* mapped.  You    -->
+  <!-- must uncomment these mappings (or add them to your application's own -->
+  <!-- web.xml deployment descriptor) to enable these services              -->
+
+    <!-- The mapping for the default servlet -->
+    <servlet-mapping>
+        <servlet-name>default</servlet-name>
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+
+    <!-- The mappings for the JSP servlet -->
+    <servlet-mapping>
+        <servlet-name>jsp</servlet-name>
+        <url-pattern>*.jsp</url-pattern>
+        <url-pattern>*.jspx</url-pattern>
+    </servlet-mapping>
+
+    <!-- The mapping for the SSI servlet -->
+<!--
+    <servlet-mapping>
+        <servlet-name>ssi</servlet-name>
+        <url-pattern>*.shtml</url-pattern>
+    </servlet-mapping>
+-->
+
+    <!-- The mapping for the CGI Gateway servlet -->
+
+<!--
+    <servlet-mapping>
+        <servlet-name>cgi</servlet-name>
+        <url-pattern>/cgi-bin/*</url-pattern>
+    </servlet-mapping>
+-->
+
+
+  <!-- ================== Built In Filter Definitions ===================== -->
+
+  <!-- A filter that sets character encoding that is used to decode -->
+  <!-- parameters in a POST request -->
+<!--
+    <filter>
+        <filter-name>setCharacterEncodingFilter</filter-name>
+        <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
+        <init-param>
+            <param-name>encoding</param-name>
+            <param-value>UTF-8</param-value>
+        </init-param>
+        <async-supported>true</async-supported>
+    </filter>
+-->
+
+  <!-- A filter that triggers request parameters parsing and rejects the    -->
+  <!-- request if some parameters were skipped because of parsing errors or -->
+  <!-- request size limitations.                                            -->
+<!--
+    <filter>
+        <filter-name>failedRequestFilter</filter-name>
+        <filter-class>
+          org.apache.catalina.filters.FailedRequestFilter
+        </filter-class>
+        <async-supported>true</async-supported>
+    </filter>
+-->
+
+
+  <!-- NOTE: An SSI Servlet is also available as an alternative SSI         -->
+  <!-- implementation. Use either the Servlet or the Filter but NOT both.   -->
+  <!--                                                                      -->
+  <!-- Server Side Includes processing filter, which processes SSI          -->
+  <!-- directives in HTML pages consistent with similar support in web      -->
+  <!-- servers like Apache.  Traditionally, this filter is mapped to the    -->
+  <!-- URL pattern "*.shtml", though it can be mapped to "*" as it will     -->
+  <!-- selectively enable/disable SSI processing based on mime types. For   -->
+  <!-- this to work you will need to uncomment the .shtml mime type         -->
+  <!-- definition towards the bottom of this file.                          -->
+  <!-- The contentType init param allows you to apply SSI processing to JSP -->
+  <!-- pages, javascript, or any other content you wish.  This filter       -->
+  <!-- supports the following initialization parameters (default values are -->
+  <!-- in square brackets):                                                 -->
+  <!--                                                                      -->
+  <!--   contentType         A regex pattern that must be matched before    -->
+  <!--                       SSI processing is applied.                     -->
+  <!--                       [text/x-server-parsed-html(;.*)?]              -->
+  <!--                                                                      -->
+  <!--   debug               Debugging detail level for messages logged     -->
+  <!--                       by this servlet.  [0]                          -->
+  <!--                                                                      -->
+  <!--   expires             The number of seconds before a page with SSI   -->
+  <!--                       directives will expire.  [No default]          -->
+  <!--                                                                      -->
+  <!--   isVirtualWebappRelative                                            -->
+  <!--                       Should "virtual" paths be interpreted as       -->
+  <!--                       relative to the context root, instead of       -->
+  <!--                       the server root? [false]                       -->
+  <!--                                                                      -->
+  <!--   allowExec           Is use of the exec command enabled? [false]    -->
+
+<!--
+    <filter>
+        <filter-name>ssi</filter-name>
+        <filter-class>
+          org.apache.catalina.ssi.SSIFilter
+        </filter-class>
+        <init-param>
+          <param-name>contentType</param-name>
+          <param-value>text/x-server-parsed-html(;.*)?</param-value>
+        </init-param>
+        <init-param>
+          <param-name>debug</param-name>
+          <param-value>0</param-value>
+        </init-param>
+        <init-param>
+          <param-name>expires</param-name>
+          <param-value>666</param-value>
+        </init-param>
+        <init-param>
+          <param-name>isVirtualWebappRelative</param-name>
+          <param-value>false</param-value>
+        </init-param>
+    </filter>
+-->
+
+
+  <!-- ==================== Built In Filter Mappings ====================== -->
+
+  <!-- The mapping for the Set Character Encoding Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>setCharacterEncodingFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+-->
+
+  <!-- The mapping for the Failed Request Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>failedRequestFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+-->
+
+  <!-- The mapping for the SSI Filter -->
+<!--
+    <filter-mapping>
+        <filter-name>ssi</filter-name>
+        <url-pattern>*.shtml</url-pattern>
+    </filter-mapping>
+-->
+
+
+  <!-- ==================== Default Session Configuration ================= -->
+  <!-- You can set the default session timeout (in minutes) for all newly   -->
+  <!-- created sessions by modifying the value below.                       -->
+
+    <session-config>
+        <session-timeout>30</session-timeout>
+    </session-config>
+
+
+  <!-- ===================== Default MIME Type Mappings =================== -->
+  <!-- When serving static resources, Tomcat will automatically generate    -->
+  <!-- a "Content-Type" header based on the resource's filename extension,  -->
+  <!-- based on these mappings.  Additional mappings can be added here (to  -->
+  <!-- apply to all web applications), or in your own application's web.xml -->
+  <!-- deployment descriptor.                                               -->
+
+    <mime-mapping>
+        <extension>123</extension>
+        <mime-type>application/vnd.lotus-1-2-3</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3dml</extension>
+        <mime-type>text/vnd.in3d.3dml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3ds</extension>
+        <mime-type>image/x-3ds</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3g2</extension>
+        <mime-type>video/3gpp2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>3gp</extension>
+        <mime-type>video/3gpp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>7z</extension>
+        <mime-type>application/x-7z-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aab</extension>
+        <mime-type>application/x-authorware-bin</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aac</extension>
+        <mime-type>audio/x-aac</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aam</extension>
+        <mime-type>application/x-authorware-map</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aas</extension>
+        <mime-type>application/x-authorware-seg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>abs</extension>
+        <mime-type>audio/x-mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>abw</extension>
+        <mime-type>application/x-abiword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ac</extension>
+        <mime-type>application/pkix-attr-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acc</extension>
+        <mime-type>application/vnd.americandynamics.acc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ace</extension>
+        <mime-type>application/x-ace-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acu</extension>
+        <mime-type>application/vnd.acucobol</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>acutc</extension>
+        <mime-type>application/vnd.acucorp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>adp</extension>
+        <mime-type>audio/adpcm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aep</extension>
+        <mime-type>application/vnd.audiograph</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>afm</extension>
+        <mime-type>application/x-font-type1</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>afp</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ahead</extension>
+        <mime-type>application/vnd.ahead.space</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ai</extension>
+        <mime-type>application/postscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aif</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aifc</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aiff</extension>
+        <mime-type>audio/x-aiff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aim</extension>
+        <mime-type>application/x-aim</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>air</extension>
+        <mime-type>application/vnd.adobe.air-application-installer-package+zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ait</extension>
+        <mime-type>application/vnd.dvb.ait</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ami</extension>
+        <mime-type>application/vnd.amiga.ami</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>anx</extension>
+        <mime-type>application/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>apk</extension>
+        <mime-type>application/vnd.android.package-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>appcache</extension>
+        <mime-type>text/cache-manifest</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>application</extension>
+        <mime-type>application/x-ms-application</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>apr</extension>
+        <mime-type>application/vnd.lotus-approach</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>arc</extension>
+        <mime-type>application/x-freearc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>art</extension>
+        <mime-type>image/x-jg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asc</extension>
+        <mime-type>application/pgp-signature</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asf</extension>
+        <mime-type>video/x-ms-asf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asm</extension>
+        <mime-type>text/x-asm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aso</extension>
+        <mime-type>application/vnd.accpac.simply.aso</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>asx</extension>
+        <mime-type>video/x-ms-asf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atc</extension>
+        <mime-type>application/vnd.acucorp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atom</extension>
+        <mime-type>application/atom+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atomcat</extension>
+        <mime-type>application/atomcat+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atomsvc</extension>
+        <mime-type>application/atomsvc+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>atx</extension>
+        <mime-type>application/vnd.antix.game-component</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>au</extension>
+        <mime-type>audio/basic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>avi</extension>
+        <mime-type>video/x-msvideo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>avx</extension>
+        <mime-type>video/x-rad-screenplay</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>aw</extension>
+        <mime-type>application/applixware</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>axa</extension>
+        <mime-type>audio/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>axv</extension>
+        <mime-type>video/annodex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azf</extension>
+        <mime-type>application/vnd.airzip.filesecure.azf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azs</extension>
+        <mime-type>application/vnd.airzip.filesecure.azs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>azw</extension>
+        <mime-type>application/vnd.amazon.ebook</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bat</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bcpio</extension>
+        <mime-type>application/x-bcpio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bdf</extension>
+        <mime-type>application/x-font-bdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bdm</extension>
+        <mime-type>application/vnd.syncml.dm+wbxml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bed</extension>
+        <mime-type>application/vnd.realvnc.bed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bh2</extension>
+        <mime-type>application/vnd.fujitsu.oasysprs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bin</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>blb</extension>
+        <mime-type>application/x-blorb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>blorb</extension>
+        <mime-type>application/x-blorb</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bmi</extension>
+        <mime-type>application/vnd.bmi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bmp</extension>
+        <mime-type>image/bmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>body</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>book</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>box</extension>
+        <mime-type>application/vnd.previewsystems.box</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>boz</extension>
+        <mime-type>application/x-bzip2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bpk</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>btif</extension>
+        <mime-type>image/prs.btif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bz</extension>
+        <mime-type>application/x-bzip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>bz2</extension>
+        <mime-type>application/x-bzip2</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c11amc</extension>
+        <mime-type>application/vnd.cluetrust.cartomobile-config</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c11amz</extension>
+        <mime-type>application/vnd.cluetrust.cartomobile-config-pkg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4d</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4f</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4g</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4p</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>c4u</extension>
+        <mime-type>application/vnd.clonk.c4group</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cab</extension>
+        <mime-type>application/vnd.ms-cab-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>caf</extension>
+        <mime-type>audio/x-caf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cap</extension>
+        <mime-type>application/vnd.tcpdump.pcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>car</extension>
+        <mime-type>application/vnd.curl.car</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cat</extension>
+        <mime-type>application/vnd.ms-pki.seccat</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cb7</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cba</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbr</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbt</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cbz</extension>
+        <mime-type>application/x-cbr</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cc</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cct</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ccxml</extension>
+        <mime-type>application/ccxml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdbcmsg</extension>
+        <mime-type>application/vnd.contact.cmsg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdf</extension>
+        <mime-type>application/x-cdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdkey</extension>
+        <mime-type>application/vnd.mediastation.cdkey</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmia</extension>
+        <mime-type>application/cdmi-capability</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmic</extension>
+        <mime-type>application/cdmi-container</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmid</extension>
+        <mime-type>application/cdmi-domain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmio</extension>
+        <mime-type>application/cdmi-object</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdmiq</extension>
+        <mime-type>application/cdmi-queue</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdx</extension>
+        <mime-type>chemical/x-cdx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdxml</extension>
+        <mime-type>application/vnd.chemdraw+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cdy</extension>
+        <mime-type>application/vnd.cinderella</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cer</extension>
+        <mime-type>application/pkix-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cfs</extension>
+        <mime-type>application/x-cfs-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cgm</extension>
+        <mime-type>image/cgm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chat</extension>
+        <mime-type>application/x-chat</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chm</extension>
+        <mime-type>application/vnd.ms-htmlhelp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>chrt</extension>
+        <mime-type>application/vnd.kde.kchart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cif</extension>
+        <mime-type>chemical/x-cif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cii</extension>
+        <mime-type>application/vnd.anser-web-certificate-issue-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cil</extension>
+        <mime-type>application/vnd.ms-artgalry</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cla</extension>
+        <mime-type>application/vnd.claymore</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>class</extension>
+        <mime-type>application/java</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkk</extension>
+        <mime-type>application/vnd.crick.clicker.keyboard</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkp</extension>
+        <mime-type>application/vnd.crick.clicker.palette</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkt</extension>
+        <mime-type>application/vnd.crick.clicker.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkw</extension>
+        <mime-type>application/vnd.crick.clicker.wordbank</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clkx</extension>
+        <mime-type>application/vnd.crick.clicker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>clp</extension>
+        <mime-type>application/x-msclip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmc</extension>
+        <mime-type>application/vnd.cosmocaller</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmdf</extension>
+        <mime-type>chemical/x-cmdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cml</extension>
+        <mime-type>chemical/x-cml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmp</extension>
+        <mime-type>application/vnd.yellowriver-custom-menu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cmx</extension>
+        <mime-type>image/x-cmx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cod</extension>
+        <mime-type>application/vnd.rim.cod</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>com</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>conf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpio</extension>
+        <mime-type>application/x-cpio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpp</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cpt</extension>
+        <mime-type>application/mac-compactpro</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crd</extension>
+        <mime-type>application/x-mscardfile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crl</extension>
+        <mime-type>application/pkix-crl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>crt</extension>
+        <mime-type>application/x-x509-ca-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cryptonote</extension>
+        <mime-type>application/vnd.rig.cryptonote</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csh</extension>
+        <mime-type>application/x-csh</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csml</extension>
+        <mime-type>chemical/x-csml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csp</extension>
+        <mime-type>application/vnd.commonspace</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>css</extension>
+        <mime-type>text/css</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cst</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>csv</extension>
+        <mime-type>text/csv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cu</extension>
+        <mime-type>application/cu-seeme</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>curl</extension>
+        <mime-type>text/vnd.curl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cww</extension>
+        <mime-type>application/prs.cww</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cxt</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>cxx</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dae</extension>
+        <mime-type>model/vnd.collada+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>daf</extension>
+        <mime-type>application/vnd.mobius.daf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dart</extension>
+        <mime-type>application/vnd.dart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dataless</extension>
+        <mime-type>application/vnd.fdsn.seed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>davmount</extension>
+        <mime-type>application/davmount+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dbk</extension>
+        <mime-type>application/docbook+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dcr</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dcurl</extension>
+        <mime-type>text/vnd.curl.dcurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dd2</extension>
+        <mime-type>application/vnd.oma.dd2+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ddd</extension>
+        <mime-type>application/vnd.fujixerox.ddd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>deb</extension>
+        <mime-type>application/x-debian-package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>def</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>deploy</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>der</extension>
+        <mime-type>application/x-x509-ca-cert</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dfac</extension>
+        <mime-type>application/vnd.dreamfactory</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dgc</extension>
+        <mime-type>application/x-dgc-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dib</extension>
+        <mime-type>image/bmp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dic</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dir</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dis</extension>
+        <mime-type>application/vnd.mobius.dis</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dist</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>distz</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>djv</extension>
+        <mime-type>image/vnd.djvu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>djvu</extension>
+        <mime-type>image/vnd.djvu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dll</extension>
+        <mime-type>application/x-msdownload</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dmg</extension>
+        <mime-type>application/x-apple-diskimage</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dmp</extension>
+        <mime-type>application/vnd.tcpdump.pcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dms</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dna</extension>
+        <mime-type>application/vnd.dna</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>doc</extension>
+        <mime-type>application/msword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>docm</extension>
+        <mime-type>application/vnd.ms-word.document.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>docx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dot</extension>
+        <mime-type>application/msword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dotm</extension>
+        <mime-type>application/vnd.ms-word.template.macroenabled.12</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dotx</extension>
+        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.template</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dp</extension>
+        <mime-type>application/vnd.osgi.dp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dpg</extension>
+        <mime-type>application/vnd.dpgraph</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dra</extension>
+        <mime-type>audio/vnd.dra</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dsc</extension>
+        <mime-type>text/prs.lines.tag</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dssc</extension>
+        <mime-type>application/dssc+der</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtb</extension>
+        <mime-type>application/x-dtbook+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtd</extension>
+        <mime-type>application/xml-dtd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dts</extension>
+        <mime-type>audio/vnd.dts</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dtshd</extension>
+        <mime-type>audio/vnd.dts.hd</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dump</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dv</extension>
+        <mime-type>video/x-dv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dvb</extension>
+        <mime-type>video/vnd.dvb.file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dvi</extension>
+        <mime-type>application/x-dvi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dwf</extension>
+        <mime-type>model/vnd.dwf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dwg</extension>
+        <mime-type>image/vnd.dwg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxf</extension>
+        <mime-type>image/vnd.dxf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxp</extension>
+        <mime-type>application/vnd.spotfire.dxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>dxr</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp4800</extension>
+        <mime-type>audio/vnd.nuera.ecelp4800</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp7470</extension>
+        <mime-type>audio/vnd.nuera.ecelp7470</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecelp9600</extension>
+        <mime-type>audio/vnd.nuera.ecelp9600</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ecma</extension>
+        <mime-type>application/ecmascript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>edm</extension>
+        <mime-type>application/vnd.novadigm.edm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>edx</extension>
+        <mime-type>application/vnd.novadigm.edx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>efif</extension>
+        <mime-type>application/vnd.picsel</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ei6</extension>
+        <mime-type>application/vnd.pg.osasli</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>elc</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emf</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eml</extension>
+        <mime-type>message/rfc822</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emma</extension>
+        <mime-type>application/emma+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>emz</extension>
+        <mime-type>application/x-msmetafile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eol</extension>
+        <mime-type>audio/vnd.digital-winds</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eot</extension>
+        <mime-type>application/vnd.ms-fontobject</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eps</extension>
+        <mime-type>application/postscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>epub</extension>
+        <mime-type>application/epub+zip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>es3</extension>
+        <mime-type>application/vnd.eszigno3+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>esa</extension>
+        <mime-type>application/vnd.osgi.subsystem</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>esf</extension>
+        <mime-type>application/vnd.epson.esf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>et3</extension>
+        <mime-type>application/vnd.eszigno3+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>etx</extension>
+        <mime-type>text/x-setext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>eva</extension>
+        <mime-type>application/x-eva</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>evy</extension>
+        <mime-type>application/x-envoy</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>exe</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>exi</extension>
+        <mime-type>application/exi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ext</extension>
+        <mime-type>application/vnd.novadigm.ext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez</extension>
+        <mime-type>application/andrew-inset</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez2</extension>
+        <mime-type>application/vnd.ezpix-album</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ez3</extension>
+        <mime-type>application/vnd.ezpix-package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f4v</extension>
+        <mime-type>video/x-f4v</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f77</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>f90</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fbs</extension>
+        <mime-type>image/vnd.fastbidsheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fcdt</extension>
+        <mime-type>application/vnd.adobe.formscentral.fcdt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fcs</extension>
+        <mime-type>application/vnd.isac.fcs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fdf</extension>
+        <mime-type>application/vnd.fdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fe_launch</extension>
+        <mime-type>application/vnd.denovo.fcselayout-link</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fg5</extension>
+        <mime-type>application/vnd.fujitsu.oasysgp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fgd</extension>
+        <mime-type>application/x-director</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh4</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh5</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fh7</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fhc</extension>
+        <mime-type>image/x-freehand</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fig</extension>
+        <mime-type>application/x-xfig</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flac</extension>
+        <mime-type>audio/flac</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fli</extension>
+        <mime-type>video/x-fli</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flo</extension>
+        <mime-type>application/vnd.micrografx.flo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flv</extension>
+        <mime-type>video/x-flv</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flw</extension>
+        <mime-type>application/vnd.kde.kivio</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>flx</extension>
+        <mime-type>text/vnd.fmi.flexstor</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fly</extension>
+        <mime-type>text/vnd.fly</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fm</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fnc</extension>
+        <mime-type>application/vnd.frogans.fnc</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>for</extension>
+        <mime-type>text/x-fortran</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fpx</extension>
+        <mime-type>image/vnd.fpx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>frame</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fsc</extension>
+        <mime-type>application/vnd.fsc.weblaunch</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fst</extension>
+        <mime-type>image/vnd.fst</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ftc</extension>
+        <mime-type>application/vnd.fluxtime.clip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fti</extension>
+        <mime-type>application/vnd.anser-web-funds-transfer-initiation</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fvt</extension>
+        <mime-type>video/vnd.fvt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fxp</extension>
+        <mime-type>application/vnd.adobe.fxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fxpl</extension>
+        <mime-type>application/vnd.adobe.fxp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>fzs</extension>
+        <mime-type>application/vnd.fuzzysheet</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g2w</extension>
+        <mime-type>application/vnd.geoplan</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g3</extension>
+        <mime-type>image/g3fax</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>g3w</extension>
+        <mime-type>application/vnd.geospace</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gac</extension>
+        <mime-type>application/vnd.groove-account</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gam</extension>
+        <mime-type>application/x-tads</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gbr</extension>
+        <mime-type>application/rpki-ghostbusters</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gca</extension>
+        <mime-type>application/x-gca-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gdl</extension>
+        <mime-type>model/vnd.gdl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>geo</extension>
+        <mime-type>application/vnd.dynageo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gex</extension>
+        <mime-type>application/vnd.geometry-explorer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ggb</extension>
+        <mime-type>application/vnd.geogebra.file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ggt</extension>
+        <mime-type>application/vnd.geogebra.tool</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ghf</extension>
+        <mime-type>application/vnd.groove-help</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gif</extension>
+        <mime-type>image/gif</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gim</extension>
+        <mime-type>application/vnd.groove-identity-message</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gml</extension>
+        <mime-type>application/gml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gmx</extension>
+        <mime-type>application/vnd.gmx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gnumeric</extension>
+        <mime-type>application/x-gnumeric</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gph</extension>
+        <mime-type>application/vnd.flographit</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gpx</extension>
+        <mime-type>application/gpx+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gqf</extension>
+        <mime-type>application/vnd.grafeq</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gqs</extension>
+        <mime-type>application/vnd.grafeq</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gram</extension>
+        <mime-type>application/srgs</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gramps</extension>
+        <mime-type>application/x-gramps-xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gre</extension>
+        <mime-type>application/vnd.geometry-explorer</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>grv</extension>
+        <mime-type>application/vnd.groove-injector</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>grxml</extension>
+        <mime-type>application/srgs+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gsf</extension>
+        <mime-type>application/x-font-ghostscript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtar</extension>
+        <mime-type>application/x-gtar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtm</extension>
+        <mime-type>application/vnd.groove-tool-message</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gtw</extension>
+        <mime-type>model/vnd.gtw</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gv</extension>
+        <mime-type>text/vnd.graphviz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gxf</extension>
+        <mime-type>application/gxf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gxt</extension>
+        <mime-type>application/vnd.geonext</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>gz</extension>
+        <mime-type>application/x-gzip</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h261</extension>
+        <mime-type>video/h261</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h263</extension>
+        <mime-type>video/h263</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>h264</extension>
+        <mime-type>video/h264</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hal</extension>
+        <mime-type>application/vnd.hal+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hbci</extension>
+        <mime-type>application/vnd.hbci</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hdf</extension>
+        <mime-type>application/x-hdf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hh</extension>
+        <mime-type>text/x-c</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hlp</extension>
+        <mime-type>application/winhlp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hpgl</extension>
+        <mime-type>application/vnd.hp-hpgl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hpid</extension>
+        <mime-type>application/vnd.hp-hpid</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hps</extension>
+        <mime-type>application/vnd.hp-hps</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hqx</extension>
+        <mime-type>application/mac-binhex40</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htc</extension>
+        <mime-type>text/x-component</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htke</extension>
+        <mime-type>application/vnd.kenameaapp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>htm</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>html</extension>
+        <mime-type>text/html</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvd</extension>
+        <mime-type>application/vnd.yamaha.hv-dic</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvp</extension>
+        <mime-type>application/vnd.yamaha.hv-voice</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>hvs</extension>
+        <mime-type>application/vnd.yamaha.hv-script</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>i2g</extension>
+        <mime-type>application/vnd.intergeo</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>icc</extension>
+        <mime-type>application/vnd.iccprofile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ice</extension>
+        <mime-type>x-conference/x-cooltalk</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>icm</extension>
+        <mime-type>application/vnd.iccprofile</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ico</extension>
+        <mime-type>image/x-icon</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ics</extension>
+        <mime-type>text/calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ief</extension>
+        <mime-type>image/ief</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ifb</extension>
+        <mime-type>text/calendar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ifm</extension>
+        <mime-type>application/vnd.shana.informed.formdata</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iges</extension>
+        <mime-type>model/iges</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igl</extension>
+        <mime-type>application/vnd.igloader</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igm</extension>
+        <mime-type>application/vnd.insors.igm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igs</extension>
+        <mime-type>model/iges</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>igx</extension>
+        <mime-type>application/vnd.micrografx.igx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iif</extension>
+        <mime-type>application/vnd.shana.informed.interchange</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>imp</extension>
+        <mime-type>application/vnd.accpac.simply.imp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ims</extension>
+        <mime-type>application/vnd.ms-ims</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>in</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ink</extension>
+        <mime-type>application/inkml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>inkml</extension>
+        <mime-type>application/inkml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>install</extension>
+        <mime-type>application/x-install-instructions</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iota</extension>
+        <mime-type>application/vnd.astraea-software.iota</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ipfix</extension>
+        <mime-type>application/ipfix</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ipk</extension>
+        <mime-type>application/vnd.shana.informed.package</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>irm</extension>
+        <mime-type>application/vnd.ibm.rights-management</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>irp</extension>
+        <mime-type>application/vnd.irepository.package+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>iso</extension>
+        <mime-type>application/x-iso9660-image</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>itp</extension>
+        <mime-type>application/vnd.shana.informed.formtemplate</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ivp</extension>
+        <mime-type>application/vnd.immervision-ivp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ivu</extension>
+        <mime-type>application/vnd.immervision-ivu</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jad</extension>
+        <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jam</extension>
+        <mime-type>application/vnd.jam</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jar</extension>
+        <mime-type>application/java-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>java</extension>
+        <mime-type>text/x-java-source</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jisp</extension>
+        <mime-type>application/vnd.jisp</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jlt</extension>
+        <mime-type>application/vnd.hp-jlyt</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jnlp</extension>
+        <mime-type>application/x-java-jnlp-file</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>joda</extension>
+        <mime-type>application/vnd.joost.joda-archive</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpe</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpeg</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpg</extension>
+        <mime-type>image/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpgm</extension>
+        <mime-type>video/jpm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpgv</extension>
+        <mime-type>video/jpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jpm</extension>
+        <mime-type>video/jpm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>js</extension>
+        <mime-type>application/javascript</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jsf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>json</extension>
+        <mime-type>application/json</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jsonml</extension>
+        <mime-type>application/jsonml+json</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>jspf</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kar</extension>
+        <mime-type>audio/midi</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>karbon</extension>
+        <mime-type>application/vnd.kde.karbon</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kfo</extension>
+        <mime-type>application/vnd.kde.kformula</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kia</extension>
+        <mime-type>application/vnd.kidspiration</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kml</extension>
+        <mime-type>application/vnd.google-earth.kml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kmz</extension>
+        <mime-type>application/vnd.google-earth.kmz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kne</extension>
+        <mime-type>application/vnd.kinar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>knp</extension>
+        <mime-type>application/vnd.kinar</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kon</extension>
+        <mime-type>application/vnd.kde.kontour</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpr</extension>
+        <mime-type>application/vnd.kde.kpresenter</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpt</extension>
+        <mime-type>application/vnd.kde.kpresenter</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kpxx</extension>
+        <mime-type>application/vnd.ds-keypoint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ksp</extension>
+        <mime-type>application/vnd.kde.kspread</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktr</extension>
+        <mime-type>application/vnd.kahootz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktx</extension>
+        <mime-type>image/ktx</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ktz</extension>
+        <mime-type>application/vnd.kahootz</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kwd</extension>
+        <mime-type>application/vnd.kde.kword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>kwt</extension>
+        <mime-type>application/vnd.kde.kword</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lasxml</extension>
+        <mime-type>application/vnd.las.las+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>latex</extension>
+        <mime-type>application/x-latex</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lbd</extension>
+        <mime-type>application/vnd.llamagraphics.life-balance.desktop</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lbe</extension>
+        <mime-type>application/vnd.llamagraphics.life-balance.exchange+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>les</extension>
+        <mime-type>application/vnd.hhe.lesson-player</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lha</extension>
+        <mime-type>application/x-lzh-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>link66</extension>
+        <mime-type>application/vnd.route66.link66+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>list</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>list3820</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>listafp</extension>
+        <mime-type>application/vnd.ibm.modcap</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lnk</extension>
+        <mime-type>application/x-ms-shortcut</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>log</extension>
+        <mime-type>text/plain</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lostxml</extension>
+        <mime-type>application/lost+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lrf</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lrm</extension>
+        <mime-type>application/vnd.ms-lrm</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ltf</extension>
+        <mime-type>application/vnd.frogans.ltf</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lvp</extension>
+        <mime-type>audio/vnd.lucent.voice</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lwp</extension>
+        <mime-type>application/vnd.lotus-wordpro</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>lzh</extension>
+        <mime-type>application/x-lzh-compressed</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m13</extension>
+        <mime-type>application/x-msmediaview</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m14</extension>
+        <mime-type>application/x-msmediaview</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m1v</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m21</extension>
+        <mime-type>application/mp21</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m2a</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m2v</extension>
+        <mime-type>video/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3a</extension>
+        <mime-type>audio/mpeg</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3u</extension>
+        <mime-type>audio/x-mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m3u8</extension>
+        <mime-type>application/vnd.apple.mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4a</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4b</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4r</extension>
+        <mime-type>audio/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4u</extension>
+        <mime-type>video/vnd.mpegurl</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>m4v</extension>
+        <mime-type>video/mp4</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>ma</extension>
+        <mime-type>application/mathematica</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mac</extension>
+        <mime-type>image/x-macpaint</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mads</extension>
+        <mime-type>application/mads+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mag</extension>
+        <mime-type>application/vnd.ecowin.chart</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>maker</extension>
+        <mime-type>application/vnd.framemaker</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>man</extension>
+        <mime-type>text/troff</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mar</extension>
+        <mime-type>application/octet-stream</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mathml</extension>
+        <mime-type>application/mathml+xml</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mb</extension>
+        <mime-type>application/mathematica</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mbk</extension>
+        <mime-type>application/vnd.mobius.mbk</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mbox</extension>
+        <mime-type>application/mbox</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mc1</extension>
+        <mime-type>application/vnd.medcalcdata</mime-type>
+    </mime-mapping>
+    <mime-mapping>
+        <extension>mcd</extension>
+        <mime-type>application/vnd.mcd</mim

<TRUNCATED>

[10/10] incubator-brooklyn git commit: This closes #325

Posted by he...@apache.org.
This closes #325


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/50e3cbce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/50e3cbce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/50e3cbce

Branch: refs/heads/master
Commit: 50e3cbce13881901b766f5d5c230c5221a8ea56d
Parents: 7ef195f d1c0782
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Nov 13 12:43:36 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 13 12:43:36 2014 +0000

----------------------------------------------------------------------
 .../entity/rebind/persister/XmlMementoSerializer.java    |  2 ++
 .../test/java/brooklyn/entity/rebind/RebindFeedTest.java | 11 ++++++++---
 .../entity/brooklynnode/BrooklynEntityMirrorImpl.java    |  6 ++++++
 3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[06/10] incubator-brooklyn git commit: Fix feed serialization and update test to catch the problem.

Posted by he...@apache.org.
Fix feed serialization and update test to catch the problem.

Feeds are serialized with the wrong element name (BasicFeedMemento.class.getName() vs feed) from what the code expects, allowing for only a single feed to be deserialized successfully.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d1c07820
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d1c07820
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d1c07820

Branch: refs/heads/master
Commit: d1c07820f4d3bd7cb050e56b90d5330537525534
Parents: 3b38639
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Nov 13 11:13:26 2014 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Nov 13 11:13:26 2014 +0200

----------------------------------------------------------------------
 .../entity/rebind/persister/XmlMementoSerializer.java    |  2 ++
 .../test/java/brooklyn/entity/rebind/RebindFeedTest.java | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d1c07820/core/src/main/java/brooklyn/entity/rebind/persister/XmlMementoSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/persister/XmlMementoSerializer.java b/core/src/main/java/brooklyn/entity/rebind/persister/XmlMementoSerializer.java
index 881f101..a179479 100644
--- a/core/src/main/java/brooklyn/entity/rebind/persister/XmlMementoSerializer.java
+++ b/core/src/main/java/brooklyn/entity/rebind/persister/XmlMementoSerializer.java
@@ -38,6 +38,7 @@ import brooklyn.entity.effector.EffectorTasks.EffectorTaskFactory;
 import brooklyn.entity.rebind.dto.BasicCatalogItemMemento;
 import brooklyn.entity.rebind.dto.BasicEnricherMemento;
 import brooklyn.entity.rebind.dto.BasicEntityMemento;
+import brooklyn.entity.rebind.dto.BasicFeedMemento;
 import brooklyn.entity.rebind.dto.BasicLocationMemento;
 import brooklyn.entity.rebind.dto.BasicPolicyMemento;
 import brooklyn.entity.rebind.dto.MutableBrooklynMemento;
@@ -85,6 +86,7 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T> implements Memento
         xstream.alias("entity", BasicEntityMemento.class);
         xstream.alias("location", BasicLocationMemento.class);
         xstream.alias("policy", BasicPolicyMemento.class);
+        xstream.alias("feed", BasicFeedMemento.class);
         xstream.alias("enricher", BasicEnricherMemento.class);
         xstream.alias("configKey", BasicConfigKey.class);
         xstream.alias("catalogItem", BasicCatalogItemMemento.class);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d1c07820/core/src/test/java/brooklyn/entity/rebind/RebindFeedTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindFeedTest.java b/core/src/test/java/brooklyn/entity/rebind/RebindFeedTest.java
index 7692771..c0be0fb 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindFeedTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindFeedTest.java
@@ -50,7 +50,6 @@ import brooklyn.location.Location;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.location.basic.SshMachineLocation;
 import brooklyn.management.Task;
-import brooklyn.test.Asserts;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestEntity;
 import brooklyn.test.entity.TestEntityImpl.TestEntityWithoutEnrichers;
@@ -151,13 +150,13 @@ public class RebindFeedTest extends RebindTestFixtureWithApp {
     public void testFunctionFeedRegisteredInInitIsPersisted() throws Exception {
         TestEntity origEntity = origApp.createAndManageChild(EntitySpec.create(TestEntity.class).impl(MyEntityWithFunctionFeedImpl.class));
         EntityTestUtils.assertAttributeEqualsEventually(origEntity, SENSOR_INT, (Integer)1);
-        assertEquals(origEntity.feeds().getFeeds().size(), 1);
+        assertEquals(origEntity.feeds().getFeeds().size(), 2);
 
         newApp = rebind(false);
         TestEntity newEntity = (TestEntity) Iterables.getOnlyElement(newApp.getChildren());
         
         Collection<Feed> newFeeds = newEntity.feeds().getFeeds();
-        assertEquals(newFeeds.size(), 1);
+        assertEquals(newFeeds.size(), 2);
         
         // Expect the feed to still be polling
         newEntity.setAttribute(SENSOR_INT, null);
@@ -217,6 +216,12 @@ public class RebindFeedTest extends RebindTestFixtureWithApp {
                             .period(POLL_PERIOD)
                             .callable(Callables.returning(1)))
                     .build());
+            addFeed(FunctionFeed.builder()
+                    .entity(this)
+                    .poll(FunctionPollConfig.forSensor(SENSOR_STRING)
+                            .period(POLL_PERIOD)
+                            .callable(Callables.returning("OK")))
+                    .build());
         }
     }
     


[04/10] incubator-brooklyn git commit: Documentation improvements

Posted by he...@apache.org.
Documentation improvements


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/0dc8e38c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/0dc8e38c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/0dc8e38c

Branch: refs/heads/master
Commit: 0dc8e38c4acb510046a3ae5674aab86d96065fb0
Parents: ed00435
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Wed Nov 12 23:26:43 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Wed Nov 12 23:26:43 2014 +0000

----------------------------------------------------------------------
 core/src/main/java/brooklyn/enricher/Enrichers.java       | 10 +++++++---
 .../java/brooklyn/entity/basic/AbstractGroupImpl.java     |  2 +-
 .../entity/group/AbstractMembershipTrackingPolicy.java    |  5 ++++-
 .../java/brooklyn/entity/webapp/JavaWebAppDriver.java     | 10 ++++++----
 usage/downstream-parent/pom.xml                           |  2 +-
 5 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0dc8e38c/core/src/main/java/brooklyn/enricher/Enrichers.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/enricher/Enrichers.java b/core/src/main/java/brooklyn/enricher/Enrichers.java
index 48b7a56..a474f37 100644
--- a/core/src/main/java/brooklyn/enricher/Enrichers.java
+++ b/core/src/main/java/brooklyn/enricher/Enrichers.java
@@ -135,12 +135,16 @@ public class Enrichers {
             return new PropagatorBuilder(true, vals);
         }
         
-        /** builds an enricher which transforms a given sensor:
-         * <li> applying a (required) function ({@link TransformerBuilder#computing(Function)}, or {@link TransformerBuilder#computingAverage()}/{@link TransformerBuilder#computingSum()}, mandatory);
+        /**
+         * Builds an enricher which transforms a given sensor:
+         * <li> applying a (required) function ({@link TransformerBuilder#computing(Function)}, or
+         *      {@link AbstractAggregatorBuilder#computingAverage()}/
+         *      {@link AbstractAggregatorBuilder#computingSum()}, mandatory);
          * <li> and publishing it on the entity where the enricher is attached;
          * <li> optionally taking the sensor from a different source entity ({@link TransformerBuilder#from(Entity)});
          * <li> and optionally publishing it as a different sensor ({@link TransformerBuilder#publishing(AttributeSensor)});
-         * <p> (You must supply at least one of the optional values, of course, otherwise the enricher may loop endlessly!) */
+         * <p> You must supply at least one of the optional values, of course, otherwise the enricher may loop endlessly!
+         */
         public <S> TransformerBuilder<S, Object> transforming(AttributeSensor<S> val) {
             return new TransformerBuilder<S, Object>(val);
         }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0dc8e38c/core/src/main/java/brooklyn/entity/basic/AbstractGroupImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/AbstractGroupImpl.java b/core/src/main/java/brooklyn/entity/basic/AbstractGroupImpl.java
index 837003c..1b40603 100644
--- a/core/src/main/java/brooklyn/entity/basic/AbstractGroupImpl.java
+++ b/core/src/main/java/brooklyn/entity/basic/AbstractGroupImpl.java
@@ -54,7 +54,7 @@ import com.google.common.collect.Sets;
  * current number of members.
  */
 public abstract class AbstractGroupImpl extends AbstractEntity implements AbstractGroup {
-    private static final Logger log = LoggerFactory.getLogger(AbstractGroup.class);
+    private static final Logger log = LoggerFactory.getLogger(AbstractGroupImpl.class);
 
     private Set<Entity> members = Sets.newLinkedHashSet();
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0dc8e38c/core/src/main/java/brooklyn/entity/group/AbstractMembershipTrackingPolicy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/group/AbstractMembershipTrackingPolicy.java b/core/src/main/java/brooklyn/entity/group/AbstractMembershipTrackingPolicy.java
index abc5e9d..22a2917 100644
--- a/core/src/main/java/brooklyn/entity/group/AbstractMembershipTrackingPolicy.java
+++ b/core/src/main/java/brooklyn/entity/group/AbstractMembershipTrackingPolicy.java
@@ -46,7 +46,10 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.reflect.TypeToken;
 
-/** abstract class which helps track membership of a group, invoking (empty) methods in this class on MEMBER{ADDED,REMOVED} events, as well as SERVICE_UP {true,false} for those members. */
+/**
+ * Abstract class which helps track membership of a group, invoking (empty) methods in this class
+ * on MEMBER{ADDED,REMOVED} events, as well as SERVICE_UP {true,false} for those members.
+ */
 public abstract class AbstractMembershipTrackingPolicy extends AbstractPolicy {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractMembershipTrackingPolicy.class);
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0dc8e38c/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppDriver.java
index 3206ff9..f355555 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppDriver.java
@@ -38,15 +38,17 @@ public interface JavaWebAppDriver extends JavaSoftwareProcessDriver {
     void deploy(File f, String targetName);
 
     /**
-     * deploys a URL as a webapp at the appserver;
-     * returns a token which can be used as an argument to undeploy,
-     * typically the web context with leading slash where the app can be reached (just "/" for ROOT)
+     * Deploys a URL as a webapp at the appserver.
      * <p>
-     * see {@link JavaWebAppSoftwareProcess#deploy(String, String)} for details of how input filenames are handled
+     * See {@link JavaWebAppSoftwareProcess#deploy(String, String)} for details of how input filenames are handled.
+     *
+     * @return A token which can be used as an argument to undeploy.
+     *     Typically the web context with leading slash where the app can be reached (just "/" for ROOT)
      */
     String deploy(String url, String targetName);
     
     void undeploy(String targetName);
     
     FilenameToWebContextMapper getFilenameContextMapper();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0dc8e38c/usage/downstream-parent/pom.xml
----------------------------------------------------------------------
diff --git a/usage/downstream-parent/pom.xml b/usage/downstream-parent/pom.xml
index 251f5b2..bd70840 100644
--- a/usage/downstream-parent/pom.xml
+++ b/usage/downstream-parent/pom.xml
@@ -32,7 +32,7 @@
   </description>
 
   <properties>
-    <!-- Compilatin -->
+    <!-- Compilation -->
     <java.version>1.6</java.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>


[09/10] incubator-brooklyn git commit: fix a few https/tomcat issues

Posted by he...@apache.org.
fix a few https/tomcat issues

add yaml example, making HttpsSslConfig coercible from a map, and misc tidy-up from #323 -
* use httpsPort when configuring (previously hard-coded 8443)
* fix integration test - parameters supplier, each entity needs its own app due to their lifecycle

also rename JbossXxxx things to JBossXxx (taking care to change names slightly to prevent case-insensitive collision errors)


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/7ef195f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/7ef195f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/7ef195f0

Branch: refs/heads/master
Commit: 7ef195f004bd7e4e718e1af744eaa31e5cf1015b
Parents: 49dad19
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Nov 13 12:26:55 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 13 12:43:34 2014 +0000

----------------------------------------------------------------------
 .../java/brooklyn/event/feed/jmx/JmxFeed.java   |   2 +-
 .../brooklyn/entity/webapp/HttpsSslConfig.java  |  21 ++
 .../webapp/JavaWebAppSoftwareProcess.java       |  10 +
 .../webapp/JavaWebAppSoftwareProcessImpl.java   |   2 +-
 .../entity/webapp/sample-java-keystore.jks      | Bin 0 -> 1355 bytes
 .../entity/webapp/sample-java-keystore.txt      |  22 +++
 .../brooklyn/entity/webapp/tomcat/server.xml    |  14 +-
 .../AbstractWebAppFixtureIntegrationTest.java   |  40 +---
 ...ElasticJavaWebAppServiceIntegrationTest.java |   9 +-
 .../entity/webapp/HttpsSslConfigTest.java       |  38 ++++
 .../webapp/TomcatAutoScalerPolicyTest.java      |   3 +-
 .../jboss/JBoss6ServerAwsEc2LiveTest.java       |  68 +++++++
 ...Boss6ServerNonInheritingIntegrationTest.java | 103 ++++++++++
 .../jboss/JBoss7ServerAwsEc2LiveTest.java       |  74 +++++++
 .../jboss/JBoss7ServerDockerLiveTest.java       |  70 +++++++
 ...Boss7ServerNonInheritingIntegrationTest.java | 184 ++++++++++++++++++
 .../JBoss7ServerRebindingIntegrationTest.java   | 122 ++++++++++++
 ...ultiVersionWebAppFixtureIntegrationTest.java | 106 ++++++++++
 .../webapp/jboss/Jboss6ServerEc2LiveTest.java   |  68 -------
 .../jboss/Jboss6ServerIntegrationTest.java      | 103 ----------
 .../webapp/jboss/Jboss7DockerLiveTest.java      |  70 -------
 .../webapp/jboss/Jboss7ServerEc2LiveTest.java   |  74 -------
 .../jboss/Jboss7ServerIntegrationTest.java      | 194 -------------------
 .../Jboss7ServerRebindIntegrationTest.java      | 126 ------------
 ...JbossServerWebAppFixtureIntegrationTest.java | 106 ----------
 ...omcatServerWebAppFixtureIntegrationTest.java |  29 +--
 .../src/test/resources/test-tomcat-https.yaml   |  29 +++
 27 files changed, 886 insertions(+), 801 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
index 24d95b5..132740c 100644
--- a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
+++ b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
@@ -423,6 +423,6 @@ public class JmxFeed extends AbstractFeed {
     
     @Override
     public String toString() {
-        return "JmxFeed["+getJmxUri()+"]";
+        return "JmxFeed["+(getManagementContext()!=null&&getManagementContext().isRunning()?getJmxUri():"mgmt-not-running")+"]";
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java b/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
index 672cfb3..cca69d0 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
@@ -18,6 +18,10 @@
  */
 package brooklyn.entity.webapp;
 
+import java.util.Map;
+
+import brooklyn.util.guava.Maybe;
+
 public class HttpsSslConfig {
 
     private String keystoreUrl;
@@ -50,4 +54,21 @@ public class HttpsSslConfig {
     public String getKeyAlias() {
         return keyAlias;
     }
+
+    // method naming convention allows it to be used by TypeCoercions
+    public static HttpsSslConfig fromMap(Map<String,String> map) {
+        HttpsSslConfig result = new HttpsSslConfig();
+        result.keystoreUrl = first(map, "keystoreUrl", "url").orNull();
+        result.keystorePassword = first(map, "keystorePassword", "password").orNull();
+        result.keyAlias = first(map, "keyAlias", "alias", "key").orNull();
+        return result;
+    }
+
+    private static Maybe<String> first(Map<String,String> map, String ...keys) {
+        for (String key: keys) {
+            if (map.containsKey(key))
+                return Maybe.of(map.get(key));
+        }
+        return Maybe.<String>absent();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
index 5460f79..bbeead2 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
@@ -21,4 +21,14 @@ package brooklyn.entity.webapp;
 import brooklyn.entity.basic.SoftwareProcess;
 
 public interface JavaWebAppSoftwareProcess extends SoftwareProcess, JavaWebAppService, JavaWebAppService.CanDeployAndUndeploy {
+    
+    // exist on the interface for freemarker to pick it up
+    
+    public boolean isHttpEnabled();
+    public boolean isHttpsEnabled();
+    public Integer getHttpPort();
+    public Integer getHttpsPort();
+    public String getHttpsSslKeyAlias();
+    public String getHttpsSslKeystorePassword();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
index 165c206..209d3fe 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
@@ -200,7 +200,7 @@ public abstract class JavaWebAppSoftwareProcessImpl extends SoftwareProcessImpl
 
     public String getHttpsSslKeystorePassword() {
         HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
-        return (config == null) ? null : config.getKeystorePassword();
+        return (config == null) ? "" : config.getKeystorePassword();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks
new file mode 100644
index 0000000..ee18b1d
Binary files /dev/null and b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
new file mode 100644
index 0000000..53096b5
--- /dev/null
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
@@ -0,0 +1,22 @@
+
+Keystore for use in tests and sample YAML, containing key with alias "myname" and password "mypass";
+created for this project using AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore .
+
+
+----
+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
+

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
index 400598a..df1360c 100644
--- a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
@@ -68,36 +68,36 @@
          Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
          Java AJP  Connector: /docs/config/ajp.html
          APR (HTTP/AJP) Connector: /docs/apr.html
-         Define a non-SSL HTTP/1.1 Connector on port 8080
+         Define a non-SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
     -->
     [#if entity.httpEnabled]
     <Connector port="${driver.httpPort?c}" protocol="HTTP/1.1"
                connectionTimeout="20000"
-               redirectPort="8443" />
+               redirectPort="${driver.httpsPort?c}" />
     [/#if]
 
     <!-- A "Connector" using the shared thread pool-->
     <!--
     <Connector executor="tomcatThreadPool"
-               port="8080" protocol="HTTP/1.1"
+               port="${driver.httpPort?c}" protocol="HTTP/1.1"
                connectionTimeout="20000"
-               redirectPort="8443" />
+               redirectPort="${driver.httpsPort?c}" />
     -->
 
-    <!-- Define a SSL HTTP/1.1 Connector on port 8443
+    <!-- Define a SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
          This connector uses the BIO implementation that requires the JSSE
          style configuration. When using the APR/native implementation, the
          OpenSSL style configuration is required as described in the APR/native
          documentation -->
     [#if entity.httpsEnabled]
-    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
+    <Connector port="${driver.httpsPort?c}" protocol="org.apache.coyote.http11.Http11Protocol"
                maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
                keystoreFile="${driver.httpsSslKeystoreFile}" keystorePass="${entity.httpsSslKeystorePassword}"
                clientAuth="false" sslProtocol="TLS" />
     [/#if]
 
     <!-- Define an AJP 1.3 Connector on port 8009 -->
-    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->
+    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="${driver.httpPort?c}" /> -->
 
 
     <!-- An Engine represents the entry point (within Catalina) that processes

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
index 478f913..cbfb436 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -52,30 +52,24 @@ import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.EntityInternal;
 import brooklyn.entity.basic.EntityLocal;
 import brooklyn.entity.basic.SoftwareProcess;
-import brooklyn.entity.rebind.PersistenceExceptionHandlerImpl;
-import brooklyn.entity.rebind.dto.MementosGenerators;
-import brooklyn.entity.rebind.persister.BrooklynMementoPersisterToMultiFile;
+import brooklyn.entity.drivers.DriverDependentEntity;
 import brooklyn.entity.trait.Startable;
 import brooklyn.event.SensorEvent;
 import brooklyn.event.SensorEventListener;
+import brooklyn.location.LocationSpec;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.management.ManagementContext;
 import brooklyn.management.SubscriptionContext;
 import brooklyn.management.SubscriptionHandle;
-import brooklyn.management.ha.ManagementNodeState;
 import brooklyn.management.internal.LocalManagementContext;
-import brooklyn.management.internal.ManagementContextInternal;
-import brooklyn.mementos.BrooklynMemento;
 import brooklyn.test.Asserts;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.crypto.FluentKeySigner;
 import brooklyn.util.crypto.SecureKeys;
 import brooklyn.util.net.Urls;
-import brooklyn.util.os.Os;
 import brooklyn.util.stream.Streams;
 import brooklyn.util.time.Time;
 
@@ -112,8 +106,8 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        loc = new LocalhostMachineProvisioningLocation(MutableMap.of("name", "london"));
-        getMgmt().getLocationManager().manage(loc);
+        loc = getMgmt().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
+            .configure("name", "london"));
     }
     
     /*
@@ -239,29 +233,9 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
      * Stop the given underlying entity, but without our entity instance being told!
      */
     protected void killEntityBehindBack(Entity tokill) throws Exception {
-        // Previously was calling entity.getDriver().kill(); but now our entity instance is a proxy so can't do that
-        ManagementContext newManagementContext = null;
-        File tempDir = Os.newTempDir(getClass());
-        try {
-            ManagementContext managementContext = ((EntityInternal)tokill).getManagementContext();
-            BrooklynMemento brooklynMemento = MementosGenerators.newBrooklynMemento(managementContext);
-            
-            BrooklynMementoPersisterToMultiFile oldPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
-            oldPersister.checkpoint(brooklynMemento, PersistenceExceptionHandlerImpl.builder().build());
-            oldPersister.waitForWritesCompleted(30*1000, TimeUnit.MILLISECONDS);
-
-            BrooklynMementoPersisterToMultiFile newPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
-            newManagementContext = new LocalManagementContextForTests();
-            newManagementContext.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build());
-            newManagementContext.getRebindManager().rebind(getClass().getClassLoader(), null, ManagementNodeState.MASTER);
-            newManagementContext.getRebindManager().startPersistence();
-            SoftwareProcess entity2 = (SoftwareProcess) newManagementContext.getEntityManager().getEntity(tokill.getId());
-            entity2.stop();
-        } finally {
-            if (newManagementContext != null) ((ManagementContextInternal)newManagementContext).terminate();
-            Os.deleteRecursively(tempDir.getAbsolutePath());
-        }
-        log.info("called to stop {} in parallel mgmt universe", entity);
+        ((JavaWebAppDriver)((DriverDependentEntity<?>)Entities.deproxy(entity)).getDriver()).stop();
+        // old method of doing this did some dodgy legacy rebind and failed due to too many dangling refs; above is better in any case
+        // but TODO we should have some rebind tests for these!
     }
     
     /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
index eb90157..09535b7 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
@@ -23,7 +23,6 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.test.HttpTestUtils;
@@ -39,8 +38,8 @@ public class ElasticJavaWebAppServiceIntegrationTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        loc = new LocalhostMachineProvisioningLocation();
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
+        loc = app.newLocalhostProvisioningLocation();
     }
 
     @AfterMethod(alwaysRun=true)
@@ -48,8 +47,10 @@ public class ElasticJavaWebAppServiceIntegrationTest {
         if (app != null) Entities.destroyAll(app.getManagementContext());
     }
 
+    @SuppressWarnings("deprecation")
     @Test(groups = "Integration")
-    public void testFactory() {
+    // TODO a new approach to what ElasticJavaWebAppService.Factory does, giving a different entity depending on location!
+    public void testLegacyFactory() {
         ElasticJavaWebAppService svc =
             new ElasticJavaWebAppService.Factory().newEntity(MutableMap.of("war", "classpath://hello-world.war"), app);
         Entities.manage(svc);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
new file mode 100644
index 0000000..da4b0ce
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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 brooklyn.entity.webapp;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.flags.TypeCoercions;
+
+public class HttpsSslConfigTest {
+
+    @Test
+    public void testCoerce() {
+        HttpsSslConfig config = TypeCoercions.coerce(MutableMap.of("keystoreUrl", "http://foo", "keystorePassword", "b4r", "keyAlias", "baz"), 
+            HttpsSslConfig.class);
+        Assert.assertEquals(config.getKeystoreUrl(), "http://foo");
+        Assert.assertEquals(config.getKeystorePassword(), "b4r");
+        Assert.assertEquals(config.getKeyAlias(), "baz");
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
index dc58557..7e41d75 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
@@ -28,7 +28,6 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.webapp.tomcat.TomcatServer;
@@ -60,7 +59,7 @@ public class TomcatAutoScalerPolicyTest {
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
+        app = TestApplication.Factory.newManagedInstanceForTests();
         managementContext = app.getManagementContext();
         loc = managementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
                 .configure("name", "london"));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java
new file mode 100644
index 0000000..bc0f0d7
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
+ */
+public class JBoss6ServerAwsEc2LiveTest extends AbstractEc2LiveTest {
+    
+    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+    
+    @Override
+    protected void doTest(Location loc) throws Exception {
+        final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+                .configure("war", warUrl.toString()));
+        
+        app.start(ImmutableList.of(loc));
+        
+        String url = server.getAttribute(JBoss6Server.ROOT_URL);
+        
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
+        HttpTestUtils.assertContentContainsText(url, "Hello");
+        
+        Asserts.succeedsEventually(new Runnable() {
+            @Override public void run() {
+                assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
+                assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
+                assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss6Server.MAX_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss6Server.BYTES_RECEIVED));
+                assertNotNull(server.getAttribute(JBoss6Server.BYTES_SENT));
+            }});
+    }
+    
+    @Test(enabled=false)
+    public void testDummy() {} // Convince testng IDE integration that this really does have test methods  
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java
new file mode 100644
index 0000000..00686c5
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.BrooklynAppLiveTestSupport;
+import brooklyn.entity.java.UsesJmx;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * TODO re-write this like WebAppIntegrationTest, rather than being jboss6 specific.
+ */
+public class JBoss6ServerNonInheritingIntegrationTest extends BrooklynAppLiveTestSupport {
+    
+    // FIXME Fails deploying hello-world.war
+    //     07:27:30,958 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war
+    //     ...
+    //     Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'url-pattern'. No child element is expected at this point. @ vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war/WEB-INF/web.xml[21,22]
+    //         at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.error(SaxJBossXBParser.java:416) [jbossxb.jar:2.0.3.GA]
+    
+    // Port increment for JBoss 6.
+    public static final int PORT_INCREMENT = 400;
+
+    private URL warUrl;
+    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+    
+    @BeforeMethod(alwaysRun=true)
+    public void setUp() throws Exception {
+        super.setUp();
+        String warPath = "hello-world-no-mapping.war";
+        warUrl = getClass().getClassLoader().getResource(warPath);
+
+        localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
+    }
+
+    @Test(groups = "Integration")
+    public void testJmxmp() throws Exception {
+        runTest(UsesJmx.JmxAgentModes.JMXMP);
+    }
+
+    @Test(groups = "Integration")
+    public void testJmxRmi() throws Exception {
+        runTest(UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT);
+    }
+    
+    @Test(groups = "Integration")
+    public void testJmxAutodetect() throws Exception {
+        runTest(UsesJmx.JmxAgentModes.AUTODETECT);
+    }
+    
+    protected void runTest(UsesJmx.JmxAgentModes jmxAgentMode) throws Exception {
+        final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+                .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT)
+                .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode)
+                .configure("war", warUrl.toString()));
+
+        app.start(ImmutableList.of(localhostProvisioningLocation));
+        
+        String httpUrl = "http://"+server.getAttribute(JBoss6Server.HOSTNAME)+":"+server.getAttribute(JBoss6Server.HTTP_PORT)+"/";
+        
+        assertEquals(server.getAttribute(JBoss6Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
+        
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+
+
+        Asserts.succeedsEventually(new Runnable() {
+            @Override public void run() {
+                // TODO Could test other attributes as well; see jboss7 test
+                assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
+                assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
+                assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
+            }});
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java
new file mode 100644
index 0000000..575a708
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
+ */
+public class JBoss7ServerAwsEc2LiveTest extends AbstractEc2LiveTest {
+    
+    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+    
+    @Override
+    protected void doTest(Location loc) throws Exception {
+        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("war", warUrl.toString()));
+        
+        app.start(ImmutableList.of(loc));
+        
+        String url = server.getAttribute(JBoss7Server.ROOT_URL);
+        
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
+        HttpTestUtils.assertContentContainsText(url, "Hello");
+        
+        Asserts.succeedsEventually(new Runnable() {
+            @Override public void run() {
+                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
+            }});
+    }
+    
+    @Test(groups = {"Live", "Live-sanity"})
+    @Override
+    public void test_CentOS_6_3() throws Exception {
+        super.test_CentOS_6_3();
+    }
+
+    @Test(enabled=false)
+    public void testDummy() {} // Convince testng IDE integration that this really does have test methods  
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java
new file mode 100644
index 0000000..1ac7fb3
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.software.AbstractDockerLiveTest;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+import com.google.common.collect.ImmutableList;
+import org.testng.annotations.Test;
+
+import java.net.URL;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.testng.Assert.assertNotNull;
+
+/**
+ * A simple test of installing+running on Docker, using various OS distros and versions.
+ */
+public class JBoss7ServerDockerLiveTest extends AbstractDockerLiveTest {
+
+   private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+
+   @Override
+   protected void doTest(Location loc) throws Exception {
+      final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+              .configure("war", warUrl.toString()));
+
+      app.start(ImmutableList.of(loc));
+
+      String url = server.getAttribute(JBoss7Server.ROOT_URL);
+
+      HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
+      HttpTestUtils.assertContentContainsText(url, "Hello");
+
+      Asserts.succeedsEventually(new Runnable() {
+         @Override
+         public void run() {
+            assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
+            assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
+            assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
+            assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
+            assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
+            assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
+         }
+      });
+   }
+
+   @Test(enabled = false)
+   public void testDummy() {
+   } // Convince testng IDE integration that this really does have test methods
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
new file mode 100644
index 0000000..04d5c7a
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.File;
+import java.net.URL;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.HttpsSslConfig;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.entity.TestApplication;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * TODO re-write this like WebAppIntegrationTest, inheriting, rather than being jboss7 specific.
+ */
+public class JBoss7ServerNonInheritingIntegrationTest {
+    
+    private URL warUrl;
+    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+    private TestApplication app;
+    private File keystoreFile;
+    
+    @BeforeMethod(alwaysRun=true)
+    public void setUp() throws Exception {
+        String warPath = "hello-world.war";
+        warUrl = getClass().getClassLoader().getResource(warPath);
+
+        localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
+        app = TestApplication.Factory.newManagedInstanceForTests();
+        keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
+    }
+
+    @AfterMethod(alwaysRun=true)
+    public void tearDown() throws Exception {
+        if (app != null) Entities.destroyAll(app.getManagementContext());
+        if (keystoreFile != null) keystoreFile.delete();
+    }
+
+    @Test(groups = "Integration")
+    public void testHttp() throws Exception {
+        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("war", warUrl.toString()));
+        
+        app.start(ImmutableList.of(localhostProvisioningLocation));
+        
+        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+        
+        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
+        
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+        
+        HttpTestUtils.assertUrlUnreachable(httpsUrl);
+
+        Asserts.succeedsEventually(new Runnable() {
+            public void run() {
+                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
+            }});
+    }
+
+    @Test(groups = {"Integration"})
+    public void testHttps() throws Exception {
+        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("war", warUrl.toString())
+                .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
+                .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+        
+        app.start(ImmutableList.of(localhostProvisioningLocation));
+        
+        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+        
+        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
+        
+        HttpTestUtils.assertUrlUnreachable(httpUrl);
+        
+        // FIXME HttpTestUtils isn't coping with https, giving
+        //     javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
+        // Uncomment this as soon as HttpTestUtils is fixed
+        // Manual inspection with breakpoint and web-browser confirmed this was working
+//        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
+//        HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
+        
+        // FIXME querying for http://localhost:9990/management/subsystem/web/connector/http/read-resource?include-runtime=true
+        // gives 500 when http is disabled, but if miss out "?include-runtime=true" then it works fine.
+        // So not getting these metrics!
+//        TestUtils.executeUntilSucceeds(new Runnable() {
+//            public void run() {
+//                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
+//                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
+//                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
+//                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
+//                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
+//                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
+//            }});
+    }
+    
+    @Test(groups = {"Integration"})
+    public void testHttpAndHttps() throws Exception {
+        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("war", warUrl.toString())
+                .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("http", "https"))
+                .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+        
+        app.start(ImmutableList.of(localhostProvisioningLocation));
+        
+        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+
+        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
+
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+        
+        // FIXME HttpTestUtils isn't coping with https, giving
+        //     javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
+        // Uncomment this as soon as HttpTestUtils is fixed
+        // Manual inspection with breakpoint and web-browser confirmed this was working
+        //HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
+        //HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
+        
+        Asserts.succeedsEventually(new Runnable() {
+            public void run() {
+                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
+                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
+                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
+            }});
+    }
+
+    @Test(groups = {"Integration"})
+    public void testUsingPortOffsets() throws Exception {
+        final JBoss7Server serverA = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("portIncrement", 100));
+        final JBoss7Server serverB = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure("portIncrement", 200));
+        app.start(ImmutableList.of(localhostProvisioningLocation));
+
+        Asserts.succeedsEventually(new Runnable() {
+            public void run() {
+                assertNotNull(serverA.getAttribute(JBoss7Server.BYTES_SENT));
+                assertNotNull(serverB.getAttribute(JBoss7Server.BYTES_SENT));
+            }});
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
new file mode 100644
index 0000000..12b0843
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.rebind.RebindTestFixtureWithApp;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.EntityTestUtils;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.WebAppMonitor;
+import brooklyn.test.entity.TestApplication;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class JBoss7ServerRebindingIntegrationTest extends RebindTestFixtureWithApp {
+    private static final Logger LOG = LoggerFactory.getLogger(JBoss7ServerRebindingIntegrationTest.class);
+    
+    private URL warUrl;
+    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+    private TestApplication newApp;
+    private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
+    private ExecutorService executor;
+    
+    @BeforeMethod(groups = "Integration")
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        String warPath = "hello-world.war";
+        warUrl = getClass().getClassLoader().getResource(warPath);
+        executor = Executors.newCachedThreadPool();
+        localhostProvisioningLocation = (LocalhostMachineProvisioningLocation) origManagementContext.getLocationRegistry().resolve("localhost");
+    }
+
+    @Override
+    @AfterMethod(alwaysRun=true)
+    public void tearDown() throws Exception {
+        for (WebAppMonitor monitor : webAppMonitors) {
+            monitor.terminate();
+        }
+        if (executor != null) executor.shutdownNow();
+        super.tearDown();
+    }
+
+    private WebAppMonitor newWebAppMonitor(String url) {
+        WebAppMonitor monitor = new WebAppMonitor(url)
+//                .delayMillis(0)
+                .logFailures(LOG);
+        webAppMonitors.add(monitor);
+        executor.execute(monitor);
+        return monitor;
+    }
+    
+    @Test(groups = "Integration")
+    public void testRebindsToRunningServer() throws Exception {
+        // Start an app-server, and wait for it to be fully up
+        JBoss7Server origServer = origApp.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                    .configure("war", warUrl.toString()));
+        
+        origApp.start(ImmutableList.of(localhostProvisioningLocation));
+        
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(origServer.getAttribute(JBoss7Server.ROOT_URL), 200);
+        WebAppMonitor monitor = newWebAppMonitor(origServer.getAttribute(JBoss7Server.ROOT_URL));
+        
+        // Rebind
+        newApp = rebind(false, true);
+        JBoss7Server newServer = (JBoss7Server) Iterables.find(newApp.getChildren(), Predicates.instanceOf(JBoss7Server.class));
+        String newRootUrl = newServer.getAttribute(JBoss7Server.ROOT_URL);
+        
+        assertEquals(newRootUrl, origServer.getAttribute(JBoss7Server.ROOT_URL));
+        assertEquals(newServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT), origServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT));
+        assertEquals(newServer.getAttribute(JBoss7Server.DEPLOYED_WARS), origServer.getAttribute(JBoss7Server.DEPLOYED_WARS));
+        
+        EntityTestUtils.assertAttributeEqualsEventually(newServer, SoftwareProcess.SERVICE_UP, true);
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl, 200);
+
+        // confirm that deploy() effector affects the correct jboss server 
+        newServer.deploy(warUrl.toString(), "myhello.war");
+        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl+"myhello", 200);
+        
+        // check we see evidence of the enrichers and sensor-feeds having an effect.
+        // Relying on WebAppMonitor to cause these to change.
+        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUEST_COUNT);
+        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
+        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
+        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.PROCESSING_TIME_FRACTION_IN_WINDOW);
+        
+        assertEquals(monitor.getFailures(), 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java
new file mode 100644
index 0000000..cf576c3
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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 brooklyn.entity.webapp.jboss;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
+import brooklyn.location.basic.PortRanges;
+import brooklyn.test.entity.TestApplication;
+
+public class JBossServersMultiVersionWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
+
+    @Test(groups = "Integration", dataProvider = "basicEntities")
+    public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception {
+        super.testReportsServiceDownWhenKilled(entity);
+    }
+    
+    @DataProvider(name = "basicEntities")
+    public Object[][] basicEntities() {
+        TestApplication jboss6App = newTestApplication();
+        JBoss6Server jboss6 = jboss6App.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+                .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT));
+        
+        TestApplication jboss7App = newTestApplication();
+        JBoss7Server jboss7 = jboss7App.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+                .configure(JBoss7Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+        
+        return new JavaWebAppSoftwareProcess[][] {
+                new JavaWebAppSoftwareProcess[] {jboss6}, 
+                new JavaWebAppSoftwareProcess[] {jboss7}
+                
+        };
+    }
+
+    // to be able to test on this class in Eclipse IDE
+    @Test(groups = "Integration", dataProvider = "basicEntities")
+    public void canStartAndStop(final SoftwareProcess entity) {
+        super.canStartAndStop(entity);
+    }
+
+//    @Override
+//    // TODO override parent and add seam-booking-as{6,7}
+//    @DataProvider(name = "entitiesWithWarAndURL")
+//    public Object[][] entitiesWithWar() {
+//        List<Object[]> result = Lists.newArrayList();
+//        
+//        for (Object[] entity : basicEntities()) {
+//            result.add(new Object[] {
+//                    entity[0],
+//                    "hello-world.war",
+//                    "hello-world/",
+//                    "" // no sub-page path
+//                    });
+//        }
+//        
+//        TestApplication tomcatApp = newTestApplication();
+//        TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
+//                .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+//        result.add(new Object[] {
+//                tomcat,
+//                "swf-booking-mvc.war",
+//                "swf-booking-mvc/",
+//                "spring/intro",
+//               });
+//            // FIXME seam-booking does not work
+////            [   new JBoss6ServerImpl(parent:application, portIncrement:PORT_INCREMENT),
+////              "seam-booking-as6.war",
+////                "seam-booking-as6/",
+////            ],
+////            [   new JBoss7ServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT),
+////                "seam-booking-as7.war",
+////                "seam-booking-as7/",
+////            ],
+//        
+//        return result.toArray(new Object[][] {});
+//    }
+
+    public static void main(String ...args) throws Exception {
+        JBossServersMultiVersionWebAppFixtureIntegrationTest t = new JBossServersMultiVersionWebAppFixtureIntegrationTest();
+        t.setUp();
+        t.testReportsServiceDownWhenKilled((SoftwareProcess) t.basicEntities()[0][0]);
+        t.shutdownApp();
+        t.shutdownMgmt();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
deleted file mode 100644
index 92d07c3..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.Test;
-
-import brooklyn.entity.AbstractEc2LiveTest;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.Location;
-import brooklyn.test.HttpTestUtils;
-import brooklyn.test.TestUtils;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
- */
-public class Jboss6ServerEc2LiveTest extends AbstractEc2LiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
-    @Override
-    protected void doTest(Location loc) throws Exception {
-        final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
-                .configure("war", warUrl.toString()));
-        
-        app.start(ImmutableList.of(loc));
-        
-        String url = server.getAttribute(JBoss6Server.ROOT_URL);
-        
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
-        HttpTestUtils.assertContentContainsText(url, "Hello");
-        
-        TestUtils.executeUntilSucceeds(new Runnable() {
-            public void run() {
-                assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
-                assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
-                assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss6Server.MAX_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss6Server.BYTES_RECEIVED));
-                assertNotNull(server.getAttribute(JBoss6Server.BYTES_SENT));
-            }});
-    }
-    
-    @Test(enabled=false)
-    public void testDummy() {} // Convince testng IDE integration that this really does have test methods  
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
deleted file mode 100644
index e3fd800..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.java.UsesJmx;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * TODO re-write this like WebAppIntegrationTest, rather than being jboss6 specific.
- */
-public class Jboss6ServerIntegrationTest extends BrooklynAppLiveTestSupport {
-    
-    // FIXME Fails deploying hello-world.war
-    //     07:27:30,958 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war
-    //     ...
-    //     Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'url-pattern'. No child element is expected at this point. @ vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war/WEB-INF/web.xml[21,22]
-    //         at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.error(SaxJBossXBParser.java:416) [jbossxb.jar:2.0.3.GA]
-    
-    // Port increment for JBoss 6.
-    public static final int PORT_INCREMENT = 400;
-
-    private URL warUrl;
-    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
-    
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() throws Exception {
-        super.setUp();
-        String warPath = "hello-world-no-mapping.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-
-        localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
-    }
-
-    @Test(groups = "Integration")
-    public void testJmxmp() throws Exception {
-        runTest(UsesJmx.JmxAgentModes.JMXMP);
-    }
-
-    @Test(groups = "Integration")
-    public void testJmxRmi() throws Exception {
-        runTest(UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT);
-    }
-    
-    @Test(groups = "Integration")
-    public void testJmxAutodetect() throws Exception {
-        runTest(UsesJmx.JmxAgentModes.AUTODETECT);
-    }
-    
-    protected void runTest(UsesJmx.JmxAgentModes jmxAgentMode) throws Exception {
-        final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
-                .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT)
-                .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode)
-                .configure("war", warUrl.toString()));
-
-        app.start(ImmutableList.of(localhostProvisioningLocation));
-        
-        String httpUrl = "http://"+server.getAttribute(JBoss6Server.HOSTNAME)+":"+server.getAttribute(JBoss6Server.HTTP_PORT)+"/";
-        
-        assertEquals(server.getAttribute(JBoss6Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
-        
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
-        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-
-
-        Asserts.succeedsEventually(new Runnable() {
-            @Override public void run() {
-                // TODO Could test other attributes as well; see jboss7 test
-                assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
-                assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
-                assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
-            }});
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
deleted file mode 100644
index e29b9b7..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.software.AbstractDockerLiveTest;
-import brooklyn.location.Location;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-import com.google.common.collect.ImmutableList;
-import org.testng.annotations.Test;
-
-import java.net.URL;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-/**
- * A simple test of installing+running on Docker, using various OS distros and versions.
- */
-public class Jboss7DockerLiveTest extends AbstractDockerLiveTest {
-
-   private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-
-   @Override
-   protected void doTest(Location loc) throws Exception {
-      final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-              .configure("war", warUrl.toString()));
-
-      app.start(ImmutableList.of(loc));
-
-      String url = server.getAttribute(JBoss7Server.ROOT_URL);
-
-      HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
-      HttpTestUtils.assertContentContainsText(url, "Hello");
-
-      Asserts.succeedsEventually(new Runnable() {
-         @Override
-         public void run() {
-            assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
-            assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
-            assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
-            assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
-            assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
-            assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
-         }
-      });
-   }
-
-   @Test(enabled = false)
-   public void testDummy() {
-   } // Convince testng IDE integration that this really does have test methods
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
deleted file mode 100644
index d041e18..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.Test;
-
-import brooklyn.entity.AbstractEc2LiveTest;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.Location;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * A simple test of installing+running on AWS-EC2, using various OS distros and versions. 
- */
-public class Jboss7ServerEc2LiveTest extends AbstractEc2LiveTest {
-    
-    private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-    
-    @Override
-    protected void doTest(Location loc) throws Exception {
-        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString()));
-        
-        app.start(ImmutableList.of(loc));
-        
-        String url = server.getAttribute(JBoss7Server.ROOT_URL);
-        
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
-        HttpTestUtils.assertContentContainsText(url, "Hello");
-        
-        Asserts.succeedsEventually(new Runnable() {
-            @Override public void run() {
-                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
-            }});
-    }
-    
-    @Test(groups = {"Live", "Live-sanity"})
-    @Override
-    public void test_CentOS_6_3() throws Exception {
-        super.test_CentOS_6_3();
-    }
-
-    @Test(enabled=false)
-    public void testDummy() {} // Convince testng IDE integration that this really does have test methods  
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
deleted file mode 100644
index d486b21..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.basic.ApplicationBuilder;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
-import brooklyn.entity.webapp.HttpsSslConfig;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.TestApplication;
-import brooklyn.util.crypto.FluentKeySigner;
-import brooklyn.util.crypto.SecureKeys;
-import brooklyn.util.stream.Streams;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * TODO re-write this like WebAppIntegrationTest, rather than being jboss7 specific.
- */
-public class Jboss7ServerIntegrationTest {
-    private static final Logger LOG = LoggerFactory.getLogger(Jboss7ServerIntegrationTest.class);
-    
-    private URL warUrl;
-    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
-    private TestApplication app;
-    private File keystoreFile;
-    
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() throws Exception {
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-
-        localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
-        keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
-    }
-
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        if (app != null) Entities.destroyAll(app.getManagementContext());
-        if (keystoreFile != null) keystoreFile.delete();
-    }
-
-    @Test(groups = "Integration")
-    public void testHttp() throws Exception {
-        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString()));
-        
-        app.start(ImmutableList.of(localhostProvisioningLocation));
-        
-        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
-        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-        
-        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
-        
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
-        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-        
-        HttpTestUtils.assertUrlUnreachable(httpsUrl);
-
-        Asserts.succeedsEventually(new Runnable() {
-            public void run() {
-                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
-            }});
-    }
-
-    @Test(groups = {"Integration"})
-    public void testHttps() throws Exception {
-        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString())
-                .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
-                .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
-        
-        app.start(ImmutableList.of(localhostProvisioningLocation));
-        
-        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
-        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-        
-        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
-        
-        HttpTestUtils.assertUrlUnreachable(httpUrl);
-        
-        // FIXME HttpTestUtils isn't coping with https, giving
-        //     javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
-        // Uncomment this as soon as HttpTestUtils is fixed
-        // Manual inspection with breakpoint and web-browser confirmed this was working
-//        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
-//        HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
-        
-        // FIXME querying for http://localhost:9990/management/subsystem/web/connector/http/read-resource?include-runtime=true
-        // gives 500 when http is disabled, but if miss out "?include-runtime=true" then it works fine.
-        // So not getting these metrics!
-//        TestUtils.executeUntilSucceeds(new Runnable() {
-//            public void run() {
-//                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
-//                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
-//                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
-//                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
-//                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
-//                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
-//            }});
-    }
-    
-    @Test(groups = {"Integration"})
-    public void testHttpAndHttps() throws Exception {
-        final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("war", warUrl.toString())
-                .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("http", "https"))
-                .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
-        
-        app.start(ImmutableList.of(localhostProvisioningLocation));
-        
-        String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
-        String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-
-        assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
-
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
-        HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-        
-        // FIXME HttpTestUtils isn't coping with https, giving
-        //     javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
-        // Uncomment this as soon as HttpTestUtils is fixed
-        // Manual inspection with breakpoint and web-browser confirmed this was working
-        //HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
-        //HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
-        
-        Asserts.succeedsEventually(new Runnable() {
-            public void run() {
-                assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT));
-                assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED));
-                assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT));
-            }});
-    }
-
-    @Test(groups = {"Integration"})
-    public void testUsingPortOffsets() throws Exception {
-        final JBoss7Server serverA = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("portIncrement", 100));
-        final JBoss7Server serverB = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure("portIncrement", 200));
-        app.start(ImmutableList.of(localhostProvisioningLocation));
-
-        Asserts.succeedsEventually(new Runnable() {
-            public void run() {
-                assertNotNull(serverA.getAttribute(JBoss7Server.BYTES_SENT));
-                assertNotNull(serverB.getAttribute(JBoss7Server.BYTES_SENT));
-            }});
-    }
-
-}


[05/10] incubator-brooklyn git commit: Restart sensor feed on mirror entity rebind

Posted by he...@apache.org.
Restart sensor feed on mirror entity rebind


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3b386399
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3b386399
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3b386399

Branch: refs/heads/master
Commit: 3b386399a5f27a098b73170ca78dbcbf8ffd5466
Parents: 59208f5
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Nov 13 10:54:05 2014 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Nov 13 10:54:05 2014 +0200

----------------------------------------------------------------------
 .../brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3b386399/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java
index b0fb728..80b19f5 100644
--- a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java
+++ b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java
@@ -68,6 +68,12 @@ public class BrooklynEntityMirrorImpl extends AbstractEntity implements Brooklyn
         setAttribute(Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STARTING);
     }
 
+    @Override
+    public void rebind() {
+        super.rebind();
+        connectSensorsAsync();
+    }
+
     protected void connectSensorsAsync() {
         Callable<Void> asyncTask = new Callable<Void>() {
             @Override


[08/10] incubator-brooklyn git commit: fix a few https/tomcat issues

Posted by he...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
deleted file mode 100644
index 9a1bd5e..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerRebindIntegrationTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.basic.SoftwareProcess;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.rebind.RebindTestFixtureWithApp;
-import brooklyn.entity.rebind.RebindTestUtils;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.EntityTestUtils;
-import brooklyn.test.HttpTestUtils;
-import brooklyn.test.WebAppMonitor;
-import brooklyn.test.entity.TestApplication;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-/**
- * TODO re-write this like WebAppIntegrationTest, rather than being jboss7 specific.
- */
-public class Jboss7ServerRebindIntegrationTest extends RebindTestFixtureWithApp {
-    private static final Logger LOG = LoggerFactory.getLogger(Jboss7ServerRebindIntegrationTest.class);
-    
-    private URL warUrl;
-    private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
-    private TestApplication newApp;
-    private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
-    private ExecutorService executor;
-    
-    @BeforeMethod(groups = "Integration")
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        String warPath = "hello-world.war";
-        warUrl = getClass().getClassLoader().getResource(warPath);
-        executor = Executors.newCachedThreadPool();
-        localhostProvisioningLocation = (LocalhostMachineProvisioningLocation) origManagementContext.getLocationRegistry().resolve("localhost");
-    }
-
-    @Override
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        for (WebAppMonitor monitor : webAppMonitors) {
-            monitor.terminate();
-        }
-        if (executor != null) executor.shutdownNow();
-        super.tearDown();
-    }
-
-    private WebAppMonitor newWebAppMonitor(String url) {
-        WebAppMonitor monitor = new WebAppMonitor(url)
-//                .delayMillis(0)
-                .logFailures(LOG);
-        webAppMonitors.add(monitor);
-        executor.execute(monitor);
-        return monitor;
-    }
-    
-    @Test(groups = "Integration")
-    public void testRebindsToRunningServer() throws Exception {
-        // Start an app-server, and wait for it to be fully up
-        JBoss7Server origServer = origApp.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                    .configure("war", warUrl.toString()));
-        
-        origApp.start(ImmutableList.of(localhostProvisioningLocation));
-        
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(origServer.getAttribute(JBoss7Server.ROOT_URL), 200);
-        WebAppMonitor monitor = newWebAppMonitor(origServer.getAttribute(JBoss7Server.ROOT_URL));
-        
-        // Rebind
-        newApp = rebind(false, true);
-        JBoss7Server newServer = (JBoss7Server) Iterables.find(newApp.getChildren(), Predicates.instanceOf(JBoss7Server.class));
-        String newRootUrl = newServer.getAttribute(JBoss7Server.ROOT_URL);
-        
-        assertEquals(newRootUrl, origServer.getAttribute(JBoss7Server.ROOT_URL));
-        assertEquals(newServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT), origServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT));
-        assertEquals(newServer.getAttribute(JBoss7Server.DEPLOYED_WARS), origServer.getAttribute(JBoss7Server.DEPLOYED_WARS));
-        
-        EntityTestUtils.assertAttributeEqualsEventually(newServer, SoftwareProcess.SERVICE_UP, true);
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl, 200);
-
-        // confirm that deploy() effector affects the correct jboss server 
-        newServer.deploy(warUrl.toString(), "myhello.war");
-        HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl+"myhello", 200);
-        
-        // check we see evidence of the enrichers and sensor-feeds having an effect.
-        // Relying on WebAppMonitor to cause these to change.
-        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUEST_COUNT);
-        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
-        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
-        EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.PROCESSING_TIME_FRACTION_IN_WINDOW);
-        
-        assertEquals(monitor.getFailures(), 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JbossServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JbossServerWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JbossServerWebAppFixtureIntegrationTest.java
deleted file mode 100644
index 3b0bdf9..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JbossServerWebAppFixtureIntegrationTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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 brooklyn.entity.webapp.jboss;
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.basic.SoftwareProcess;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
-import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
-import brooklyn.location.basic.PortRanges;
-import brooklyn.test.entity.TestApplication;
-
-public class JbossServerWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
-
-    @Test(groups = "Integration", dataProvider = "basicEntities")
-    public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception {
-        super.testReportsServiceDownWhenKilled(entity);
-    }
-    
-    @DataProvider(name = "basicEntities")
-    public Object[][] basicEntities() {
-        TestApplication jboss6App = newTestApplication();
-        JBoss6Server jboss6 = jboss6App.createAndManageChild(EntitySpec.create(JBoss6Server.class)
-                .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT));
-        
-        TestApplication jboss7App = newTestApplication();
-        JBoss7Server jboss7 = jboss7App.createAndManageChild(EntitySpec.create(JBoss7Server.class)
-                .configure(JBoss7Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
-        
-        return new JavaWebAppSoftwareProcess[][] {
-                new JavaWebAppSoftwareProcess[] {jboss6}, 
-                new JavaWebAppSoftwareProcess[] {jboss7}
-                
-        };
-    }
-
-    // to be able to test on this class in Eclipse IDE
-    @Test(groups = "Integration", dataProvider = "basicEntities")
-    public void canStartAndStop(final SoftwareProcess entity) {
-        super.canStartAndStop(entity);
-    }
-
-//    @Override
-//    // TODO override parent and add seam-booking-as{6,7}
-//    @DataProvider(name = "entitiesWithWarAndURL")
-//    public Object[][] entitiesWithWar() {
-//        List<Object[]> result = Lists.newArrayList();
-//        
-//        for (Object[] entity : basicEntities()) {
-//            result.add(new Object[] {
-//                    entity[0],
-//                    "hello-world.war",
-//                    "hello-world/",
-//                    "" // no sub-page path
-//                    });
-//        }
-//        
-//        TestApplication tomcatApp = newTestApplication();
-//        TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
-//                .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
-//        result.add(new Object[] {
-//                tomcat,
-//                "swf-booking-mvc.war",
-//                "swf-booking-mvc/",
-//                "spring/intro",
-//               });
-//            // FIXME seam-booking does not work
-////            [   new JBoss6ServerImpl(parent:application, portIncrement:PORT_INCREMENT),
-////              "seam-booking-as6.war",
-////                "seam-booking-as6/",
-////            ],
-////            [   new JBoss7ServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT),
-////                "seam-booking-as7.war",
-////                "seam-booking-as7/",
-////            ],
-//        
-//        return result.toArray(new Object[][] {});
-//    }
-
-    public static void main(String ...args) throws Exception {
-        JbossServerWebAppFixtureIntegrationTest t = new JbossServerWebAppFixtureIntegrationTest();
-        t.setUp();
-        t.testReportsServiceDownWhenKilled((SoftwareProcess) t.basicEntities()[0][0]);
-        t.shutdownApp();
-        t.shutdownMgmt();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
index ff9ed93..39c775d 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
@@ -32,21 +32,21 @@ import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.DataProvider;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
+import org.testng.annotations.Test;
 
 import brooklyn.entity.basic.SoftwareProcess;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
 import brooklyn.entity.webapp.HttpsSslConfig;
 import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
-import brooklyn.entity.webapp.jboss.JBoss7Server;
 import brooklyn.location.basic.PortRanges;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.repeat.Repeater;
 
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+
 public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
 
     @SuppressWarnings("unused")
@@ -67,22 +67,27 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
             throw Exceptions.propagate(e);
         }
 
-        TomcatServer httpsTomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
-                .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT))
+        TestApplication tomcatHttpsApp = newTestApplication();
+        TomcatServer httpsTomcat = tomcatHttpsApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
                 .configure(TomcatServer.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
                 .configure(TomcatServer.HTTPS_SSL_CONFIG,
                         new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
 
         return new JavaWebAppSoftwareProcess[][] {
-                new JavaWebAppSoftwareProcess[] { tomcat, httpsTomcat }
+                new JavaWebAppSoftwareProcess[] { tomcat },
+                new JavaWebAppSoftwareProcess[] { httpsTomcat }
         };
     }
 
-//    // uncomment to be able to test on this class from GUI in Eclipse IDE
-//    @Test(groups = "Integration", dataProvider = "basicEntities")
-//    public void canStartAndStop(final SoftwareProcess entity) {
-//        super.canStartAndStop(entity);
-//    }
+    // exists to be able to test on this class from GUI in Eclipse IDE
+    @Test(groups = "Integration", dataProvider = "basicEntities")
+    public void canStartAndStop(final SoftwareProcess entity) {
+        super.canStartAndStop(entity);
+    }
+    @Test(groups = "Integration", dataProvider = "basicEntities")
+    public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception {
+        super.testReportsServiceDownWhenKilled(entity);
+    }
 
     @Override
     // as parent, but with spring travel

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/usage/camp/src/test/resources/test-tomcat-https.yaml
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/resources/test-tomcat-https.yaml b/usage/camp/src/test/resources/test-tomcat-https.yaml
new file mode 100644
index 0000000..88209a1
--- /dev/null
+++ b/usage/camp/src/test/resources/test-tomcat-https.yaml
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+name: Test Tomcat HTTPS
+location: localhost
+services:
+- type: brooklyn.entity.webapp.tomcat.TomcatServer
+  war: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
+  quorumSize: 2
+  enabledProtocols: [https]
+  httpsSsl:
+    url: classpath://brooklyn/entity/webapp/sample-java-keystore.jks
+    alias: myname
+    password: mypass


[03/10] incubator-brooklyn git commit: Tomcat entity supports HTTPS

Posted by he...@apache.org.
Tomcat entity supports HTTPS


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/ed00435c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/ed00435c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/ed00435c

Branch: refs/heads/master
Commit: ed00435c7434496bf5d1ec6e7b3f679712804bd6
Parents: 46dfc41
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Wed Nov 12 23:26:09 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Wed Nov 12 23:26:09 2014 +0000

----------------------------------------------------------------------
 .../webapp/JavaWebAppSoftwareProcessImpl.java   | 27 +++++++++++++++++++
 .../entity/webapp/WebAppServiceConstants.java   |  6 ++---
 .../entity/webapp/jboss/JBoss7ServerImpl.java   | 26 ------------------
 .../entity/webapp/tomcat/Tomcat7SshDriver.java  | 26 +++++++++++++-----
 .../entity/webapp/tomcat/TomcatServerImpl.java  |  4 ++-
 .../brooklyn/entity/webapp/tomcat/server.xml    | 10 +++++--
 .../AbstractWebAppFixtureIntegrationTest.java   | 26 ++++++++++++++++++
 .../jboss/Jboss7ServerIntegrationTest.java      | 23 ++--------------
 ...omcatServerWebAppFixtureIntegrationTest.java | 28 +++++++++++++++++---
 9 files changed, 113 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
index 04117ea..165c206 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
@@ -176,4 +176,31 @@ public abstract class JavaWebAppSoftwareProcessImpl extends SoftwareProcessImpl
         setAttribute(REQUESTS_PER_SECOND_LAST, 0D);
         setAttribute(REQUESTS_PER_SECOND_IN_WINDOW, 0D);
     }
+
+    public boolean isHttpEnabled() {
+        return WebAppServiceMethods.isProtocolEnabled(this, "HTTP");
+    }
+
+    public boolean isHttpsEnabled() {
+        return WebAppServiceMethods.isProtocolEnabled(this, "HTTPS");
+    }
+
+    public Integer getHttpPort() {
+        return getAttribute(HTTP_PORT);
+    }
+
+    public Integer getHttpsPort() {
+        return getAttribute(HTTPS_PORT);
+    }
+
+    public String getHttpsSslKeyAlias() {
+        HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
+        return (config == null) ? null : config.getKeyAlias();
+    }
+
+    public String getHttpsSslKeystorePassword() {
+        HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
+        return (config == null) ? null : config.getKeystorePassword();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/java/brooklyn/entity/webapp/WebAppServiceConstants.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/WebAppServiceConstants.java b/software/webapp/src/main/java/brooklyn/entity/webapp/WebAppServiceConstants.java
index dbb9ec5..68ba9ae 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/WebAppServiceConstants.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/WebAppServiceConstants.java
@@ -20,6 +20,8 @@ package brooklyn.entity.webapp;
 
 import java.util.Set;
 
+import com.google.common.collect.ImmutableSet;
+
 import brooklyn.config.render.RendererHints;
 import brooklyn.entity.basic.Attributes;
 import brooklyn.event.AttributeSensor;
@@ -28,8 +30,6 @@ import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
 import brooklyn.event.basic.Sensors;
 import brooklyn.util.flags.SetFromFlag;
 
-import com.google.common.collect.ImmutableList;
-
 public interface WebAppServiceConstants extends WebAppServiceMetrics {
 
     @SetFromFlag("httpPort")
@@ -41,7 +41,7 @@ public interface WebAppServiceConstants extends WebAppServiceMetrics {
     @SuppressWarnings({ "unchecked", "rawtypes" })
     @SetFromFlag("enabledProtocols")
     public static final BasicAttributeSensorAndConfigKey<Set<String>> ENABLED_PROTOCOLS = new BasicAttributeSensorAndConfigKey(
-            Set.class, "webapp.enabledProtocols", "List of enabled protocols (e.g. http, https)", ImmutableList.of("http"));
+            Set.class, "webapp.enabledProtocols", "List of enabled protocols (e.g. http, https)", ImmutableSet.of("http"));
 
     @SetFromFlag("httpsSsl")
     public static final BasicAttributeSensorAndConfigKey<HttpsSslConfig> HTTPS_SSL_CONFIG = new BasicAttributeSensorAndConfigKey<HttpsSslConfig>(

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
index 76491ce..e246db3 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java
@@ -181,32 +181,6 @@ public class JBoss7ServerImpl extends JavaWebAppSoftwareProcessImpl implements J
         return getConfig(DEPLOYMENT_TIMEOUT);
     }
 
-    public boolean isHttpEnabled() {
-        return WebAppServiceMethods.isProtocolEnabled(this, "HTTP");
-    }
-    
-    public boolean isHttpsEnabled() {
-        return WebAppServiceMethods.isProtocolEnabled(this, "HTTPS");
-    }
-    
-    public Integer getHttpPort() {
-        return getAttribute(HTTP_PORT);
-    }
-    
-    public Integer getHttpsPort() {
-        return getAttribute(HTTPS_PORT);
-    }
-    
-    public String getHttpsSslKeyAlias() {
-        HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
-        return (config == null) ? null : config.getKeyAlias();
-    }
-    
-    public String getHttpsSslKeystorePassword() {
-        HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
-        return (config == null) ? null : config.getKeystorePassword();
-    }
-    
     /** Path of the keystore file on the AS7 server */
     public String getHttpsSslKeystoreFile() {
         return getDriver().getSslKeystoreFile();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
index 930457c..4a08242 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
@@ -20,10 +20,15 @@ package brooklyn.entity.webapp.tomcat;
 
 import static java.lang.String.format;
 
+import java.io.InputStream;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
 
 import brooklyn.entity.basic.Entities;
@@ -38,6 +43,9 @@ import brooklyn.util.text.StringEscapes.BashStringEscapes;
 
 public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driver {
 
+    private static final Logger LOG = LoggerFactory.getLogger(Tomcat7SshDriver.class);
+    private static final String KEYSTORE_FILE = "keystore";
+
     public Tomcat7SshDriver(TomcatServerImpl entity, SshMachineLocation machine) {
         super(entity, machine);
     }
@@ -58,12 +66,6 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
         commands.add(BashCommands.INSTALL_TAR);
         commands.add(format("tar xvzf %s", saveAs));
 
-        if (getEnabledProtocols().size()!=1) {
-            log.warn("TomcatServer only supports one protocol, http; ignoring requested protocols "+getEnabledProtocols());
-        } else if (!"http".equalsIgnoreCase(Iterables.getOnlyElement(getEnabledProtocols()))) {
-            log.warn("TomcatServer only supports one protocol, http; ignoring requested protocol "+getEnabledProtocols());
-        }
-        
         newScript(INSTALLING)
                 .environmentVariablesReset()
                 .body.append(commands)
@@ -80,6 +82,14 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
         copyTemplate(entity.getConfig(TomcatServer.SERVER_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "server.xml"));
         copyTemplate(entity.getConfig(TomcatServer.WEB_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "web.xml"));
 
+        // Deduplicate same code in JBoss
+        if (isProtocolEnabled("HTTPS")) {
+            String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore URL must be specified if using HTTPS for " + entity);
+            String destinationSslKeystoreFile = getHttpsSslKeystoreFile();
+            InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl);
+            getMachine().copyTo(keystoreStream, destinationSslKeystoreFile);
+        }
+
         getEntity().deployInitialWars();
     }
 
@@ -162,4 +172,8 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
         return entity.getAttribute(TomcatServerImpl.SHUTDOWN_PORT);
     }
 
+    public String getHttpsSslKeystoreFile() {
+        return Os.mergePathsUnix(getRunDir(), "conf", KEYSTORE_FILE);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
index 5bc9204..64a4765 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java
@@ -53,7 +53,9 @@ public class TomcatServerImpl extends JavaWebAppSoftwareProcessImpl implements T
 
         if (getDriver().isJmxEnabled()) {
             String requestProcessorMbeanName = "Catalina:type=GlobalRequestProcessor,name=\"http-*\"";
-            String connectorMbeanName = format("Catalina:type=Connector,port=%s", getAttribute(HTTP_PORT));
+
+            Integer port = isHttpsEnabled() ? getAttribute(HTTPS_PORT) : getAttribute(HTTP_PORT);
+            String connectorMbeanName = format("Catalina:type=Connector,port=%s", port);
 
             jmxWebFeed = JmxFeed.builder()
                     .entity(this)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
index 6644e17..400598a 100644
--- a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
@@ -1,3 +1,4 @@
+[#ftl]
 <?xml version='1.0' encoding='utf-8'?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
@@ -69,9 +70,12 @@
          APR (HTTP/AJP) Connector: /docs/apr.html
          Define a non-SSL HTTP/1.1 Connector on port 8080
     -->
+    [#if entity.httpEnabled]
     <Connector port="${driver.httpPort?c}" protocol="HTTP/1.1"
                connectionTimeout="20000"
                redirectPort="8443" />
+    [/#if]
+
     <!-- A "Connector" using the shared thread pool-->
     <!--
     <Connector executor="tomcatThreadPool"
@@ -79,16 +83,18 @@
                connectionTimeout="20000"
                redirectPort="8443" />
     -->
+
     <!-- Define a SSL HTTP/1.1 Connector on port 8443
          This connector uses the BIO implementation that requires the JSSE
          style configuration. When using the APR/native implementation, the
          OpenSSL style configuration is required as described in the APR/native
          documentation -->
-    <!--
+    [#if entity.httpsEnabled]
     <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
                maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
+               keystoreFile="${driver.httpsSslKeystoreFile}" keystorePass="${entity.httpsSslKeystorePassword}"
                clientAuth="false" sslProtocol="TLS" />
-    -->
+    [/#if]
 
     <!-- Define an AJP 1.3 Connector on port 8009 -->
     <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
index 4569a59..478f913 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -25,9 +25,12 @@ import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
 import java.io.File;
+import java.io.FileOutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -69,8 +72,11 @@ import brooklyn.test.HttpTestUtils;
 import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.collections.MutableMap;
+import brooklyn.util.crypto.FluentKeySigner;
+import brooklyn.util.crypto.SecureKeys;
 import brooklyn.util.net.Urls;
 import brooklyn.util.os.Os;
+import brooklyn.util.stream.Streams;
 import brooklyn.util.time.Time;
 
 import com.google.common.base.Stopwatch;
@@ -148,6 +154,26 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
         }
     }
 
+    public static File createTemporaryKeyStore(String alias, String password) throws Exception {
+        FluentKeySigner signer = new FluentKeySigner("brooklyn-test").selfsign();
+
+        KeyStore ks = SecureKeys.newKeyStore();
+        ks.setKeyEntry(
+                alias,
+                signer.getKey().getPrivate(),
+                password.toCharArray(),
+                new Certificate[]{signer.getAuthorityCertificate()});
+
+        File file = File.createTempFile("test", "keystore");
+        FileOutputStream fos = new FileOutputStream(file);
+        try {
+            ks.store(fos, "mypass".toCharArray());
+            return file;
+        } finally {
+            Streams.closeQuietly(fos);
+        }
+    }
+
     /** 
      * Create a new instance of TestApplication and append it to applications list
      * so it can be terminated suitable after each test has run.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
index a6cf0b8..d486b21 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
@@ -36,6 +36,7 @@ import org.testng.annotations.Test;
 import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
 import brooklyn.entity.webapp.HttpsSslConfig;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.test.Asserts;
@@ -66,7 +67,7 @@ public class Jboss7ServerIntegrationTest {
 
         localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
         app = ApplicationBuilder.newManagedApp(TestApplication.class);
-        keystoreFile = createTemporaryKeyStore("myname", "mypass");
+        keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
     }
 
     @AfterMethod(alwaysRun=true)
@@ -75,26 +76,6 @@ public class Jboss7ServerIntegrationTest {
         if (keystoreFile != null) keystoreFile.delete();
     }
 
-    private File createTemporaryKeyStore(String alias, String password) throws Exception {
-        FluentKeySigner signer = new FluentKeySigner("brooklyn-test").selfsign();
-        
-        KeyStore ks = SecureKeys.newKeyStore();
-        ks.setKeyEntry(
-                alias, 
-                signer.getKey().getPrivate(), 
-                password.toCharArray(), 
-                new Certificate[] { signer.getAuthorityCertificate() });
-        
-        File file = File.createTempFile("test", "keystore");
-        FileOutputStream fos = new FileOutputStream(file);
-        try {
-            ks.store(fos, "mypass".toCharArray());
-            return file;
-        } finally {
-            Streams.closeQuietly(fos);
-        }
-    }
-    
     @Test(groups = "Integration")
     public void testHttp() throws Exception {
         final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ed00435c/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
index 9942dd3..ff9ed93 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/tomcat/TomcatServerWebAppFixtureIntegrationTest.java
@@ -18,6 +18,7 @@
  */
 package brooklyn.entity.webapp.tomcat;
 
+import java.io.File;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
@@ -32,16 +33,20 @@ import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.DataProvider;
 
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+
 import brooklyn.entity.basic.SoftwareProcess;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.HttpsSslConfig;
 import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
+import brooklyn.entity.webapp.jboss.JBoss7Server;
 import brooklyn.location.basic.PortRanges;
 import brooklyn.test.entity.TestApplication;
+import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.repeat.Repeater;
 
-import com.google.common.collect.Lists;
-
 public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
 
     @SuppressWarnings("unused")
@@ -52,9 +57,24 @@ public class TomcatServerWebAppFixtureIntegrationTest extends AbstractWebAppFixt
         TestApplication tomcatApp = newTestApplication();
         TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
                 .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
-        
+
+
+        File keystoreFile;
+        try {
+            keystoreFile = createTemporaryKeyStore("myname", "mypass");
+            keystoreFile.deleteOnExit();
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+
+        TomcatServer httpsTomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
+                .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT))
+                .configure(TomcatServer.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
+                .configure(TomcatServer.HTTPS_SSL_CONFIG,
+                        new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+
         return new JavaWebAppSoftwareProcess[][] {
-                new JavaWebAppSoftwareProcess[] {tomcat}
+                new JavaWebAppSoftwareProcess[] { tomcat, httpsTomcat }
         };
     }
 


[07/10] incubator-brooklyn git commit: This closes #323

Posted by he...@apache.org.
This closes #323


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/49dad19d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/49dad19d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/49dad19d

Branch: refs/heads/master
Commit: 49dad19d3e89737339e8588acc4f768d2d405c59
Parents: 297f608 0dc8e38
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Nov 13 12:43:25 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 13 12:43:25 2014 +0000

----------------------------------------------------------------------
 .../main/java/brooklyn/enricher/Enrichers.java  |   10 +-
 .../entity/basic/AbstractGroupImpl.java         |    2 +-
 .../group/AbstractMembershipTrackingPolicy.java |    5 +-
 .../entity/webapp/JavaWebAppDriver.java         |   10 +-
 .../webapp/JavaWebAppSoftwareProcessImpl.java   |   27 +
 .../entity/webapp/WebAppServiceConstants.java   |    6 +-
 .../entity/webapp/jboss/JBoss7ServerImpl.java   |   26 -
 .../entity/webapp/tomcat/Tomcat7SshDriver.java  |   65 +-
 .../entity/webapp/tomcat/TomcatServer.java      |   15 +-
 .../entity/webapp/tomcat/TomcatServerImpl.java  |    4 +-
 .../brooklyn/entity/webapp/tomcat/server.xml    |  151 +
 .../brooklyn/entity/webapp/tomcat/web.xml       | 4615 ++++++++++++++++++
 .../AbstractWebAppFixtureIntegrationTest.java   |   26 +
 .../jboss/Jboss7ServerIntegrationTest.java      |   23 +-
 ...omcatServerWebAppFixtureIntegrationTest.java |   28 +-
 usage/downstream-parent/pom.xml                 |    2 +-
 16 files changed, 4924 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/49dad19d/usage/downstream-parent/pom.xml
----------------------------------------------------------------------


[02/10] incubator-brooklyn git commit: Un-sed Tomcat configuration

Posted by he...@apache.org.
Un-sed Tomcat configuration


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/46dfc410
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/46dfc410
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/46dfc410

Branch: refs/heads/master
Commit: 46dfc41088d0b84f930b5fc98ceaf60a67d05a83
Parents: 79e1c94
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Wed Nov 12 14:03:01 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Wed Nov 12 14:03:01 2014 +0000

----------------------------------------------------------------------
 .../entity/webapp/tomcat/Tomcat7SshDriver.java  |   39 +-
 .../entity/webapp/tomcat/TomcatServer.java      |   15 +-
 .../brooklyn/entity/webapp/tomcat/server.xml    |  145 +
 .../brooklyn/entity/webapp/tomcat/web.xml       | 4615 ++++++++++++++++++
 4 files changed, 4794 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/46dfc410/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
index 3593bc0..930457c 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/Tomcat7SshDriver.java
@@ -42,18 +42,6 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
         super(entity, machine);
     }
 
-    protected String getLogFileLocation() {
-        return Os.mergePathsUnix(getRunDir(), "logs/catalina.out");
-    }
-
-    protected String getDeploySubdir() {
-       return "webapps";
-    }
-
-    protected Integer getShutdownPort() {
-        return entity.getAttribute(TomcatServerImpl.SHUTDOWN_PORT);
-    }
-    
     @Override
     public void preInstall() {
         resolver = Entities.newDownloader(this);
@@ -85,15 +73,13 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
     @Override
     public void customize() {
         newScript(CUSTOMIZING)
-                .body.append(
-                        "mkdir conf logs webapps temp",
-                        format("cp %s/conf/{server,web}.xml conf/", getExpandedInstallDir()),
-                        format("sed -i.bk s/8080/%s/g conf/server.xml", getHttpPort()),
-                        format("sed -i.bk s/8005/%s/g conf/server.xml", getShutdownPort()),
-                        "sed -i.bk /8009/D conf/server.xml"
-                    )
+                .body.append("mkdir conf logs webapps temp")
+                .failOnNonZeroResultCode()
                 .execute();
 
+        copyTemplate(entity.getConfig(TomcatServer.SERVER_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "server.xml"));
+        copyTemplate(entity.getConfig(TomcatServer.WEB_XML_RESOURCE), Os.mergePaths(getRunDir(), "conf", "web.xml"));
+
         getEntity().deployInitialWars();
     }
 
@@ -161,4 +147,19 @@ public class Tomcat7SshDriver extends JavaWebAppSshDriver implements Tomcat7Driv
 
         return shellEnv;
     }
+
+    @Override
+    protected String getLogFileLocation() {
+        return Os.mergePathsUnix(getRunDir(), "logs/catalina.out");
+    }
+
+    @Override
+    protected String getDeploySubdir() {
+       return "webapps";
+    }
+
+    public Integer getShutdownPort() {
+        return entity.getAttribute(TomcatServerImpl.SHUTDOWN_PORT);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/46dfc410/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServer.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServer.java b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServer.java
index 586c3b6..d8a4ca9 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServer.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/tomcat/TomcatServer.java
@@ -32,12 +32,15 @@ import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
 import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
 import brooklyn.location.basic.PortRanges;
 import brooklyn.util.flags.SetFromFlag;
+import brooklyn.util.javalang.JavaClassNames;
 import brooklyn.util.time.Duration;
 
 /**
  * An {@link brooklyn.entity.Entity} that represents a single Tomcat instance.
  */
-@Catalog(name="Tomcat Server", description="Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies", iconUrl="classpath:///tomcat-logo.png")
+@Catalog(name="Tomcat Server",
+        description="Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies",
+        iconUrl="classpath:///tomcat-logo.png")
 @ImplementedBy(TomcatServerImpl.class)
 public interface TomcatServer extends JavaWebAppSoftwareProcess, UsesJmx, HasShortName {
 
@@ -57,6 +60,16 @@ public interface TomcatServer extends JavaWebAppSoftwareProcess, UsesJmx, HasSho
     PortAttributeSensorAndConfigKey SHUTDOWN_PORT =
             ConfigKeys.newPortSensorAndConfigKey("tomcat.shutdownport", "Suggested shutdown port", PortRanges.fromString("31880+"));
 
+    @SetFromFlag("server.xml")
+    ConfigKey<String> SERVER_XML_RESOURCE = ConfigKeys.newStringConfigKey(
+            "tomcat.serverxml", "The file to template and use as the Tomcat process' server.xml",
+            JavaClassNames.resolveClasspathUrl(TomcatServer.class, "server.xml"));
+
+    @SetFromFlag("web.xml")
+    ConfigKey<String> WEB_XML_RESOURCE = ConfigKeys.newStringConfigKey(
+            "tomcat.webxml", "The file to template and use as the Tomcat process' web.xml",
+            JavaClassNames.resolveClasspathUrl(TomcatServer.class, "web.xml"));
+
     ConfigKey<Duration> START_TIMEOUT = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.START_TIMEOUT, Duration.FIVE_MINUTES);
 
     AttributeSensor<String> CONNECTOR_STATUS =

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/46dfc410/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
new file mode 100644
index 0000000..6644e17
--- /dev/null
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
@@ -0,0 +1,145 @@
+<?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.
+-->
+<!-- Brooklyn note: This file is a modified copy of server.xml from Tomcat v7.0.56.
+-->
+<!-- Note:  A "Server" is not itself a "Container", so you may not
+     define subcomponents such as "Valves" at this level.
+     Documentation at /docs/config/server.html
+ -->
+<Server port="${driver.shutdownPort?c}" shutdown="SHUTDOWN">
+  <!-- Security listener. Documentation at /docs/config/listeners.html
+  <Listener className="org.apache.catalina.security.SecurityListener" />
+  -->
+  <!--APR library loader. Documentation at /docs/apr.html -->
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
+  <Listener className="org.apache.catalina.core.JasperListener" />
+  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+  <!-- Global JNDI resources
+       Documentation at /docs/jndi-resources-howto.html
+  -->
+  <GlobalNamingResources>
+    <!-- Editable user database that can also be used by
+         UserDatabaseRealm to authenticate users
+    -->
+    <Resource name="UserDatabase" auth="Container"
+              type="org.apache.catalina.UserDatabase"
+              description="User database that can be updated and saved"
+              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+              pathname="conf/tomcat-users.xml" />
+  </GlobalNamingResources>
+
+  <!-- A "Service" is a collection of one or more "Connectors" that share
+       a single "Container" Note:  A "Service" is not itself a "Container",
+       so you may not define subcomponents such as "Valves" at this level.
+       Documentation at /docs/config/service.html
+   -->
+  <Service name="Catalina">
+
+    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
+    <!--
+    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+        maxThreads="150" minSpareThreads="4"/>
+    -->
+
+
+    <!-- A "Connector" represents an endpoint by which requests are received
+         and responses are returned. Documentation at :
+         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+         Java AJP  Connector: /docs/config/ajp.html
+         APR (HTTP/AJP) Connector: /docs/apr.html
+         Define a non-SSL HTTP/1.1 Connector on port 8080
+    -->
+    <Connector port="${driver.httpPort?c}" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="8443" />
+    <!-- A "Connector" using the shared thread pool-->
+    <!--
+    <Connector executor="tomcatThreadPool"
+               port="8080" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="8443" />
+    -->
+    <!-- Define a SSL HTTP/1.1 Connector on port 8443
+         This connector uses the BIO implementation that requires the JSSE
+         style configuration. When using the APR/native implementation, the
+         OpenSSL style configuration is required as described in the APR/native
+         documentation -->
+    <!--
+    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
+               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
+               clientAuth="false" sslProtocol="TLS" />
+    -->
+
+    <!-- Define an AJP 1.3 Connector on port 8009 -->
+    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->
+
+
+    <!-- An Engine represents the entry point (within Catalina) that processes
+         every request.  The Engine implementation for Tomcat stand alone
+         analyzes the HTTP headers included with the request, and passes them
+         on to the appropriate Host (virtual host).
+         Documentation at /docs/config/engine.html -->
+
+    <!-- You should set jvmRoute to support load-balancing via AJP ie :
+    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
+    -->
+    <Engine name="Catalina" defaultHost="localhost">
+
+      <!--For clustering, please take a look at documentation at:
+          /docs/cluster-howto.html  (simple how to)
+          /docs/config/cluster.html (reference documentation) -->
+      <!--
+      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+      -->
+
+      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
+           via a brute-force attack -->
+      <Realm className="org.apache.catalina.realm.LockOutRealm">
+        <!-- This Realm uses the UserDatabase configured in the global JNDI
+             resources under the key "UserDatabase".  Any edits
+             that are performed against this UserDatabase are immediately
+             available for use by the Realm.  -->
+        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+               resourceName="UserDatabase"/>
+      </Realm>
+
+      <Host name="localhost"  appBase="webapps"
+            unpackWARs="true" autoDeploy="true">
+
+        <!-- SingleSignOn valve, share authentication between web applications
+             Documentation at: /docs/config/valve.html -->
+        <!--
+        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+        -->
+
+        <!-- Access log processes all example.
+             Documentation at: /docs/config/valve.html
+             Note: The pattern used is equivalent to using pattern="common" -->
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+               prefix="localhost_access_log." suffix=".txt"
+               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+
+      </Host>
+    </Engine>
+  </Service>
+</Server>