http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/assembly/test/build.xml ---------------------------------------------------------------------- diff --git a/assembly/test/build.xml b/assembly/test/build.xml index aeba50b..1fe97b2 100644 --- a/assembly/test/build.xml +++ b/assembly/test/build.xml @@ -1,362 +1,362 @@ -<?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. ---> -<!-- $Revision: 579817 $ $Date: 2007-09-26 14:56:30 -0700 (Wed, 26 Sep 2007) $ --> - -<project name="Test OpenEJB" default="test" basedir="."> - <description> - Tests OpenEJB distribution using the OpenEJB iTest suite. - </description> - - <property name="tomee.version" value="1.7.2"/> - <property name="repo" location="${basedir}/repo"/> - <property name="maven.repo" value="file:${user.home}/.m2/repository"/> - <property name="target.dir" location="${basedir}/target"/> - <property name="windows.sleep" value="5"/> - <property name="unix.sleep" value="1"/> - - - <target name="clean"> - <delete dir="${basedir}/activemq-data"/> - <delete dir="${target.dir}"/> - </target> - - <target name="test"> - <antcall target="openejb.test"/> - <antcall target="test:tomcat6"/> - <antcall target="test:tomcat55"/> - </target> - - <target name="test:all"> - <antcall target="openejb.test"/> - <antcall target="test:tomcat6:all"/> - <antcall target="test:tomcat55:all"/> - </target> - - <target name="test:tomcat6"> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="6.0.14"/> - </antcall> - </target> - - <target name="test:tomcat6:all"> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="6.0.14"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="6.0.13"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="6.0.10"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="6.0.9"/> - </antcall> - </target> - - <target name="test:tomcat55"> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="5.5.26"/> - </antcall> - </target> - - <target name="test:tomcat55:all"> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="5.5.26"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="5.5.25"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="5.5.23"/> - </antcall> - <antcall target="tomcat.test"> - <param name="tomcat.version" value="5.5.20"/> - </antcall> - </target> - - <target name="openejb.test" depends="openejb.test.setup"> - <!-- unpack openejb --> - <antcall target="openejb.unpack"/> - - <!-- copy openejb-itests-app.jar to apps dir --> - <copy file="${itests.app.file}" todir="${openejb.home}/apps"/> - - <!-- start openejb --> - <antcall target="openejb.start"/> - - <!-- run itests --> - <antcall target="itests.openejb.run"/> - - <!-- stop openejb --> - <antcall target="openejb.stop"/> - </target> - - <target name="openejb.unpack"> - <delete dir="${openejb.home}"/> - <mkdir dir="${target.dir}"/> - <unjar src="${openejb.app.file}" dest="${target.dir}"/> - <chmod perm="u+x"> - <fileset dir="${openejb.home}/bin"> - <include name="openejb"/> - <include name="**/*.sh"/> - </fileset> - </chmod> - </target> - - <target name="openejb.start"> - <echo message="Starting OpenEJB ${tomee.version}..."/> - <exec executable="${openejb.home}/bin/openejb.bat" spawn="true" osfamily="windows"> - <env key="OPENEJB_HOME" value="${openejb.home}"/> - <arg value="start"/> - </exec> - <exec executable="${openejb.home}/bin/openejb" spawn="true" osfamily="unix"> - <arg value="start"/> - </exec> - <waitfor maxwait="1" maxwaitunit="minute"> - <and> - <socket server="localhost" port="4200"/> - <socket server="localhost" port="4201"/> - <socket server="localhost" port="4202"/> - <socket server="localhost" port="4204"/> - <socket server="localhost" port="61616"/> - </and> - </waitfor> - <echo message=" started"/> - </target> - - <target name="openejb.stop"> - <echo message="Stopping OpenEJB ${tomee.version}..."/> - <exec executable="${openejb.home}/bin/openejb.bat" osfamily="windows"> - <env key="OPENEJB_HOME" value="${openejb.home}"/> - <arg value="stop"/> - </exec> - <exec executable="${openejb.home}/bin/openejb" osfamily="unix"> - <arg value="stop"/> - </exec> - <waitfor maxwait="1" maxwaitunit="minute"> - <not> - <or> - <socket server="localhost" port="4200"/> - <socket server="localhost" port="4201"/> - <socket server="localhost" port="4202"/> - <socket server="localhost" port="4204"/> - <socket server="localhost" port="61616"/> - </or> - </not> - </waitfor> - - <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> - <os family="unix"/> - </condition> - <echo message=" sleeping for ${sleep} sec"/> - <sleep seconds="${sleep}"/> - - <echo message=" stopped"/> - </target> - - - <target name="tomcat.test" depends="tomcat.test.setup"> - <!-- unpack tomcat --> - <antcall target="tomcat.unpack"/> - - <!-- copy openejb.war to webapps dir --> - <copy file="${openejb.war.file}" todir="${tomcat.home}/webapps"/> - - <!-- install itests.war --> - <copy file="${itests.war.file}" todir="${tomcat.home}/webapps"/> - - <!-- start tomcat --> - <antcall target="tomcat.start"/> - - <!-- run itests (Servlet started mode) --> - <antcall target="itests.tomcat.run"/> - - <!-- run installer --> - <get src="http://localhost:8080/openejb/installer?action=Install" dest="${target.dir}/installer.out"/> - - <!-- stop tomcat --> - <antcall target="tomcat.stop"/> - - <!-- run itests (Listener started mode) --> - <antcall target="tomcat.start"/> - - <!-- run itests --> - <antcall target="itests.tomcat.run"/> - - <!-- stop tomcat --> - <antcall target="tomcat.stop"/> - - <!-- Make sure all resources are collected on windows --> - <condition property="sleep" value="1" else="30"> - <os family="unix"/> - </condition> - <echo message="Sleeping for ${sleep} sec to avoid Windows failures"/> - <sleep seconds="${sleep}"/> - </target> - - <target name="tomcat.unpack"> - <delete dir="${tomcat.home}"/> - <mkdir dir="${target.dir}"/> - <unjar src="${tomcat.file}" dest="${target.dir}"/> - <chmod dir="${tomcat.home}/bin" perm="u+x" includes="**/*.sh"/> - </target> - - <target name="tomcat.start"> - <echo message="Starting Tomcat ${tomcat.version}..."/> - <exec executable="${tomcat.home}/bin/startup.bat" spawn="true" osfamily="windows"> - <env key="CATALINA_HOME" value="${tomcat.home}"/> - </exec> - <exec executable="${tomcat.home}/bin/startup.sh" osfamily="unix"/> - <waitfor maxwait="1" maxwaitunit="minute"> - <and> - <socket server="localhost" port="8080"/> - <socket server="localhost" port="8005"/> - <socket server="localhost" port="8009"/> - <http url="http://localhost:8080/openejb/installer"/> - </and> - </waitfor> - - <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> - <os family="unix"/> - </condition> - <echo message=" sleeping for ${sleep} sec"/> - <sleep seconds="${sleep}"/> - - <echo message=" started"/> - </target> - - <target name="tomcat.stop"> - <echo message="Stopping Tomcat ${tomcat.version}..."/> - <exec executable="${tomcat.home}/bin/shutdown.bat" osfamily="windows"> - <env key="CATALINA_HOME" value="${tomcat.home}"/> - </exec> - <exec executable="${tomcat.home}/bin/shutdown.sh" osfamily="unix"/> - <waitfor maxwait="1" maxwaitunit="minute"> - <not> - <or> - <http url="http://localhost:8080"/> - <socket server="localhost" port="8080"/> - <socket server="localhost" port="8005"/> - <socket server="localhost" port="8009"/> - <socket server="localhost" port="61616"/> - </or> - </not> - </waitfor> - - <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> - <os family="unix"/> - </condition> - <echo message=" sleeping for ${sleep} sec"/> - <sleep seconds="${sleep}"/> - - <echo message=" stopped"/> - </target> - - <target name="itests.openejb.run"> - <java jar="${itests.client.file}" fork="yes"> - <sysproperty key="openejb.home" value="${openejb.home}"/> - <arg value="remote"/> - </java> - </target> - - <target name="itests.tomcat.run"> - <java jar="${itests.client.file}" fork="yes"> - <sysproperty key="openejb.home" value="${openejb.home}"/> - <arg value="tomcat"/> - </java> - </target> - - <target name="openejb.test.setup"> - <property name="openejb.app.url" value="${maven.repo}/org/apache/openejb/openejb-standalone/${tomee.version}/openejb-standalone-${tomee.version}.zip"/> - <property name="openejb.app.file" value="${repo}/openejb/distributions/${tomee.version}/openejb.zip"/> - - <property name="itests.app.url" value="${maven.repo}/org/apache/openejb/openejb-itests-app/${tomee.version}/openejb-itests-app-${tomee.version}.jar"/> - <property name="itests.app.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-app.jar"/> - - <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${tomee.version}/openejb-itests-standalone-client-${tomee.version}.jar"/> - <property name="itests.client.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-standalone-client.jar"/> - - <property name="openejb.home" value="${target.dir}/openejb-${tomee.version}"/> - - <antcall target="download.file"> - <param name="download.url" value="${openejb.app.url}"/> - <param name="download.file" value="${openejb.app.file}"/> - </antcall> - <antcall target="download.file"> - <param name="download.url" value="${itests.app.url}"/> - <param name="download.file" value="${itests.app.file}"/> - </antcall> - <antcall target="download.file"> - <param name="download.url" value="${itests.client.url}"/> - <param name="download.file" value="${itests.client.file}"/> - </antcall> - </target> - - <target name="tomcat.test.setup"> - <property name="openejb.war.url" value="${maven.repo}/org/apache/openejb/openejb-tomcat-webapp/${tomee.version}/openejb-tomcat-webapp-${tomee.version}.war"/> - <property name="openejb.war.file" value="${repo}/openejb/distributions/${tomee.version}/openejb.war"/> - - <property name="itests.war.url" value="${maven.repo}/org/apache/openejb/openejb-itests-web/${tomee.version}/openejb-itests-web-${tomee.version}.war"/> - <property name="itests.war.file" value="${repo}/openejb/distributions/${tomee.version}/itests.war"/> - - <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${tomee.version}/openejb-itests-standalone-client-${tomee.version}.jar"/> - <property name="itests.client.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-standalone-client.jar"/> - - <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> - <matches pattern="^7\." string="${tomcat.version}"/> - </condition> - <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> - <matches pattern="^6\." string="${tomcat.version}"/> - </condition> - <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-5/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> - <matches pattern="^5\.5" string="${tomcat.version}"/> - </condition> - <fail message="Unknown Tomcat version ${tomcat.version}" unless="tomcat.url"/> - <property name="tomcat.file" value="${repo}/tomcat/distributions/${tomcat.version}/tomcat.zip"/> - - <property name="tomcat.home" value="${target.dir}/apache-tomcat-${tomcat.version}"/> - - <antcall target="download.file"> - <param name="download.url" value="${tomcat.url}"/> - <param name="download.file" value="${tomcat.file}"/> - </antcall> - <antcall target="download.file"> - <param name="download.url" value="${openejb.war.url}"/> - <param name="download.file" value="${openejb.war.file}"/> - </antcall> - <antcall target="download.file"> - <param name="download.url" value="${itests.war.url}"/> - <param name="download.file" value="${itests.war.file}"/> - </antcall> - <antcall target="download.file"> - <param name="download.url" value="${itests.client.url}"/> - <param name="download.file" value="${itests.client.file}"/> - </antcall> - </target> - - <target name="download.uptodate"> - <available file="${download.file}" property="download.uptodate"/> - </target> - - <target name="download.file" depends="download.uptodate" unless="download.uptodate"> - <dirname property="download.dir" file="${download.file}"/> - <mkdir dir="${download.dir}"/> - <get src="${download.url}" dest="${download.file}"/> - </target> -</project> +<?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. +--> +<!-- $Revision: 579817 $ $Date: 2007-09-26 14:56:30 -0700 (Wed, 26 Sep 2007) $ --> + +<project name="Test OpenEJB" default="test" basedir="."> + <description> + Tests OpenEJB distribution using the OpenEJB iTest suite. + </description> + + <property name="tomee.version" value="1.7.2"/> + <property name="repo" location="${basedir}/repo"/> + <property name="maven.repo" value="file:${user.home}/.m2/repository"/> + <property name="target.dir" location="${basedir}/target"/> + <property name="windows.sleep" value="5"/> + <property name="unix.sleep" value="1"/> + + + <target name="clean"> + <delete dir="${basedir}/activemq-data"/> + <delete dir="${target.dir}"/> + </target> + + <target name="test"> + <antcall target="openejb.test"/> + <antcall target="test:tomcat6"/> + <antcall target="test:tomcat55"/> + </target> + + <target name="test:all"> + <antcall target="openejb.test"/> + <antcall target="test:tomcat6:all"/> + <antcall target="test:tomcat55:all"/> + </target> + + <target name="test:tomcat6"> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="6.0.14"/> + </antcall> + </target> + + <target name="test:tomcat6:all"> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="6.0.14"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="6.0.13"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="6.0.10"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="6.0.9"/> + </antcall> + </target> + + <target name="test:tomcat55"> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="5.5.26"/> + </antcall> + </target> + + <target name="test:tomcat55:all"> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="5.5.26"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="5.5.25"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="5.5.23"/> + </antcall> + <antcall target="tomcat.test"> + <param name="tomcat.version" value="5.5.20"/> + </antcall> + </target> + + <target name="openejb.test" depends="openejb.test.setup"> + <!-- unpack openejb --> + <antcall target="openejb.unpack"/> + + <!-- copy openejb-itests-app.jar to apps dir --> + <copy file="${itests.app.file}" todir="${openejb.home}/apps"/> + + <!-- start openejb --> + <antcall target="openejb.start"/> + + <!-- run itests --> + <antcall target="itests.openejb.run"/> + + <!-- stop openejb --> + <antcall target="openejb.stop"/> + </target> + + <target name="openejb.unpack"> + <delete dir="${openejb.home}"/> + <mkdir dir="${target.dir}"/> + <unjar src="${openejb.app.file}" dest="${target.dir}"/> + <chmod perm="u+x"> + <fileset dir="${openejb.home}/bin"> + <include name="openejb"/> + <include name="**/*.sh"/> + </fileset> + </chmod> + </target> + + <target name="openejb.start"> + <echo message="Starting OpenEJB ${tomee.version}..."/> + <exec executable="${openejb.home}/bin/openejb.bat" spawn="true" osfamily="windows"> + <env key="OPENEJB_HOME" value="${openejb.home}"/> + <arg value="start"/> + </exec> + <exec executable="${openejb.home}/bin/openejb" spawn="true" osfamily="unix"> + <arg value="start"/> + </exec> + <waitfor maxwait="1" maxwaitunit="minute"> + <and> + <socket server="localhost" port="4200"/> + <socket server="localhost" port="4201"/> + <socket server="localhost" port="4202"/> + <socket server="localhost" port="4204"/> + <socket server="localhost" port="61616"/> + </and> + </waitfor> + <echo message=" started"/> + </target> + + <target name="openejb.stop"> + <echo message="Stopping OpenEJB ${tomee.version}..."/> + <exec executable="${openejb.home}/bin/openejb.bat" osfamily="windows"> + <env key="OPENEJB_HOME" value="${openejb.home}"/> + <arg value="stop"/> + </exec> + <exec executable="${openejb.home}/bin/openejb" osfamily="unix"> + <arg value="stop"/> + </exec> + <waitfor maxwait="1" maxwaitunit="minute"> + <not> + <or> + <socket server="localhost" port="4200"/> + <socket server="localhost" port="4201"/> + <socket server="localhost" port="4202"/> + <socket server="localhost" port="4204"/> + <socket server="localhost" port="61616"/> + </or> + </not> + </waitfor> + + <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> + <os family="unix"/> + </condition> + <echo message=" sleeping for ${sleep} sec"/> + <sleep seconds="${sleep}"/> + + <echo message=" stopped"/> + </target> + + + <target name="tomcat.test" depends="tomcat.test.setup"> + <!-- unpack tomcat --> + <antcall target="tomcat.unpack"/> + + <!-- copy openejb.war to webapps dir --> + <copy file="${openejb.war.file}" todir="${tomcat.home}/webapps"/> + + <!-- install itests.war --> + <copy file="${itests.war.file}" todir="${tomcat.home}/webapps"/> + + <!-- start tomcat --> + <antcall target="tomcat.start"/> + + <!-- run itests (Servlet started mode) --> + <antcall target="itests.tomcat.run"/> + + <!-- run installer --> + <get src="http://localhost:8080/openejb/installer?action=Install" dest="${target.dir}/installer.out"/> + + <!-- stop tomcat --> + <antcall target="tomcat.stop"/> + + <!-- run itests (Listener started mode) --> + <antcall target="tomcat.start"/> + + <!-- run itests --> + <antcall target="itests.tomcat.run"/> + + <!-- stop tomcat --> + <antcall target="tomcat.stop"/> + + <!-- Make sure all resources are collected on windows --> + <condition property="sleep" value="1" else="30"> + <os family="unix"/> + </condition> + <echo message="Sleeping for ${sleep} sec to avoid Windows failures"/> + <sleep seconds="${sleep}"/> + </target> + + <target name="tomcat.unpack"> + <delete dir="${tomcat.home}"/> + <mkdir dir="${target.dir}"/> + <unjar src="${tomcat.file}" dest="${target.dir}"/> + <chmod dir="${tomcat.home}/bin" perm="u+x" includes="**/*.sh"/> + </target> + + <target name="tomcat.start"> + <echo message="Starting Tomcat ${tomcat.version}..."/> + <exec executable="${tomcat.home}/bin/startup.bat" spawn="true" osfamily="windows"> + <env key="CATALINA_HOME" value="${tomcat.home}"/> + </exec> + <exec executable="${tomcat.home}/bin/startup.sh" osfamily="unix"/> + <waitfor maxwait="1" maxwaitunit="minute"> + <and> + <socket server="localhost" port="8080"/> + <socket server="localhost" port="8005"/> + <socket server="localhost" port="8009"/> + <http url="http://localhost:8080/openejb/installer"/> + </and> + </waitfor> + + <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> + <os family="unix"/> + </condition> + <echo message=" sleeping for ${sleep} sec"/> + <sleep seconds="${sleep}"/> + + <echo message=" started"/> + </target> + + <target name="tomcat.stop"> + <echo message="Stopping Tomcat ${tomcat.version}..."/> + <exec executable="${tomcat.home}/bin/shutdown.bat" osfamily="windows"> + <env key="CATALINA_HOME" value="${tomcat.home}"/> + </exec> + <exec executable="${tomcat.home}/bin/shutdown.sh" osfamily="unix"/> + <waitfor maxwait="1" maxwaitunit="minute"> + <not> + <or> + <http url="http://localhost:8080"/> + <socket server="localhost" port="8080"/> + <socket server="localhost" port="8005"/> + <socket server="localhost" port="8009"/> + <socket server="localhost" port="61616"/> + </or> + </not> + </waitfor> + + <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}"> + <os family="unix"/> + </condition> + <echo message=" sleeping for ${sleep} sec"/> + <sleep seconds="${sleep}"/> + + <echo message=" stopped"/> + </target> + + <target name="itests.openejb.run"> + <java jar="${itests.client.file}" fork="yes"> + <sysproperty key="openejb.home" value="${openejb.home}"/> + <arg value="remote"/> + </java> + </target> + + <target name="itests.tomcat.run"> + <java jar="${itests.client.file}" fork="yes"> + <sysproperty key="openejb.home" value="${openejb.home}"/> + <arg value="tomcat"/> + </java> + </target> + + <target name="openejb.test.setup"> + <property name="openejb.app.url" value="${maven.repo}/org/apache/openejb/openejb-standalone/${tomee.version}/openejb-standalone-${tomee.version}.zip"/> + <property name="openejb.app.file" value="${repo}/openejb/distributions/${tomee.version}/openejb.zip"/> + + <property name="itests.app.url" value="${maven.repo}/org/apache/openejb/openejb-itests-app/${tomee.version}/openejb-itests-app-${tomee.version}.jar"/> + <property name="itests.app.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-app.jar"/> + + <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${tomee.version}/openejb-itests-standalone-client-${tomee.version}.jar"/> + <property name="itests.client.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-standalone-client.jar"/> + + <property name="openejb.home" value="${target.dir}/openejb-${tomee.version}"/> + + <antcall target="download.file"> + <param name="download.url" value="${openejb.app.url}"/> + <param name="download.file" value="${openejb.app.file}"/> + </antcall> + <antcall target="download.file"> + <param name="download.url" value="${itests.app.url}"/> + <param name="download.file" value="${itests.app.file}"/> + </antcall> + <antcall target="download.file"> + <param name="download.url" value="${itests.client.url}"/> + <param name="download.file" value="${itests.client.file}"/> + </antcall> + </target> + + <target name="tomcat.test.setup"> + <property name="openejb.war.url" value="${maven.repo}/org/apache/openejb/openejb-tomcat-webapp/${tomee.version}/openejb-tomcat-webapp-${tomee.version}.war"/> + <property name="openejb.war.file" value="${repo}/openejb/distributions/${tomee.version}/openejb.war"/> + + <property name="itests.war.url" value="${maven.repo}/org/apache/openejb/openejb-itests-web/${tomee.version}/openejb-itests-web-${tomee.version}.war"/> + <property name="itests.war.file" value="${repo}/openejb/distributions/${tomee.version}/itests.war"/> + + <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${tomee.version}/openejb-itests-standalone-client-${tomee.version}.jar"/> + <property name="itests.client.file" value="${repo}/openejb/distributions/${tomee.version}/openejb-itests-standalone-client.jar"/> + + <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> + <matches pattern="^7\." string="${tomcat.version}"/> + </condition> + <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> + <matches pattern="^6\." string="${tomcat.version}"/> + </condition> + <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-5/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip"> + <matches pattern="^5\.5" string="${tomcat.version}"/> + </condition> + <fail message="Unknown Tomcat version ${tomcat.version}" unless="tomcat.url"/> + <property name="tomcat.file" value="${repo}/tomcat/distributions/${tomcat.version}/tomcat.zip"/> + + <property name="tomcat.home" value="${target.dir}/apache-tomcat-${tomcat.version}"/> + + <antcall target="download.file"> + <param name="download.url" value="${tomcat.url}"/> + <param name="download.file" value="${tomcat.file}"/> + </antcall> + <antcall target="download.file"> + <param name="download.url" value="${openejb.war.url}"/> + <param name="download.file" value="${openejb.war.file}"/> + </antcall> + <antcall target="download.file"> + <param name="download.url" value="${itests.war.url}"/> + <param name="download.file" value="${itests.war.file}"/> + </antcall> + <antcall target="download.file"> + <param name="download.url" value="${itests.client.url}"/> + <param name="download.file" value="${itests.client.file}"/> + </antcall> + </target> + + <target name="download.uptodate"> + <available file="${download.file}" property="download.uptodate"/> + </target> + + <target name="download.file" depends="download.uptodate" unless="download.uptodate"> + <dirname property="download.dir" file="${download.file}"/> + <mkdir dir="${download.dir}"/> + <get src="${download.url}" dest="${download.file}"/> + </target> +</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java index b8b6721..cb5706b 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java @@ -1,101 +1,101 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.assembler.classic; - -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.persistence.PersistenceUnitInfoImpl; - -import javax.persistence.EntityManagerFactory; -import javax.persistence.ValidationMode; -import javax.persistence.spi.PersistenceProvider; -import javax.validation.ValidatorFactory; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; - -public class EntityManagerFactoryCallable implements Callable<EntityManagerFactory> { - public static final String OPENEJB_JPA_INIT_ENTITYMANAGER = "openejb.jpa.init-entitymanager"; - public static final String OPENJPA_ENTITY_MANAGER_FACTORY_POOL = "openjpa.EntityManagerFactoryPool"; - - private final String persistenceProviderClassName; - private final PersistenceUnitInfoImpl unitInfo; - private final Map<ComparableValidationConfig, ValidatorFactory> potentialValidators; - private ClassLoader appClassLoader; - - public EntityManagerFactoryCallable(final String persistenceProviderClassName, final PersistenceUnitInfoImpl unitInfo, - final ClassLoader cl, final Map<ComparableValidationConfig, ValidatorFactory> validators) { - this.persistenceProviderClassName = persistenceProviderClassName; - this.unitInfo = unitInfo; - this.appClassLoader = cl; - this.potentialValidators = validators; - } - - @Override - public EntityManagerFactory call() throws Exception { - final ClassLoader old = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(appClassLoader); - try { - final Class<?> clazz = appClassLoader.loadClass(persistenceProviderClassName); - final PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance(); - - // Create entity manager factories with the validator factory - final Map<String, Object> properties = new HashMap<String, Object>(); - if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) { - properties.put("javax.persistence.validation.factory", new ValidatorFactoryWrapper(potentialValidators)); - } - - customizeProperties(properties); - - final EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties); - - if (unitInfo.getProperties() != null - && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER)) - || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) { - emf.createEntityManager().close(); - } - - if (unitInfo.getNonJtaDataSource() != null) { - final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource()); - if (importer.hasSomethingToImport()) { - emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way - importer.doImport(); - } - } - - return emf; - } finally { - Thread.currentThread().setContextClassLoader(old); - } - } - - // properties that have to be passed to properties parameters and not unit properties - private void customizeProperties(final Map<String, Object> properties) { - final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL); - if (pool != null) { - properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool); - } - } - - public PersistenceUnitInfoImpl getUnitInfo() { - return unitInfo; - } - - public void overrideClassLoader(final ClassLoader loader) { - appClassLoader = loader; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.assembler.classic; + +import org.apache.openejb.loader.SystemInstance; +import org.apache.openejb.persistence.PersistenceUnitInfoImpl; + +import javax.persistence.EntityManagerFactory; +import javax.persistence.ValidationMode; +import javax.persistence.spi.PersistenceProvider; +import javax.validation.ValidatorFactory; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Callable; + +public class EntityManagerFactoryCallable implements Callable<EntityManagerFactory> { + public static final String OPENEJB_JPA_INIT_ENTITYMANAGER = "openejb.jpa.init-entitymanager"; + public static final String OPENJPA_ENTITY_MANAGER_FACTORY_POOL = "openjpa.EntityManagerFactoryPool"; + + private final String persistenceProviderClassName; + private final PersistenceUnitInfoImpl unitInfo; + private final Map<ComparableValidationConfig, ValidatorFactory> potentialValidators; + private ClassLoader appClassLoader; + + public EntityManagerFactoryCallable(final String persistenceProviderClassName, final PersistenceUnitInfoImpl unitInfo, + final ClassLoader cl, final Map<ComparableValidationConfig, ValidatorFactory> validators) { + this.persistenceProviderClassName = persistenceProviderClassName; + this.unitInfo = unitInfo; + this.appClassLoader = cl; + this.potentialValidators = validators; + } + + @Override + public EntityManagerFactory call() throws Exception { + final ClassLoader old = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(appClassLoader); + try { + final Class<?> clazz = appClassLoader.loadClass(persistenceProviderClassName); + final PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance(); + + // Create entity manager factories with the validator factory + final Map<String, Object> properties = new HashMap<String, Object>(); + if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) { + properties.put("javax.persistence.validation.factory", new ValidatorFactoryWrapper(potentialValidators)); + } + + customizeProperties(properties); + + final EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties); + + if (unitInfo.getProperties() != null + && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER)) + || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) { + emf.createEntityManager().close(); + } + + if (unitInfo.getNonJtaDataSource() != null) { + final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource()); + if (importer.hasSomethingToImport()) { + emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way + importer.doImport(); + } + } + + return emf; + } finally { + Thread.currentThread().setContextClassLoader(old); + } + } + + // properties that have to be passed to properties parameters and not unit properties + private void customizeProperties(final Map<String, Object> properties) { + final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL); + if (pool != null) { + properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool); + } + } + + public PersistenceUnitInfoImpl getUnitInfo() { + return unitInfo; + } + + public void overrideClassLoader(final ClassLoader loader) { + appClassLoader = loader; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/cipher/PasswordCipher.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cipher/PasswordCipher.java b/container/openejb-core/src/main/java/org/apache/openejb/cipher/PasswordCipher.java index 52e3fe6..fc657dd 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cipher/PasswordCipher.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cipher/PasswordCipher.java @@ -1,51 +1,51 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.cipher; - -/** - * Implementations of {@link org.apache.openejb.cipher.PasswordCipher} allow to encode and decode passwords - * used to connect to a database. - * <p/> - * Several implementations may exist, as several encryption algorithms may be - * supported. One-way encryption algorithm (hash) can't be used as we need to - * give a plain password to the database. {@link #encrypt(String)} method is not - * mandatory as we don't need to encode a password, but it's useful to get the - * encrypted value for a given plain text password. In the case you have - * implemented both methods, you can use the PasswordCodec command line tool to - * encode/decode a password. - */ -public interface PasswordCipher { - - /** - * Encodes a given plain text password and returns the encoded password. - * - * @param plainPassword The password to encode. May not be <code>null</code>, nor empty. - * @return The encoded password. - */ - char[] encrypt(String plainPassword); - - /** - * Decodes an encoded password and returns a plain text password. - * - * @param encryptedPassword The ciphered password to decode. May not be <code>null</code>, - * nor empty. - * @return The plain text password. - */ - String decrypt(char[] encryptedPassword); - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.cipher; + +/** + * Implementations of {@link org.apache.openejb.cipher.PasswordCipher} allow to encode and decode passwords + * used to connect to a database. + * <p/> + * Several implementations may exist, as several encryption algorithms may be + * supported. One-way encryption algorithm (hash) can't be used as we need to + * give a plain password to the database. {@link #encrypt(String)} method is not + * mandatory as we don't need to encode a password, but it's useful to get the + * encrypted value for a given plain text password. In the case you have + * implemented both methods, you can use the PasswordCodec command line tool to + * encode/decode a password. + */ +public interface PasswordCipher { + + /** + * Encodes a given plain text password and returns the encoded password. + * + * @param plainPassword The password to encode. May not be <code>null</code>, nor empty. + * @return The encoded password. + */ + char[] encrypt(String plainPassword); + + /** + * Decodes an encoded password and returns a plain text password. + * + * @param encryptedPassword The ciphered password to decode. May not be <code>null</code>, + * nor empty. + * @return The plain text password. + */ + String decrypt(char[] encryptedPassword); + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/cipher/PlainTextPasswordCipher.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cipher/PlainTextPasswordCipher.java b/container/openejb-core/src/main/java/org/apache/openejb/cipher/PlainTextPasswordCipher.java index 4b71dad..099b4ef 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cipher/PlainTextPasswordCipher.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cipher/PlainTextPasswordCipher.java @@ -1,54 +1,54 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.cipher; - -/** - * This {@link org.apache.openejb.cipher.PlainTextPasswordCipher} is an {@link org.apache.openejb.cipher.PasswordCipher} - * implementation that does not use any encryption/decryption algorithm at all. - */ -public class PlainTextPasswordCipher implements PasswordCipher { - - /** - * Returns the <code>encryptedPassword</code> as plain text string. - * - * @param encryptedPassword the encoded password - * @return String the decoded password - * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) - */ - public String decrypt(final char[] encryptedPassword) { - if (null == encryptedPassword) { - throw new IllegalArgumentException("encodedPassword cannot be null."); - } - return new String(encryptedPassword); - } - - /** - * Returns the <code>plainPassword</code> as plain text character array. - * - * @param plainPassword the plain-text password - * @return the plain-text password as character array - * @see org.apache.openejb.cipher.PasswordCipher#encrypt(String) - */ - public char[] encrypt(final String plainPassword) { - if (null == plainPassword) { - throw new IllegalArgumentException("plainPassword cannot be null."); - } - return plainPassword.toCharArray(); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.cipher; + +/** + * This {@link org.apache.openejb.cipher.PlainTextPasswordCipher} is an {@link org.apache.openejb.cipher.PasswordCipher} + * implementation that does not use any encryption/decryption algorithm at all. + */ +public class PlainTextPasswordCipher implements PasswordCipher { + + /** + * Returns the <code>encryptedPassword</code> as plain text string. + * + * @param encryptedPassword the encoded password + * @return String the decoded password + * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) + */ + public String decrypt(final char[] encryptedPassword) { + if (null == encryptedPassword) { + throw new IllegalArgumentException("encodedPassword cannot be null."); + } + return new String(encryptedPassword); + } + + /** + * Returns the <code>plainPassword</code> as plain text character array. + * + * @param plainPassword the plain-text password + * @return the plain-text password as character array + * @see org.apache.openejb.cipher.PasswordCipher#encrypt(String) + */ + public char[] encrypt(final String plainPassword) { + if (null == plainPassword) { + throw new IllegalArgumentException("plainPassword cannot be null."); + } + return plainPassword.toCharArray(); + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java b/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java index f6cd88f..1741e4f 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java @@ -1,97 +1,97 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.cipher; - -import org.apache.openejb.OpenEJBRuntimeException; -import org.apache.openejb.util.Base64; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; - -/** - * This {@link org.apache.openejb.cipher.PasswordCipher} implementation uses a the Triple-DES encryption - * algorithm. - */ -public class StaticDESPasswordCipher implements PasswordCipher { - - private static final byte[] _3desData = { - (byte) 0x76, (byte) 0x6F, (byte) 0xBA, (byte) 0x39, (byte) 0x31, - (byte) 0x2F, (byte) 0x0D, (byte) 0x4A, (byte) 0xA3, (byte) 0x90, - (byte) 0x55, (byte) 0xFE, (byte) 0x55, (byte) 0x65, (byte) 0x61, - (byte) 0x13, (byte) 0x34, (byte) 0x82, (byte) 0x12, (byte) 0x17, - (byte) 0xAC, (byte) 0x77, (byte) 0x39, (byte) 0x19}; - - private static final SecretKeySpec KEY = new SecretKeySpec(_3desData, "DESede"); - - /** - * The name of the transformation defines Triple-DES encryption - */ - private static final String TRANSFORMATION = "DESede"; - - /** - * @throws RuntimeException in any case of error. - * @see org.apache.openejb.cipher.PasswordCipher#encrypt(String) - */ - public char[] encrypt(final String plainPassword) { - if (null == plainPassword || plainPassword.length() == 0) { - throw new IllegalArgumentException("plainPassword cannot be null nor empty."); - } - - final byte[] plaintext = plainPassword.getBytes(); - try { - // Get a 3DES Cipher object - final Cipher cipher = Cipher.getInstance(TRANSFORMATION); - // Set it into encryption mode - cipher.init(Cipher.ENCRYPT_MODE, KEY); - - // Encrypt data - final byte[] cipherText = cipher.doFinal(plaintext); - return new String(Base64.encodeBase64(cipherText)).toCharArray(); - - } catch (final Exception e) { - throw new OpenEJBRuntimeException(e); - } - } - - /** - * @throws RuntimeException in any case of error. - * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) - */ - public String decrypt(final char[] encodedPassword) { - if (null == encodedPassword || encodedPassword.length == 0) { - throw new IllegalArgumentException("encodedPassword cannot be null nor empty."); - } - - try { - final byte[] cipherText = Base64.decodeBase64( - String.valueOf(encodedPassword).getBytes()); - - // Get a 3DES Cipher object - final Cipher cipher = Cipher.getInstance(TRANSFORMATION); - // Set it into decryption mode - cipher.init(Cipher.DECRYPT_MODE, KEY); - - // Decrypt data - return new String(cipher.doFinal(cipherText)); - - } catch (final Exception e) { - throw new OpenEJBRuntimeException(e); - } - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.cipher; + +import org.apache.openejb.OpenEJBRuntimeException; +import org.apache.openejb.util.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; + +/** + * This {@link org.apache.openejb.cipher.PasswordCipher} implementation uses a the Triple-DES encryption + * algorithm. + */ +public class StaticDESPasswordCipher implements PasswordCipher { + + private static final byte[] _3desData = { + (byte) 0x76, (byte) 0x6F, (byte) 0xBA, (byte) 0x39, (byte) 0x31, + (byte) 0x2F, (byte) 0x0D, (byte) 0x4A, (byte) 0xA3, (byte) 0x90, + (byte) 0x55, (byte) 0xFE, (byte) 0x55, (byte) 0x65, (byte) 0x61, + (byte) 0x13, (byte) 0x34, (byte) 0x82, (byte) 0x12, (byte) 0x17, + (byte) 0xAC, (byte) 0x77, (byte) 0x39, (byte) 0x19}; + + private static final SecretKeySpec KEY = new SecretKeySpec(_3desData, "DESede"); + + /** + * The name of the transformation defines Triple-DES encryption + */ + private static final String TRANSFORMATION = "DESede"; + + /** + * @throws RuntimeException in any case of error. + * @see org.apache.openejb.cipher.PasswordCipher#encrypt(String) + */ + public char[] encrypt(final String plainPassword) { + if (null == plainPassword || plainPassword.length() == 0) { + throw new IllegalArgumentException("plainPassword cannot be null nor empty."); + } + + final byte[] plaintext = plainPassword.getBytes(); + try { + // Get a 3DES Cipher object + final Cipher cipher = Cipher.getInstance(TRANSFORMATION); + // Set it into encryption mode + cipher.init(Cipher.ENCRYPT_MODE, KEY); + + // Encrypt data + final byte[] cipherText = cipher.doFinal(plaintext); + return new String(Base64.encodeBase64(cipherText)).toCharArray(); + + } catch (final Exception e) { + throw new OpenEJBRuntimeException(e); + } + } + + /** + * @throws RuntimeException in any case of error. + * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) + */ + public String decrypt(final char[] encodedPassword) { + if (null == encodedPassword || encodedPassword.length == 0) { + throw new IllegalArgumentException("encodedPassword cannot be null nor empty."); + } + + try { + final byte[] cipherText = Base64.decodeBase64( + String.valueOf(encodedPassword).getBytes()); + + // Get a 3DES Cipher object + final Cipher cipher = Cipher.getInstance(TRANSFORMATION); + // Set it into decryption mode + cipher.init(Cipher.DECRYPT_MODE, KEY); + + // Decrypt data + return new String(cipher.doFinal(cipherText)); + + } catch (final Exception e) { + throw new OpenEJBRuntimeException(e); + } + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/classloader/FalseFilter.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/classloader/FalseFilter.java b/container/openejb-core/src/main/java/org/apache/openejb/classloader/FalseFilter.java index 3378221..3452f19 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/classloader/FalseFilter.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/classloader/FalseFilter.java @@ -1,29 +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. - */ - -package org.apache.openejb.classloader; - -import org.apache.xbean.finder.filter.Filter; - -public class FalseFilter implements Filter { - public static final FalseFilter INSTANCE = new FalseFilter(); - - @Override - public boolean accept(final String name) { - return false; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.classloader; + +import org.apache.xbean.finder.filter.Filter; + +public class FalseFilter implements Filter { + public static final FalseFilter INSTANCE = new FalseFilter(); + + @Override + public boolean accept(final String name) { + return false; + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentFilterable.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentFilterable.java b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentFilterable.java index ec3365a..f4b9be6 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentFilterable.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentFilterable.java @@ -1,33 +1,33 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.config; - -/** - * @version $Rev$ - */ -public interface DeploymentFilterable { - String DEPLOYMENTS_CLASSPATH_PROPERTY = "openejb.deployments.classpath"; - String SEARCH_CLASSPATH_FOR_DEPLOYMENTS_PROPERTY = DEPLOYMENTS_CLASSPATH_PROPERTY; - String CLASSPATH_INCLUDE = "openejb.deployments.classpath.include"; - String CLASSPATH_EXCLUDE = "openejb.deployments.classpath.exclude"; - String PACKAGE_INCLUDE = "openejb.deployments.package.include"; - String PACKAGE_EXCLUDE = "openejb.deployments.package.exclude"; - String CLASSPATH_REQUIRE_DESCRIPTOR = RequireDescriptors.PROPERTY; - String CLASSPATH_FILTER_DESCRIPTORS = "openejb.deployments.classpath.filter.descriptors"; - String CLASSPATH_FILTER_SYSTEMAPPS = "openejb.deployments.classpath.filter.systemapps"; -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.config; + +/** + * @version $Rev$ + */ +public interface DeploymentFilterable { + String DEPLOYMENTS_CLASSPATH_PROPERTY = "openejb.deployments.classpath"; + String SEARCH_CLASSPATH_FOR_DEPLOYMENTS_PROPERTY = DEPLOYMENTS_CLASSPATH_PROPERTY; + String CLASSPATH_INCLUDE = "openejb.deployments.classpath.include"; + String CLASSPATH_EXCLUDE = "openejb.deployments.classpath.exclude"; + String PACKAGE_INCLUDE = "openejb.deployments.package.include"; + String PACKAGE_EXCLUDE = "openejb.deployments.package.exclude"; + String CLASSPATH_REQUIRE_DESCRIPTOR = RequireDescriptors.PROPERTY; + String CLASSPATH_FILTER_DESCRIPTORS = "openejb.deployments.classpath.filter.descriptors"; + String CLASSPATH_FILTER_SYSTEMAPPS = "openejb.deployments.classpath.filter.systemapps"; +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAnnotations.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAnnotations.java b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAnnotations.java index 8a6adce..1ff2611 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAnnotations.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckAnnotations.java @@ -1,96 +1,96 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.config.rules; - -import org.apache.openejb.config.AppModule; -import org.apache.openejb.config.EjbModule; -import org.apache.openejb.config.WebModule; -import org.apache.openejb.util.LogCategory; -import org.apache.openejb.util.Logger; -import org.apache.xbean.finder.IAnnotationFinder; - -import javax.jws.WebService; -import java.lang.annotation.Annotation; -import java.util.Arrays; -import java.util.List; - -public class CheckAnnotations extends ValidationBase { - - Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP_VALIDATION, CheckAnnotations.class); - - @Override - public void validate(final AppModule appModule) { - try { - - for (final EjbModule ejbModule : appModule.getEjbModules()) { - module = ejbModule; - findClassesAnnotatedWithWebService(ejbModule); - } - - for (final WebModule webModule : appModule.getWebModules()) { - module = webModule; - findClassesAnnotatedWithWebService(webModule); - } - - } catch (final Exception e) { - logger.error("Error while validating @WebService annotation", e); - } - - - } - - private void findClassesAnnotatedWithWebService(final EjbModule ejbModule) { - - final IAnnotationFinder finder = ejbModule.getFinder(); - if (finder != null) { - findIncorrectAnnotationAndWarn(finder, ejbModule.toString()); - } - } - - - private void findClassesAnnotatedWithWebService(final WebModule webModule) { - final IAnnotationFinder finder = webModule.getFinder(); - if (finder != null) { - findIncorrectAnnotationAndWarn(finder, webModule.toString()); - } - - } - - private void findIncorrectAnnotationAndWarn(final IAnnotationFinder finder, final String component) { - final List<Class<?>> webserviceAnnotatedClasses = finder.findAnnotatedClasses(WebService.class); - for (final Class clazz : webserviceAnnotatedClasses) { - final Annotation[] annotations = clazz.getDeclaredAnnotations(); - - final List<Annotation> declaredAnnotations = Arrays.asList(annotations); - for (final Annotation declaredAnn : declaredAnnotations) { - if (declaredAnn.annotationType().getName().equals("javax.ejb.Stateful")) { - warn(component, "annotation.invalid.stateful.webservice", clazz.getName()); - } - if (declaredAnn.annotationType().getName().equals("javax.annotation.ManagedBean")) { - warn(component, "annotation.invalid.managedbean.webservice", clazz.getName()); - } - if (declaredAnn.annotationType().getName().equals("javax.ejb.MessageDriven")) { - warn(component, "annotation.invalid.messagedriven.webservice", clazz.getName()); - } - - } - } - } - - +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.config.rules; + +import org.apache.openejb.config.AppModule; +import org.apache.openejb.config.EjbModule; +import org.apache.openejb.config.WebModule; +import org.apache.openejb.util.LogCategory; +import org.apache.openejb.util.Logger; +import org.apache.xbean.finder.IAnnotationFinder; + +import javax.jws.WebService; +import java.lang.annotation.Annotation; +import java.util.Arrays; +import java.util.List; + +public class CheckAnnotations extends ValidationBase { + + Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP_VALIDATION, CheckAnnotations.class); + + @Override + public void validate(final AppModule appModule) { + try { + + for (final EjbModule ejbModule : appModule.getEjbModules()) { + module = ejbModule; + findClassesAnnotatedWithWebService(ejbModule); + } + + for (final WebModule webModule : appModule.getWebModules()) { + module = webModule; + findClassesAnnotatedWithWebService(webModule); + } + + } catch (final Exception e) { + logger.error("Error while validating @WebService annotation", e); + } + + + } + + private void findClassesAnnotatedWithWebService(final EjbModule ejbModule) { + + final IAnnotationFinder finder = ejbModule.getFinder(); + if (finder != null) { + findIncorrectAnnotationAndWarn(finder, ejbModule.toString()); + } + } + + + private void findClassesAnnotatedWithWebService(final WebModule webModule) { + final IAnnotationFinder finder = webModule.getFinder(); + if (finder != null) { + findIncorrectAnnotationAndWarn(finder, webModule.toString()); + } + + } + + private void findIncorrectAnnotationAndWarn(final IAnnotationFinder finder, final String component) { + final List<Class<?>> webserviceAnnotatedClasses = finder.findAnnotatedClasses(WebService.class); + for (final Class clazz : webserviceAnnotatedClasses) { + final Annotation[] annotations = clazz.getDeclaredAnnotations(); + + final List<Annotation> declaredAnnotations = Arrays.asList(annotations); + for (final Annotation declaredAnn : declaredAnnotations) { + if (declaredAnn.annotationType().getName().equals("javax.ejb.Stateful")) { + warn(component, "annotation.invalid.stateful.webservice", clazz.getName()); + } + if (declaredAnn.annotationType().getName().equals("javax.annotation.ManagedBean")) { + warn(component, "annotation.invalid.managedbean.webservice", clazz.getName()); + } + if (declaredAnn.annotationType().getName().equals("javax.ejb.MessageDriven")) { + warn(component, "annotation.invalid.messagedriven.webservice", clazz.getName()); + } + + } + } + } + + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java index e2e3eaf..8b85bb3 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNames.java @@ -1,84 +1,84 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.config.rules; - -import org.apache.openejb.config.AppModule; -import org.apache.openejb.loader.SystemInstance; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Properties; - -public class CheckIncorrectPropertyNames extends ValidationBase { - - Map incorrectAndCorrectPropNames = new HashMap<String, String>(); - - { - //incorrect property key : correct property key - incorrectAndCorrectPropNames.put("java.persistence.provider", "javax.persistence.provider"); - incorrectAndCorrectPropNames.put("java.persistence.transactionType", "javax.persistence.transactionType"); - incorrectAndCorrectPropNames.put("java.persistence.jtaDataSource", "javax.persistence.jtaDataSource"); - incorrectAndCorrectPropNames.put("java.persistence.nonJtaDataSource", "javax.persistence.nonJtaDataSource"); - incorrectAndCorrectPropNames.put("java.net.ssl.keyStore", "javax.net.ssl.keyStore"); - incorrectAndCorrectPropNames.put("java.net.ssl.keyStorePassword", "javax.net.ssl.keyStorePassword"); - incorrectAndCorrectPropNames.put("java.net.ssl.trustStore", "javax.net.ssl.trustStore"); - incorrectAndCorrectPropNames.put("java.security.jacc.PolicyConfigurationFactory.provider", "javax.security.jacc.PolicyConfigurationFactory.provider"); - incorrectAndCorrectPropNames.put("java.security.jacc.policy.provider", "javax.security.jacc.policy.provider"); - incorrectAndCorrectPropNames.put("java.xml.ws.spi.Provider", "javax.xml.ws.spi.Provider"); - incorrectAndCorrectPropNames.put("java.xml.soap.MessageFactory", "javax.xml.soap.MessageFactory"); - incorrectAndCorrectPropNames.put("java.xml.soap.SOAPFactory", "javax.xml.soap.SOAPFactory"); - incorrectAndCorrectPropNames.put("java.xml.soap.SOAPConnectionFactory", "javax.xml.soap.SOAPConnectionFactory"); - incorrectAndCorrectPropNames.put("java.xml.soap.MetaFactory", "javax.xml.soap.MetaFactory"); - incorrectAndCorrectPropNames.put("java.persistence.sharedCache.mode", "javax.persistence.sharedCache.mode"); - incorrectAndCorrectPropNames.put("java.persistence.validation.mode", "javax.persistence.validation.mode"); - incorrectAndCorrectPropNames.put("java.persistence.transactionType", "javax.persistence.transactionType"); - - incorrectAndCorrectPropNames.put("javax.naming.applet", "java.naming.applet"); - incorrectAndCorrectPropNames.put("javax.naming.authoritative", "java.naming.authoritative"); - incorrectAndCorrectPropNames.put("javax.naming.batchsize", "java.naming.batchsize"); - incorrectAndCorrectPropNames.put("javax.naming.dns.url", "java.naming.dns.url"); - incorrectAndCorrectPropNames.put("javax.naming.factory.initial", "java.naming.factory.initial"); - incorrectAndCorrectPropNames.put("javax.naming.factory.object", "java.naming.factory.object"); - incorrectAndCorrectPropNames.put("javax.naming.factory.state", "java.naming.factory.state"); - incorrectAndCorrectPropNames.put("javax.naming.factory.url.pkgs", "java.naming.factory.url.pkgs"); - incorrectAndCorrectPropNames.put("javax.naming.language", "java.naming.language"); - incorrectAndCorrectPropNames.put("javax.naming.provider.url", "java.naming.provider.url"); - incorrectAndCorrectPropNames.put("javax.naming.referral", "java.naming.referral"); - incorrectAndCorrectPropNames.put("javax.naming.security.authentication", "java.naming.security.authentication"); - incorrectAndCorrectPropNames.put("javax.naming.security.credentials", "java.naming.security.credentials"); - incorrectAndCorrectPropNames.put("javax.naming.security.principal", "java.naming.security.principal"); - incorrectAndCorrectPropNames.put("javax.naming.security.protocol", "java.naming.security.protocol"); - - } - - @Override - public void validate(final AppModule appModule) { - this.module = appModule; - final Properties systemProperties = SystemInstance.get().getProperties(); - - final Iterator iterator = incorrectAndCorrectPropNames.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next(); - if (systemProperties.containsKey(entry.getKey())) { - warn(appModule.toString(), "incorrect.property.name", entry.getKey(), entry.getValue()); - } - } - - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.config.rules; + +import org.apache.openejb.config.AppModule; +import org.apache.openejb.loader.SystemInstance; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +public class CheckIncorrectPropertyNames extends ValidationBase { + + Map incorrectAndCorrectPropNames = new HashMap<String, String>(); + + { + //incorrect property key : correct property key + incorrectAndCorrectPropNames.put("java.persistence.provider", "javax.persistence.provider"); + incorrectAndCorrectPropNames.put("java.persistence.transactionType", "javax.persistence.transactionType"); + incorrectAndCorrectPropNames.put("java.persistence.jtaDataSource", "javax.persistence.jtaDataSource"); + incorrectAndCorrectPropNames.put("java.persistence.nonJtaDataSource", "javax.persistence.nonJtaDataSource"); + incorrectAndCorrectPropNames.put("java.net.ssl.keyStore", "javax.net.ssl.keyStore"); + incorrectAndCorrectPropNames.put("java.net.ssl.keyStorePassword", "javax.net.ssl.keyStorePassword"); + incorrectAndCorrectPropNames.put("java.net.ssl.trustStore", "javax.net.ssl.trustStore"); + incorrectAndCorrectPropNames.put("java.security.jacc.PolicyConfigurationFactory.provider", "javax.security.jacc.PolicyConfigurationFactory.provider"); + incorrectAndCorrectPropNames.put("java.security.jacc.policy.provider", "javax.security.jacc.policy.provider"); + incorrectAndCorrectPropNames.put("java.xml.ws.spi.Provider", "javax.xml.ws.spi.Provider"); + incorrectAndCorrectPropNames.put("java.xml.soap.MessageFactory", "javax.xml.soap.MessageFactory"); + incorrectAndCorrectPropNames.put("java.xml.soap.SOAPFactory", "javax.xml.soap.SOAPFactory"); + incorrectAndCorrectPropNames.put("java.xml.soap.SOAPConnectionFactory", "javax.xml.soap.SOAPConnectionFactory"); + incorrectAndCorrectPropNames.put("java.xml.soap.MetaFactory", "javax.xml.soap.MetaFactory"); + incorrectAndCorrectPropNames.put("java.persistence.sharedCache.mode", "javax.persistence.sharedCache.mode"); + incorrectAndCorrectPropNames.put("java.persistence.validation.mode", "javax.persistence.validation.mode"); + incorrectAndCorrectPropNames.put("java.persistence.transactionType", "javax.persistence.transactionType"); + + incorrectAndCorrectPropNames.put("javax.naming.applet", "java.naming.applet"); + incorrectAndCorrectPropNames.put("javax.naming.authoritative", "java.naming.authoritative"); + incorrectAndCorrectPropNames.put("javax.naming.batchsize", "java.naming.batchsize"); + incorrectAndCorrectPropNames.put("javax.naming.dns.url", "java.naming.dns.url"); + incorrectAndCorrectPropNames.put("javax.naming.factory.initial", "java.naming.factory.initial"); + incorrectAndCorrectPropNames.put("javax.naming.factory.object", "java.naming.factory.object"); + incorrectAndCorrectPropNames.put("javax.naming.factory.state", "java.naming.factory.state"); + incorrectAndCorrectPropNames.put("javax.naming.factory.url.pkgs", "java.naming.factory.url.pkgs"); + incorrectAndCorrectPropNames.put("javax.naming.language", "java.naming.language"); + incorrectAndCorrectPropNames.put("javax.naming.provider.url", "java.naming.provider.url"); + incorrectAndCorrectPropNames.put("javax.naming.referral", "java.naming.referral"); + incorrectAndCorrectPropNames.put("javax.naming.security.authentication", "java.naming.security.authentication"); + incorrectAndCorrectPropNames.put("javax.naming.security.credentials", "java.naming.security.credentials"); + incorrectAndCorrectPropNames.put("javax.naming.security.principal", "java.naming.security.principal"); + incorrectAndCorrectPropNames.put("javax.naming.security.protocol", "java.naming.security.protocol"); + + } + + @Override + public void validate(final AppModule appModule) { + this.module = appModule; + final Properties systemProperties = SystemInstance.get().getProperties(); + + final Iterator iterator = incorrectAndCorrectPropNames.entrySet().iterator(); + while (iterator.hasNext()) { + final Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next(); + if (systemProperties.containsKey(entry.getKey())) { + warn(appModule.toString(), "incorrect.property.name", entry.getKey(), entry.getValue()); + } + } + + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/fa0d3745/container/openejb-core/src/main/java/org/apache/openejb/injection/FallbackPropertyInjector.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/injection/FallbackPropertyInjector.java b/container/openejb-core/src/main/java/org/apache/openejb/injection/FallbackPropertyInjector.java index c886a92..8a176fd 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/injection/FallbackPropertyInjector.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/injection/FallbackPropertyInjector.java @@ -1,24 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.openejb.injection; - -import org.apache.openejb.Injection; - -public interface FallbackPropertyInjector { - Object getValue(final Injection prefix); -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.openejb.injection; + +import org.apache.openejb.Injection; + +public interface FallbackPropertyInjector { + Object getValue(final Injection prefix); +}