code contribution from git://git.springsource.org/virgo/system-verification-tests.git commit b7eeb1b8f01e39304e27d8e8d9521b8e9d8c744f
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cf9bfe8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+target
+integration-repo
+ivy-cache
+spring-build/lib/findbugs
diff --git a/build-svt/build.xml b/build-svt/build.xml
new file mode 100644
index 0000000..ca917b2
--- /dev/null
+++ b/build-svt/build.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="build-svt" default="precommit">
+
+ <path id="bundles"/>
+
+ <property file="${basedir}/../build.properties"/>
+ <property file="${basedir}/../build.versions"/>
+ <import file="${basedir}/../virgo-build/multi-bundle/default.xml"/>
+
+ <target name="svt-test" description="Runs svt tests on the packaged build">
+ <path id="svt.test.bundles">
+ <pathelement location="${basedir}/../org.eclipse.virgo.server.svt" />
+ </path>
+
+ <path id="download.bundles">
+ <pathelement location="${basedir}/../org.eclipse.virgo.server.svt" />
+ <pathelement location="${basedir}/../org.eclipse.virgo.server.svt.cleanstart" />
+ </path>
+
+ <all-bundles target="download" buildpathRef="download.bundles"/>
+
+ <antcall target="test.pre"/>
+
+ <all-bundles target="test-package" buildpathRef="svt.test.bundles">
+ <property name="package.output.file" value="${package.output.file}"/>
+ <property name="package.basename" value="${package.basename}"/>
+ <property name="test-results.output.dir" value="${test-results.output.dir}"/>
+ </all-bundles>
+
+ <antcall target="test.post"/>
+ </target>
+
+</project>
diff --git a/build-svt/test-package.xml b/build-svt/test-package.xml
new file mode 100644
index 0000000..482e2ab
--- /dev/null
+++ b/build-svt/test-package.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="test-package">
+
+ <property name="test.staging.dir" value="${target.dir}/test-expanded"/>
+ <property name="test.package.dir" value="${test.staging.dir}/virgo-tomcat-server"/>
+ <property name="pickup.dir" value="${test.package.dir}/pickup"/>
+ <property name="usr.dir" value="${test.package.dir}/repository/usr"/>
+ <property name="cleanstart.test.dir" value="${basedir}/../org.eclipse.virgo.server.svt.cleanstart/src/test/resources"/>
+ <property name="cleanstart.test.package.dir" value="${cleanstart.test.dir}/virgo-tomcat-server"/>
+ <property name="cleanstart.test.package.dir1" value="${cleanstart.test.dir}/virgo-tomcat-server1"/>
+ <property name="cleanstart.test.package.dir2" value="${cleanstart.test.dir}/virgo-tomcat-server2"/>
+
+ <target name="test-package"
+ description="Runs a test on the packaged build">
+ <antcall target="unzip.package"/>
+ <antcall target="startup.pre"/>
+ <antcall target="startup"/>
+ <antcall target="startup.post"/>
+ <antcall target="test.do"/>
+ <antcall target="shutdown.pre"/>
+ <antcall target="shutdown"/>
+ <antcall target="shutdown.post"/>
+ </target>
+
+ <target name="unzip.package">
+ <delete dir="${test.staging.dir}" quiet="true"/>
+ <mkdir dir="${test.staging.dir}"/>
+ <unzip dest="${test.staging.dir}">
+ <fileset dir="${basedir}/../build-svt/target">
+ <include name="artifacts/virgo-tomcat-server-*.zip"/>
+ </fileset>
+ <regexpmapper from="(virgo-tomcat-server-[^/]*/)(.*)" to="virgo-tomcat-server/\2" />
+ </unzip>
+ <unzip dest="${cleanstart.test.dir}">
+ <fileset dir="${basedir}/../build-svt/target">
+ <include name="artifacts/virgo-tomcat-server-*.zip"/>
+ </fileset>
+ <regexpmapper from="(virgo-tomcat-server-[^/]*/)(.*)" to="virgo-tomcat-server/\2" />
+ </unzip>
+ <unzip dest="${cleanstart.test.dir}">
+ <fileset dir="${basedir}/../build-svt/target">
+ <include name="artifacts/virgo-tomcat-server-*.zip"/>
+ </fileset>
+ <regexpmapper from="(virgo-tomcat-server-[^/]*/)(.*)" to="virgo-tomcat-server1/\2" />
+ </unzip>
+ <unzip dest="${cleanstart.test.dir}">
+ <fileset dir="${basedir}/../build-svt/target">
+ <include name="artifacts/virgo-tomcat-server-*.zip"/>
+ </fileset>
+ <regexpmapper from="(virgo-tomcat-server-[^/]*/)(.*)" to="virgo-tomcat-server2/\2" />
+ </unzip>
+ <chmod perm="755">
+ <fileset dir="${test.package.dir}/bin">
+ <include name="*.sh"/>
+ </fileset>
+ <fileset dir="${cleanstart.test.package.dir}/bin">
+ <include name="*.sh"/>
+ </fileset>
+ <fileset dir="${cleanstart.test.package.dir1}/bin">
+ <include name="*.sh"/>
+ </fileset>
+ <fileset dir="${cleanstart.test.package.dir2}/bin">
+ <include name="*.sh"/>
+ </fileset>
+ </chmod>
+ </target>
+
+ <target name="startup.pre"/>
+
+ <target name="startup" depends="shutdown">
+ <echo message="Starting Up Virgo Web Server" />
+
+ <exec dir="${test.package.dir}" osfamily="unix" spawn="true" executable="bin/startup.sh"/>
+
+ <exec dir="${test.package.dir}" osfamily="windows" spawn="true" executable="cmd">
+ <arg line="/c bin\startup.bat" />
+ </exec>
+
+ <waitfor maxwait="5" maxwaitunit="minute" timeoutproperty="start.failed">
+ <http url="http://localhost:8080/"/>
+ </waitfor>
+ <fail if="start.failed" message="Virgo Web Server start up failed"/>
+ </target>
+
+ <target name="startup.clean" depends="shutdown">
+ <echo message="Clean Starting of Virgo Web Server" />
+
+ <exec dir="${test.package.dir}" osfamily="unix" spawn="true" executable="bin/startup.sh">
+ <arg line="-clean" />
+ </exec>
+
+ <exec dir="${test.package.dir}" osfamily="windows" spawn="true" executable="cmd">
+ <arg line="/c bin\startup.bat" />
+ <arg line="-clean" />
+ </exec>
+
+ <waitfor maxwait="5" maxwaitunit="minute" timeoutproperty="start.failed">
+ <http url="http://localhost:8080/"/>
+ </waitfor>
+ <fail if="start.failed" message="Virgo Web Server clean start up failed"/>
+ </target>
+
+ <target name="startup.post"/>
+
+ <target name="shutdown.pre"/>
+
+ <target name="shutdown">
+ <echo message="Shutting Down Virgo Web Server" />
+
+ <exec dir="${test.package.dir}" osfamily="unix" spawn="true" executable="bin/shutdown.sh">
+ <arg line="-immediate" />
+ </exec>
+ <exec dir="${test.package.dir}" osfamily="windows" spawn="true" executable="cmd">
+ <arg line="/c bin\shutdown.bat" />
+ <arg line="-immediate" />
+ </exec>
+
+ <waitfor maxwait="5" maxwaitunit="minute" timeoutproperty="shutdown.failed">
+ <not>
+ <http url="http://localhost:8080/"/>
+ </not>
+ </waitfor>
+ <fail if="shutdown.failed" message="Virgo Web Server shutdown failed"/>
+ </target>
+
+ <target name="shutdown.post"/>
+
+</project>
diff --git a/build.properties b/build.properties
index 317fe99..7f2f7c7 100644
--- a/build.properties
+++ b/build.properties
@@ -1 +1,20 @@
-version=3.0.0
\ No newline at end of file
+version=2.1.0
+release.type=integration
+javadoc.exclude.package.names=**/internal/**,**/internal
+ivy.cache.dir=${basedir}/../ivy-cache
+integration.repo.dir=${basedir}/../integration-repo
+# avoid memory leaks
+test.forkmode=perTest
+disable.bundlor=true
+source.version=1.5
+target.version=1.5
+findbugs.enforce=true
+clover.enforce=true
+clover.coverage=70%
+
+test.vm.args= -Xmx512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError
+#test.vm.args= -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
+
+project.name=Virgo Server
+natural.name=virgo-dm-server
+project.key=VWS
diff --git a/build.versions b/build.versions
new file mode 100644
index 0000000..0b6b576
--- /dev/null
+++ b/build.versions
@@ -0,0 +1,42 @@
+org.eclipse.virgo.kernel=2.1.0.D-20100420092714
+org.eclipse.virgo.medic=1.0.1.D-20100420092100
+org.eclipse.virgo.osgi=2.1.0.D-20100420091535
+org.eclipse.virgo.repository=2.1.0.D-20100420092424
+org.eclipse.virgo.apps.repository=2.1.0.D-20100420101047
+org.eclipse.virgo.web=2.1.0.D-20100420094714
+org.eclipse.virgo.util=2.1.0.D-20100420091708
+
+com.springsource.json=1.0.1.RELEASE
+com.dumbster=1.6.0
+javax.ejb=3.0.0
+javax.jms=1.1.0
+javax.portlet=2.0.0
+javax.servlet.jsp.jstl=1.1.2
+javax.servlet=2.5.0
+javax.transaction=1.1.0
+javax.xml.rpc=1.1.0
+net.sourceforge.jwebunit=2.2.0
+org.antlr=3.0.1
+org.aopalliance=1.0.0
+org.apache.commons.codec=1.3.0
+org.apache.commons.fileupload=1.2.0
+org.apache.commons.httpclient=3.1.0
+org.apache.commons.io=1.4.0
+org.apache.felix.log=1.0.0
+org.apache.log4j=1.2.15
+org.apache.taglibs=1.1.2
+org.aspectj=1.6.6.RELEASE
+org.eclipse.equinox.cm=1.0.0.v20080509-1800
+org.hibernate=3.2.6.ga
+org.hibernate.annotations=3.3.1.ga
+org.hibernate.annotations.common=3.3.0.ga
+org.hibernate.ejb=3.3.2.GA
+org.jboss.el=2.0.0.GA
+org.jboss.util=2.0.4.GA
+org.jgroups=2.5.1
+org.junit=4.5.0
+org.slf4j=1.5.10
+org.springframework.js=2.0.8.RELEASE
+org.springframework.osgi=1.2.1
+org.springframework=3.0.0.RELEASE
+
diff --git a/org.eclipse.virgo.server.svt.cleanstart/.classpath b/org.eclipse.virgo.server.svt.cleanstart/.classpath
new file mode 100644
index 0000000..4c61178
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/.classpath
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/SERVER_IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-1.5.10.jar" sourcepath="/SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-sources-1.5.10.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.regexp/com.springsource.org.apache.regexp/1.5.0/com.springsource.org.apache.regexp-1.5.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.regexp/com.springsource.org.apache.regexp/1.5.0/com.springsource.org.apache.regexp-sources-1.5.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.httpclient/3.1.0/com.springsource.org.apache.commons.httpclient-3.1.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.httpclient/3.1.0/com.springsource.org.apache.commons.httpclient-sources-3.1.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.w3.sac/com.springsource.org.w3c.css.sac/1.3.0/com.springsource.org.w3c.css.sac-1.3.0.jar" sourcepath="/SERVER_IVY_CACHE/org.w3.sac/com.springsource.org.w3c.css.sac/1.3.0/com.springsource.org.w3c.css.sac-sources-1.3.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.io/1.4.0/com.springsource.org.apache.commons.io-1.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.io/1.4.0/com.springsource.org.apache.commons.io-sources-1.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.lang/2.4.0/com.springsource.org.apache.commons.lang-2.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.lang/2.4.0/com.springsource.org.apache.commons.lang-sources-2.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1/com.springsource.org.apache.commons.collections-3.2.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1/com.springsource.org.apache.commons.collections-sources-3.2.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.cssparser/com.springsource.com.steadystate.css/0.9.5/com.springsource.com.steadystate.css-0.9.5.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.cssparser/com.springsource.com.steadystate.css/0.9.5/com.springsource.com.steadystate.css-sources-0.9.5.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.5.10/com.springsource.slf4j.nop-1.5.10.jar" sourcepath="/SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.5.10/com.springsource.slf4j.nop-sources-1.5.10.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.1.0.D-20100420091708/org.eclipse.virgo.util.io-2.1.0.D-20100420091708.jar" sourcepath="/SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.1.0.D-20100420091708/org.eclipse.virgo.util.io-sources-2.1.0.D-20100420091708.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-2.1.0.D-20100420091708.jar" sourcepath="/SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-sources-2.1.0.D-20100420091708.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.1.0.D-20100420092424/org.eclipse.virgo.repository-2.1.0.D-20100420092424.jar" sourcepath="/SERVER_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.1.0.D-20100420092424/org.eclipse.virgo.repository-sources-2.1.0.D-20100420092424.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.com.gargoylesoftware.htmlunit/2.6.0/com.springsource.com.gargoylesoftware.htmlunit-2.6.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.com.gargoylesoftware.htmlunit/2.6.0/com.springsource.com.gargoylesoftware.htmlunit-sources-2.6.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.net.sourceforge.htmlunit.corejs/2.6.0/com.springsource.net.sourceforge.htmlunit.corejs-2.6.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit/2.2.0/com.springsource.net.sourceforge.jwebunit-2.2.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit/2.2.0/com.springsource.net.sourceforge.jwebunit-sources-2.2.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit.htmlunit/2.2.0/com.springsource.net.sourceforge.jwebunit.htmlunit-2.2.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit.htmlunit/2.2.0/com.springsource.net.sourceforge.jwebunit.htmlunit-sources-2.2.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.nekohtml/com.springsource.org.cyberneko.html/1.9.13/com.springsource.org.cyberneko.html-1.9.13.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.nekohtml/com.springsource.org.cyberneko.html/1.9.13/com.springsource.org.cyberneko.html-sources-1.9.13.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xalan/2.7.1/com.springsource.org.apache.xalan-2.7.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xalan/2.7.1/com.springsource.org.apache.xalan-sources-2.7.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xml.serializer/2.7.1/com.springsource.org.apache.xml.serializer-2.7.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xml.serializer/2.7.1/com.springsource.org.apache.xml.serializer-sources-2.7.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.codec/1.4.0/com.springsource.org.apache.commons.codec-1.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.codec/1.4.0/com.springsource.org.apache.commons.codec-sources-1.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.xerces/com.springsource.org.apache.xerces/2.9.1/com.springsource.org.apache.xerces-2.9.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.xerces/com.springsource.org.apache.xerces/2.9.1/com.springsource.org.apache.xerces-sources-2.9.1.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/.project b/org.eclipse.virgo.server.svt.cleanstart/.project
new file mode 100644
index 0000000..4ef50fa
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.virgo.server.svt.cleanstart</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/build.xml b/org.eclipse.virgo.server.svt.cleanstart/build.xml
new file mode 100644
index 0000000..8f45f9f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/build.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.virgo.server.svt.cleanstart" xmlns:ivy="antlib:org.apache.ivy.ant">
+
+ <property name="ivy.cache.dir" value="${basedir}/../ivy-cache" />
+ <property name="integration.repo.dir" value="${basedir}/../integration-repo"/>
+ <property name="download.dir" value="${basedir}/target/bundles"/>
+
+ <property file="${basedir}/../build.properties"/>
+ <property file="${basedir}/../build.versions"/>
+ <import file="${basedir}/../virgo-build/standard/default.xml"/>
+
+ <target name="download" depends="ivy.init">
+ <delete dir="${download.dir}" quiet="true"/>
+ <mkdir dir="${download.dir}"/>
+
+ <ivy:resolve resolveId="download.deps" file="${basedir}/ivy.xml" transitive="false"/>
+ <ivy:retrieve resolveId="download.deps" pattern="${download.dir}/[artifact]-[revision].[ext]" conf="test" type="jar"/>
+ </target>
+
+ <target name="startup.clean.post">
+ <antcall target="test.do"/>
+ </target>
+
+</project>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/ivy.xml b/org.eclipse.virgo.server.svt.cleanstart/ivy.xml
new file mode 100644
index 0000000..6ac6535
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/ivy.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
+<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
+ version="1.3">
+
+ <info organisation="org.eclipse.virgo.svt" module="${ant.project.name}" />
+
+ <configurations>
+ <include file="${virgo.build.dir}/common/default-ivy-configurations.xml" />
+ </configurations>
+
+ <publications>
+ <artifact name="${ant.project.name}" />
+ <artifact name="${ant.project.name}-sources" type="src" ext="jar" />
+ </publications>
+
+ <dependencies>
+ <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="test->runtime" />
+ <dependency org="org.eclipse.virgo.repository" name="org.eclipse.virgo.repository" rev="${org.eclipse.virgo.repository}" conf="test->runtime"/>
+ <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime" />
+ <dependency org="net.sourceforge.jwebunit" name="com.springsource.net.sourceforge.jwebunit" rev="${net.sourceforge.jwebunit}" conf="test->runtime" />
+ <dependency org="net.sourceforge.jwebunit" name="com.springsource.net.sourceforge.jwebunit.htmlunit" rev="${net.sourceforge.jwebunit}" conf="test->runtime" />
+ <dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="test->runtime" />
+ <dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="runtime->runtime" />
+
+ <!-- Dependencies which cannot be checked in to Eclipse repositories because of their licenses, e.g. LGPL. -->
+ <dependency org="org.hibernate" name="com.springsource.org.hibernate" rev="${org.hibernate}" conf="test->runtime"/>
+
+ <exclude org="org.slf4j" module="com.springsource.slf4j.org.apache.log4j" />
+ </dependencies>
+
+</ivy-module>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java
new file mode 100644
index 0000000..74e8b13
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java
@@ -0,0 +1,436 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Properties;
+
+import net.sourceforge.jwebunit.html.Cell;
+import net.sourceforge.jwebunit.html.Row;
+import net.sourceforge.jwebunit.junit.WebTester;
+import net.sourceforge.jwebunit.util.TestContext;
+
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public abstract class AbstractWebTests {
+ protected static final String URL = "http://localhost:8080/admin/web/artifact/overview.htm";
+ protected static final String USER = "admin";
+ protected static final String PASSWORD = "springsource";
+
+ private static String pickupDir = null;
+ private static String usrDir = null;
+ private static String workDir = null;
+ private static String serviceabilityDir = null;
+ private static String repoPropertiesDir = null;
+ private static String versionFile = null;
+
+ private static String serverHomeDir = null;
+ private static String binDir = null;
+
+ private static Process process = null;
+ private static ProcessBuilder pb = null;
+ private static File startup = null;
+ private static File startupURI = null;
+ private static File shutdownURI = null;
+ private static String startupFileName = null;
+ private static File shutdown = null;
+ private static String shutdownFileName = null;
+ private static OperatingSystemMXBean os = ManagementFactory
+ .getOperatingSystemMXBean();
+ private static final String SPLASHURL = "http://localhost:8080/";
+
+ private final WebTester tester = new WebTester();
+
+ protected final TestContext getTestContext() {
+ return this.tester.getTestContext();
+ }
+
+ protected final WebTester getTester() {
+ return this.tester;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void assertTableContent(String tableId, Object[][] expectedRows) {
+ ArrayList<Row> actualRows = getTester().getTable(tableId).getRows();
+
+ boolean tableMatched = true;
+ for (Object[] expectedRow : expectedRows) {
+ Object bsn = expectedRow[0];
+ boolean rowMatched = false;
+ for (Row actualRow : actualRows) {
+ Cell[] cells = ((ArrayList<Cell>) actualRow.getCells())
+ .toArray(new Cell[actualRow.getCellCount()]);
+ if (bsn.equals(cells[0].getValue())) {
+ rowMatched = rowEqual(expectedRow, cells);
+ break;
+ }
+ }
+ tableMatched &= rowMatched;
+ }
+ assertTrue("Table did not match", tableMatched);
+ }
+
+ protected static void copyApplicationsToPickup(String pickupDir,
+ String appsDir, String[] applicationNames) throws IOException {
+ for (String applicationName : applicationNames) {
+ FileCopyUtils.copy(new File(appsDir, applicationName), new File(
+ pickupDir, applicationName));
+ }
+ }
+
+ protected static void copyDependentBundlesToUsrRepository(String usrDir,
+ String bundlesDir, String[] bundleNames) throws IOException {
+ for (String bundleName : bundleNames) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ usrDir, bundleName));
+ }
+ }
+
+ protected static void deleteApplicationsFromPickup(String pickupDir,
+ String[] applicationNames) throws IOException {
+ for (String applicationName : applicationNames) {
+ new File(pickupDir, applicationName).delete();
+ }
+ }
+
+ protected static String getPickupDir() throws IOException {
+ if (pickupDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ pickupDir = new File(candidate, "pickup")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return pickupDir;
+ }
+
+ protected static String getUsrDir() throws IOException {
+ if (usrDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ File repositoryDir = new File(mainDir, "repository")
+ .getCanonicalFile();
+ usrDir = new File(repositoryDir, "usr").getCanonicalPath();
+ }
+ }
+ }
+ return usrDir;
+ }
+
+ public static String getServerBinDir() throws IOException {
+ if (binDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ binDir = new File(candidate, "bin").getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return binDir;
+ }
+
+ protected static String getWorkDir() throws IOException {
+ if (workDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ workDir = new File(candidate, "work").getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return workDir;
+ }
+
+ protected static String getServiceabilityDir() throws IOException {
+ if (serviceabilityDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ serviceabilityDir = new File(candidate, "serviceability")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return serviceabilityDir;
+ }
+
+ protected static String getWatchedRepoDir() throws IOException {
+ File watchedRepoDir = null;
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ watchedRepoDir = new File(candidate, "watched-repo");
+ if (!watchedRepoDir.exists()) {
+ watchedRepoDir.mkdir();
+ }
+ }
+ }
+ return watchedRepoDir.getCanonicalPath();
+
+ }
+
+ protected static String getRepositoryPropertiesDir() throws IOException {
+ if (repoPropertiesDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File configDir = new File(candidate, "config");
+ if (configDir.isDirectory()) {
+ repoPropertiesDir = new File(configDir,
+ "repository.properties").getCanonicalPath();
+
+ }
+
+ }
+ }
+ }
+
+ return repoPropertiesDir;
+ }
+
+ protected static String getServerHomeDir() throws Exception {
+ if (serverHomeDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ serverHomeDir = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ }
+ }
+ }
+ return serverHomeDir;
+ }
+
+ protected static String getHostedRepoDir() throws IOException {
+
+ File hostedDir = null;
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ File repositoryDir = new File(mainDir, "repository")
+ .getCanonicalFile();
+
+ hostedDir = new File(repositoryDir, "hosted");
+ if (!hostedDir.exists()) {
+ hostedDir.mkdir();
+ }
+
+ }
+ }
+ return hostedDir.getCanonicalPath();
+
+ }
+
+ protected static String getConfigDir() throws IOException {
+ File configDir = null;
+ if (configDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ configDir = new File(candidate, "config");
+
+ }
+ }
+ }
+
+ return configDir.getCanonicalPath();
+ }
+
+ protected static String getServerVersion() throws IOException {
+
+ String version;
+ if (versionFile == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ versionFile = new File(candidate, "lib/.version")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+
+ Properties versions = new Properties();
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream(versionFile);
+ versions.load(stream);
+ version = versions.getProperty("dm.server.version");
+ stream.close();
+ } catch (IOException e) {
+ version = "Unknown";
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (IOException e1) {
+
+ }
+ }
+ return version;
+ }
+
+ private boolean rowEqual(Object[] expected, Cell[] actual) {
+ if (expected.length != actual.length) {
+ return false;
+ }
+
+ for (int i = 0; i < expected.length; i++) {
+ if (!expected[i].equals(actual[i].getValue())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String getOperatingSystem() {
+ OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
+ return String.format("%s(%s) - %s", os.getName(), os.getArch(), os
+ .getVersion());
+ }
+
+ public String getJavaInfo() {
+ RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
+ return String.format("%s(%s) - %s", rt.getVmVendor(), rt.getVmName(),
+ rt.getVmVersion());
+ }
+
+ public static void startServer() {
+ new Thread(new StartUpThread()).start();
+ sleep();
+ UrlWaitLatch.waitFor(URL, USER, PASSWORD);
+ }
+
+ private static void sleep() {
+ try {
+ Thread.sleep(25000);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ public static void shutdownServer() {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully(SPLASHURL);
+ }
+
+ private static class StartUpThread implements Runnable {
+
+ public StartUpThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getServerBinDir(), "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+
+ } else {
+ startup = new File(getServerBinDir(), "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class ShutdownThread implements Runnable {
+
+ public ShutdownThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getServerBinDir(), "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getServerBinDir(), "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-immediate" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java
new file mode 100644
index 0000000..280d71b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt;
+
+import static org.junit.Assert.fail;
+
+import java.net.ConnectException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+public class UrlWaitLatch {
+ public static final long HALF_SECOND = 500;
+
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ public static void waitFor(String url) {
+ waitFor(url, HALF_SECOND, TWO_MINUTES);
+ }
+
+ public static void waitFor(String url, String username, String password) {
+ waitFor(url, username, password, HALF_SECOND, TWO_MINUTES);
+ }
+
+ public static void waitFor(String url, long interval, long duration) {
+ HttpClient client = new HttpClient();
+ wait(url, client, interval, duration);
+ }
+
+ public static void waitFor(String url, String username, String password,
+ long interval, long duration) {
+ HttpClient client = new HttpClient();
+ client.getParams().setAuthenticationPreemptive(true);
+ client.getState().setCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(username, password));
+ wait(url, client, interval, duration);
+ }
+
+ private static void wait(String url, HttpClient client, long interval,
+ long duration) {
+ HttpMethod get = new GetMethod(url);
+
+ try {
+ long startTime = System.currentTimeMillis();
+
+ int statusCode = 999;
+ while (System.currentTimeMillis() - startTime < duration) {
+ try {
+ statusCode = client.executeMethod(get);
+ if (statusCode < 400) {
+ return;
+ }
+ } catch (ConnectException e) {
+ // Swallow this and retry
+ }
+ Thread.sleep(interval);
+ }
+
+ fail(String.format("After %d ms, status code was %d", duration,
+ statusCode));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+ public static void waitForNotExistence(String url) {
+ HttpClient client = new HttpClient();
+ waitForNotExistence(url, client, 1000, 120000);
+ }
+
+ private static void waitForNotExistence(String url, HttpClient client,
+ long interval, long duration) {
+ HttpMethod get = new GetMethod(url);
+
+ try {
+ long startTime = System.currentTimeMillis();
+
+ int statusCode = 100;
+ while (System.currentTimeMillis() - startTime < duration) {
+ try {
+ statusCode = client.executeMethod(get);
+ if (statusCode > 400) {
+ return;
+ }
+ } catch (ConnectException e) {
+ // Swallow this and retry
+ }
+ Thread.sleep(interval);
+ }
+
+ fail(String.format("After %d ms, status code was %d", duration,
+ statusCode));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+ public static void waitForServerShutdownFully(String url) {
+ HttpClient client = new HttpClient();
+ waitForServerShutdownFully(url, client, HALF_SECOND, TWO_MINUTES);
+ }
+
+ private static void waitForServerShutdownFully(String url,
+ HttpClient client, long interval, long duration) {
+ HttpMethod get = new GetMethod(url);
+
+ try {
+ for (;;) {
+ try {
+ client.executeMethod(get);
+ Thread.sleep(interval);
+ } catch (ConnectException e) {
+ break;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/additional/DebugModeStartTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/additional/DebugModeStartTests.java
new file mode 100644
index 0000000..fb8757b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/additional/DebugModeStartTests.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.additional;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.util.Map;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+
+public class DebugModeStartTests extends AbstractWebTests {
+
+ private static Process process = null;
+ private static ProcessBuilder pb = null;
+ private static File startup = null;
+ private static File startupURI = null;
+ private static File shutdownURI = null;
+ private static String startupFileName = null;
+ private static File shutdown = null;
+ private static String shutdownFileName = null;
+ private static OperatingSystemMXBean os = ManagementFactory
+ .getOperatingSystemMXBean();
+ private static String jvmMsg;
+ private static final String SPLASHURL = "http://localhost:8080/";
+
+ @Test
+ public void testdmServerStartWithDefaultRemoteDebugPort()
+ throws InterruptedException {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully(SPLASHURL);
+ new Thread(new StartUpThread()).start();
+ UrlWaitLatch.waitFor(URL, USER, PASSWORD);
+ assertEquals("Listening for transport dt_socket at address: 8000",
+ jvmMsg);
+ }
+
+ @Test
+ public void testdmServerStartWithSpecificDebugPort()
+ throws InterruptedException {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully(SPLASHURL);
+ new Thread(new StartUpThreadWithSpecificDebugPort()).start();
+ UrlWaitLatch.waitFor(URL, USER, PASSWORD);
+ assertEquals("Listening for transport dt_socket at address: 8001",
+ jvmMsg);
+ }
+
+ @AfterClass
+ public static void tearDown() throws InterruptedException {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully(SPLASHURL);
+ }
+
+ private static class StartUpThread implements Runnable {
+
+ public StartUpThread() {
+
+ }
+
+ public void run() {
+ String[] msg = new String[100];
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getServerBinDir(), "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+
+ } else {
+ startup = new File(getServerBinDir(), "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-debug", "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+ process = pb.start();
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ for (int i = 0; i < msg.length; i++) {
+ if (line
+ .contentEquals("Listening for transport dt_socket at address: 8000")) {
+ jvmMsg = line;
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class StartUpThreadWithSpecificDebugPort implements Runnable {
+
+ public StartUpThreadWithSpecificDebugPort() {
+
+ }
+
+ public void run() {
+ String[] msg = new String[100];
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getServerBinDir(), "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+
+ } else {
+ startup = new File(getServerBinDir(), "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-debug", "8001",
+ "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+ process = pb.start();
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ for (int i = 0; i < msg.length; i++) {
+ if (line
+ .contentEquals("Listening for transport dt_socket at address: 8001")) {
+ jvmMsg = line;
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class ShutdownThread implements Runnable {
+
+ public ShutdownThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getServerBinDir(), "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getServerBinDir(), "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-immediate" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+ process = pb.start();
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfAdditionAndRemovalOfBundlesInTheRepositoryTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfAdditionAndRemovalOfBundlesInTheRepositoryTests.java
new file mode 100644
index 0000000..40831ad
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfAdditionAndRemovalOfBundlesInTheRepositoryTests.java
@@ -0,0 +1,298 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.cleanstart;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class VerificationOfAdditionAndRemovalOfBundlesInTheRepositoryTests
+ extends AbstractWebTests {
+
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ @BeforeClass
+ public static void startUp() {
+ shutdownServer();
+ startServer();
+ }
+
+ @AfterClass
+ public static void shutDown() {
+ shutdownServer();
+ }
+
+ @Test
+ public void testAddtionOfBundlesToTheExtRepository() throws Exception {
+ String repoName = (String) getMBeanServerConnection().getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=ext"),
+ "Name");
+ assertEquals("ext", repoName);
+ CompositeData[] object = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=ext"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object.length; i++) {
+ if ((object[i].get("name")
+ .equals("org.springframework.dmServer.testtool.incoho"))) {
+ assertEquals("org.springframework.dmServer.testtool.incoho",
+ object[i].get("name"));
+ assertEquals("1.0.0.RELEASE", object[i].get("version"));
+ assertEquals("bundle", object[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfBundlesToTheUsrRepository() throws Exception {
+ String repoName = (String) getMBeanServerConnection().getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=usr"),
+ "Name");
+ assertEquals("usr", repoName);
+ CompositeData[] object = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=usr"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object.length; i++) {
+ if ((object[i].get("name")
+ .equals("org.springframework.dmServer.testtool.incoho"))) {
+ assertEquals("org.springframework.dmServer.testtool.incoho",
+ object[i].get("name"));
+ assertEquals("1.0.0.RELEASE", object[i].get("version"));
+ assertEquals("bundle", object[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfLibrariesToTheExtRepository() throws Exception {
+ String repoName = (String) getMBeanServerConnection().getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=ext"),
+ "Name");
+ assertEquals("ext", repoName);
+ CompositeData[] object = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=ext"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object.length; i++) {
+ if ((object[i].get("name").equals("org.springframework.spring") && object[i]
+ .get("version").equals("2.5.4.A"))) {
+ assertEquals("org.springframework.spring", object[i]
+ .get("name"));
+ assertEquals("2.5.4.A", object[i].get("version").toString());
+ assertEquals("library", object[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfLibrariesToTheUsrRepository() throws Exception {
+ String repoName = (String) getMBeanServerConnection().getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=usr"),
+ "Name");
+ assertEquals("usr", repoName);
+ CompositeData[] object = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=usr"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object.length; i++) {
+ if ((object[i].get("name").equals("org.springframework.spring") && object[i]
+ .get("version").equals("2.5.4.A"))) {
+ assertEquals("org.springframework.spring", object[i]
+ .get("name"));
+ assertEquals("2.5.4.A", object[i].get("version").toString());
+ assertEquals("library", object[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfBundlesAndLibrariesToTheHostedRepository()
+ throws Exception {
+ String repoName = (String) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=hosted-repository"),
+ "Name");
+ assertEquals("hosted-repository", repoName);
+ CompositeData[] object1 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=hosted-repository"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object1.length; i++) {
+ if (object1[i].get("name")
+ .equals("org.springframework.petclinic.domain") && object1[i].get("version").equals("2.0.1.BUILD-20091126110002")) {
+ assertEquals("org.springframework.petclinic.domain", object1[i]
+ .get("name"));
+ assertEquals("2.0.1.BUILD-20091126110002", object1[i].get("version")
+ .toString());
+ assertEquals("bundle", object1[i].get("type"));
+ }
+ }
+
+ CompositeData[] object2 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=hosted-repository"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object2.length; i++) {
+ if ((object2[i].get("name").equals("org.springframework.spring"))) {
+ assertEquals("org.springframework.spring", object2[i]
+ .get("name"));
+ assertEquals("2.5.4.A", object2[i].get("version").toString());
+ assertEquals("library", object2[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfBundlesAndLibrariesToTheRemoteRepository()
+ throws Exception {
+ String repoName = (String) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=remote-repo"),
+ "Name");
+ assertEquals("remote-repo", repoName);
+ CompositeData[] object1 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=remote-repo"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object1.length; i++) {
+ if (object1[i].get("name")
+ .equals("org.springframework.petclinic.domain") && object1[i].get("version").equals("2.0.1.BUILD-20091126110002")){
+ assertEquals("org.springframework.petclinic.domain", object1[i]
+ .get("name"));
+ assertEquals("2.0.1.BUILD-20091126110002", object1[i].get("version")
+ .toString());
+ assertEquals("bundle", object1[i].get("type"));
+ }
+ }
+
+ CompositeData[] object2 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=remote-repo"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object2.length; i++) {
+ if ((object2[i].get("name").equals("org.springframework.spring"))) {
+ assertEquals("org.springframework.spring", object2[i]
+ .get("name"));
+ assertEquals("2.5.4.A", object2[i].get("version").toString());
+ assertEquals("library", object2[i].get("type"));
+ }
+ }
+ }
+
+ @Test
+ public void testAddtionOfBundlesAndLibrariesToTheWatchedRepository()
+ throws Exception {
+ String repoName = (String) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=watched-repo"),
+ "Name");
+ assertEquals("watched-repo", repoName);
+ CompositeData[] object1 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=watched-repo"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object1.length; i++) {
+ if ((object1[i].get("name")
+ .equals("org.springframework.petclinic.domain"))) {
+ assertEquals("org.springframework.petclinic.domain", object1[i]
+ .get("name"));
+ assertEquals("2.0.1.BUILD-20091126110002", object1[i].get("version")
+ .toString());
+ assertEquals("bundle", object1[i].get("type"));
+ }
+ }
+
+ CompositeData[] object2 = (CompositeData[]) getMBeanServerConnection()
+ .getAttribute(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:type=Repository,name=watched-repo"),
+ "AllArtifactDescriptorSummaries");
+
+ for (int i = 0; i < object2.length; i++) {
+ if ((object2[i].get("name").equals("org.springframework.spring"))) {
+ assertEquals("org.springframework.spring", object2[i]
+ .get("name"));
+ assertEquals("2.5.4.A", object2[i].get("version").toString());
+ assertEquals("library", object2[i].get("type"));
+ }
+ }
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfPreventionOfRedeploymentOfFormTagsAppDeployedThroughAdminConsoleAfterCleanStartTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfPreventionOfRedeploymentOfFormTagsAppDeployedThroughAdminConsoleAfterCleanStartTests.java
new file mode 100644
index 0000000..55a2ad6
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfPreventionOfRedeploymentOfFormTagsAppDeployedThroughAdminConsoleAfterCleanStartTests.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.cleanstart;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class VerificationOfPreventionOfRedeploymentOfFormTagsAppDeployedThroughAdminConsoleAfterCleanStartTests
+ extends AbstractWebTests {
+
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ @BeforeClass
+ public static void startUp() {
+ shutdownServer();
+ startServer();
+ }
+
+ @AfterClass
+ public static void shutDown() {
+ shutdownServer();
+ }
+
+ @Test
+ public void testPreventionOfArtifactsRedeploymentByCleanStart()
+ throws Exception {
+ waitForMBeanDeRegister("par", "formtags-par", "2.0.1.BUILD-20100413113234",
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/formtags-par");
+ assertArtifactNotExists("par", "formtags-par", "2.0.1.BUILD-20100413113234");
+
+ waitForMBeanDeRegister("bundle", "/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war",
+ "0.0.0", HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists("bundle", "formtags-war-2.0.1.BUILD-20100413113234.war",
+ "0.0.0");
+
+ waitForMBeanDeRegister("bundle",
+ "org.springframework.showcase.formtags_shared_libs",
+ "2.0.1.BUILD-20100413113234", HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists("bundle",
+ "org.springframework.showcase.formtags_shared_libs",
+ "2.0.1.BUILD-20100413113234");
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ private void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfRemovalOfWorkAndServiceabilityDirectoriesUponCleanStartTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfRemovalOfWorkAndServiceabilityDirectoriesUponCleanStartTests.java
new file mode 100644
index 0000000..c748e3a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/cleanstart/VerificationOfRemovalOfWorkAndServiceabilityDirectoriesUponCleanStartTests.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.cleanstart;
+
+import java.io.File;
+
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+
+
+public class VerificationOfRemovalOfWorkAndServiceabilityDirectoriesUponCleanStartTests
+ extends AbstractWebTests {
+
+ @Test
+ public void testRemovalOfWorkAndServiceabilityDir() throws Exception {
+
+ File file1 = new File(getWorkDir(), "temp.txt");
+ assertFalse("work dir is not cleaned up properly", file1.exists());
+ File file2= new File(getServiceabilityDir(), "temp.txt");
+ assertFalse("serviceability dir is not cleaned up properly", file2
+ .exists());
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/configadmin/ConfigAdminTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/configadmin/ConfigAdminTests.java
new file mode 100644
index 0000000..e2681ba
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/configadmin/ConfigAdminTests.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.configadmin;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class ConfigAdminTests extends AbstractWebTests {
+
+ private static final String APPS_DIR = "src/test/resources";
+ private static final String[] APPLICATION_NAMES = new String[] { "configadminservice.war" };
+
+ @BeforeClass
+ public static void startUp() {
+ shutdownServer();
+ startServer();
+ }
+
+ @AfterClass
+ public static void shutDown() {
+ shutdownServer();
+ }
+
+ @Test
+ public void testConfigAdminPersistedData() throws Exception {
+
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR, APPLICATION_NAMES);
+
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/configadminservice/list.htm");
+ getTester()
+ .beginAt("http://localhost:8080/configadminservice/list.htm");
+ getTester().assertTextPresent("spring");
+ getTester().assertTextPresent("source");
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/LocalHostedRepositoryTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/LocalHostedRepositoryTests.java
new file mode 100644
index 0000000..f194434
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/LocalHostedRepositoryTests.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.hostedrepo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+public class LocalHostedRepositoryTests extends AbstractWebTests {
+
+ private static final String APP_URI_PLAN = "./../test-apps/scopedplan.plan";
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ private static String artifactType = null;
+ private static String artifactName = null;
+ private static String artifactVersion = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @BeforeClass
+ public static void startUp() {
+ shutdownServer();
+ startServer();
+ }
+
+ @AfterClass
+ public static void shutDown() {
+ shutdownServer();
+ }
+
+ @Test
+ public void testPlanPickupDeployThatDependsUponArtifactsInLocalHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PLAN).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactExists(artifactType, artifactName,
+ artifactVersion);
+ assertPlanArtifactState(artifactType, artifactName,
+ artifactVersion, "ACTIVE");
+ }
+
+ @Test
+ public void testPlanPickupUnDeployThatDependsUponArtifactsInLocalHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName, artifactVersion };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactNotExists(artifactType, artifactName, artifactVersion);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertPlanArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Eclipselink plan artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Eclipselink plan artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactNotExists(String type,
+ String name, String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Eclipselink plan artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ private void waitForMBeanRegister(String type, String name, String version,
+ long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = false;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryOtherThan8080Tests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryOtherThan8080Tests.java
new file mode 100644
index 0000000..0859aab
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryOtherThan8080Tests.java
@@ -0,0 +1,884 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.hostedrepo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+import org.eclipse.virgo.util.io.FileSystemUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RemoteHostedRepositoryOtherThan8080Tests extends AbstractWebTests {
+
+ private static String serverHomeDir1 = null;
+ private static String usrDir1 = null;
+ private static String binDir1 = null;
+ private static String configDir1 = null;
+
+ private static String serverHomeDir2 = null;
+ private static String usrDir2 = null;
+ private static String binDir2 = null;
+ private static String configDir2 = null;
+ private static String pickupDir = null;
+ private static String hostedDir = null;
+
+ protected static final String HOSTED_REPO_SPLASHURL = "http://localhost:8084/";
+ protected static final String HOSTED_REPO_ADMINURL = "http://localhost:8084/admin";
+ protected static final String CLIENT_SPLASHURL = "http://localhost:8083/";
+ protected static final String CLEINT_ADMINURL = "http://localhost:8083/admin";
+
+ private static final String APP_URI_PLAN_UNSCOPED = "./../org.eclipse.virgo.server.svt/apps/helloworld_unscoped-1.0.0.RELEASE.plan";
+ private static final String APP_URI_SHAREDSERVICES_WAR1 = "./../org.eclipse.virgo.server.svt/apps/hello_war_shared_services.war";
+ private static final String APP_URI_SHAREDSERVICES_WAR2 = "./../org.eclipse.virgo.server.svt/apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war";
+ private static final String APP_URI_PAR = "./../org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par";
+ private static final String APP_URI_PLAN = "./../test-apps/scopedplan.plan";
+
+ private static final String resourcesDir1 = "./../org.eclipse.virgo.server.svt/bundles";
+ private static final String resourcesDir2 = "./../org.eclipse.virgo.server.svt/src/test/resources/bundles";
+ private static final String downloadDir = "target/bundles";
+
+ private static String[] bundleNames1 = new String[] {
+ "com.springsource.org.antlr-3.0.1.jar",
+ "com.springsource.javassist-3.9.0.GA.jar",
+ "com.springsource.net.sf.cglib-2.2.0.jar",
+ "com.springsource.org.apache.commons.collections-3.2.1.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.logging-1.1.1.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.dom4j-1.6.1.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.hsqldb-1.8.0.9.jar",
+ "com.springsource.org.objectweb.asm-1.5.3.jar",
+ "com.springsource.org.objectweb.asm.attrs-1.5.3.jar" };
+
+ private static String[] downloadBundleNames1 = new String[] {
+ "com.springsource.org.hibernate-3.2.6.ga.jar" };
+
+ private static String[] bundleNames2 = new String[] {
+ "formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar",
+ "com.springsource.freemarker-2.3.15.jar",
+ "com.springsource.javax.persistence-1.0.0.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.h2-1.0.71.jar", "hello.domain.jar",
+ "hello.service.api.jar", "hello.service.impl-en.jar",
+ "bundleA.jar", "bundleB.war", "foo.properties" };
+
+ private static Process process = null;
+ private static ProcessBuilder pb = null;
+ private static File startup = null;
+ private static File startupURI = null;
+ private static File shutdownURI = null;
+ private static String startupFileName = null;
+ private static File shutdown = null;
+ private static String shutdownFileName = null;
+ private static OperatingSystemMXBean os = ManagementFactory
+ .getOperatingSystemMXBean();
+
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:4444/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ private static String artifactType1 = null;
+ private static String artifactName1 = null;
+ private static String artifactVersion1 = null;
+
+ private static String artifactType4 = null;
+ private static String artifactName4 = null;
+ private static String artifactVersion4 = null;
+
+ private static String artifactType5 = null;
+ private static String artifactName5 = null;
+ private static String artifactVersion5 = null;
+
+ private static String artifactType6 = null;
+ private static String artifactName6 = null;
+ private static String artifactVersion6 = null;
+
+ private static String artifactType7 = null;
+ private static String artifactName7 = null;
+ private static String artifactVersion7 = null;
+
+ @BeforeClass
+ public static void testSetUp() throws IOException, Exception {
+ FileCopyUtils.copy(new File("src/test/resources/tomcat-server1.xml"),
+ new File(getConfiguredRemoteServerConfigDir1(),
+ "tomcat-server.xml"));
+ new File(getConfiguredRemoteServerConfigDir1(), "tomcat-server1.xml")
+ .renameTo(new File(getConfiguredRemoteServerConfigDir1(),
+ "tomcat-server.xml"));
+ FileCopyUtils.copy(new File(
+ "src/test/resources/org.eclipse.virgo.kernel4.properties"),
+ new File(getConfiguredRemoteServerConfigDir1(),
+ "org.eclipse.virgo.kernel.properties"));
+ new File(getConfiguredRemoteServerConfigDir1(),
+ "org.eclipse.virgo.kernel4.properties").renameTo(new File(
+ getConfiguredRemoteServerConfigDir1(),
+ "org.eclipse.virgo.kernel.properties"));
+ copyBundlesToHostedRepository(getConfiguredRemoteServerHostedBundlesDir());
+ new Thread(new StartUpThread1()).start();
+ Thread.sleep(5000);
+ UrlWaitLatch.waitFor(HOSTED_REPO_SPLASHURL);
+
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredRemoteServerBundlesUsrDir2()));
+ new File(getConfiguredRemoteServerBundlesUsrDir2()).mkdir();
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.apps.repository.properties"));
+ FileCopyUtils.copy(new File(
+ "src/test/resources/org.eclipse.virgo.repository1.properties"),
+ new File(getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.repository.properties"));
+ new File(getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.repository1.properties").renameTo(new File(
+ getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.repository.properties"));
+ copyDependentBundlesToRepository(getConfiguredRemoteServerBundlesUsrDir2());
+ FileCopyUtils.copy(new File("src/test/resources/tomcat-server2.xml"),
+ new File(getConfiguredRemoteServerConfigDir2(),
+ "tomcat-server.xml"));
+ new File(getConfiguredRemoteServerConfigDir2(), "tomcat-server2.xml")
+ .renameTo(new File(getConfiguredRemoteServerConfigDir2(),
+ "tomcat-server.xml"));
+ FileCopyUtils.copy(new File(
+ "src/test/resources/org.eclipse.virgo.kernel5.properties"),
+ new File(getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.kernel.properties"));
+ new File(getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.kernel5.properties").renameTo(new File(
+ getConfiguredRemoteServerConfigDir2(),
+ "org.eclipse.virgo.kernel.properties"));
+ new Thread(new StartUpThread2()).start();
+ Thread.sleep(5000);
+ UrlWaitLatch.waitFor(CLIENT_SPLASHURL);
+ }
+
+ protected static String getConfiguredRemoteServerHomeDir1()
+ throws Exception {
+ if (serverHomeDir1 == null) {
+ File testExpanded = new File("src/test/resources");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("virgo-web-server1")) {
+ serverHomeDir1 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return serverHomeDir1;
+ }
+
+ protected static String getConfiguredRemoteServerHomeDir2()
+ throws Exception {
+ if (serverHomeDir2 == null) {
+ File testExpanded = new File("src/test/resources");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("virgo-web-server2")) {
+ serverHomeDir2 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return serverHomeDir2;
+ }
+
+ protected static String getConfiguredRemoteServerPickupDir()
+ throws Exception {
+ if (pickupDir == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir2());
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("pickup")) {
+ pickupDir = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return pickupDir;
+ }
+
+ public static String getConfiguredRemoteServerBinDir1() throws Exception {
+ if (binDir1 == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir1());
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("bin")) {
+ binDir1 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return binDir1;
+ }
+
+ public static String getConfiguredRemoteServerConfigDir1() throws Exception {
+ if (configDir1 == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir1());
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("config")) {
+ configDir1 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return configDir1;
+ }
+
+ public static String getConfiguredRemoteServerConfigDir2() throws Exception {
+ if (configDir2 == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir2());
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("config")) {
+ configDir2 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return configDir2;
+ }
+
+ public static String getConfiguredRemoteServerBinDir2() throws Exception {
+ if (binDir2 == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir2());
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("bin")) {
+ binDir2 = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return binDir2;
+ }
+
+ public static void copyFile(File source, File dest) throws IOException {
+ if (!dest.exists()) {
+ dest.createNewFile();
+ }
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = new FileInputStream(source);
+ out = new FileOutputStream(dest);
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ }
+
+ finally {
+ in.close();
+ out.close();
+ }
+ }
+
+ protected static String getConfiguredRemoteServerBundlesUsrDir1()
+ throws Exception {
+ if (usrDir1 == null) {
+ File serverHomeDir = new File(getConfiguredRemoteServerHomeDir1());
+ if (serverHomeDir.isDirectory()) {
+ File repositoryDir = new File(serverHomeDir, "repository")
+ .getCanonicalFile();
+ usrDir1 = new File(repositoryDir, "usr").getCanonicalPath();
+ }
+ }
+
+ return usrDir1;
+ }
+
+ protected static String getConfiguredRemoteServerBundlesUsrDir2()
+ throws Exception {
+ if (usrDir2 == null) {
+ File serverHomeDir = new File(getConfiguredRemoteServerHomeDir2());
+ if (serverHomeDir.isDirectory()) {
+ File repositoryDir = new File(serverHomeDir, "repository")
+ .getCanonicalFile();
+ usrDir2 = new File(repositoryDir, "usr").getCanonicalPath();
+ }
+ }
+
+ return usrDir2;
+ }
+
+ protected static String getConfiguredRemoteServerHostedBundlesDir()
+ throws Exception {
+ if (hostedDir == null) {
+ File testExpanded = new File(getConfiguredRemoteServerHomeDir1());
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()
+ && mainDir.getName().equals("repository")) {
+ new File(mainDir, "hosted").mkdir();
+ hostedDir = new File(mainDir, "hosted").getCanonicalPath();
+ break;
+ }
+ }
+ }
+
+ return hostedDir;
+ }
+
+ protected static void copyDependentBundlesToRepository(String bundlesUsrDir)
+ throws Exception {
+
+ for (String bundleName : bundleNames1) {
+
+ FileCopyUtils.copy(new File(resourcesDir1, bundleName), new File(
+ bundlesUsrDir, bundleName));
+ }
+
+ for (String bundleName : downloadBundleNames1) {
+
+ FileCopyUtils.copy(new File(downloadDir, bundleName), new File(
+ bundlesUsrDir, bundleName));
+ }
+ }
+
+ protected static void copyBundlesToHostedRepository(String bundlesUsrDir)
+ throws Exception {
+
+ for (String bundleName : bundleNames2) {
+
+ FileCopyUtils.copy(new File(resourcesDir2, bundleName), new File(
+ bundlesUsrDir, bundleName));
+ }
+ }
+
+ @Test
+ public void testScopedPlanArtifactDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PLAN).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName1 = compositeData.get("symbolicName").toString();
+ artifactType1 = compositeData.get("type").toString();
+ artifactVersion1 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType1, artifactName1, artifactVersion1);
+ waitForArtifactState("plan", "scoped.plan", "1.0.0", "ACTIVE",
+ HALF_SECOND, TWO_MINUTES);
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType1, artifactName1,
+ artifactVersion1), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertPlanReferencedArtifacts(objectName);
+ }
+ assertArtifactState(artifactType1, artifactName1, artifactVersion1,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testScopedPlanArtifactUndeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName1, artifactVersion1 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists(artifactType1, artifactName1, artifactVersion1);
+ }
+
+ @Test
+ public void testUnscopedPlanThatDependsUponArtifactsInRemoteHostedRepo()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PLAN_UNSCOPED).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName4 = compositeData.get("symbolicName").toString();
+ artifactType4 = compositeData.get("type").toString();
+ artifactVersion4 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType4, artifactName4, artifactVersion4,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType4, artifactName4, artifactVersion4);
+ assertArtifactState(artifactType4, artifactName4, artifactVersion4,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testDeploymentOfSharedServicesWarDependsOnArtfiactsInUnscopedPlan()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHAREDSERVICES_WAR1).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName5 = compositeData.get("symbolicName").toString();
+ artifactType5 = compositeData.get("type").toString();
+ artifactVersion5 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8083/hello_war_shared_services/");
+ assertArtifactExists(artifactType5, artifactName5, artifactVersion5);
+ assertArtifactState(artifactType5, artifactName5, artifactVersion5,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testUnDeploymentOfSharedServicesWarDependsOnArtfiactsInUnscopedPlan()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName5, artifactVersion5 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8083/hello_war_shared_services");
+ assertArtifactNotExists(artifactType5, artifactName5, artifactVersion5);
+ }
+
+ @Test
+ public void testSharedServicesWarDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHAREDSERVICES_WAR2).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName6 = compositeData.get("symbolicName").toString();
+ artifactType6 = compositeData.get("type").toString();
+ artifactVersion6 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType6, artifactName6, artifactVersion6,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8083/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8083/formtags-shared-services-war-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8083/formtags-shared-services-war-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType6, artifactName6, artifactVersion6);
+ assertArtifactState(artifactType6, artifactName6, artifactVersion6,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testSharedServicesWarUnDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName6, artifactVersion6 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType6, artifactName6, artifactVersion6,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8083/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists(artifactType6, artifactName6, artifactVersion6);
+ }
+
+ @Test
+ public void testParDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PAR).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName7 = compositeData.get("symbolicName").toString();
+ artifactType7 = compositeData.get("type").toString();
+ artifactVersion7 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType7, artifactName7, artifactVersion7,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType7, artifactName7, artifactVersion7);
+ UrlWaitLatch.waitFor("http://localhost:8083/greenpages/app/home.htm");
+ assertArtifactState(artifactType7, artifactName7, artifactVersion7,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testParUnDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName7, artifactVersion7 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType7, artifactName7, artifactVersion7,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8083/greenpages");
+ assertArtifactNotExists(artifactType7, artifactName7, artifactVersion7);
+ }
+
+ @AfterClass
+ public static void shutdownRemoteInstance() throws Exception {
+ new Thread(new ShutdownThread1()).start();
+ UrlWaitLatch.waitForServerShutdownFully(HOSTED_REPO_SPLASHURL);
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredRemoteServerHomeDir1()));
+ new Thread(new ShutdownThread2()).start();
+ UrlWaitLatch.waitForServerShutdownFully(CLIENT_SPLASHURL);
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredRemoteServerHomeDir2()));
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File("src/test/resources");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()
+ && mainDir.getName().equals("virgo-web-server2")) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ private void waitForMBeanRegister(String type, String name, String version,
+ long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = false;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForArtifactState(String type, String name, String version,
+ String state, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ String artifactstate = null;
+ while (System.currentTimeMillis() - startTime < duration) {
+ artifactstate = getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "State").toString();
+ if (artifactstate.equals(state)) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String
+ .format("After %d ms, artifact %s state was", duration, name)
+ + artifactstate);
+ }
+
+ private static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanReferencedArtifacts(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertTrue("plan referenced artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format(
+ "plan referenced artifact is not in state %s", "ACTIVE"),
+ "ACTIVE", getMBeanServerConnection().getAttribute(objectName,
+ "State"));
+ }
+
+ private static class StartUpThread1 implements Runnable {
+ public StartUpThread1() {
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getConfiguredRemoteServerBinDir1(),
+ "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+
+ } else {
+ startup = new File(getConfiguredRemoteServerBinDir1(),
+ "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-jmxport", "3333",
+ "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class StartUpThread2 implements Runnable {
+ public StartUpThread2() {
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getConfiguredRemoteServerBinDir2(),
+ "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+
+ } else {
+ startup = new File(getConfiguredRemoteServerBinDir2(),
+ "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-jmxport", "4444",
+ "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class ShutdownThread1 implements Runnable {
+ public ShutdownThread1() {
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getConfiguredRemoteServerBinDir1(),
+ "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getConfiguredRemoteServerBinDir1(),
+ "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-jmxport", "3333",
+ "-immediate" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ private static class ShutdownThread2 implements Runnable {
+ public ShutdownThread2() {
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getConfiguredRemoteServerBinDir2(),
+ "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getConfiguredRemoteServerBinDir2(),
+ "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-jmxport", "4444",
+ "-immediate" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryTests.java
new file mode 100644
index 0000000..3a8d32e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/hostedrepo/RemoteHostedRepositoryTests.java
@@ -0,0 +1,665 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.hostedrepo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+import org.eclipse.virgo.util.io.FileSystemUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+
+public class RemoteHostedRepositoryTests extends AbstractWebTests {
+
+ private static String serverHomeDir = null;
+ private static String usrDir = null;
+ private static String binDir = null;
+ private static String configDir = null;
+
+ protected static final String SPLASHURL = "http://localhost:8081/";
+ protected static final String ADMINURL = "http://localhost:8081/admin";
+
+ private static final String APP_URI_SHAREDSERVICES_WAR1 = "./../org.eclipse.virgo.server.svt/apps/hello_war_shared_services.war";
+ private static final String APP_URI_PAR = "./../org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par";
+ private static final String APP_URI_UNSCOPED_PLAN = "./../org.eclipse.virgo.server.svt/apps/helloworld_unscoped-1.0.0.RELEASE.plan";
+ private static final String APP_URI_PLAN1 = "./../test-apps/scopedplan.plan";
+ private static final String APP_URI_PLAN2 = "src/test/resources/parreferencedplan.plan";
+
+ private static final String resourcesDir = "./../org.eclipse.virgo.server.svt/bundles";
+ private static final String downloadDir = "target/bundles";
+
+ private static String[] bundleNames = new String[] {
+ "com.springsource.org.antlr-3.0.1.jar",
+ "com.springsource.javassist-3.9.0.GA.jar",
+ "com.springsource.net.sf.cglib-2.2.0.jar",
+ "com.springsource.org.apache.commons.collections-3.2.1.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.logging-1.1.1.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.dom4j-1.6.1.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.hsqldb-1.8.0.9.jar",
+ "com.springsource.org.objectweb.asm-1.5.3.jar",
+ "com.springsource.org.objectweb.asm.attrs-1.5.3.jar" };
+
+ private static String[] downloadBundleNames = new String[] {
+ "com.springsource.org.hibernate-3.2.6.ga.jar" };
+
+ private static Process process = null;
+ private static ProcessBuilder pb = null;
+ private static File startup = null;
+ private static File startupURI = null;
+ private static File shutdownURI = null;
+ private static String startupFileName = null;
+ private static File shutdown = null;
+ private static String shutdownFileName = null;
+ private static OperatingSystemMXBean os = ManagementFactory
+ .getOperatingSystemMXBean();
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:3333/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ private static String artifactType1 = null;
+ private static String artifactName1 = null;
+ private static String artifactVersion1 = null;
+
+ private static String artifactType3 = null;
+ private static String artifactName3 = null;
+ private static String artifactVersion3 = null;
+
+ private static String artifactType4 = null;
+ private static String artifactName4 = null;
+ private static String artifactVersion4 = null;
+
+ private static String artifactType5 = null;
+ private static String artifactName5 = null;
+ private static String artifactVersion5 = null;
+
+
+ private static String artifactType7 = null;
+ private static String artifactName7 = null;
+ private static String artifactVersion7 = null;
+
+ private static String artifactType8 = null;
+ private static String artifactName8 = null;
+ private static String artifactVersion8 = null;
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @BeforeClass
+ public static void testSetUp() throws IOException, Exception {
+ startServer();
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredServerConfigDir(),
+ "org.eclipse.virgo.apps.repository.properties"));
+ FileSystemUtils.deleteRecursively(new File(
+ getConfiguredServerRepositoryUsrDir()));
+ new File(getConfiguredServerRepositoryUsrDir()).mkdir();
+ FileCopyUtils.copy(new File(
+ "src/test/resources/org.eclipse.virgo.repository.properties"),
+ new File(getConfiguredServerConfigDir(),
+ "org.eclipse.virgo.repository.properties"));
+ FileCopyUtils.copy(new File("src/test/resources/tomcat-server.xml"),
+ new File(getConfiguredServerConfigDir(), "tomcat-server.xml"));
+ FileCopyUtils.copy(new File(
+ "src/test/resources/org.eclipse.virgo.kernel3.properties"),
+ new File(getConfiguredServerConfigDir(),
+ "org.eclipse.virgo.kernel.properties"));
+ new File(getConfiguredServerConfigDir(),
+ "org.eclipse.virgo.kernel3.properties").renameTo(new File(
+ getConfiguredServerConfigDir(),
+ "org.eclipse.virgo.kernel.properties"));
+ copyDependentBundlesToRepository(getConfiguredServerRepositoryUsrDir());
+ new Thread(new StartUpThread()).start();
+ UrlWaitLatch.waitFor(SPLASHURL);
+ }
+
+ private static String getConfiguredServerHomeDir() throws Exception {
+ if (serverHomeDir == null) {
+ File testExpanded = new File("src/test/resources");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()
+ && candidate.getName().equals("virgo-web-server")) {
+ serverHomeDir = new File(candidate.getCanonicalPath())
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return serverHomeDir;
+ }
+
+ private static String getConfiguredServerConfigDir() throws Exception {
+ if (configDir == null) {
+ File serverHomeDir = new File(getConfiguredServerHomeDir());
+ if (serverHomeDir.isDirectory()) {
+ configDir = new File(serverHomeDir, "config")
+ .getCanonicalPath();
+ }
+ }
+ return configDir;
+ }
+
+ private static String getConfiguredServerBinDir() throws Exception {
+ if (binDir == null) {
+ File serverHomeDir = new File(getConfiguredServerHomeDir());
+ if (serverHomeDir.isDirectory()) {
+ binDir = new File(serverHomeDir, "bin").getCanonicalPath();
+ }
+ }
+ return binDir;
+ }
+
+ public static void copyFile(File source, File dest) throws IOException {
+ if (!dest.exists()) {
+ dest.createNewFile();
+ }
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = new FileInputStream(source);
+ out = new FileOutputStream(dest);
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ }
+
+ finally {
+ in.close();
+ out.close();
+ }
+ }
+
+ protected static String getConfiguredServerRepositoryUsrDir()
+ throws Exception {
+ if (usrDir == null) {
+ File serverHomeDir = new File(getConfiguredServerHomeDir());
+ if (serverHomeDir.isDirectory()) {
+ File repositoryDir = new File(serverHomeDir, "repository")
+ .getCanonicalFile();
+ usrDir = new File(repositoryDir, "usr").getCanonicalPath();
+ }
+ }
+
+ return usrDir;
+ }
+
+ protected static void copyDependentBundlesToRepository(String bundlesUsrDir)
+ throws Exception {
+
+ for (String bundleName : bundleNames) {
+
+ FileCopyUtils.copy(new File(resourcesDir, bundleName), new File(
+ bundlesUsrDir, bundleName));
+ }
+
+ for (String bundleName : downloadBundleNames) {
+
+ FileCopyUtils.copy(new File(downloadDir, bundleName), new File(
+ bundlesUsrDir, bundleName));
+ }
+ }
+
+
+ @Test
+ public void testPlanArtifactDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PLAN1).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName1 = compositeData.get("symbolicName").toString();
+ artifactType1 = compositeData.get("type").toString();
+ artifactVersion1 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType1, artifactName1, artifactVersion1);
+ waitForArtifactState("plan", "scoped.plan", "1.0.0", "ACTIVE",
+ HALF_SECOND, TWO_MINUTES);
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType1, artifactName1,
+ artifactVersion1), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertPlanReferencedArtifacts(objectName);
+ }
+ assertArtifactState(artifactType1, artifactName1, artifactVersion1,
+ "ACTIVE");
+ }
+
+
+ @Test
+ public void testPlanArtifactUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName1, artifactVersion1 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists(artifactType1, artifactName1, artifactVersion1);
+ }
+
+ @Ignore
+ @Test
+ public void planDeployReferencesParArtifactFromRemoteRepository() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PLAN2).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName8 = compositeData.get("symbolicName").toString();
+ artifactType8 = compositeData.get("type").toString();
+ artifactVersion8 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType8, artifactName8, artifactVersion8, HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType8, artifactName8, artifactVersion8);
+ assertArtifactState(artifactType8, artifactName8, artifactVersion8, "ACTIVE");
+ }
+
+ @Ignore
+ @Test
+ public void planUnDeployReferencesParArtifactFromRemoteRepository() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName8, artifactVersion8 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType8, artifactName8, artifactVersion8, HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists(artifactType8, artifactName8, artifactVersion8);
+ }
+
+
+
+ @Test
+ public void testUnscopedPlanDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_UNSCOPED_PLAN).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName3 = compositeData.get("symbolicName").toString();
+ artifactType3 = compositeData.get("type").toString();
+ artifactVersion3 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType3, artifactName3, artifactVersion3,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType3, artifactName3, artifactVersion3);
+ assertArtifactState(artifactType3, artifactName3, artifactVersion3,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testUnscopedPlanUnDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName3, artifactVersion3 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType3, artifactName3, artifactVersion3,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists(artifactType3, artifactName3, artifactVersion3);
+ }
+
+ @Test
+ public void testJmxDeploymentOfUnscopedPlanThatDependsUponArtifactsInRemoteHostedRepo()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_UNSCOPED_PLAN).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName4 = compositeData.get("symbolicName").toString();
+ artifactType4 = compositeData.get("type").toString();
+ artifactVersion4 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType4, artifactName4, artifactVersion4,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType4, artifactName4, artifactVersion4);
+ assertArtifactState(artifactType4, artifactName4, artifactVersion4,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testDeploymentOfSharedServicesWarDependsOnArtfiactsInUnscopedPlan()
+ throws IOException, Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHAREDSERVICES_WAR1).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName5 = compositeData.get("symbolicName").toString();
+ artifactType5 = compositeData.get("type").toString();
+ artifactVersion5 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8081/hello_war_shared_services/");
+ assertArtifactExists(artifactType5, artifactName5, artifactVersion5);
+ assertArtifactState(artifactType5, artifactName5, artifactVersion5,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testUnDeploymentOfSharedServicesWarDependsOnArtfiactsInUnscopedPlan()
+ throws ElementNotFoundException, Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName5, artifactVersion5 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8081/hello_war_shared_services");
+ assertArtifactNotExists(artifactType5, artifactName5, artifactVersion5);
+ }
+
+
+
+ @Test
+ public void testParDeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PAR).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName7 = compositeData.get("symbolicName").toString();
+ artifactType7 = compositeData.get("type").toString();
+ artifactVersion7 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType7, artifactName7, artifactVersion7,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType7, artifactName7, artifactVersion7);
+ UrlWaitLatch.waitFor("http://localhost:8081/greenpages/app/home.htm");
+ assertArtifactState(artifactType7, artifactName7, artifactVersion7,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testParUndeployThatDependsUponArtifactsInRemoteHostedRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName7, artifactVersion7 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType7, artifactName7, artifactVersion7,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8081/greenpages");
+ assertArtifactNotExists(artifactType7, artifactName7, artifactVersion7);
+ }
+
+ @AfterClass
+ public static void shutdownRemoteInstance() throws Exception {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully(SPLASHURL);
+ FileSystemUtils
+ .deleteRecursively(new File(getConfiguredServerHomeDir()));
+ shutdownServer();
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanReferencedArtifacts(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertTrue("plan referenced artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format(
+ "plan referenced artifact is not in state %s", "ACTIVE"),
+ "ACTIVE", getMBeanServerConnection().getAttribute(objectName,
+ "State"));
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File("src/test/resources");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()
+ && mainDir.getName().equals("virgo-web-server")) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ private void waitForMBeanRegister(String type, String name, String version,
+ long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = false;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForArtifactState(String type, String name, String version,
+ String state, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ String artifactstate = null;
+ while (System.currentTimeMillis() - startTime < duration) {
+ artifactstate = getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "State").toString();
+ if (artifactstate.equals(state)) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String
+ .format("After %d ms, artifact %s state was", duration, name)
+ + artifactstate);
+ }
+
+ private static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+
+ private static class StartUpThread implements Runnable {
+ public StartUpThread() {
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getConfiguredServerBinDir(),
+ "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ } else {
+ startup = new File(getConfiguredServerBinDir(),
+ "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-jmxport", "3333" ,"-clean"};
+ pb = new ProcessBuilder(args);
+ pb.redirectErrorStream(true);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class ShutdownThread implements Runnable {
+ public ShutdownThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getConfiguredServerBinDir(),
+ "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getConfiguredServerBinDir(),
+ "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-jmxport", "3333" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/watchrepo/WatchedRepositoryTests.java b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/watchrepo/WatchedRepositoryTests.java
new file mode 100644
index 0000000..923dfef
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/java/org/eclipse/virgo/server/svt/watchrepo/WatchedRepositoryTests.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.watchrepo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WatchedRepositoryTests extends AbstractWebTests {
+
+ private static String[] bundleNames = new String[] {
+ "formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar",
+ "com.springsource.freemarker-2.3.15.jar",
+ "com.springsource.javax.persistence-1.0.0.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.h2-1.0.71.jar"};
+ private static final String bundlesDir = "src/test/resources/bundles";
+
+ private static final String APP_URI_SHAREDSERVICES_WAR = "./../org.eclipse.virgo.server.svt/apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war";
+ private static final String APP_URI_PAR = "./../org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par";
+
+ private static Process process = null;
+ private static ProcessBuilder pb = null;
+ private static File startup = null;
+ private static String startupFileName = null;
+ private static File shutdown = null;
+ private static String shutdownFileName = null;
+ private static File startupURI = null;
+ private static File shutdownURI = null;
+ private static OperatingSystemMXBean os = ManagementFactory
+ .getOperatingSystemMXBean();
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ private static String artifactType1 = null;
+ private static String artifactName1 = null;
+ private static String artifactVersion1 = null;
+
+ private static String artifactType2 = null;
+ private static String artifactName2 = null;
+ private static String artifactVersion2 = null;
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @BeforeClass
+ public static void watchRepoSetUp() throws Exception {
+ addBundlesToWatchedRepository(getWatchedRepoDir());
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully("http://localhost:8080/");
+ new Thread(new StartUpThread()).start();
+ UrlWaitLatch.waitFor("http://localhost:8080/");
+ }
+
+ public static void addBundlesToWatchedRepository(String repoDir)
+ throws Exception {
+ for (String bundleName : bundleNames) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ repoDir, bundleName));
+ }
+
+ }
+
+ @Test
+ public void testSharedServicesWarDeployThatDependsUponArtifactsInWatchRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHAREDSERVICES_WAR).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName1 = compositeData.get("symbolicName").toString();
+ artifactType1 = compositeData.get("type").toString();
+ artifactVersion1 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType1, artifactName1, artifactVersion1);
+ assertArtifactState(artifactType1, artifactName1, artifactVersion1,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testSharedServicesWarUndeployThatDependsUponArtifactsInWatchRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName1, artifactVersion1 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists(artifactType1, artifactName1, artifactVersion1);
+ }
+
+ @Test
+ public void testParDeployThatDependsUponArtifactsInWatchRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PAR).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName2 = compositeData.get("symbolicName").toString();
+ artifactType2 = compositeData.get("type").toString();
+ artifactVersion2 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType2, artifactName2, artifactVersion2,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType2, artifactName2, artifactVersion2);
+ UrlWaitLatch.waitFor("http://localhost:8080/greenpages/app/home.htm");
+ assertArtifactState(artifactType2, artifactName2, artifactVersion2,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testParUndeployThatDependsUponArtifactsInWatchRepo()
+ throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName2, artifactVersion2 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType2, artifactName2, artifactVersion2,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/greenpages");
+ assertArtifactNotExists(artifactType2, artifactName2, artifactVersion2);
+ }
+
+
+ @AfterClass
+ public static void shutdownServerInstance() {
+ new Thread(new ShutdownThread()).start();
+ UrlWaitLatch.waitForServerShutdownFully("http://localhost:8080/");
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ private void waitForMBeanRegister(String type, String name, String version,
+ long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = false;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ private static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+
+ private static class StartUpThread implements Runnable {
+
+ public StartUpThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+ if (os.getName().contains("Windows")) {
+ startup = new File(getServerBinDir(), "startup.bat");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ } else {
+ startup = new File(getServerBinDir(), "startup.sh");
+ startupURI = new File(startup.toURI());
+ startupFileName = startupURI.getCanonicalPath();
+ }
+ args = new String[] { startupFileName, "-clean" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static class ShutdownThread implements Runnable {
+
+ public ShutdownThread() {
+
+ }
+
+ public void run() {
+ String[] args = null;
+ try {
+
+ if (os.getName().contains("Windows")) {
+ shutdown = new File(getServerBinDir(), "shutdown.bat");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ } else {
+ shutdown = new File(getServerBinDir(), "shutdown.sh");
+ shutdownURI = new File(shutdown.toURI());
+ shutdownFileName = shutdownURI.getCanonicalPath();
+ }
+ args = new String[] { shutdownFileName, "-immediate" };
+ pb = new ProcessBuilder(args);
+ Map<String, String> env = pb.environment();
+ env.put("JAVA_HOME", System.getProperty("java.home"));
+ pb.redirectErrorStream(true);
+
+ process = pb.start();
+
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar
new file mode 100644
index 0000000..9bf1020
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar
new file mode 100644
index 0000000..9fcc5ae
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
new file mode 100644
index 0000000..a8ef066
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
new file mode 100644
index 0000000..7e45c21
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
new file mode 100644
index 0000000..8a27959
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
new file mode 100644
index 0000000..31d1164
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
new file mode 100644
index 0000000..3b9a810
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
new file mode 100644
index 0000000..1508f97
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar
new file mode 100644
index 0000000..41dc982
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
new file mode 100644
index 0000000..5ed2f3b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/configadminservice.war b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/configadminservice.war
new file mode 100644
index 0000000..4593ad2
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/configadminservice.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/keystore b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/keystore
new file mode 100644
index 0000000..9684caa
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/keystore
Binary files differ
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel.properties
new file mode 100644
index 0000000..bbe21d0
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 0
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2401
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel1.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel1.properties
new file mode 100644
index 0000000..45c0023
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel1.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 90
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2401
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel2.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel2.properties
new file mode 100644
index 0000000..58dc8a4
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel2.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 1000
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2401
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel3.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel3.properties
new file mode 100644
index 0000000..742febc
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel3.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 300
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2402
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel4.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel4.properties
new file mode 100644
index 0000000..583f871
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel4.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 300
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2403
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel5.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel5.properties
new file mode 100644
index 0000000..7cae5e8
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.kernel5.properties
@@ -0,0 +1,12 @@
+########################
+# Deployer Configuration
+########################
+# Note: use 0 to disable deployment timeouts
+deployer.timeout= 300
+deployer.pickupDirectory= pickup
+
+##########################
+# OSGi Shell Configuration
+##########################
+shell.enabled= true
+shell.port= 2404
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository.properties
new file mode 100644
index 0000000..66c38e9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository.properties
@@ -0,0 +1,13 @@
+ext.type=external
+ext.searchPattern=repository/ext/{artifact}
+
+usr.type=watched
+usr.watchDirectory=repository/usr
+
+remote-repo.type=remote
+remote-repo.uri=http://localhost:8080/org.eclipse.virgo.apps.repository/hosted-repository
+remote-repo.indexRefreshInterval=1
+
+chain=ext,usr,remote-repo
+
+
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository1.properties b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository1.properties
new file mode 100644
index 0000000..8b2c1c8
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/org.eclipse.virgo.repository1.properties
@@ -0,0 +1,13 @@
+ext.type=external
+ext.searchPattern=repository/ext/{artifact}
+
+usr.type=watched
+usr.watchDirectory=repository/usr
+
+remote-repo.type=remote
+remote-repo.uri=http://localhost:8084/org.eclipse.virgo.apps.repository/hosted-repository
+remote-repo.indexRefreshInterval=1
+
+chain=ext,usr,remote-repo
+
+
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/parreferencedplan.plan b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/parreferencedplan.plan
new file mode 100644
index 0000000..f569eaa
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/parreferencedplan.plan
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="parreferenced.plan" version="1.0.0" scoped="false" atomic="true"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="par" name="appA123" version="[1.0.0,2.0)"/>
+
+</plan>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server.xml b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server.xml
new file mode 100644
index 0000000..5bb440b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+<Server port="8006" shutdown="SHUTDOWN">
+
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+ <Listener className="org.apache.catalina.core.JasperListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+
+ <Listener className="org.eclipse.virgo.web.tomcat.ServerLifecycleLoggingListener"/>
+
+ <Service name="Catalina">
+ <Connector port="8081" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8444" />
+
+ <Connector port="8444" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS"
+ keystoreFile="config/keystore"
+ keystorePass="changeit"/>
+
+ <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
+
+ <Engine name="Catalina" defaultHost="localhost">
+ <Realm className="org.apache.catalina.realm.JAASRealm" appName="dm-kernel"
+ userClassNames="org.eclipse.virgo.kernel.authentication.User"
+ roleClassNames="org.eclipse.virgo.kernel.authentication.Role"/>
+
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="serviceability/logs/access"
+ prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
+
+ <Valve className="org.eclipse.virgo.web.tomcat.ApplicationNameTrackingValve"/>
+ </Host>
+ </Engine>
+ </Service>
+</Server>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server1.xml b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server1.xml
new file mode 100644
index 0000000..e46b1a2
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server1.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<Server port="8007" shutdown="SHUTDOWN">
+
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+ <Listener className="org.apache.catalina.core.JasperListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+
+ <Listener className="org.eclipse.virgo.web.tomcat.ServerLifecycleLoggingListener"/>
+
+ <Service name="Catalina">
+ <Connector port="8084" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8445" />
+
+ <Connector port="8445" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS"
+ keystoreFile="config/keystore"
+ keystorePass="changeit"/>
+
+ <Connector port="8011" protocol="AJP/1.3" redirectPort="8445" />
+
+ <Engine name="Catalina" defaultHost="localhost">
+ <Realm className="org.apache.catalina.realm.JAASRealm" appName="dm-kernel"
+ userClassNames="org.eclipse.virgo.kernel.authentication.User"
+ roleClassNames="org.eclipse.virgo.kernel.authentication.Role"/>
+
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="serviceability/logs/access"
+ prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
+ </Host>
+ </Engine>
+ </Service>
+</Server>
diff --git a/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server2.xml b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server2.xml
new file mode 100644
index 0000000..1ad31cb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt.cleanstart/src/test/resources/tomcat-server2.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<Server port="8008" shutdown="SHUTDOWN">
+
+ <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+ <Listener className="org.apache.catalina.core.JasperListener" />
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+
+ <Listener className="org.eclipse.virgo.web.tomcat.ServerLifecycleLoggingListener"/>
+
+ <Service name="Catalina">
+ <Connector port="8083" protocol="HTTP/1.1"
+ connectionTimeout="20000"
+ redirectPort="8446" />
+
+ <Connector port="8446" protocol="HTTP/1.1" SSLEnabled="true"
+ maxThreads="150" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS"
+ keystoreFile="config/keystore"
+ keystorePass="changeit"/>
+
+ <Connector port="8012" protocol="AJP/1.3" redirectPort="8446" />
+
+ <Engine name="Catalina" defaultHost="localhost">
+ <Realm className="org.apache.catalina.realm.JAASRealm" appName="dm-kernel"
+ userClassNames="org.eclipse.virgo.kernel.authentication.User"
+ roleClassNames="org.eclipse.virgo.kernel.authentication.Role"/>
+
+ <Host name="localhost" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="serviceability/logs/access"
+ prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
+ </Host>
+ </Engine>
+ </Service>
+</Server>
diff --git a/org.eclipse.virgo.server.svt/.classpath b/org.eclipse.virgo.server.svt/.classpath
new file mode 100644
index 0000000..37512c1
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/.classpath
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-4.5.0.jar" sourcepath="/SERVER_IVY_CACHE/org.junit/com.springsource.org.junit/4.5.0/com.springsource.org.junit-sources-4.5.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-1.5.10.jar" sourcepath="/SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.5.10/com.springsource.slf4j.api-sources-1.5.10.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.regexp/com.springsource.org.apache.regexp/1.5.0/com.springsource.org.apache.regexp-1.5.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.regexp/com.springsource.org.apache.regexp/1.5.0/com.springsource.org.apache.regexp-sources-1.5.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.httpclient/3.1.0/com.springsource.org.apache.commons.httpclient-3.1.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.httpclient/3.1.0/com.springsource.org.apache.commons.httpclient-sources-3.1.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.w3.sac/com.springsource.org.w3c.css.sac/1.3.0/com.springsource.org.w3c.css.sac-1.3.0.jar" sourcepath="/SERVER_IVY_CACHE/org.w3.sac/com.springsource.org.w3c.css.sac/1.3.0/com.springsource.org.w3c.css.sac-sources-1.3.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.io/1.4.0/com.springsource.org.apache.commons.io-1.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.io/1.4.0/com.springsource.org.apache.commons.io-sources-1.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.lang/2.4.0/com.springsource.org.apache.commons.lang-2.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.lang/2.4.0/com.springsource.org.apache.commons.lang-sources-2.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1/com.springsource.org.apache.commons.collections-3.2.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.collections/3.2.1/com.springsource.org.apache.commons.collections-sources-3.2.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.cssparser/com.springsource.com.steadystate.css/0.9.5/com.springsource.com.steadystate.css-0.9.5.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.cssparser/com.springsource.com.steadystate.css/0.9.5/com.springsource.com.steadystate.css-sources-0.9.5.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.5.10/com.springsource.slf4j.nop-1.5.10.jar" sourcepath="/SERVER_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.5.10/com.springsource.slf4j.nop-sources-1.5.10.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.1.0.D-20100420091708/org.eclipse.virgo.util.io-2.1.0.D-20100420091708.jar" sourcepath="/SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.1.0.D-20100420091708/org.eclipse.virgo.util.io-sources-2.1.0.D-20100420091708.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-2.1.0.D-20100420091708.jar" sourcepath="/SERVER_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-sources-2.1.0.D-20100420091708.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/com.dumbster/com.springsource.com.dumbster.smtp/1.6.0/com.springsource.com.dumbster.smtp-1.6.0.jar" sourcepath="/SERVER_IVY_CACHE/com.dumbster/com.springsource.com.dumbster.smtp/1.6.0/com.springsource.com.dumbster.smtp-sources-1.6.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.com.gargoylesoftware.htmlunit/2.6.0/com.springsource.com.gargoylesoftware.htmlunit-2.6.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.com.gargoylesoftware.htmlunit/2.6.0/com.springsource.com.gargoylesoftware.htmlunit-sources-2.6.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit/2.2.0/com.springsource.net.sourceforge.jwebunit-2.2.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit/2.2.0/com.springsource.net.sourceforge.jwebunit-sources-2.2.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.nekohtml/com.springsource.org.cyberneko.html/1.9.13/com.springsource.org.cyberneko.html-1.9.13.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.nekohtml/com.springsource.org.cyberneko.html/1.9.13/com.springsource.org.cyberneko.html-sources-1.9.13.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xalan/2.7.1/com.springsource.org.apache.xalan-2.7.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.xalan/com.springsource.org.apache.xalan/2.7.1/com.springsource.org.apache.xalan-sources-2.7.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.xerces/com.springsource.org.apache.xerces/2.9.1/com.springsource.org.apache.xerces-2.9.1.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.xerces/com.springsource.org.apache.xerces/2.9.1/com.springsource.org.apache.xerces-sources-2.9.1.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.codec/1.4.0/com.springsource.org.apache.commons.codec-1.4.0.jar" sourcepath="/SERVER_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.codec/1.4.0/com.springsource.org.apache.commons.codec-sources-1.4.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit.htmlunit/2.2.0/com.springsource.net.sourceforge.jwebunit.htmlunit-2.2.0.jar" sourcepath="/SERVER_IVY_CACHE/net.sourceforge.jwebunit/com.springsource.net.sourceforge.jwebunit.htmlunit/2.2.0/com.springsource.net.sourceforge.jwebunit.htmlunit-sources-2.2.0.jar"/>
+ <classpathentry kind="var" path="SERVER_IVY_CACHE/net.sourceforge.htmlunit/com.springsource.net.sourceforge.htmlunit.corejs/2.6.0/com.springsource.net.sourceforge.htmlunit.corejs-2.6.0.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.virgo.server.svt/.project b/org.eclipse.virgo.server.svt/.project
new file mode 100644
index 0000000..1bfac27
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.virgo.server.svt</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.virgo.server.svt/apps/email-shared-libs-war.war b/org.eclipse.virgo.server.svt/apps/email-shared-libs-war.war
new file mode 100644
index 0000000..3a92243
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/email-shared-libs-war.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/email-standard-war.war b/org.eclipse.virgo.server.svt/apps/email-standard-war.war
new file mode 100644
index 0000000..5ea5914
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/email-standard-war.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-email-par.par b/org.eclipse.virgo.server.svt/apps/formtags-email-par.par
new file mode 100644
index 0000000..60e3a2c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-email-par.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-par-2.0.1.BUILD-20100413113234.par b/org.eclipse.virgo.server.svt/apps/formtags-par-2.0.1.BUILD-20100413113234.par
new file mode 100644
index 0000000..dcc860c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-par-2.0.1.BUILD-20100413113234.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-shared-libs-2.0.1.BUILD-20100413113234.war b/org.eclipse.virgo.server.svt/apps/formtags-shared-libs-2.0.1.BUILD-20100413113234.war
new file mode 100644
index 0000000..22b4228
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-shared-libs-2.0.1.BUILD-20100413113234.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar b/org.eclipse.virgo.server.svt/apps/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
new file mode 100644
index 0000000..5ed2f3b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war b/org.eclipse.virgo.server.svt/apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war
new file mode 100644
index 0000000..e2f2c38
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/formtags-war-2.0.1.BUILD-20100413113234.war b/org.eclipse.virgo.server.svt/apps/formtags-war-2.0.1.BUILD-20100413113234.war
new file mode 100644
index 0000000..ff76d5a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/formtags-war-2.0.1.BUILD-20100413113234.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par b/org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par
new file mode 100644
index 0000000..c660123
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/greenpages-solution-2.0.1.SNAPSHOT.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/hello.domain.jar b/org.eclipse.virgo.server.svt/apps/hello.domain.jar
new file mode 100644
index 0000000..097a95c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/hello.domain.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/hello.service.api.jar b/org.eclipse.virgo.server.svt/apps/hello.service.api.jar
new file mode 100644
index 0000000..55d136d
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/hello.service.api.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/hello.service.impl-en.jar b/org.eclipse.virgo.server.svt/apps/hello.service.impl-en.jar
new file mode 100644
index 0000000..6bbfdeb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/hello.service.impl-en.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/hello_war_shared_services.war b/org.eclipse.virgo.server.svt/apps/hello_war_shared_services.war
new file mode 100644
index 0000000..bb8b061
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/hello_war_shared_services.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/helloworld_unscoped-1.0.0.RELEASE.plan b/org.eclipse.virgo.server.svt/apps/helloworld_unscoped-1.0.0.RELEASE.plan
new file mode 100644
index 0000000..33b12f8
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/helloworld_unscoped-1.0.0.RELEASE.plan
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="helloworld_unscoped.plan" version="1.0.0.RELEASE" scoped="false" atomic="true"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="bundle" name="hello.domain" version="0"/>
+ <artifact type="bundle" name="hello.service.api" version="0"/>
+ <artifact type="bundle" name="hello.service.impl_en" version="0"/>
+
+</plan>
diff --git a/org.eclipse.virgo.server.svt/apps/org.springframework.showcase.formtags-1.5.0.RELEASE.plan b/org.eclipse.virgo.server.svt/apps/org.springframework.showcase.formtags-1.5.0.RELEASE.plan
new file mode 100644
index 0000000..7ca2ec3
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/org.springframework.showcase.formtags-1.5.0.RELEASE.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="org.springframework.showcase.formtags.plan" version="1.5.0.RELEASE" scoped="true" atomic="true"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="bundle" name="org.springframework.showcase.formtags.domain_par" version="[1.5.0.RELEASE,2.0)"/>
+ <artifact type="bundle" name="org.springframework.showcase.formtags.service_par" version="[1.5.0.RELEASE,2.0)"/>
+ <artifact type="bundle" name="org.springframework.showcase.formtags.web_par" version="[1.5.0.RELEASE,2.0)"/>
+</plan>
diff --git a/org.eclipse.virgo.server.svt/apps/per-app-logging.war b/org.eclipse.virgo.server.svt/apps/per-app-logging.war
new file mode 100644
index 0000000..b9190d9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/per-app-logging.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/servlet2.4-war.war b/org.eclipse.virgo.server.svt/apps/servlet2.4-war.war
new file mode 100644
index 0000000..d2460e4
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/servlet2.4-war.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/servlet2.5-war.war b/org.eclipse.virgo.server.svt/apps/servlet2.5-war.war
new file mode 100644
index 0000000..6cdf968
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/servlet2.5-war.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/apps/wicket-phonebook.war b/org.eclipse.virgo.server.svt/apps/wicket-phonebook.war
new file mode 100644
index 0000000..fb2fa31
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/apps/wicket-phonebook.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/build.xml b/org.eclipse.virgo.server.svt/build.xml
new file mode 100644
index 0000000..e09a40b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/build.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.virgo.server.svt" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:maven="antlib:org.apache.maven.artifact.ant">
+
+ <property name="ivy.cache.dir" value="${basedir}/../ivy-cache" />
+ <property name="integration.repo.dir" value="${basedir}/../integration-repo"/>
+ <property name="download.dir" value="${basedir}/target/bundles"/>
+
+ <property file="${basedir}/../build.properties"/>
+ <property file="${basedir}/../build.versions"/>
+ <import file="${basedir}/../virgo-build/standard/default.xml"/>
+ <import file="${basedir}/../build-svt/test-package.xml"/>
+
+ <property name="bundles.dir" value="${basedir}/bundles"/>
+ <property name="libraries.dir" value="${basedir}/libraries"/>
+ <property name="greenpagesdb.dir" value="${basedir}/../org.eclipse.virgo.server.svt/greenpages-db"/>
+ <property name="svt.cleanstart.dir" value="${basedir}/../org.eclipse.virgo.server.svt.cleanstart"/>
+
+ <target name="maven.init" depends="ivy.init">
+ <ivy:cachepath resolveId="maven.ant.tasks.classpath" pathid="maven.ant.tasks.classpath"
+ organisation="org.apache.maven" module="com.springsource.org.apache.maven.ant"
+ revision="${org.apache.maven.ant.version}" conf="runtime" type="jar" inline="true" log="download-only"/>
+ <taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant"
+ classpathref="maven.ant.tasks.classpath"/>
+ <maven:install-provider groupId="org.springframework.build.aws" artifactId="org.springframework.build.aws.maven"
+ version="${org.springframework.build.aws.maven.version}"/>
+ </target>
+
+ <target name="maven.download" depends="maven.init">
+ <delete dir="${download.dir}" quiet="true"/>
+ <mkdir dir="${download.dir}"/>
+
+ <maven:dependencies filesetId="maven.fileset" versionsId="maven.versions">
+ <dependency groupId="org.apache.struts" artifactId="struts2-mailreader" version="2.1.8" type="war" scope="compile" />
+ <dependency groupId="org.wicketstuff" artifactId="phonebook" version="1.4.8" type="war" scope="compile" />
+ <remoteRepository id="maven.central" url="http://repo1.maven.org/maven2" />
+ </maven:dependencies>
+
+ <copy todir="${download.dir}">
+ <fileset refid="maven.fileset" />
+ <mapper classpathref="maven.ant.tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper" from="${maven.versions}" to="flatten" />
+ </copy>
+ </target>
+
+ <target name="download" depends="ivy.init,maven.download">
+ <ivy:resolve resolveId="download.deps" file="${basedir}/ivy.xml" transitive="false"/>
+ <ivy:retrieve resolveId="download.deps" pattern="${download.dir}/[artifact]-[revision].[ext]" conf="test" type="jar"/>
+ </target>
+
+ <target name="startup.pre">
+ <copy todir="${usr.dir}">
+ <fileset dir="${bundles.dir}"/>
+ </copy>
+ <copy todir="${usr.dir}">
+ <fileset dir="${libraries.dir}"/>
+ </copy>
+ <antcall target="startup.greenpages.h2db"/>
+ <sleep milliseconds="1000"/>
+ <antcall target="refresh.greenpages.h2db"/>
+ </target>
+
+ <path id="hsqldb.classpath">
+ <fileset dir="${test.package.dir}/repository/usr">
+ <include name="com.springsource.org.hsqldb-1.8.0.9.jar" />
+ </fileset>
+ </path>
+
+ <path id="h2db.classpath">
+ <fileset dir="${test.package.dir}/repository/usr">
+ <include name="com.springsource.org.h2-1.0.71.jar" />
+ </fileset>
+ </path>
+
+ <target name="startup.greenpages.h2db">
+ <java classname="org.h2.tools.Server" fork="true" spawn="true">
+ <classpath refid="h2db.classpath"/>
+ </java>
+ <fail if="start.failed" message="h2 db start up failed"/>
+ </target>
+
+ <target name="refresh.greenpages.h2db">
+ <path id="svt.test.db">
+ <pathelement location="${greenpagesdb.dir}" />
+ </path>
+ <all-bundles target="setupGreenPagesDB" buildpathRef="svt.test.db">
+ <property name="server.dir" value="${test.package.dir}"/>
+ </all-bundles>
+ </target>
+
+ <target name="test-clean-startup">
+ <antcall target="startup.clean"/>
+ <path id="svt.test.clean">
+ <pathelement location="${svt.cleanstart.dir}" />
+ </path>
+ <all-bundles target="startup.clean.post" buildpathRef="svt.test.clean"/>
+ <antcall target="shutdown"/>
+ </target>
+
+
+ <target name="shutdown.post">
+ <echo message="Testing warm restart"/>
+ <sleep seconds="5"/>
+ <antcall target="startup"/>
+ <!-- <antcall target="test.do"/>-->
+ <antcall target="shutdown"/>
+ <echo message="Testing clean start"/>
+ <antcall target="test-clean-startup"/>
+ </target>
+
+</project>
diff --git a/org.eclipse.virgo.server.svt/bundles/appA.par b/org.eclipse.virgo.server.svt/bundles/appA.par
new file mode 100644
index 0000000..6042240
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/appA.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.com.mysql.jdbc-5.1.6.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.com.mysql.jdbc-5.1.6.jar
new file mode 100644
index 0000000..e9a0717
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.com.mysql.jdbc-5.1.6.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.com.sun.facelets-1.1.14.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.com.sun.facelets-1.1.14.jar
new file mode 100644
index 0000000..1053e53
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.com.sun.facelets-1.1.14.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.freemarker-2.3.15.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.freemarker-2.3.15.jar
new file mode 100644
index 0000000..9bf1020
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.freemarker-2.3.15.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.javassist-3.9.0.GA.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.javassist-3.9.0.GA.jar
new file mode 100644
index 0000000..0da478b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.javassist-3.9.0.GA.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.persistence-1.0.0.jar
new file mode 100644
index 0000000..9fcc5ae
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.xml.stream-1.0.1.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.xml.stream-1.0.1.jar
new file mode 100644
index 0000000..ce68dd7
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.javax.xml.stream-1.0.1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.net.sf.cglib-2.2.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.net.sf.cglib-2.2.0.jar
new file mode 100644
index 0000000..a4f97dc
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.net.sf.cglib-2.2.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.oracle.toplink.essentials-2.0.0.b41-beta2.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.oracle.toplink.essentials-2.0.0.b41-beta2.jar
new file mode 100644
index 0000000..b3f95b9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.oracle.toplink.essentials-2.0.0.b41-beta2.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.aopalliance-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.aopalliance-1.0.0.jar
new file mode 100644
index 0000000..150af80
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.aopalliance-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.beanutils-1.7.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.beanutils-1.7.0.jar
new file mode 100644
index 0000000..92d2173
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.beanutils-1.7.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.codec-1.3.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.codec-1.3.0.jar
new file mode 100644
index 0000000..c69504a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.codec-1.3.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.collections-3.2.1.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.collections-3.2.1.jar
new file mode 100644
index 0000000..aee7281
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.collections-3.2.1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
new file mode 100644
index 0000000..de49d6f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.digester-1.8.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.digester-1.8.0.jar
new file mode 100644
index 0000000..a0dcd93
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.digester-1.8.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.discovery-0.4.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.discovery-0.4.0.jar
new file mode 100644
index 0000000..53d661e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.discovery-0.4.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.lang-2.1.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.lang-2.1.0.jar
new file mode 100644
index 0000000..1213ff2
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.lang-2.1.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.logging-1.1.1.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.logging-1.1.1.jar
new file mode 100644
index 0000000..d5dfe76
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.logging-1.1.1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
new file mode 100644
index 0000000..715790f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces-1.2.2.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces-1.2.2.jar
new file mode 100644
index 0000000..c3d990d
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces-1.2.2.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces.javax.faces-1.2.2.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces.javax.faces-1.2.2.jar
new file mode 100644
index 0000000..8f14dec
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.apache.myfaces.javax.faces-1.2.2.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.dom4j-1.6.1.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.dom4j-1.6.1.jar
new file mode 100644
index 0000000..f2075d0
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.dom4j-1.6.1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
new file mode 100644
index 0000000..e93073d
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
new file mode 100644
index 0000000..b9b3be8
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
new file mode 100644
index 0000000..39d9a54
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
new file mode 100644
index 0000000..f92fd82
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.h2-1.0.71.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.h2-1.0.71.jar
new file mode 100644
index 0000000..41dc982
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.h2-1.0.71.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.hsqldb-1.8.0.9.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.hsqldb-1.8.0.9.jar
new file mode 100644
index 0000000..b94487b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.hsqldb-1.8.0.9.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm-1.5.3.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm-1.5.3.jar
new file mode 100644
index 0000000..4c70679
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm-1.5.3.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm.attrs-1.5.3.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm.attrs-1.5.3.jar
new file mode 100644
index 0000000..e45c51a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.org.objectweb.asm.attrs-1.5.3.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.api-1.5.6.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.api-1.5.6.jar
new file mode 100644
index 0000000..44f166d
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.api-1.5.6.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.jcl-1.5.6.jar b/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.jcl-1.5.6.jar
new file mode 100644
index 0000000..cf87be9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/com.springsource.slf4j.jcl-1.5.6.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.aop-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.aop-2.5.6.A.jar
new file mode 100644
index 0000000..7de0e61
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.aop-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.aspects-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.aspects-2.5.6.A.jar
new file mode 100644
index 0000000..16cd0d5
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.aspects-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.beans-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.beans-2.5.6.A.jar
new file mode 100644
index 0000000..aae6f1b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.beans-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.context-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.context-2.5.6.A.jar
new file mode 100644
index 0000000..05f0233
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.context-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.context.support-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.context.support-2.5.6.A.jar
new file mode 100644
index 0000000..bbbeb39
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.context.support-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.core-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.core-2.5.6.A.jar
new file mode 100644
index 0000000..d41bd0a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.core-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.jdbc-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.jdbc-2.5.6.A.jar
new file mode 100644
index 0000000..8e72392
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.jdbc-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.jms-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.jms-2.5.6.A.jar
new file mode 100644
index 0000000..8eb8c71
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.jms-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.orm-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.orm-2.5.6.A.jar
new file mode 100644
index 0000000..3005f17
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.orm-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.transaction-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.transaction-2.5.6.A.jar
new file mode 100644
index 0000000..68a8662
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.transaction-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.web-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.web-2.5.6.A.jar
new file mode 100644
index 0000000..ec25efb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.web-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/bundles/org.springframework.web.servlet-2.5.6.A.jar b/org.eclipse.virgo.server.svt/bundles/org.springframework.web.servlet-2.5.6.A.jar
new file mode 100644
index 0000000..8646a6b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/bundles/org.springframework.web.servlet-2.5.6.A.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/build.xml b/org.eclipse.virgo.server.svt/greenpages-db/build.xml
new file mode 100644
index 0000000..1dc5008
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/build.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<project name="setupGreenPagesDB" basedir="." default="all">
+ <property file="${basedir}/../../build.properties"/>
+ <import file="${basedir}/../../build-svt/test-package.xml"/>
+
+ <property name="server.home" value="${server.dir}"/>
+
+ <path id="h2db.classpath">
+ <fileset dir="${server.home}/repository/usr">
+ <include name="com.springsource.org.h2-1.0.71.jar" />
+ </fileset>
+ </path>
+
+ <target name="setH2DBProperties" >
+ <property name="db.driver" value="org.h2.Driver"/>
+ <property name="db.url" value="jdbc:h2:~/greenpages-db/greenpages"/>
+ <property name="db.user" value="greenpages"/>
+ <property name="db.pw" value="pass"/>
+ </target>
+
+ <target name="populateH2DBData" depends="setH2DBProperties">
+ <echo message="Create tables using: ${db.driver} ${db.url}" />
+ <sql driver="${db.driver}" url="${db.url}" userid="${db.user}" password="${db.pw}" onerror="continue">
+ <classpath refid="h2db.classpath"/>
+ <transaction src="db.sql" />
+ </sql>
+ </target>
+
+ <target name="setupGreenPagesDB" depends="populateH2DBData" />
+
+</project>
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/data.bat b/org.eclipse.virgo.server.svt/greenpages-db/data.bat
new file mode 100644
index 0000000..0fdc44c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/data.bat
@@ -0,0 +1,5 @@
+@echo off
+setlocal
+
+call h2
+java -cp "%H2CP%" org.h2.tools.RunScript -url jdbc:h2:tcp://localhost/~/greenpages-db/greenpages -user greenpages -password pass -script db.sql
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/data.sh b/org.eclipse.virgo.server.svt/greenpages-db/data.sh
new file mode 100755
index 0000000..f2cc337
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/data.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+. ./h2.sh
+
+java -cp $CLASSPATH org.h2.tools.RunScript -url jdbc:h2:~/greenpages-db/greenpages -user greenpages -password pass -script ./db.sql
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/db.sql b/org.eclipse.virgo.server.svt/greenpages-db/db.sql
new file mode 100644
index 0000000..394c60c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/db.sql
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS LISTING;
+
+CREATE TABLE LISTING (
+ LISTING_NUMBER INT PRIMARY KEY,
+ FIRST_NAME VARCHAR(255),
+ LAST_NAME VARCHAR(255),
+ EMAIL_ADDRESS VARCHAR(255)
+);
+
+INSERT INTO LISTING VALUES(1, 'Rod', 'Johnson', 'rod.johnson@springsource.com');
+INSERT INTO LISTING VALUES(2, 'Rob', 'Harrop', 'rob.harrop@springsource.com');
+INSERT INTO LISTING VALUES(3, 'Glyn', 'Normington', 'glyn.normington@springsource.com');
+INSERT INTO LISTING VALUES(4, 'Andy', 'Wilkinson', 'andy.wilkinson@springsource.com');
+INSERT INTO LISTING VALUES(5, 'Ben', 'Hale', 'ben.hale@springsource.com');
+INSERT INTO LISTING VALUES(6, 'Chris', 'Frost', 'chris.frost@springsource.com');
+INSERT INTO LISTING VALUES(7, 'Steve', 'Powell', 'steve.powell@springsource.com');
+INSERT INTO LISTING VALUES(8, 'Christian', 'Dupuis', 'christian.dupuis@springsource.com');
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/h2.bat b/org.eclipse.virgo.server.svt/greenpages-db/h2.bat
new file mode 100644
index 0000000..e79da93
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/h2.bat
@@ -0,0 +1,9 @@
+for /r "%HOMEPATH%\.m2" %%X in (*h2*.jar) do (set H2CP=%H2CP%;%%X)
+
+if "%H2CP%" == "" (goto h2NotFound) else goto end
+
+:h2NotFound
+echo Cannot find H2 jars in .m2 Maven repository
+exit /b -1s
+
+:end
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/h2.sh b/org.eclipse.virgo.server.svt/greenpages-db/h2.sh
new file mode 100755
index 0000000..4ffc5eb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/h2.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+JARS=`find $HOME/.m2 -iname "com.springsource.org.h2*"`
+
+for JAR in $JARS
+do
+ CLASSPATH=$CLASSPATH:$JAR
+done
+
+if [ -z $CLASSPATH ]
+then
+ echo "Cannot find H2 jars in .m2 Maven repository"
+ exit -1
+fi
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/run.bat b/org.eclipse.virgo.server.svt/greenpages-db/run.bat
new file mode 100644
index 0000000..6c67dd9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/run.bat
@@ -0,0 +1,5 @@
+@echo off
+setlocal
+
+call h2
+start java -cp "%H2CP%" org.h2.tools.Server
diff --git a/org.eclipse.virgo.server.svt/greenpages-db/run.sh b/org.eclipse.virgo.server.svt/greenpages-db/run.sh
new file mode 100755
index 0000000..c3403e4
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/greenpages-db/run.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+. ./h2.sh
+
+java -cp $CLASSPATH org.h2.tools.Server
+
diff --git a/org.eclipse.virgo.server.svt/ivy.xml b/org.eclipse.virgo.server.svt/ivy.xml
new file mode 100644
index 0000000..78963f3
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/ivy.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
+<ivy-module
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
+ version="1.3">
+
+ <info organisation="org.eclipse.virgo.svt" module="${ant.project.name}"/>
+
+ <configurations>
+ <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/>
+ </configurations>
+
+ <publications>
+ <artifact name="${ant.project.name}"/>
+ <artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
+ </publications>
+
+ <dependencies>
+ <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="test->runtime"/>
+
+ <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+ <dependency org="net.sourceforge.jwebunit" name="com.springsource.net.sourceforge.jwebunit" rev="${net.sourceforge.jwebunit}" conf="test->runtime"/>
+ <dependency org="net.sourceforge.jwebunit" name="com.springsource.net.sourceforge.jwebunit.htmlunit" rev="${net.sourceforge.jwebunit}" conf="test->runtime"/>
+
+ <dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="test->runtime"/>
+ <dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="runtime->runtime"/>
+ <dependency org="com.dumbster" name="com.springsource.com.dumbster.smtp" rev="${com.dumbster}" conf="test->runtime"/>
+
+ <!-- Dependencies which cannot be checked in to Eclipse repositories because of their licenses, e.g. LGPL. -->
+ <dependency org="org.hibernate" name="com.springsource.org.hibernate" rev="${org.hibernate}" conf="test->runtime"/>
+
+ <exclude org="org.slf4j" module="com.springsource.slf4j.org.apache.log4j" />
+ </dependencies>
+
+</ivy-module>
diff --git a/org.eclipse.virgo.server.svt/libraries/oracle.toplink.essentials-library-2.0.0.b41-beta2.libd b/org.eclipse.virgo.server.svt/libraries/oracle.toplink.essentials-library-2.0.0.b41-beta2.libd
new file mode 100644
index 0000000..d4b3b92
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/libraries/oracle.toplink.essentials-library-2.0.0.b41-beta2.libd
@@ -0,0 +1,6 @@
+Library-SymbolicName: oracle.toplink.essentials
+Library-Version: 2.0.0.b41-beta2
+Library-Name: TopLink Essentials
+Import-Bundle:
+ com.springsource.oracle.toplink.essentials;version="[2.0.0.b41-beta2, 2.0.0.b41-beta2]",
+ com.springsource.javax.persistence;version="[1.0.0, 1.0.0]"
diff --git a/org.eclipse.virgo.server.svt/libraries/org.apache.myfaces-library-1.2.2.libd b/org.eclipse.virgo.server.svt/libraries/org.apache.myfaces-library-1.2.2.libd
new file mode 100644
index 0000000..6a7db90
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/libraries/org.apache.myfaces-library-1.2.2.libd
@@ -0,0 +1,6 @@
+Library-SymbolicName: org.apache.myfaces
+Library-Version: 1.2.2
+Library-Name: Apache MyFaces Java Server Faces Implementation
+Import-Bundle:
+ com.springsource.org.apache.myfaces;version="[1.2.2, 1.2.2]",
+ com.springsource.org.apache.myfaces.javax.faces;version="[1.2.2, 1.2.2]"
diff --git a/org.eclipse.virgo.server.svt/libraries/org.hibernate.ejb-library-3.3.2.GA.libd b/org.eclipse.virgo.server.svt/libraries/org.hibernate.ejb-library-3.3.2.GA.libd
new file mode 100644
index 0000000..94cc6be
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/libraries/org.hibernate.ejb-library-3.3.2.GA.libd
@@ -0,0 +1,9 @@
+Library-SymbolicName: org.hibernate.ejb
+Library-Version: 3.3.2.GA
+Library-Name: Hibernate JPA
+Import-Bundle:
+ com.springsource.org.hibernate;version="[3.2.6.ga, 3.2.6.ga]",
+ com.springsource.org.hibernate.annotations;version="[3.3.1.ga, 3.3.1.ga]",
+ com.springsource.org.hibernate.annotations.common;version="[3.3.0.ga, 3.3.0.ga]",
+ com.springsource.org.hibernate.ejb;version="[3.3.2.GA, 3.3.2.GA]",
+ com.springsource.javax.persistence;version="[1.0.0, 1.0.0]"
diff --git a/org.eclipse.virgo.server.svt/libraries/org.springframework.spring-library-2.5.6.A.libd b/org.eclipse.virgo.server.svt/libraries/org.springframework.spring-library-2.5.6.A.libd
new file mode 100644
index 0000000..9875801
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/libraries/org.springframework.spring-library-2.5.6.A.libd
@@ -0,0 +1,17 @@
+Library-SymbolicName: org.springframework.spring
+Library-Version: 2.5.6.A
+Library-Name: Spring Framework
+Import-Bundle:
+ org.springframework.aop;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.aspects;version="[2.5.6.A, 2.5.6.A]";import-scope:=application,
+ org.springframework.beans;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.context;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.context.support;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.core;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.jdbc;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.jms;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.orm;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.transaction;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.web;version="[2.5.6.A, 2.5.6.A]",
+ org.springframework.web.servlet;version="[2.5.6.A, 2.5.6.A]",
+ com.springsource.org.aopalliance;version="[1.0.0, 1.0.0]"
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java
new file mode 100644
index 0000000..a11cac5
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/AbstractWebTests.java
@@ -0,0 +1,551 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import net.sourceforge.jwebunit.html.Cell;
+import net.sourceforge.jwebunit.html.Row;
+import net.sourceforge.jwebunit.junit.WebTester;
+import net.sourceforge.jwebunit.util.TestContext;
+
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+
+public abstract class AbstractWebTests {
+ protected static final String URL = "http://localhost:8080/admin/web/artifact/overview.htm";
+ protected static final String USER = "admin";
+ protected static final String PASSWORD = "springsource";
+
+ static final String TXT_FILE_SUFFIX = ".txt";
+ static final String TXT_FILE_PREFIX = "summary";
+
+ private static String pickupDir = null;
+ private static String repositoryUsrDir = null;
+ private static String repositoryExtDir = null;
+ private static String repoPropertiesDir = null;
+ private static String hostedRepoPropertiesDir = null;
+ private static String kernelPropertiesDir = null;
+
+ private static String workDir = null;
+ private static String serviceabilityDir = null;
+ private static String versionFile = null;
+
+ private static MBeanServerConnection connection = null;
+ private static final String JMXURL = "service:jmx:rmi:///jndi/rmi://localhost:9875/jmxrmi";
+ private static final String KEYSTORE = "/config/keystore";
+ private static final String KEYPASSWORD = "changeit";
+ public static final long HALF_SECOND = 500;
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ private final WebTester tester = new WebTester();
+
+ protected final TestContext getTestContext() {
+ return this.tester.getTestContext();
+ }
+
+ protected final WebTester getTester() {
+ return this.tester;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void assertTableContent(String tableId, Object[][] expectedRows) {
+ ArrayList<Row> actualRows = getTester().getTable(tableId).getRows();
+
+ boolean tableMatched = true;
+ for (Object[] expectedRow : expectedRows) {
+ Object bsn = expectedRow[0];
+ boolean rowMatched = false;
+ for (Row actualRow : actualRows) {
+ Cell[] cells = ((ArrayList<Cell>) actualRow.getCells())
+ .toArray(new Cell[actualRow.getCellCount()]);
+ if (bsn.equals(cells[0].getValue())) {
+ rowMatched = rowEqual(expectedRow, cells);
+
+ break;
+ }
+ }
+ tableMatched &= rowMatched;
+
+ }
+ assertTrue("Table did not match", tableMatched);
+ }
+
+ protected static void copyApplicationsToPickup(String pickupDir,
+ String appsDir, String[] applicationNames) throws IOException,
+ InterruptedException {
+ for (String applicationName : applicationNames) {
+
+ FileCopyUtils.copy(new File(appsDir, applicationName), new File(
+ pickupDir, applicationName));
+ Thread.sleep(1500);
+ }
+ }
+
+ protected static void copyDependentBundlesToUsrRepository(String usrDir,
+ String bundlesDir, String[] bundleNames) throws IOException {
+ for (String bundleName : bundleNames) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ usrDir, bundleName));
+ }
+ }
+
+ protected static void deleteApplicationsFromPickup(String pickupDir,
+ String[] applicationNames) throws IOException {
+ for (String applicationName : applicationNames) {
+ new File(pickupDir, applicationName).delete();
+ }
+ }
+
+ protected static String getPickupDir() throws IOException {
+ if (pickupDir == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ pickupDir = new File(candidate, "pickup")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return pickupDir;
+ }
+
+ protected static String getWorkDir() throws IOException {
+ if (workDir == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ workDir = new File(candidate, "work").getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return workDir;
+ }
+
+ protected static String getServiceabilityDir() throws IOException {
+ if (serviceabilityDir == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ serviceabilityDir = new File(candidate, "serviceability")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+ return serviceabilityDir;
+ }
+
+ protected static String getRepositoryUsrDir() throws IOException {
+ if (repositoryUsrDir == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ File repositoryDir = new File(mainDir, "repository")
+ .getCanonicalFile();
+ repositoryUsrDir = new File(repositoryDir, "usr")
+ .getCanonicalPath();
+ }
+ }
+ }
+ return repositoryUsrDir;
+ }
+
+ protected static String getRepositoryExtDir() throws IOException {
+ if (repositoryExtDir == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ File repositoryDir = new File(mainDir, "repository")
+ .getCanonicalFile();
+ repositoryExtDir = new File(repositoryDir, "ext")
+ .getCanonicalPath();
+ }
+ }
+ }
+ return repositoryExtDir;
+ }
+
+ protected static String getHostedRepoDir() throws IOException {
+
+ /*
+ * File hostedDir = null;
+ *
+ * File testExpanded = new File("./target/test-expanded/"); for (File
+ * mainDir : testExpanded.listFiles()) { if (mainDir.isDirectory()) {
+ * File repositoryDir = new File(mainDir, "repository")
+ * .getCanonicalFile();
+ *
+ * hostedDir = new File(repositoryDir, "hosted"); hostedDir.mkdir();
+ *
+ * } } return hostedDir.getCanonicalPath();
+ */
+
+ File hostedDir = new File(System.getProperty("user.home"), "hosted");
+ if (!hostedDir.exists()) {
+ hostedDir.mkdir();
+ }
+ return hostedDir.getCanonicalPath();
+ }
+
+ protected static String getRepositoryPropertiesDir() throws IOException {
+ if (repoPropertiesDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File configDir = new File(candidate, "config");
+ if (configDir.isDirectory()) {
+ repoPropertiesDir = new File(configDir,
+ "org.eclipse.virgo.repository.properties")
+ .getCanonicalPath();
+
+ }
+
+ }
+ }
+ }
+
+ return repoPropertiesDir;
+ }
+
+ protected static String getConfigDir() throws IOException {
+ File configDir = null;
+ if (configDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ configDir = new File(candidate, "config");
+
+ }
+ }
+ }
+
+ return configDir.getCanonicalPath();
+ }
+
+ protected static String getHostedRepositoryPropertiesDir()
+ throws IOException {
+ if (hostedRepoPropertiesDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File configDir = new File(candidate, "config");
+ if (configDir.isDirectory()) {
+ hostedRepoPropertiesDir = new File(configDir,
+ "org.eclipse.virgo.apps.repository.properties")
+ .getCanonicalPath();
+
+ }
+
+ }
+ }
+ }
+
+ return hostedRepoPropertiesDir;
+ }
+
+ protected static String getKernelPropertiesDir() throws IOException {
+
+ if (kernelPropertiesDir == null) {
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File configDir = new File(candidate, "config");
+ if (configDir.isDirectory()) {
+ kernelPropertiesDir = new File(configDir,
+ "org.eclipse.virgo.kernel.properties")
+ .getCanonicalPath();
+
+ }
+
+ }
+ }
+ }
+
+ return kernelPropertiesDir;
+ }
+
+ protected static String getWatchedRepoDir() throws IOException {
+ File watchedRepoDir = null;
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ watchedRepoDir = new File(candidate, "watched-repo");
+ if (!watchedRepoDir.exists()) {
+ watchedRepoDir.mkdir();
+ }
+ }
+ }
+ return watchedRepoDir.getCanonicalPath();
+
+ }
+
+ protected File[] getDumpIds() throws IOException {
+
+ File[] dumpFiles = null;
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File serviceabilityDir = new File(candidate, "serviceability");
+
+ for (File serviceabilityFile : serviceabilityDir.listFiles()) {
+
+ if (serviceabilityFile.isDirectory()
+ && serviceabilityFile.getName().equals("dump")) {
+
+ dumpFiles = serviceabilityFile.listFiles();
+
+ }
+ }
+ }
+ }
+ return dumpFiles;
+ }
+
+ protected File[] getDumpEntries(File dumpFile) throws IOException {
+
+ File[] dumpSummaries = dumpFile.listFiles();
+
+ return dumpSummaries;
+ }
+
+ protected static String getDumpDir() throws IOException {
+ File dumpDir = null;
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ File serviceabilityDir = new File(candidate, "serviceability");
+
+ if (serviceabilityDir.isDirectory()) {
+
+ dumpDir = new File(serviceabilityDir, "dump");
+
+ }
+ }
+ }
+ return dumpDir.getCanonicalPath();
+ }
+
+ public String applyNameFormatting(File sourceFolder) {
+ String modDate = DateFormat.getDateInstance(DateFormat.MEDIUM).format(
+ sourceFolder.lastModified());
+ String modTime = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(
+ sourceFolder.lastModified());
+ return String.format("%s at %s", modDate, modTime);
+ }
+
+ final FilenameFilter summaryFilenameFilter = new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(TXT_FILE_SUFFIX)
+ && name.startsWith(TXT_FILE_PREFIX);
+ }
+ };
+
+ protected static String getServerVersion() throws IOException {
+
+ String version;
+ if (versionFile == null) {
+ File testExpanded = new File("./target/test-expanded/");
+ for (File candidate : testExpanded.listFiles()) {
+ if (candidate.isDirectory()) {
+ versionFile = new File(candidate, "lib/.version")
+ .getCanonicalPath();
+ break;
+ }
+ }
+ }
+
+ Properties versions = new Properties();
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream(versionFile);
+ versions.load(stream);
+ version = versions.getProperty("virgo.server.version");
+ stream.close();
+ } catch (IOException e) {
+ version = "Unknown";
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (IOException e1) {
+
+ }
+ }
+ return version;
+ }
+
+ private boolean rowEqual(Object[] expected, Cell[] actual) {
+ if (expected.length != actual.length) {
+
+ return false;
+ }
+
+ for (int i = 0; i < expected.length; i++) {
+ if (!expected[i].equals(actual[i].getValue())) {
+
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String getOperatingSystem() {
+ OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
+ return String.format("%s(%s) - %s", os.getName(), os.getArch(), os
+ .getVersion());
+ }
+
+ public String getJavaVMDescription() {
+ RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
+ return String.format("%s(%s) - %s", rt.getVmVendor(), rt.getVmName(),
+ rt.getVmVersion());
+ }
+
+ public String getJavaVersion() {
+ String vendor = System.getProperty("java.vendor");
+ String version = System.getProperty("java.version");
+ return String.format("%s - %s", vendor, version);
+ }
+
+ protected static MBeanServerConnection getMBeanServerConnection()
+ throws Exception {
+ String severDir = null;
+ String[] creds = { "admin", "springsource" };
+ Map<String, String[]> env = new HashMap<String, String[]>();
+
+ File testExpanded = new File(
+ "./../org.eclipse.virgo.server.svt/target/test-expanded/");
+ for (File mainDir : testExpanded.listFiles()) {
+ if (mainDir.isDirectory()) {
+ severDir = new File(mainDir.toURI()).getCanonicalPath();
+ }
+ }
+ env.put(JMXConnector.CREDENTIALS, creds);
+ System.setProperty("javax.net.ssl.trustStore", severDir + KEYSTORE);
+ System.setProperty("javax.net.ssl.trustStorePassword", KEYPASSWORD);
+ JMXServiceURL url = new JMXServiceURL(JMXURL);
+ connection = JMXConnectorFactory.connect(url, env)
+ .getMBeanServerConnection();
+ return connection;
+ }
+
+ protected void waitForMBeanRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = false;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ protected void waitForMBeanDeRegister(String type, String name,
+ String version, long interval, long duration) throws Exception {
+ long startTime = System.currentTimeMillis();
+ boolean mbeanStatus = true;
+ while (System.currentTimeMillis() - startTime < duration) {
+ mbeanStatus = getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version));
+ if (!mbeanStatus) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, artifact %s mbean Status was",
+ duration, name)
+ + mbeanStatus);
+ }
+
+ protected static ObjectName getObjectName(String type, String name,
+ String version) throws MalformedObjectNameException {
+ return new ObjectName(
+ String
+ .format(
+ "org.eclipse.virgo.kernel:type=Model,artifact-type=%s,name=%s,version=%s",
+ type, name, version));
+ }
+
+ protected void waitForArtifactState(String type, String name,
+ String version, String state, long interval, long duration)
+ throws Exception {
+ long startTime = System.currentTimeMillis();
+ String artifactstate = null;
+ while (System.currentTimeMillis() - startTime < duration) {
+ artifactstate = getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "State").toString();
+ if (artifactstate.equals(state)) {
+ return;
+ }
+ Thread.sleep(interval);
+ }
+ fail(String
+ .format("After %d ms, artifact %s state was", duration, name)
+ + artifactstate);
+ }
+
+ protected static HtmlElement getHtmlChildElement(HtmlElement htmlElement, int index) {
+ Iterable<HtmlElement> htmlChildElements = htmlElement.getAllHtmlChildElements();
+ Iterator<HtmlElement> iterator = htmlChildElements.iterator();
+
+ HtmlElement child = null;
+ for (int childIndex = 0; childIndex <= index; childIndex++) {
+ assertTrue(iterator.hasNext());
+ child = iterator.next();
+ }
+
+ return child;
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java
new file mode 100644
index 0000000..da9ba25
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/UrlWaitLatch.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt;
+
+import static org.junit.Assert.fail;
+
+import java.net.ConnectException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+public class UrlWaitLatch {
+
+ public static final long HALF_SECOND = 500;
+
+ public static final long TWO_MINUTES = 120 * 1000;
+
+ public static void waitFor(String url) {
+ waitFor(url, HALF_SECOND, TWO_MINUTES);
+ }
+
+ public static void waitFor(String url, String username, String password) {
+ waitFor(url, username, password, HALF_SECOND, TWO_MINUTES);
+ }
+
+ public static void waitFor(String url, long interval, long duration) {
+ HttpClient client = new HttpClient();
+ wait(url, client, interval, duration);
+ }
+
+ public static void waitFor(String url, String username, String password,
+ long interval, long duration) {
+ HttpClient client = new HttpClient();
+ client.getParams().setAuthenticationPreemptive(true);
+ client.getState().setCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(username, password));
+ wait(url, client, interval, duration);
+ }
+
+ private static void wait(String url, HttpClient client, long interval,
+ long duration) {
+ HttpMethod get = new GetMethod(url);
+
+ try {
+ long startTime = System.currentTimeMillis();
+
+ int statusCode = 999;
+ while (System.currentTimeMillis() - startTime < duration) {
+ try {
+ statusCode = client.executeMethod(get);
+ if (statusCode < 400) {
+ return;
+ }
+ } catch (ConnectException e) {
+ // Swallow this and retry
+ }
+ Thread.sleep(interval);
+ }
+
+ fail(String.format("After %d ms, status code was %d", duration,
+ statusCode));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+ public static void waitForNotExistence(String url) {
+ HttpClient client = new HttpClient();
+ waitForNotExistence(url, client, 1000, 120000);
+ }
+
+ private static void waitForNotExistence(String url, HttpClient client,
+ long interval, long duration) {
+ HttpMethod get = new GetMethod(url);
+
+ try {
+ long startTime = System.currentTimeMillis();
+
+ int statusCode = 100;
+ while (System.currentTimeMillis() - startTime < duration) {
+ try {
+ statusCode = client.executeMethod(get);
+ if (statusCode >= 400) {
+ return;
+ }
+ } catch (ConnectException e) {
+ // Swallow this and retry
+ }
+ Thread.sleep(interval);
+ }
+ fail(String.format("After %d ms, status code was %d", duration,
+ statusCode));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ get.releaseConnection();
+ }
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/AdminConsoleAppTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/AdminConsoleAppTests.java
new file mode 100644
index 0000000..18524eb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/AdminConsoleAppTests.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.io.IOException;
+import javax.management.MalformedObjectNameException;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+
+public class AdminConsoleAppTests extends AbstractWebTests {
+
+ @Test
+ public void adminApplicationProperties() throws Exception {
+ waitForMBeanRegister("plan", "org.eclipse.virgo.apps.admin.plan", "3.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ UrlWaitLatch.waitFor("http://localhost:8080/admin");
+ assertAdminConsoleArtifactExists("plan", "org.eclipse.virgo.apps.admin.plan", "3.0.0");
+ assertAdminConsoleArtifactState("plan", "org.eclipse.virgo.apps.admin.plan", "3.0.0",
+ "ACTIVE");
+ }
+
+ private void assertAdminConsoleArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "admin console plan artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertAdminConsoleArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "admin console plan artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactDeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactDeployTests.java
new file mode 100644
index 0000000..abf02a2
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactDeployTests.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class BundleArtifactDeployTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ }
+
+ @Test
+ public void bundleArtifactDeploy() throws Exception {
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/bundleA.jar"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ waitForArtifactState("bundle","bundleA","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactState("bundle", "bundleA", "1.0.0", "ACTIVE");
+ }
+
+ private void assertBundleArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertBundleArtifactExists(type, name, version);
+ assertEquals(String.format(
+ "Bundle Artifact %s:%s:%s is not in state %s", type, name,
+ version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertBundleArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Bundle Artifact %s:%s:%s does not exist",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("bundle", "bundleA", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRefreshTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRefreshTests.java
new file mode 100644
index 0000000..95364f9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRefreshTests.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.Iterator;
+import javax.management.MalformedObjectNameException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class BundleArtifactRefreshTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/bundleA.jar"));
+ HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void bundleArtifactRefreshForBSN() throws Exception {
+ assertBundleArtifactBSNBeforeRefresh("bundle", "bundleA", "1.0.0");
+ assertBundleArtifactStateBeforeRefresh("bundle", "bundleA", "1.0.0",
+ "ACTIVE");
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "src/test/resources/bundleA.jar"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("src/test/resources/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("bundle");
+ assertNotNull("Bundle Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ if (adminPage
+ .getElementById("bundlebundlebundleA_Updated2.0.0") != null) {
+ adminPage.getElementById(
+ "bundlebundlebundleA_Updated2.0.0").click();
+ assertNotNull(
+ "Refresh button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_2"));
+ adminPage.getElementById("dijit_form_Button_2").click();
+ assertBundleArtifactBSNAfterRefresh("bundle",
+ "bundleA_Updated", "2.0.0");
+ waitForArtifactState("bundle","bundleA_Updated","2.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactStateAfterRefresh("bundle",
+ "bundleA_Updated", "2.0.0", "ACTIVE");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertBundleArtifactBSNAfterRefresh(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Bundle Artifact With BSN %s does not exist",
+ name), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertBundleArtifactStateAfterRefresh(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Bundle Artifact %s:%s:%s is not in state %s After Refresh",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertBundleArtifactBSNBeforeRefresh(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Bundle Artifact With BSN %s does not exist",
+ name), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertBundleArtifactStateBeforeRefresh(String type,
+ String name, String version, String state)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertEquals(String.format(
+ "Bundle Artifact %s:%s:%s is not in state After Refresh %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("bundle", "bundleA_Updated", "2.0.0"),
+ "uninstall", params, signature);
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRenderTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRenderTests.java
new file mode 100644
index 0000000..f579abf
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactRenderTests.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class BundleArtifactRenderTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/bundleA.jar"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void bundleArtifactRenderInAdminConsole() throws Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("bundle");
+ assertNotNull("Bundle Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ assertBundleArtifactRender("bundle", "bundleA", "1.0.0");
+ assertBundleArtifactState("ACTIVE");
+ assertBundleArtifactDependents(
+ "com.springsource.javax.servlet", "2.5.0", "ACTIVE");
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertBundleArtifactRender(String type, String name,
+ String version) throws Exception {
+ if (adminPage.getElementById("bundlebundlebundleA1.0.0") != null) {
+ assertNotNull(String.format(
+ "Bundle Artifact %s:%s:%s does not exist", type, name,
+ version), adminPage
+ .getElementById("bundlebundlebundleA1.0.0"));
+ assertTrue(String.format(
+ "Bundle Artifact %s is not rendered properly", name),
+ adminPage.getElementById("bundlebundlebundleA1.0.0")
+ .getTextContent().contains("bundleA"));
+ assertTrue(String.format(
+ "Bundle Artifact %s is not rendered properly", name),
+ adminPage.getElementById("bundlebundlebundleA1.0.0")
+ .getTextContent().contains("1.0.0"));
+ }
+ }
+
+ private void assertBundleArtifactState(String state) throws IOException {
+ if (adminPage.getElementById("bundlebundlebundleA1.0.0") != null) {
+ assertNotNull(
+ "User installed bundle artifact is not listed out in admin console",
+ adminPage.getElementById("bundlebundlebundleA1.0.0"));
+ if (adminPage.getElementById("bundlebundlebundleA1.0.0") != null) {
+ HtmlElement bundleChildElement = adminPage
+ .getElementById("bundlebundlebundleA1.0.0");
+ Iterator<HtmlElement> subIterator = bundleChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement bundleChildHtmlElement = subIterator.next();
+ if (bundleChildHtmlElement.getTagName().equals("img")) {
+ bundleChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Bundle Artifact state %s is not Exists",
+ state),
+ adminPage
+ .getElementById(
+ "bundlebundlebundleA1.0.0bundlebundleA1.0.0ACTIVE")
+ .getTextContent().contains(state));
+ assertTrue(
+ String
+ .format(
+ "Bundle Artifact %s is not showing up the User installed status",
+ "bundleA 1.0.0"),
+ adminPage
+ .getElementById(
+ "bundlebundlebundleA1.0.0bundlebundleA1.0.0user.installed")
+ .getTextContent().contains(
+ "user.installed"));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void assertBundleArtifactDependents(String name, String version, String state)
+ throws IOException {
+ if (adminPage.getElementById("bundlebundlebundleA1.0.0") != null) {
+ assertNotNull(
+ String
+ .format(
+ "Bundle Dependent artifact %s is not listed out in admin console",
+ name),
+ adminPage
+ .getElementById("bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0"));
+ if (adminPage
+ .getElementById("bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0") != null) {
+ HtmlElement bundleChildChildElement = adminPage
+ .getElementById("bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0");
+ Iterator<HtmlElement> subIterator = bundleChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement bundleChildChildHtmlElement = subIterator
+ .next();
+ if (bundleChildChildHtmlElement.getTagName().equals("img")) {
+ bundleChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Dependent Bundle Artifact %s does not exist",
+ name),
+ adminPage
+ .getElementById(
+ "bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0")
+ .getTextContent().contains(name));
+ assertTrue(
+ String
+ .format(
+ "Dependent Bundle Artifact %s does not exist",
+ name),
+ adminPage
+ .getElementById(
+ "bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0")
+ .getTextContent().contains(version));
+ assertTrue(
+ String
+ .format(
+ "Dependent Bundle Artifact %s state %s does not exist",
+ name, state),
+ adminPage
+ .getElementById(
+ "bundlebundlebundleA1.0.0bundlecom.springsource.javax.servlet2.5.0bundlecom.springsource.javax.servlet2.5.0ACTIVE")
+ .getTextContent().contains(state));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("bundle", "bundleA", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactStartAndStopTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactStartAndStopTests.java
new file mode 100644
index 0000000..17430cf
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactStartAndStopTests.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+public class BundleArtifactStartAndStopTests extends AbstractWebTests {
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;;
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/bundleA.jar"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void bundleArtifactStop() throws MalformedObjectNameException,
+ Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("bundle");
+ assertNotNull("Bundle Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleANode = adminPage
+ .getElementById("bundlebundlebundleA1.0.0");
+ if (bundleANode != null) {
+ clickBundleA(bundleANode);
+
+ HtmlElement stopButton = adminPage
+ .getElementById("dijit_form_Button_1");
+ assertNotNull(
+ "Stop button is not listed out in admin console",
+ stopButton);
+ stopButton.click();
+ waitForArtifactState("bundle", "bundleA", "1.0.0",
+ "RESOLVED", HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactState("bundle", "bundleA", "1.0.0",
+ "RESOLVED");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void clickBundleA(HtmlElement bundleANode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(bundleANode, 0), 2), 1).click();
+ }
+
+ @Test
+ public void bundleArtifactStart() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("bundle");
+ assertNotNull("Bundle Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleANode = adminPage.getElementById("bundlebundlebundleA1.0.0");
+ if (bundleANode != null) {
+ clickBundleA(bundleANode);
+
+ assertNotNull(
+ "Start button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_0"));
+ adminPage.getElementById("dijit_form_Button_0").click();
+ waitForArtifactState("bundle", "bundleA", "1.0.0",
+ "ACTIVE", HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactState("bundle", "bundleA", "1.0.0",
+ "ACTIVE");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertBundleArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Bundle Artifact %s:%s:%s is not in state %s", type, name,
+ version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("bundle", "bundleA", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactUninstallTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactUninstallTests.java
new file mode 100644
index 0000000..941f7db
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/BundleArtifactUninstallTests.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class BundleArtifactUninstallTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/bundleA.jar"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/bundleA.jar");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+
+ @Test
+ public void bundleArtifactUninstall() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("bundle");
+ assertNotNull("Bundle Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleANode = adminPage.getElementById("bundlebundlebundleA1.0.0");
+ if (bundleANode != null) {
+ clickBundleA(bundleANode);
+ assertNotNull(
+ "Uninstall button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_3"));
+ adminPage.getElementById("dijit_form_Button_3").click();
+ waitForMBeanDeRegister("bundle","bundleA","1.0.0",HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactNotExists("bundle", "bundleA", "1.0.0");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertBundleArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Bundle Artifact %s:%s:%s is still exist",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void clickBundleA(HtmlElement bundleANode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(bundleANode, 0), 2), 1).click();
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactDeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactDeployTests.java
new file mode 100644
index 0000000..189f761
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactDeployTests.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import javax.management.MalformedObjectNameException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ConfigurationArtifactDeployTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ }
+
+ @Test
+ public void configurationArtifactDeploy() throws Exception {
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ waitForArtifactState("configuration","foo","0.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertConfigurationArtifactState("configuration", "foo", "0.0.0",
+ "ACTIVE");
+ }
+
+ private void assertConfigurationArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertConfigurationArtifactExists(type, name, version);
+ assertEquals(String.format(
+ "Configuration Artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertConfigurationArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Configuration Artifact %s:%s:%s does not exist", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("configuration", "foo", "0.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRefreshTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRefreshTests.java
new file mode 100644
index 0000000..9ed1f75
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRefreshTests.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+@Ignore("bug 353996: user region configuration properties are not visible via JMX")
+public class ConfigurationArtifactRefreshTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+
+ @Test
+ public void configurationArtifactRefresh()
+ throws MalformedObjectNameException, IOException, Exception {
+ assertConfigurationArtifactExists("configuration", "foo", "0.0.0");
+ assertConfigurationArtifactRefresh();
+ }
+
+ private void assertConfigurationArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Configuration Artifact %s:%s:%s does not exist", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ // The following no longer works. See bug 353996.
+ assertTrue(getMBeanServerConnection().getAttribute(
+ getConfigObjectName("foo"), "Properties").toString().contains(
+ "bar"));
+ }
+
+ private void assertConfigurationArtifactRefresh()
+ throws MalformedObjectNameException, IOException, Exception {
+ assertTrue(getMBeanServerConnection().getAttribute(
+ getConfigObjectName("foo"), "Properties").toString().contains(
+ "bar"));
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "src/test/resources/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("src/test/resources/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("configuration");
+ assertNotNull("Configuration Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ if (adminPage
+ .getElementById("configurationconfigurationfoo0.0.0") != null) {
+ adminPage.getElementById(
+ "configurationconfigurationfoo0.0.0").click();
+ assertNotNull(
+ "Refresh button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_2"));
+ adminPage.getElementById("dijit_form_Button_2").click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ }
+
+ break;
+ }
+ }
+ }
+ assertTrue("Configuration Artifact Refresh is Not Successful",
+ getMBeanServerConnection().getAttribute(
+ getConfigObjectName("foo"), "Properties").toString()
+ .contains("boo"));
+ }
+
+ private ObjectName getConfigObjectName(String name)
+ throws MalformedObjectNameException {
+ return new ObjectName(String.format(
+ "org.eclipse.virgo.kernel:type=Configuration,name=%s", name));
+ }
+
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("configuration", "foo", "0.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRenderTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRenderTests.java
new file mode 100644
index 0000000..b0a1ebd
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactRenderTests.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ConfigurationArtifactRenderTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+
+ @Test
+ public void configurationArtifactRenderInAdminConsole() throws Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement propertiesElement = adminPage.getElementById("configuration");
+ assertNotNull("Configuration Artifacts are not Listed out Properly",
+ propertiesElement);
+ if (propertiesElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = propertiesElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement propertiesHtmlElement = iterator.next();
+ if (propertiesHtmlElement.getTagName().equals("img")) {
+ propertiesHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ assertConfigurationArtifactRender("configuration", "foo",
+ "0.0.0");
+ assertConfigurationArtifactState("foo 0.0.0", "ACTIVE");
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertConfigurationArtifactRender(String type, String name,
+ String version) throws Exception {
+ if (adminPage.getElementById("configurationconfigurationfoo0.0.0") != null) {
+ assertNotNull(String.format(
+ "Configration Artifact %s:%s:%s does not exist", type,
+ name, version), adminPage
+ .getElementById("configurationconfigurationfoo0.0.0"));
+ assertTrue(String.format(
+ "Configuration Artifact %s does not render properly", name),
+ adminPage.getElementById(
+ "configurationconfigurationfoo0.0.0")
+ .getTextContent().contains("foo"));
+ assertTrue(String.format(
+ "Configuration Artifact %s does not render properly", name),
+ adminPage.getElementById(
+ "configurationconfigurationfoo0.0.0")
+ .getTextContent().contains("0.0.0"));
+ }
+ }
+
+ private void assertConfigurationArtifactState(String name, String state)
+ throws IOException {
+ HtmlElement propertiesChildElement = adminPage
+ .getElementById("configurationconfigurationfoo0.0.0");
+ if (propertiesChildElement != null) {
+ Iterator<HtmlElement> subIterator = propertiesChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement propertiesChildHtmlElement = subIterator.next();
+ if (propertiesChildHtmlElement.getTagName().equals("img")) {
+ propertiesChildHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Configuration Artifact %s state %s is not render",
+ name, state),
+ adminPage
+ .getElementById(
+ "configurationconfigurationfoo0.0.0configurationfoo0.0.0ACTIVE")
+ .getTextContent().contains(state));
+ assertTrue(
+ String
+ .format(
+ "Configuration Artifact %s is not showing up the User installed status",
+ name),
+ adminPage
+ .getElementById(
+ "configurationconfigurationfoo0.0.0configurationfoo0.0.0user.installed")
+ .getTextContent().contains(
+ "user.installed"));
+ break;
+ }
+ }
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("configuration", "foo", "0.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactStartAndStopTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactStartAndStopTests.java
new file mode 100644
index 0000000..5e52940
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactStartAndStopTests.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+
+import java.util.Iterator;
+import javax.management.MalformedObjectNameException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ConfigurationArtifactStartAndStopTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void configurationArtifactStop()
+ throws MalformedObjectNameException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("configuration");
+ assertNotNull("Configuration Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement configNode = adminPage
+ .getElementById("configurationconfigurationfoo0.0.0");
+ if (configNode != null) {
+ clickConfig(configNode);
+ assertNotNull(
+ "Stop button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_1"));
+ adminPage.getElementById("dijit_form_Button_1").click();
+ waitForArtifactState("configuration","foo","0.0.0","RESOLVED",HALF_SECOND, TWO_MINUTES);
+ assertConfigurationArtifactState("configuration",
+ "foo", "0.0.0", "RESOLVED");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void clickConfig(HtmlElement configNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(configNode, 0), 2), 1).click();
+ }
+
+ @Test
+ public void configurationArtifactStart()
+ throws MalformedObjectNameException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("configuration");
+ assertNotNull("Configuration Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement configNode = adminPage
+ .getElementById("configurationconfigurationfoo0.0.0");
+ if (configNode != null) {
+ clickConfig(configNode);
+ assertNotNull(
+ "Start button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_0"));
+ adminPage.getElementById("dijit_form_Button_0").click();
+ waitForArtifactState("configuration","foo","0.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertConfigurationArtifactState("configuration",
+ "foo", "0.0.0", "ACTIVE");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertConfigurationArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Configuration Artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("configuration", "foo", "0.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactUninstallTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactUninstallTests.java
new file mode 100644
index 0000000..82600c1
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ConfigurationArtifactUninstallTests.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ConfigurationArtifactUninstallTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/foo.properties"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/foo.properties");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void configurationArtifactUninstall()
+ throws MalformedObjectNameException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("configuration");
+ assertNotNull("Configuration Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement configNode = adminPage
+ .getElementById("configurationconfigurationfoo0.0.0");
+ if (configNode != null) {
+ clickConfig(configNode);
+ assertNotNull(
+ "Uninstall button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_3"));
+ adminPage.getElementById("dijit_form_Button_3").click();
+ waitForMBeanDeRegister("configuration","foo","0.0.0",HALF_SECOND, TWO_MINUTES);
+ assertConfigurationArtifactNotExists("configuration",
+ "foo", "0.0.0");
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertConfigurationArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Configuration Artifact %s:%s:%s is still exist", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void clickConfig(HtmlElement configNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(configNode, 0), 2), 1).click();
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactDeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactDeployTests.java
new file mode 100644
index 0000000..b12af8f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactDeployTests.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ParArtifactDeployTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ }
+
+ @Test
+ public void parArtifactDeploy() throws Exception {
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ waitForArtifactState("par","appA","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactState("par", "appA", "1.0.0", "ACTIVE");
+ assertParArtifactDependents("bundle", "bundleA", "1.0.0");
+ assertParArtifactDependents("bundle", "bundleB", "1.0.0");
+ assertParArtifactDependents("configuration", "foo", "0.0.0");
+ assertParArtifactDependents("bundle", "appA-synthetic.context", "1.0.0");
+ }
+
+ private void assertParArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertParArtifactExists(type, name, version);
+ assertEquals(String.format("Par Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Par Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactDependents(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("par", "appA", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertTrue(String.format(
+ "Par Dependent Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ objectName));
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("par", "appA", "1.0.0"), "uninstall", params,
+ signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRefreshTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRefreshTests.java
new file mode 100644
index 0000000..97dec9f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRefreshTests.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ParArtifactRefreshTests extends AbstractWebTests {
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void parArtifactRefreshForASN() throws Exception {
+ assertParArtifactASNBeforeRefresh("par", "appA", "1.0.0");
+ assertParArtifactStateBeforeRefresh("par", "appA", "1.0.0", "ACTIVE");
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "src/test/resources/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("src/test/resources/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("par");
+ assertNotNull("Par Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ if (adminPage.getElementById("parparappA_Updated2.0.0") != null) {
+ adminPage.getElementById("parparappA_Updated2.0.0")
+ .click();
+ assertNotNull(
+ "Refresh button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_2"));
+ adminPage.getElementById("dijit_form_Button_2").click();
+ waitForArtifactState("par","appA_Updated","2.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactASNAfterRefresh("par", "appA_Updated",
+ "2.0.0");
+ assertParArtifactStateAfterRefresh("par",
+ "appA_Updated", "2.0.0", "ACTIVE");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertParArtifactASNBeforeRefresh(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertTrue(String.format("Par Artifact with ASN %s does not exist",
+ name), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactStateBeforeRefresh(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Par Artifact %s:%s:%s is not in state After Refresh %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactASNAfterRefresh(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertTrue(String.format("Par Artifact with ASN %s does not exist",
+ name), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactStateAfterRefresh(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Par Artifact %s:%s:%s is not in state After Refresh %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("par", "appA_Updated", "2.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRenderTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRenderTests.java
new file mode 100644
index 0000000..3cd95a8
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactRenderTests.java
@@ -0,0 +1,371 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ParArtifactRenderTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void parArtifactRenderInAdminConsole() throws Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement parElement = adminPage.getElementById("par");
+ assertNotNull("Par Artifacts are not Listed out Properly", parElement);
+ if (parElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = parElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement parHtmlElement = iterator.next();
+ if (parHtmlElement.getTagName().equals("img")) {
+ parHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ assertParArtifactRender("par", "appA", "1.0.0");
+ assertParArtifactAttributes("ACTIVE", "scoped-atomic");
+ assertParArtifactDependents();
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertParArtifactRender(String type, String name,
+ String version) throws Exception {
+ if (adminPage.getElementById("parparappA1.0.0") != null) {
+ assertNotNull(String.format(
+ "Par Artifact %s:%s:%s does not exist", type, name,
+ version), adminPage.getElementById("parparappA1.0.0"));
+ assertTrue(String.format("Par Artifact %s does not render properly",
+ name), adminPage.getElementById("parparappA1.0.0")
+ .getTextContent().contains("appA"));
+ assertTrue(String.format("Par Artifact %s does not render properly",
+ name), adminPage.getElementById("parparappA1.0.0")
+ .getTextContent().contains("1.0.0"));
+ }
+ }
+
+ private void assertParArtifactAttributes(String state, String scopedatomic)
+ throws IOException {
+ if (adminPage.getElementById("parparappA1.0.0") != null) {
+ assertNotNull(
+ String
+ .format(
+ "User installed Par artifact is not listed out in admin console",
+ "appA 1.0.0"), adminPage
+ .getElementById("parparappA1.0.0"));
+ if (adminPage.getElementById("parparappA1.0.0") != null) {
+ HtmlElement parChildElement = adminPage
+ .getElementById("parparappA1.0.0");
+ Iterator<HtmlElement> subIterator = parChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildHtmlElement = subIterator.next();
+ if (parChildHtmlElement.getTagName().equals("img")) {
+ parChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(String.format(
+ "Par Artifact %s state %s is not render",
+ "appA 1.0.0", state), adminPage.getElementById(
+ "parparappA1.0.0parappA1.0.0ACTIVE")
+ .getTextContent().contains(state));
+ assertTrue(
+ String
+ .format(
+ "Par Artifact %s scope %s is not render",
+ "appA 1.0.0", scopedatomic),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0parappA1.0.0scoped-atomic")
+ .getTextContent()
+ .contains(scopedatomic));
+
+ assertTrue(
+ String
+ .format(
+ "Par Artifact %s is not showing up the User installed status",
+ "appA 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0parappA1.0.0user.installed")
+ .getTextContent().contains(
+ "user.installed"));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void assertParArtifactDependents() throws IOException {
+ if (adminPage.getElementById("parparappA1.0.0") != null) {
+ if (adminPage
+ .getElementById("parparappA1.0.0configurationfoo0.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("parparappA1.0.0configurationfoo0.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(String.format(
+ "Dependent par Artifact %s does not exist",
+ "foo 0.0.0"), adminPage.getElementById(
+ "parparappA1.0.0configurationfoo0.0.0")
+ .getTextContent().contains("foo"));
+ assertTrue(String.format(
+ "Dependent par Artifact %s does not exist",
+ "foo 0.0.0"), adminPage.getElementById(
+ "parparappA1.0.0configurationfoo0.0.0")
+ .getTextContent().contains("0.0.0"));
+
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s state %s is not render",
+ "foo 0.0.0", "ACTIVE"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0configurationfoo0.0.0configurationfoo0.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-bundleA1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-bundleA1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not exist",
+ "appA-1-bundleA 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleA1.0.0")
+ .getTextContent().contains(
+ "appA-1-bundleA"));
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not exist",
+ "appA-1-bundleA 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleA1.0.0")
+ .getTextContent().contains(
+ "1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s state %s does not exist",
+ "appA-1-bundleA 1.0.0",
+ "ACTIVE"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleA1.0.0bundleappA-1-bundleA1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-bundleB1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-bundleB1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not render",
+ "appA-1-bundleB 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleB1.0.0")
+ .getTextContent().contains(
+ "appA-1-bundleB"));
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not render",
+ "appA-1-bundleB 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleB1.0.0")
+ .getTextContent().contains(
+ "1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s state %s does not render",
+ "appA-1-bundleB 1.0.0",
+ "ACTIVE"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleB1.0.0bundleappA-1-bundleB1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s type %s does not render",
+ "appA-1-bundleB 1.0.0",
+ "Web Bundle"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleB1.0.0bundleappA-1-bundleB1.0.0artifact-type: Web Bundle")
+ .getTextContent()
+ .contains("Web Bundle"));
+
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s context path %s is not render",
+ "appA-1-bundleB 1.0.0",
+ "/bundleBContext"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-bundleB1.0.0bundleappA-1-bundleB1.0.0org.eclipse.virgo.web.contextPath: /bundleBContext")
+ .getTextContent().contains(
+ "/bundleBContext"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-synthetic.context1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("parparappA1.0.0bundleappA-1-synthetic.context1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not render",
+ "appA-1-synthetic.context 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-synthetic.context1.0.0")
+ .getTextContent()
+ .contains(
+ "appA-1-synthetic.context"));
+ assertTrue(
+ String
+ .format(
+ "Dependent par Artifact %s does not render",
+ "appA-1-synthetic.context 1.0.0"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-synthetic.context1.0.0")
+ .getTextContent()
+ .contains(
+ "1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Dependent Par Artifact %s state %s does not render",
+ "appA-1-synthetic.context 1.0.0",
+ "ACTIVE"),
+ adminPage
+ .getElementById(
+ "parparappA1.0.0bundleappA-1-synthetic.context1.0.0bundleappA-1-synthetic.context1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("par", "appA", "1.0.0"), "uninstall", params,
+ signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactStartAndStopTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactStartAndStopTests.java
new file mode 100644
index 0000000..a74e20f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactStartAndStopTests.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ParArtifactStartAndStopTests extends AbstractWebTests {
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void parArtifactStop() throws MalformedObjectNameException,
+ Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("par");
+ assertNotNull("Par Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement parNode = adminPage.getElementById("parparappA1.0.0");
+ if (parNode != null) {
+ clickPar(parNode);
+ assertNotNull(
+ "Stop button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_1"));
+ adminPage.getElementById("dijit_form_Button_1").click();
+ waitForArtifactState("par","appA","1.0.0","RESOLVED",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactState("par", "appA", "1.0.0",
+ "RESOLVED");
+ assertParArtifactDependentsState("bundle", "bundleA",
+ "1.0.0", "RESOLVED");
+ assertParArtifactDependentsState("bundle", "bundleB",
+ "1.0.0", "RESOLVED");
+ assertParArtifactDependentsState("configuration", "foo",
+ "0.0.0", "RESOLVED");
+ assertParArtifactDependentsState("bundle",
+ "appA-synthetic.context", "1.0.0", "RESOLVED");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void clickPar(HtmlElement parNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(parNode, 0), 2), 1).click();
+ }
+
+ @Test
+ public void parArtifactStart() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("par");
+ assertNotNull("Par Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement parNode = adminPage.getElementById("parparappA1.0.0");
+ if (parNode != null) {
+ clickPar(parNode);
+ assertNotNull(
+ "Start button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_0"));
+ adminPage.getElementById("dijit_form_Button_0").click();
+ waitForArtifactState("par","appA","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactState("par", "appA", "1.0.0", "ACTIVE");
+ assertParArtifactDependentsState("bundle", "bundleA",
+ "1.0.0", "ACTIVE");
+ assertParArtifactDependentsState("bundle", "bundleB",
+ "1.0.0", "ACTIVE");
+ assertParArtifactDependentsState("configuration", "foo",
+ "0.0.0", "ACTIVE");
+ assertParArtifactDependentsState("bundle",
+ "appA-synthetic.context", "1.0.0", "ACTIVE");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertParArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format("Par Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactDependentsState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("par", "appA", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertEquals(String.format(
+ "Par Dependent Artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(objectName, "State"));
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("par", "appA", "1.0.0"), "uninstall", params,
+ signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactUninstallTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactUninstallTests.java
new file mode 100644
index 0000000..95f2431
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/ParArtifactUninstallTests.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class ParArtifactUninstallTests extends AbstractWebTests {
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException {
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/appA.par"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/appA.par");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void parArtifactUninstall() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("par");
+ assertNotNull("Par Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement parNode = adminPage.getElementById("parparappA1.0.0");
+ if (parNode != null) {
+ clickPar(parNode);
+ assertNotNull(
+ "Uninstall button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_3"));
+ adminPage.getElementById("dijit_form_Button_3").click();
+ waitForMBeanDeRegister("par","appA","1.0.0",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactNotExists("par", "appA", "1.0.0");
+ assertParArtifactDependentsNotExists("bundle",
+ "bundleA", "1.0.0");
+ assertParArtifactDependentsNotExists("bundle",
+ "bundleB", "1.0.0");
+ assertParArtifactDependentsNotExists("configuration",
+ "foo", "0.0.0");
+ assertParArtifactDependentsNotExists("bundle",
+ "appA-synthetic.context", "1.0.0");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void assertParArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Par Artifact %s:%s:%s is still exists",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactDependentsNotExists(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertFalse(String.format(
+ "Par Dependent Artifact %s:%s:%s is still exists", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void clickPar(HtmlElement parNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(parNode, 0), 2), 1).click();
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactDeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactDeployTests.java
new file mode 100644
index 0000000..c7a3796
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactDeployTests.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class PlanArtifactDeployTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ Thread.sleep(10000);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ }
+
+ @Test
+ public void planArtifactDeploy() throws Exception {
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ waitForArtifactState("plan","scoped.plan","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactState("plan", "scoped.plan", "1.0.0", "ACTIVE");
+ assertPlanReferencedArtifacts("bundle", "bundleA", "1.0.0");
+ assertPlanReferencedArtifacts("bundle", "bundleB", "1.0.0");
+ assertPlanReferencedArtifacts("configuration", "foo", "0.0.0");
+ assertPlanReferencedArtifacts("bundle",
+ "scoped.plan-synthetic.context", "1.0.0");
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ private void assertPlanArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertPlanArtifactExists(type, name, version);
+ assertEquals(String.format("Plan Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Plan Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanReferencedArtifacts(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("plan", "scoped.plan", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ objectName));
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("plan", "scoped.plan", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRefreshTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRefreshTests.java
new file mode 100644
index 0000000..00399a4
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRefreshTests.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.management.MalformedObjectNameException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class PlanArtifactRefreshTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ Thread.sleep(10000);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+
+ @Test
+ public void planArtifactRefreshForAtomicity() throws Exception {
+ assertPlanArtifactAtomicityBeforeRefresh("plan", "scoped.plan",
+ "1.0.0", true);
+ assertPlanArtifactStateBeforeRefresh("plan", "scoped.plan", "1.0.0",
+ "ACTIVE");
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "src/test/resources/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField
+ .setValueAttribute("src/test/resources/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("plan");
+ assertNotNull("Plan Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ if (adminPage.getElementById("planplanscoped.plan1.0.0") != null) {
+ adminPage.getElementById("planplanscoped.plan1.0.0")
+ .click();
+ assertNotNull(
+ "Refresh button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_2"));
+ adminPage.getElementById("dijit_form_Button_2").click();
+ waitForArtifactState("plan","scoped.plan","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactAtomicityAfterRefresh("plan",
+ "scoped.plan", "1.0.0", false);
+ assertPlanArtifactStateAfterRefresh("plan",
+ "scoped.plan", "1.0.0", "ACTIVE");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ private void assertPlanArtifactAtomicityBeforeRefresh(String type,
+ String name, String version, Boolean atomic) throws IOException,
+ Exception, MalformedObjectNameException {
+ assertEquals(
+ String
+ .format(
+ "Plan Artifact %s:%s:%s is not having Atomicity %s before Refresh ",
+ type, name, version, atomic), atomic,
+ getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "Atomic"));
+ }
+
+ private void assertPlanArtifactStateBeforeRefresh(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertPlanArtifactExists(type, name, version);
+ assertEquals(String.format(
+ "Plan Artifact %s:%s:%s is not in state %s before refresh",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactStateAfterRefresh(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertPlanArtifactExists(type, name, version);
+ assertEquals(String.format(
+ "Plan Artifact %s:%s:%s is not in state %s after Refresh ",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactAtomicityAfterRefresh(String type,
+ String name, String version, Boolean atomic) throws IOException,
+ Exception, MalformedObjectNameException {
+ assertEquals(
+ String
+ .format(
+ "Plan Artifact %s:%s:%s is not having Atomicity %s after Refresh ",
+ type, name, version, atomic), atomic,
+ getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "Atomic"));
+ }
+
+ private void assertPlanArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Plan Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("plan", "scoped.plan", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRenderTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRenderTests.java
new file mode 100644
index 0000000..96b6d7c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactRenderTests.java
@@ -0,0 +1,364 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+
+public class PlanArtifactRenderTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException,
+ InterruptedException {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ Thread.sleep(10000);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void planArtifactRenderInAdminConsole() throws Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement parElement = adminPage.getElementById("plan");
+ assertNotNull("Plan Artifacts are not Listed out Properly", parElement);
+ if (parElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = parElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement parHtmlElement = iterator.next();
+ if (parHtmlElement.getTagName().equals("img")) {
+ parHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ assertPlanArtifactRender("plan", "scoped.plan", "1.0.0");
+ assertPlanArtifactAttributesRender("ACTIVE", "scoped-atomic");
+ assertPlanReferencedArtifactsRender();
+ break;
+ }
+ }
+ }
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ private void assertPlanArtifactRender(String type, String name,
+ String version) throws Exception {
+ if (adminPage.getElementById("planplanscoped.plan1.0.0") != null) {
+ assertNotNull(String.format(
+ "Plan Artifact %s:%s:%s does not exist", type, name,
+ version), adminPage
+ .getElementById("planplanscoped.plan1.0.0"));
+ assertTrue(String.format("Plan Artifact %s does not render properly",
+ name), adminPage.getElementById("planplanscoped.plan1.0.0")
+ .getTextContent().contains("scoped.plan"));
+ assertTrue(String.format("Plan Artifact %s does not render properly",
+ name), adminPage.getElementById("planplanscoped.plan1.0.0")
+ .getTextContent().contains("1.0.0"));
+ }
+ }
+
+ private void assertPlanArtifactAttributesRender(String state, String scopedatomic) throws IOException {
+ if (adminPage.getElementById("planplanscoped.plan1.0.0") != null) {
+ assertNotNull(
+ "User installed Plan artifact is not listed out in admin console",
+ adminPage.getElementById("planplanscoped.plan1.0.0"));
+ if (adminPage.getElementById("planplanscoped.plan1.0.0") != null) {
+ HtmlElement parChildElement = adminPage
+ .getElementById("planplanscoped.plan1.0.0");
+ Iterator<HtmlElement> subIterator = parChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildHtmlElement = subIterator.next();
+ if (parChildHtmlElement.getTagName().equals("img")) {
+ parChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Plan Artifact %s state %s is not exists",
+ "scoped.plan 1.0.0", state),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0planscoped.plan1.0.0ACTIVE")
+ .getTextContent().contains(state));
+ assertTrue(
+ String
+ .format(
+ "Par Artifact %s scope %s is not exists",
+ "scoped.plan 1.0.0", scopedatomic),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0planscoped.plan1.0.0scoped-atomic")
+ .getTextContent().contains(scopedatomic));
+
+ assertTrue(
+ String
+ .format(
+ "Par Artifact %s is not showing up the User installed status",
+ "scoped.plan 1.0.0"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0planscoped.plan1.0.0user.installed")
+ .getTextContent().contains(
+ "user.installed"));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void assertPlanReferencedArtifactsRender() throws IOException {
+ if (adminPage.getElementById("planplanscoped.plan1.0.0") != null) {
+ if (adminPage
+ .getElementById("planplanscoped.plan1.0.0configurationfoo0.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("planplanscoped.plan1.0.0configurationfoo0.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "foo 0.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0configurationfoo0.0.0")
+ .getTextContent().contains("foo"));
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "foo 0.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0configurationfoo0.0.0")
+ .getTextContent().contains("0.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s state %s is not render",
+ "foo 0.0.0", "ACTIVE"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0configurationfoo0.0.0configurationfoo0.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage
+ .getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-bundleA1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-bundleA1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "scoped.plan-1-bundleA 1.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleA1.0.0")
+ .getTextContent().contains("scoped.plan-1-bundleA"));
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "scoped.plan-1-bundleA 1.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleA1.0.0")
+ .getTextContent().contains("1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s state %s is not render",
+ "scoped.plan-1-bundleA 1.0.0", "ACTIVE"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleA1.0.0bundlescoped.plan-1-bundleA1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage.getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "scoped.plan-1-bundleB 1.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0")
+ .getTextContent().contains("scoped.plan-1-bundleB"));
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s does not render correctly",
+ "scoped.plan-1-bundleB 1.0.0"), adminPage.getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0")
+ .getTextContent().contains("1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s state %s is not render",
+ "scoped.plan-1-bundleB 1.0.0", "ACTIVE"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0bundlescoped.plan-1-bundleB1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s type %s is not render",
+ "scoped.plan-1-bundleB 1.0.0", "Web Bundle"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0bundlescoped.plan-1-bundleB1.0.0artifact-type: Web Bundle")
+ .getTextContent()
+ .contains("Web Bundle"));
+
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s contextpath %s is not render",
+ "scoped.plan-1-bundleB 1.0.0",
+ "/bundleBContext"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-bundleB1.0.0bundlescoped.plan-1-bundleB1.0.0org.eclipse.virgo.web.contextPath: /bundleBContext")
+ .getTextContent().contains(
+ "/bundleBContext"));
+ break;
+ }
+ }
+ }
+
+ if (adminPage
+ .getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-synthetic.context1.0.0") != null) {
+ HtmlElement parChildChildElement = adminPage
+ .getElementById("planplanscoped.plan1.0.0bundlescoped.plan-1-synthetic.context1.0.0");
+ Iterator<HtmlElement> subIterator = parChildChildElement
+ .getFirstChild().getAllHtmlChildElements().iterator();
+ while (subIterator.hasNext()) {
+ HtmlElement parChildChildHtmlElement = subIterator.next();
+ if (parChildChildHtmlElement.getTagName().equals("img")) {
+ parChildChildHtmlElement.click();
+ webClient
+ .waitForBackgroundJavaScriptStartingBefore(500);
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s does not render",
+ "scoped.plan-1-synthetic.context 1.0.0"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-synthetic.context1.0.0")
+ .getTextContent()
+ .contains(
+ "scoped.plan-1-synthetic.context"));
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s does not render",
+ "scoped.plan-1-synthetic.context 1.0.0"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-synthetic.context1.0.0")
+ .getTextContent()
+ .contains(
+ "1.0.0"));
+ assertTrue(
+ String
+ .format(
+ "Plan Referenced Artifact %s state %s is not render",
+ "scoped.plan-1-synthetic.context 1.0.0",
+ "ACTIVE"),
+ adminPage
+ .getElementById(
+ "planplanscoped.plan1.0.0bundlescoped.plan-1-synthetic.context1.0.0bundlescoped.plan-1-synthetic.context1.0.0ACTIVE")
+ .getTextContent().contains("ACTIVE"));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("plan", "scoped.plan", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactStartAndStopTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactStartAndStopTests.java
new file mode 100644
index 0000000..f2ae665
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactStartAndStopTests.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class PlanArtifactStartAndStopTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ Thread.sleep(10000);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void planArtifactStop() throws MalformedObjectNameException,
+ Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("plan");
+ assertNotNull("Plan Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement planNode = adminPage.getElementById("planplanscoped.plan1.0.0");
+ if (planNode != null) {
+ clickPlan(planNode);
+ assertNotNull(
+ "Stop button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_1"));
+ adminPage.getElementById("dijit_form_Button_1").click();
+ waitForArtifactState("plan","scoped.plan","1.0.0","RESOLVED",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactState("plan", "scoped.plan", "1.0.0",
+ "RESOLVED");
+ assertPlanReferencedArtifactState("bundle", "bundleA",
+ "1.0.0", "RESOLVED");
+ assertPlanReferencedArtifactState("bundle", "bundleB",
+ "1.0.0", "RESOLVED");
+ assertPlanReferencedArtifactState("configuration", "foo",
+ "0.0.0", "RESOLVED");
+ assertPlanReferencedArtifactState("bundle",
+ "scoped.plan-synthetic.context", "1.0.0",
+ "RESOLVED");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private void clickPlan(HtmlElement planNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(planNode, 0), 2), 1).click();
+ }
+
+ @Test
+ public void planArtifactStart() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("plan");
+ assertNotNull("Plan Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement planNode = adminPage.getElementById("planplanscoped.plan1.0.0");
+ if (planNode != null) {
+ clickPlan(planNode);
+
+ assertNotNull(
+ "Start button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_0"));
+ adminPage.getElementById("dijit_form_Button_0").click();
+ waitForArtifactState("plan","scoped.plan","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactState("plan", "scoped.plan", "1.0.0",
+ "ACTIVE");
+ assertPlanReferencedArtifactState("bundle", "bundleA",
+ "1.0.0", "ACTIVE");
+ assertPlanReferencedArtifactState("bundle", "bundleB",
+ "1.0.0", "ACTIVE");
+ assertPlanReferencedArtifactState("configuration", "foo",
+ "0.0.0", "ACTIVE");
+ assertPlanReferencedArtifactState("bundle",
+ "scoped.plan-synthetic.context", "1.0.0",
+ "ACTIVE");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ private void assertPlanArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format("Plan Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanReferencedArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("plan", "scoped.plan", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertEquals(String.format(
+ "Plan Referenced Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state,
+ getMBeanServerConnection()
+ .getAttribute(objectName, "State"));
+ }
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ Object[] params = {};
+ String[] signature = {};
+ getMBeanServerConnection().invoke(
+ getObjectName("plan", "scoped.plan", "1.0.0"), "uninstall",
+ params, signature);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactUninstallTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactUninstallTests.java
new file mode 100644
index 0000000..9d81a22
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminconsole/PlanArtifactUninstallTests.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminconsole;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import javax.management.MalformedObjectNameException;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class PlanArtifactUninstallTests extends AbstractWebTests {
+
+ private static HtmlPage adminPage = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+ private static WebClient webClient = null;
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws IOException,
+ InterruptedException {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ Thread.sleep(10000);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+
+ byte[] byteArray = FileCopyUtils.copyToByteArray(new File(
+ "./../test-apps/scopedplan.plan"));
+ final HtmlForm uploadform = adminPage.getFormByName("uploadForm");
+ final HtmlFileInput applicationField = uploadform
+ .getInputByName("application");
+ applicationField.setData(byteArray);
+ applicationField.setValueAttribute("./../test-apps/scopedplan.plan");
+ final HtmlSubmitInput uploadButton = uploadform
+ .getElementById("deploy_application_submit_button");
+ uploadform.submit(uploadButton);
+ }
+
+ @Test
+ public void planArtifactUninstall() throws MalformedObjectNameException,
+ IOException, Exception {
+ adminPage = webClient.getPage(AbstractWebTests.URL);
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement bundleElement = adminPage.getElementById("plan");
+ assertNotNull("Plan Artifacts are not Listed out Properly",
+ bundleElement);
+ if (bundleElement.getFirstChild() != null) {
+ Iterator<HtmlElement> iterator = bundleElement.getFirstChild()
+ .getAllHtmlChildElements().iterator();
+ while (iterator.hasNext()) {
+ HtmlElement bundleHtmlElement = iterator.next();
+ if (bundleHtmlElement.getTagName().equals("img")) {
+ bundleHtmlElement.click();
+ webClient.waitForBackgroundJavaScriptStartingBefore(500);
+ HtmlElement planNode = adminPage.getElementById("planplanscoped.plan1.0.0");
+ if (planNode != null) {
+ clickPlan(planNode);
+ assertNotNull(
+ "Uninstall button is not listed out in admin console",
+ adminPage.getElementById("dijit_form_Button_3"));
+ adminPage.getElementById("dijit_form_Button_3").click();
+ waitForMBeanDeRegister("plan","scoped.plan","1.0.0",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactNotExists("plan", "scoped.plan",
+ "1.0.0");
+ assertPlanReferencedArtifactsNotExists("bundle",
+ "bundleA", "1.0.0");
+ assertPlanReferencedArtifactsNotExists("bundle",
+ "bundleB", "1.0.0");
+ assertPlanReferencedArtifactsNotExists("configuration",
+ "foo", "0.0.0");
+ assertPlanReferencedArtifactsNotExists("bundle",
+ "scoped.plan-synthetic.context", "1.0.0");
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ private void assertPlanArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Plan Artifact %s:%s:%s is still exists",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanReferencedArtifactsNotExists(String type,
+ String name, String version) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertFalse(String.format(
+ "Plan Referenced Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void clickPlan(HtmlElement planNode) throws IOException {
+ // 1st child -> 3rd child -> 2nd child -> click
+ getHtmlChildElement(getHtmlChildElement(getHtmlChildElement(planNode, 0), 2), 1).click();
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminmetadata/ServerAdminMetadataTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminmetadata/ServerAdminMetadataTests.java
new file mode 100644
index 0000000..f59e968
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/adminmetadata/ServerAdminMetadataTests.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.adminmetadata;
+
+import net.sourceforge.jwebunit.html.Table;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.gargoylesoftware.htmlunit.DefaultCredentialsProvider;
+import com.gargoylesoftware.htmlunit.WebClient;
+
+public class ServerAdminMetadataTests extends AbstractWebTests {
+
+ private static WebClient webClient = null;
+ private static DefaultCredentialsProvider credentialsProvider = null;
+
+ @Before
+ public void testContextSetup() throws Exception {
+ getTestContext().setBaseUrl(AbstractWebTests.URL);
+ getTestContext().setAuthorization(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ webClient = new WebClient();
+ webClient.setThrowExceptionOnScriptError(false);
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ credentialsProvider = (DefaultCredentialsProvider) webClient
+ .getCredentialsProvider();
+ credentialsProvider.addCredentials(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ }
+
+ @Test
+ public void testServerProperties() throws Exception {
+ Table propTable;
+ webClient.setThrowExceptionOnScriptError(false);
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ getTester()
+ .beginAt("http://localhost:8080/admin/web/info/overview.htm");
+ getTester().assertTextPresent("Server Properties");
+ getTester().assertTablePresent("properties");
+
+ propTable = new Table(new Object[][] { { "Name", "Value" },
+ { "Java VM Description", getJavaVMDescription() },
+ { "Java Version", getJavaVersion() },
+ { "Operating System", getOperatingSystem() },
+ { "Server Time Zone", System.getProperty("user.timezone") },
+ { "Virgo Server Version", getServerVersion() } });
+ getTester().assertTableRowCountEquals("properties", 6);
+ getTester().assertTableEquals("properties", propTable);
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/configadmin/AddPropertyFilesForConfigAdminTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/configadmin/AddPropertyFilesForConfigAdminTests.java
new file mode 100644
index 0000000..872527e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/configadmin/AddPropertyFilesForConfigAdminTests.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.configadmin;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class AddPropertyFilesForConfigAdminTests extends AbstractWebTests {
+
+ private static final String APPS_DIR = "src/test/resources";
+ private static final String propertyFileName = "com.springsource.test.properties";
+
+ @Test
+ public void copyApplicationsToPickup() throws IOException,
+ InterruptedException {
+ FileCopyUtils.copy(new File(APPS_DIR, propertyFileName), new File(
+ getConfigDir(), propertyFileName));
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/dumpinspector/DumpInspectorTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/dumpinspector/DumpInspectorTests.java
new file mode 100644
index 0000000..90b4397
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/dumpinspector/DumpInspectorTests.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.dumpinspector;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.eclipse.virgo.util.io.FileSystemUtils;
+
+public class DumpInspectorTests extends AbstractWebTests {
+ private static final String APPS_DIR = "./src/test/resources";
+
+ private static final String[] APPLICATION_NAMES_USES_VOILATION = new String[] {
+ "eclipselink1.jar", "eclipselink2.jar", "spring.jar", "app1.jar" };
+
+ private static final String[] APPLICATION_NAMES_CLASSNOTFOUND = new String[] { "formtags-par-1.4.0.RELEASE_FAILURE.par" };
+ private static final String EXCLUDE_PATTERN = ".DS_Store";
+
+ @Before
+ public void testContextSetup() throws Exception {
+ getTestContext().setBaseUrl(
+ "http://localhost:8080/admin/web/dump/inspector.htm");
+ getTestContext().setAuthorization(AbstractWebTests.USER,
+ AbstractWebTests.PASSWORD);
+ }
+
+ @Test
+ public void testDumpContentInAdminScreenUponDumpGenerationOfUsesVoilation()
+ throws Exception {
+ if (getDumpDir() != null) {
+ FileSystemUtils.deleteRecursively(getDumpDir());
+ }
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR,
+ APPLICATION_NAMES_USES_VOILATION);
+ Thread.sleep(2000);
+ UrlWaitLatch.waitFor(
+ "http://localhost:8080/admin/web/dump/inspector.htm", USER,
+ PASSWORD);
+ getTester().beginAt(
+ "http://localhost:8080/admin/web/dump/inspector.htm");
+
+ File[] dumpIds = getDumpIds();
+ if (dumpIds != null) {
+ for (int i = 0; i < dumpIds.length; i++) {
+ if (!dumpIds[i].getName().equals(EXCLUDE_PATTERN)) {
+ getTester().clickButton("dump_selector_submit");
+ File[] dumpEntries = getDumpEntries(dumpIds[i]);
+ for (int j = 0; j < dumpEntries.length; j++) {
+ if (dumpEntries[j].getName().startsWith("summary")
+ && dumpEntries[j].getName().endsWith(".txt")) {
+ getTester().selectOptionByValue("dumpEntryName",
+ dumpEntries[j].getName());
+ getTester().clickButton("dump_selector_submit");
+ getTester().assertTextPresent(
+ "Cause: resolutionFailure");
+ }
+ }
+ }
+ }
+ }
+ FileSystemUtils.deleteRecursively(getDumpDir());
+ deleteApplicationsFromPickup(getPickupDir(),
+ APPLICATION_NAMES_USES_VOILATION);
+ }
+
+ @Ignore("Since dump is not generating on ClassNotFoundException as of 2.0.0.M5")
+ @Test
+ public void testDumpContentInAdminScreenUponDumpGenerationOfClassNotFounException()
+ throws Exception {
+
+ if (getDumpDir() != null) {
+ FileSystemUtils.deleteRecursively(getDumpDir());
+ }
+
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR,
+ APPLICATION_NAMES_CLASSNOTFOUND);
+ Thread.sleep(2000);
+
+ getTester().beginAt("http://localhost:8080/admin/web/dump/dump.htm");
+
+ File[] dumpIds = getDumpIds();
+ if (dumpIds != null) {
+
+ for (int i = 0; i < dumpIds.length; i++) {
+
+ if (!dumpIds[i].getName().equals(EXCLUDE_PATTERN)) {
+ getTester().selectOptionByValue("dumpID",
+ applyNameFormatting(dumpIds[i]));
+ getTester().clickButtonWithText("Select Dump");
+ File[] dumpEntries = getDumpEntries(dumpIds[i]);
+ assertEquals(5, dumpEntries.length);
+ for (int j = 0; j < dumpEntries.length; j++) {
+
+ getTester().selectOptionByValue("dumpEntryName",
+ dumpEntries[j].getName());
+ if (j == 0) {
+ assertEquals(true, dumpEntries[0].getName()
+ .startsWith("osgi")
+ && dumpEntries[0].getName()
+ .endsWith(".zip"));
+ }
+ if (j == 1) {
+ assertEquals(true, dumpEntries[1].getName()
+ .startsWith("summary")
+ && dumpEntries[1].getName()
+ .endsWith(".txt"));
+ }
+ if (j == 2) {
+ assertEquals(true, dumpEntries[2].getName()
+ .startsWith("system")
+ && dumpEntries[2].getName().endsWith(
+ ".json"));
+ }
+ if (j == 3) {
+ assertEquals(true, dumpEntries[3].getName()
+ .startsWith("thread")
+ && dumpEntries[3].getName()
+ .endsWith(".txt"));
+ }
+ if (j == 4) {
+ assertEquals(true, dumpEntries[4].getName()
+ .startsWith("trickle")
+ && dumpEntries[4].getName()
+ .endsWith(".log"));
+ }
+ getTester().assertTextPresent("Dump Entry Viewer");
+ if (dumpEntries[j].getName().startsWith("summary")
+ && dumpEntries[j].getName().endsWith(".txt")) {
+
+ getTester().clickButtonWithText("Select Entry");
+ getTester().assertTextPresent("Cause: ERROR");
+ }
+
+ }
+ }
+ }
+ }
+
+ deleteApplicationsFromPickup(getPickupDir(),
+ APPLICATION_NAMES_CLASSNOTFOUND);
+ Thread.sleep(1000);
+ FileSystemUtils.deleteRecursively(getDumpDir());
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/par/repository/PlanDeployReferencesParArtifactFromRepository.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/par/repository/PlanDeployReferencesParArtifactFromRepository.java
new file mode 100644
index 0000000..04c3139
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/par/repository/PlanDeployReferencesParArtifactFromRepository.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.par.repository;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Test;
+
+public class PlanDeployReferencesParArtifactFromRepository extends
+ AbstractWebTests {
+
+ private static final String APP_URI = "./../test-apps/parreferencedplan.plan";
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void planDeployReferencesParArtifactFromRepository() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactExists(type, name, version);
+ assertPlanArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void planUnDeployReferencesParArtifactFromRepository() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name, version };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactNotExists(type, name, version);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertPlanArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Plan Artifact referencing par artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Plan Artifact referencing par artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Plan Artifact referencing par artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/BundleArtifactPickupDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/BundleArtifactPickupDeployAndUndeployTests.java
new file mode 100644
index 0000000..6f095e7
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/BundleArtifactPickupDeployAndUndeployTests.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.pickup;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Test;
+
+public class BundleArtifactPickupDeployAndUndeployTests extends
+ AbstractWebTests {
+ private static final String APPS_DIR = "./../test-apps";
+ private static final String[] APPLICATION_NAMES = new String[] { "bundleA.jar" };
+
+ @Test
+ public void bundleArtifactDeploy() throws Exception {
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR, APPLICATION_NAMES);
+ waitForMBeanRegister("bundle", "bundleA", "1.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertBundleArtifactExists("bundle", "bundleA", "1.0.0");
+ waitForArtifactState("bundle","bundleA","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertBundleArtifactState("bundle", "bundleA", "1.0.0", "ACTIVE");
+ }
+
+ @Test
+ public void bundleArtifactUndeploy() throws Exception {
+ deleteApplicationsFromPickup(getPickupDir(), APPLICATION_NAMES);
+ waitForMBeanDeRegister("bundle", "bundleA", "1.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertBundleArtifactNotExists("bundle", "bundleA", "1.0.0");
+ }
+
+ private void assertBundleArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Bundle Artifact %s:%s:%s does not exist",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertBundleArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Bundle Artifact %s:%s:%s is not in state %s", type, name,
+ version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertBundleArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Bundle Artifact %s:%s:%s is still exists",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ConfigurationArtifactPickupDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ConfigurationArtifactPickupDeployAndUndeployTests.java
new file mode 100644
index 0000000..e5d339a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ConfigurationArtifactPickupDeployAndUndeployTests.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.pickup;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import javax.management.MalformedObjectNameException;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Test;
+
+public class ConfigurationArtifactPickupDeployAndUndeployTests extends
+ AbstractWebTests {
+
+ private static final String APPS_DIR = "./../test-apps";
+ private static final String[] APPLICATION_NAMES = new String[] { "foo.properties" };
+
+ @Test
+ public void configurationArtifactDeploy() throws Exception {
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR, APPLICATION_NAMES);
+ waitForMBeanRegister("configuration", "foo", "0.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertConfigurationArtifactExists("configuration", "foo", "0.0.0");
+ waitForArtifactState("configuration", "foo", "0.0.0", "ACTIVE",
+ HALF_SECOND, TWO_MINUTES);
+ assertConfigurationArtifactState("configuration", "foo", "0.0.0",
+ "ACTIVE");
+ }
+
+ @Test
+ public void configurationArtifactUndeploy() throws Exception {
+ deleteApplicationsFromPickup(getPickupDir(), APPLICATION_NAMES);
+ waitForMBeanDeRegister("configuration", "foo", "0.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertConfigurationArtifactNotExists("configuration", "foo", "0.0.0");
+ }
+
+ private void assertConfigurationArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Configuration Artifact %s:%s:%s does not exist", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertConfigurationArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Configuration Artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertConfigurationArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Configuration Artifact %s:%s:%s is still exists", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ParArtifactPickupDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ParArtifactPickupDeployAndUndeployTests.java
new file mode 100644
index 0000000..4bac290
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/ParArtifactPickupDeployAndUndeployTests.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.pickup;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.junit.Test;
+
+public class ParArtifactPickupDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APPS_DIR = "./../test-apps";
+ private static final String[] APPLICATION_NAMES = new String[] { "appA.par" };
+
+ @Test
+ public void parArtifactDeploy() throws Exception {
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR, APPLICATION_NAMES);
+ waitForMBeanRegister("par", "appA", "1.0.0", HALF_SECOND, TWO_MINUTES);
+ assertParArtifactExists("par", "appA", "1.0.0");
+ waitForArtifactState("par","appA","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertParArtifactState("par", "appA", "1.0.0", "ACTIVE");
+ assertParArtifactDependents("bundle", "bundleA", "1.0.0");
+ assertParArtifactDependents("bundle", "bundleB", "1.0.0");
+ assertParArtifactDependents("configuration", "foo", "0.0.0");
+ assertParArtifactDependents("bundle", "appA-synthetic.context", "1.0.0");
+ }
+
+ @Test
+ public void parArtifactUndeploy() throws Exception {
+ deleteApplicationsFromPickup(getPickupDir(), APPLICATION_NAMES);
+ Thread.sleep(5000);
+ waitForMBeanDeRegister("par", "appA", "1.0.0", HALF_SECOND, TWO_MINUTES);
+ assertParArtifactNotExists("par", "appA", "1.0.0");
+ }
+
+ private void assertParArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Par Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format("Par Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Par Artifact %s:%s:%s is still exists",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertParArtifactDependents(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("par", "appA", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertTrue(String.format(
+ "Par Dependent Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ objectName));
+ }
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/PlanArtifactPickupDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/PlanArtifactPickupDeployAndUndeployTests.java
new file mode 100644
index 0000000..8a816af
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/pickup/PlanArtifactPickupDeployAndUndeployTests.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.pickup;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class PlanArtifactPickupDeployAndUndeployTests extends AbstractWebTests {
+ private static final String APPS_DIR = "./../test-apps";
+ private static final String[] APPLICATION_NAMES = new String[] { "scopedplan.plan" };
+ private static final String ARTIFACTSDIR = "./../test-apps";
+ private static String[] artifactNames = new String[] { "bundleA.jar",
+ "bundleB.war", "foo.properties" };
+
+ @BeforeClass
+ public static void testContextSetup() throws Exception {
+ copyPlanReferencedArtifactsToRepository(getRepositoryUsrDir(),
+ ARTIFACTSDIR, artifactNames);
+ }
+
+ private static void copyPlanReferencedArtifactsToRepository(String usrDir,
+ String artifactsDir, String[] artifactsNames) throws IOException,
+ InterruptedException {
+ for (String artifactName : artifactsNames) {
+ FileCopyUtils.copy(new File(artifactsDir, artifactName), new File(
+ usrDir, artifactName));
+ }
+ }
+
+ @Test
+ public void planArtifactDeploy() throws Exception {
+ copyApplicationsToPickup(getPickupDir(), APPS_DIR, APPLICATION_NAMES);
+ waitForMBeanRegister("plan", "scoped.plan", "1.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertPlanArtifactExists("plan", "scoped.plan", "1.0.0");
+ waitForArtifactState("plan","scoped.plan","1.0.0","ACTIVE",HALF_SECOND, TWO_MINUTES);
+ assertPlanArtifactState("plan", "scoped.plan", "1.0.0", "ACTIVE");
+ assertPlanReferencedArtifacts("bundle", "bundleA", "1.0.0");
+ assertPlanReferencedArtifacts("bundle", "bundleB", "1.0.0");
+ assertPlanReferencedArtifacts("configuration", "foo", "0.0.0");
+ assertPlanReferencedArtifacts("bundle",
+ "scoped.plan-synthetic.context", "1.0.0");
+ }
+
+ @Test
+ public void planArtifactUndeploy() throws Exception {
+ deleteApplicationsFromPickup(getPickupDir(), APPLICATION_NAMES);
+ Thread.sleep(5000);
+ waitForMBeanDeRegister("plan", "scoped.plan", "1.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertPlanArtifactNotExists("plan", "scoped.plan", "1.0.0");
+ }
+
+ private void assertPlanArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format("Plan Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format("Plan Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertPlanArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Plan Artifact %s:%s:%s is still exists",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertPlanReferencedArtifacts(String type, String name,
+ String version) throws MalformedObjectNameException, IOException,
+ Exception {
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(getObjectName("plan", "scoped.plan", "1.0.0"),
+ "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertTrue(String.format(
+ "Plan Referenced Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ objectName));
+ }
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet24WarDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet24WarDeployAndUndeployTests.java
new file mode 100644
index 0000000..29b52a5
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet24WarDeployAndUndeployTests.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.rfc66;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+public class Rfc66Servlet24WarDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APP_URI = "./apps/servlet2.4-war.war";
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testServlet24WarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertServlet24WarArtifactExists(type, name, version);
+ UrlWaitLatch.waitFor("http://localhost:8080/servlet2.4-war/test.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/servlet2.4-war/requestForward.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/servlet2.4-war/requestInclude.htm");
+ assertServlet24WarArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void testServlet24WarUnDeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name, version };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/servlet2.4-war/");
+ assertServlet24WarArtifactNotExists(type, name, version);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertServlet24WarArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Servlet24 war Bundle Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertServlet24WarArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Servlet24 war Bundle Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertServlet24WarArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Servlet24 war Bundle Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet25WarDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet25WarDeployAndUndeployTests.java
new file mode 100644
index 0000000..3fbac24
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/rfc66/Rfc66Servlet25WarDeployAndUndeployTests.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.rfc66;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+public class Rfc66Servlet25WarDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APP_URI = "./apps/servlet2.5-war.war";
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testServlet25WarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertServlet25WarArtifactExists(type, name, version);
+ UrlWaitLatch.waitFor("http://localhost:8080/servlet2.5-war/test.htm");
+ UrlWaitLatch.waitFor("http://localhost:8080/servlet2.5-war/first.htm");
+ UrlWaitLatch.waitFor("http://localhost:8080/servlet2.5-war/second.htm");
+ assertServlet25WarArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void testServlet25WarUnDeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name, version };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/servlet2.5-war/test.htm");
+ assertServlet25WarArtifactNotExists(type, name, version);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertServlet25WarArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Servlet25 war Bundle Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertServlet25WarArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Servlet25 war Bundle Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertServlet25WarArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Servlet25 war Bundle Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsDeployAndUndeployTests.java
new file mode 100644
index 0000000..a0ad656
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsDeployAndUndeployTests.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+
+public class FormTagsDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APP_URI_PAR = "./apps/formtags-par-2.0.1.BUILD-20100413113234.par";
+ private static final String APP_URI_WAR = "./apps/formtags-war-2.0.1.BUILD-20100413113234.war";
+ private static final String APP_URI_BUNDLE = "./apps/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar";
+ private static final String APP_URI_SHARED_SERVICES_WAR = "./apps/formtags-shared-services-war-2.0.1.BUILD-20100413113234.war";
+ private static final String APP_URI_SHARED_LIBRARIES_WAR = "./apps/formtags-shared-libs-2.0.1.BUILD-20100413113234.war";
+
+ private static String artifactType1 = null;
+ private static String artifactName1 = null;
+ private static String artifactVersion1 = null;
+
+ private static String artifactType2 = null;
+ private static String artifactName2 = null;
+ private static String artifactVersion2 = null;
+
+ private static String artifactType3 = null;
+ private static String artifactName3 = null;
+ private static String artifactVersion3 = null;
+
+ private static String artifactType4 = null;
+ private static String artifactName4 = null;
+ private static String artifactVersion4 = null;
+
+ private static String artifactType5 = null;
+ private static String artifactName5 = null;
+ private static String artifactVersion5 = null;
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testFormTagsParDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PAR).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName1 = compositeData.get("symbolicName").toString();
+ artifactType1 = compositeData.get("type").toString();
+ artifactVersion1 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType1, artifactName1, artifactVersion1);
+
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType1, artifactName1,
+ artifactVersion1), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertParArtifactDependents(objectName);
+ }
+ UrlWaitLatch.waitFor("http://localhost:8080/formtags-par");
+ UrlWaitLatch.waitFor("http://localhost:8080/formtags-par/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-par/form.htm?id=1");
+ assertArtifactState(artifactType1, artifactName1, artifactVersion1,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsParUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName1, artifactVersion1 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType1, artifactName1, artifactVersion1,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/formtags-par");
+ assertArtifactNotExists(artifactType1, artifactName1, artifactVersion1);
+ }
+
+ @Test
+ public void testFormTagsWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_WAR).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName2 = compositeData.get("symbolicName").toString();
+ artifactType2 = compositeData.get("type").toString();
+ artifactVersion2 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType2, artifactName2, artifactVersion2,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType2, artifactName2, artifactVersion2);
+ assertArtifactState(artifactType2, artifactName2, artifactVersion2,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName2, artifactVersion2 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType2, artifactName2, artifactVersion2,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists(artifactType2, artifactName2, artifactVersion2);
+ }
+
+ @Test
+ public void testFormTagsBundleDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_BUNDLE).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName3 = compositeData.get("symbolicName").toString();
+ artifactType3 = compositeData.get("type").toString();
+ artifactVersion3 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType3, artifactName3, artifactVersion3,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType3, artifactName3, artifactVersion3);
+ assertArtifactState(artifactType3, artifactName3, artifactVersion3,
+ "ACTIVE");
+ }
+
+
+ @Test
+ public void testFormTagsSharedServicesWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHARED_SERVICES_WAR).toURI()
+ .toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName4 = compositeData.get("symbolicName").toString();
+ artifactType4 = compositeData.get("type").toString();
+ artifactVersion4 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType4, artifactName4, artifactVersion4,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType4, artifactName4, artifactVersion4);
+ assertArtifactState(artifactType4, artifactName4, artifactVersion4,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsSharedServicesWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName4, artifactVersion4 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType4, artifactName4, artifactVersion4,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-shared-services-war-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists(artifactType4, artifactName4, artifactVersion4);
+ }
+
+ @Test
+ public void testFormTagsSharedLibrariesWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHARED_LIBRARIES_WAR).toURI()
+ .toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName5 = compositeData.get("symbolicName").toString();
+ artifactType5 = compositeData.get("type").toString();
+ artifactVersion5 = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType5, artifactName5, artifactVersion5);
+ assertArtifactState(artifactType5, artifactName5, artifactVersion5,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsSharedLibrariesWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName5, artifactVersion5 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType5, artifactName5, artifactVersion5,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234");
+ assertArtifactNotExists(artifactType5, artifactName5, artifactVersion5);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactDependents(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+
+ assertTrue("par dependent artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format("par dependent artifact is not in state %s",
+ "ACTIVE"), "ACTIVE", getMBeanServerConnection().getAttribute(
+ objectName, "State"));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsEmailParDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsEmailParDeployAndUndeployTests.java
new file mode 100644
index 0000000..178b05c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/FormTagsEmailParDeployAndUndeployTests.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+public class FormTagsEmailParDeployAndUndeployTests extends AbstractWebTests {
+ private static final String APP_URI = "./apps/formtags-email-par.par";
+
+ private static String artifactType = null;
+ private static String artifactName = null;
+ private static String artifactVersion = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testFormTagsEmailParDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ assertFormtagsEmailParArtifactExists(artifactType, artifactName,
+ artifactVersion);
+
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType, artifactName,
+ artifactVersion), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertFormtagsEmailParArtifactDependents(objectName);
+ }
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formTagsParWithWebModule/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formTagsParWithWebModule/bundleContext.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formTagsParWithWebModule/servletContext.htm");
+ assertFormtagsEmailParArtifactState(artifactType, artifactName,
+ artifactVersion, "ACTIVE");
+ }
+
+ @Test
+ public void testFormtagsEmailParUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName, artifactVersion };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/formTagsParWithWebModule");
+ assertFormtagsEmailParArtifactNotExists(artifactType, artifactName,
+ artifactVersion);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertFormtagsEmailParArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Formtags Email Par Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertFormtagsEmailParArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Formtags Email Par Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertFormtagsEmailParArtifactNotExists(String type,
+ String name, String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Formtags Email Par Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertFormtagsEmailParArtifactDependents(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertTrue("Formtags email par dependent artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format(
+ "Formtags email par dependent artifact is not in state %s",
+ "ACTIVE"), "ACTIVE", getMBeanServerConnection().getAttribute(
+ objectName, "State"));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/GreenPagesParDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/GreenPagesParDeployAndUndeployTests.java
new file mode 100644
index 0000000..c84c16c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/GreenPagesParDeployAndUndeployTests.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+public class GreenPagesParDeployAndUndeployTests extends AbstractWebTests {
+ private static final String APP_URI = "./apps/greenpages-solution-2.0.1.SNAPSHOT.par";
+ private static String artifactType = null;
+ private static String artifactName = null;
+ private static String artifactVersion = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testGreenPagesParDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ assertGreenpagesParArtifactExists(artifactType, artifactName,
+ artifactVersion);
+
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType, artifactName,
+ artifactVersion), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertGreenpagesParArtifactDependents(objectName);
+ }
+ UrlWaitLatch.waitFor("http://localhost:8080/greenpages/app/home.htm");
+ assertGreenpagesParArtifactState(artifactType, artifactName,
+ artifactVersion, "ACTIVE");
+ }
+
+ @Test
+ public void testGreenPagesParUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { artifactName, artifactVersion };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/greenpages/");
+ assertGreenpagesParArtifactNotExists(artifactType, artifactName,
+ artifactVersion);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertGreenpagesParArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Greenapges par artifact %s:%s:%s does not exist", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertGreenpagesParArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Greenpages par artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertGreenpagesParArtifactDependents(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertTrue("Greenpgaes par dependent artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format(
+ "Greenpgaes par dependent artifact is not in state %s",
+ "ACTIVE"), "ACTIVE", getMBeanServerConnection().getAttribute(
+ objectName, "State"));
+ }
+
+ private void assertGreenpagesParArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Greenpages par Artifact %s:%s:%s is still exists", type, name,
+ version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/HelloWorldSharedServicesWarDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/HelloWorldSharedServicesWarDeployAndUndeployTests.java
new file mode 100644
index 0000000..63e7ba6
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/HelloWorldSharedServicesWarDeployAndUndeployTests.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+
+public class HelloWorldSharedServicesWarDeployAndUndeployTests extends
+ AbstractWebTests {
+ private static final String APP_URI_BUNDLE1 = "./apps/hello.domain.jar";
+ private static final String APP_URI_BUNDLE2 = "./apps/hello.service.api.jar";
+ private static final String APP_URI_BUNDLE3 = "./apps/hello.service.impl-en.jar";
+ private static final String APP_URI_SHARED_SERVICES_WAR = "./apps/hello_war_shared_services.war";
+
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+ private static CompositeData compositeData=null;
+
+ @Test
+ public void testSharedServicesWarDeployWithDependencies() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_BUNDLE1).toURI().toString() };
+ compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(type, name, version);
+ assertArtifactState(type, name, version, "ACTIVE");
+
+ params = new Object[] { new File(APP_URI_BUNDLE2).toURI().toString() };
+ compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(type, name, version);
+ assertArtifactState(type, name, version, "ACTIVE");
+
+ params = new Object[] { new File(APP_URI_BUNDLE3).toURI().toString() };
+ compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(type, name, version);
+ assertArtifactState(type, name, version, "ACTIVE");
+
+ params = new Object[] { new File(APP_URI_SHARED_SERVICES_WAR).toURI()
+ .toString() };
+ compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/hello_war_shared_services/");
+ assertArtifactExists(type, name, version);
+ assertArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void testSharedServicesWarUndeployWithDependencies()
+ throws Exception, InterruptedException {
+ String[] signature = { String.class.getName(), String.class.getName() };
+ Object[] params1 = { "hello_war_shared_services", "1.0.0" };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params1, signature);
+ waitForMBeanDeRegister("bundle", "hello_war_shared_services", "1.0.0",
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/hello_war_shared_services/");
+ assertArtifactNotExists("bundle", "hello_war_shared_services", "1.0.0");
+
+ Object[] params2 = { "hello.service.impl_en", "1.0.0" };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params2, signature);
+ waitForMBeanDeRegister("bundle", "hello.service.impl_en", "1.0.0",
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists("bundle", "hello.service.impl_en", "1.0.0");
+
+ Object[] params3 = { "hello.service.api", "1.0.0" };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params3, signature);
+ waitForMBeanDeRegister("bundle", "hello.service.api", "1.0.0",
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactNotExists("bundle", "hello.service.api", "1.0.0");
+
+ Object[] params4 = { "hello.domain", "1.0.0" };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params4, signature);
+ waitForMBeanDeRegister("bundle", "hello.domain", "1.0.0", HALF_SECOND,
+ TWO_MINUTES);
+ assertArtifactNotExists("bundle", "hello.domain", "1.0.0");
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/StrutsFrameworkWarDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/StrutsFrameworkWarDeployAndUndeployTests.java
new file mode 100644
index 0000000..daca94a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/StrutsFrameworkWarDeployAndUndeployTests.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+public class StrutsFrameworkWarDeployAndUndeployTests extends AbstractWebTests {
+ private static final String APP_URI = "./target/bundles/struts2-mailreader.war";
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testStrutsWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertStrutsWarArtifactExists(type, name, version);
+ UrlWaitLatch.waitFor("http://localhost:8080/struts2-mailreader/");
+ assertStrutsWarArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void testStrutsWarUnDeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name, version };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/struts2-mailreader/");
+ assertStrutsWarArtifactNotExists(type, name, version);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertStrutsWarArtifactExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Struts war Bundle Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertStrutsWarArtifactState(String type, String name,
+ String version, String state) throws MalformedObjectNameException,
+ IOException, Exception {
+ assertEquals(String.format(
+ "Struts war Bundle Artifact %s:%s:%s is not in state %s", type,
+ name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertStrutsWarArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format(
+ "Struts war Bundle Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WarEmailDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WarEmailDeployAndUndeployTests.java
new file mode 100644
index 0000000..af117fa
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WarEmailDeployAndUndeployTests.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+import com.dumbster.smtp.SimpleSmtpServer;
+
+public class WarEmailDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APP_EMAIL_SHARED_LIBS_URI = "./apps/email-shared-libs-war.war";
+ private static final String APP_EMAIL_STANDARD_WAR_URI = "./apps/email-standard-war.war";
+
+ protected static final int SMTP_PORT = 2525;
+ SimpleSmtpServer server = null;
+ private static String type1 = null;
+ private static String name1 = null;
+ private static String version1 = null;
+
+ private static String type2 = null;
+ private static String name2 = null;
+ private static String version2 = null;
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testEmailSharedLibsWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_EMAIL_SHARED_LIBS_URI).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ name1 = compositeData.get("symbolicName").toString();
+ type1 = compositeData.get("type").toString();
+ version1 = compositeData.get("version").toString();
+ waitForMBeanRegister(type1, name1, version1, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/email-shared-libs-war/send?subject=Hola,%20Mundo");
+ server = SimpleSmtpServer.start(SMTP_PORT);
+
+ assertEquals("Verifying initial number of e-mails sent.", 0, server
+ .getReceivedEmailSize());
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/email-shared-libs-war/send?subject=Hola,%20Mundo");
+
+ assertEquals("Verifying final number of e-mails sent.", 1, server
+ .getReceivedEmailSize());
+ server.stop();
+ assertArtifactExists(type1, name1, version1);
+ assertArtifactState(type1, name1, version1, "ACTIVE");
+ }
+
+ @Test
+ public void testEmailSharedLibsWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name1, version1 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type1, name1, version1, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/email-shared-libs-war");
+ assertArtifactNotExists(type1, name1, version1);
+ }
+
+ @Test
+ public void testEmailStandardWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_EMAIL_STANDARD_WAR_URI).toURI()
+ .toString() };
+ CompositeData compositeData = deploy(signature, params);
+ name2 = compositeData.get("symbolicName").toString();
+ type2 = compositeData.get("type").toString();
+ version2 = compositeData.get("version").toString();
+ waitForMBeanRegister(type2, name2, version2, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/email-standard-war/send?subject=Hola,%20Mundo");
+ server = SimpleSmtpServer.start(SMTP_PORT);
+
+ assertEquals("Verifying initial number of e-mails sent.", 0, server
+ .getReceivedEmailSize());
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/email-standard-war/send?subject=Hola,%20Mundo");
+ assertEquals("Verifying final number of e-mails sent.", 1, server
+ .getReceivedEmailSize());
+ server.stop();
+ assertArtifactExists(type2, name2, version2);
+ assertArtifactState(type2, name2, version2, "ACTIVE");
+ }
+
+ @Test
+ public void testEmailStandardWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name2, version2 };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type2, name2, version2, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitForNotExistence("http://localhost:8080/email-standard-war");
+ assertArtifactNotExists(type2, name2, version2);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertArtifactNotExists(String type, String name,
+ String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(String.format("Artifact %s:%s:%s is still exists", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WicketFrameworkWarDeployAndUndeployTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WicketFrameworkWarDeployAndUndeployTests.java
new file mode 100644
index 0000000..22b9ae9
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/samples/WicketFrameworkWarDeployAndUndeployTests.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.samples;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+@Ignore
+public class WicketFrameworkWarDeployAndUndeployTests extends AbstractWebTests {
+
+ private static final String APP_URI = "./target/bundles/phonebook.war";
+ private static String type = null;
+ private static String name = null;
+ private static String version = null;
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ @Test
+ public void testWicketWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ name = compositeData.get("symbolicName").toString();
+ type = compositeData.get("type").toString();
+ version = compositeData.get("version").toString();
+
+ waitForMBeanRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ assertWicketFrameworkWarArtifactExists(type, name, version);
+ UrlWaitLatch.waitFor("http://localhost:8080/wicket-phonebook/");
+ assertWicketFrameworkWarArtifactState(type, name, version, "ACTIVE");
+ }
+
+ @Test
+ public void testWicketWarUndeploy() throws Exception {
+ signature = new String[] { String.class.getName(),
+ String.class.getName() };
+ params = new Object[] { name, version };
+ getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "undeploy", params, signature);
+ waitForMBeanDeRegister(type, name, version, HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch.waitForNotExistence("http://localhost:8080/wicket-phonebook/");
+ assertWicketFrameworkWarArtifactNotExists(type, name, version);
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertWicketFrameworkWarArtifactExists(String type,
+ String name, String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertTrue(String.format(
+ "Wicket framework war Bundle Artifact %s:%s:%s does not exist",
+ type, name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertWicketFrameworkWarArtifactState(String type,
+ String name, String version, String state)
+ throws MalformedObjectNameException, IOException, Exception {
+ assertEquals(
+ String
+ .format(
+ "Wicket framework war Bundle Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state,
+ getMBeanServerConnection().getAttribute(
+ getObjectName(type, name, version), "State"));
+ }
+
+ private void assertWicketFrameworkWarArtifactNotExists(String type,
+ String name, String version) throws IOException, Exception,
+ MalformedObjectNameException {
+ assertFalse(
+ String
+ .format(
+ "Wicket framework war Bundle Artifact %s:%s:%s is still exists",
+ type, name, version),
+ getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/AddAndRemoveBundlesToRepositoryTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/AddAndRemoveBundlesToRepositoryTests.java
new file mode 100644
index 0000000..3c648c3
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/AddAndRemoveBundlesToRepositoryTests.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.startclean;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+public class AddAndRemoveBundlesToRepositoryTests extends AbstractWebTests {
+
+ private static String[] bundleNames = new String[] {
+ "com.springsource.freemarker-2.3.15.jar",
+ "com.springsource.javax.persistence-1.0.0.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.h2-1.0.71.jar", "hello.domain.jar",
+ "hello.service.api.jar", "hello.service.impl-en.jar","bundleA.jar","bundleB.war","foo.properties","appA.par" };
+ private static String[] bundleNames_watched = new String[] {
+ "com.springsource.freemarker-2.3.15.jar",
+ "com.springsource.javax.persistence-1.0.0.jar",
+ "com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar",
+ "com.springsource.org.apache.commons.pool-1.3.0.jar",
+ "com.springsource.org.eclipse.persistence-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.antlr-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.asm-1.0.0.jar",
+ "com.springsource.org.eclipse.persistence.jpa-1.0.0.jar",
+ "com.springsource.org.h2-1.0.71.jar" };
+ private static String[] bundle = new String[] { "org.springframework.dmServer.testtool.incoho.domain-1.0.0.RELEASE.jar" };
+ private static String[] library = new String[] { "org.springframework.spring-library-2.5.4.A.libd" };
+ private static final String bundlesDir = "src/test/resources/bundles";
+ private static final String librariesDir = "src/test/resources/libraries";
+ private static String repositoryPropertiesDir = "src/test/resources/org.eclipse.virgo.repository.properties";
+ private static String hostedRepositoryPropertiesDir = "src/test/resources/org.eclipse.virgo.apps.repository.properties";
+
+ public void addBundlesToRepository(String repoDir) throws Exception {
+ for (String bundleName : bundle) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ repoDir, bundleName));
+ }
+ }
+
+ public void addLibrariesToRepository(String repoDir) throws Exception {
+ for (String libraryName : library) {
+ FileCopyUtils.copy(new File(librariesDir, libraryName), new File(
+ repoDir, libraryName));
+ }
+ }
+
+ public void addBundlesAndLibrariesToHostedRepository(String repoDir)
+ throws Exception {
+ for (String bundleName : bundleNames) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ repoDir, bundleName));
+ }
+ for (String libraryName : library) {
+ FileCopyUtils.copy(new File(librariesDir, libraryName), new File(
+ repoDir, libraryName));
+ }
+ }
+
+ public void addBundlesAndLibrariesToWatchedRepository(String repoDir)
+ throws Exception {
+ for (String bundleName : bundleNames_watched) {
+ FileCopyUtils.copy(new File(bundlesDir, bundleName), new File(
+ repoDir, bundleName));
+ }
+ for (String libraryName : library) {
+ FileCopyUtils.copy(new File(librariesDir, libraryName), new File(
+ repoDir, libraryName));
+ }
+ }
+
+ public void updateHostedRepoProperties(String hostedRepoPropertiesDir)
+ throws IOException {
+ FileCopyUtils.copy(new File(hostedRepositoryPropertiesDir), new File(
+ hostedRepoPropertiesDir));
+ }
+
+ public void updateRepositoryProperties(String repoPropertiesDir)
+ throws IOException {
+ FileCopyUtils.copy(new File(repositoryPropertiesDir), new File(
+ repoPropertiesDir));
+ }
+
+ @Test
+ public void testAddedBundlesToRepository() throws Exception {
+ addBundlesToRepository(getRepositoryUsrDir());
+ addBundlesToRepository(getRepositoryExtDir());
+ addLibrariesToRepository(getRepositoryUsrDir());
+ addLibrariesToRepository(getRepositoryExtDir());
+ updateHostedRepoProperties(getHostedRepositoryPropertiesDir());
+ addBundlesAndLibrariesToHostedRepository(getHostedRepoDir());
+ updateRepositoryProperties(getRepositoryPropertiesDir());
+ addBundlesAndLibrariesToWatchedRepository(getWatchedRepoDir());
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/CopyTempFilesToWorkAndServiceabilityDirectoriesForCleanStartTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/CopyTempFilesToWorkAndServiceabilityDirectoriesForCleanStartTests.java
new file mode 100644
index 0000000..8852863
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/CopyTempFilesToWorkAndServiceabilityDirectoriesForCleanStartTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.startclean;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.util.io.FileCopyUtils;
+
+
+public class CopyTempFilesToWorkAndServiceabilityDirectoriesForCleanStartTests extends AbstractWebTests{
+
+ private static final String APPS_DIR = "./src/test/resources";
+ private static final String fileName = "temp.txt";
+
+ protected static void copyTempFileToWorkAndServiceability(String tempDir,
+ String fileName, String checkDir) throws IOException {
+ FileCopyUtils.copy(new File(tempDir, fileName), new File(checkDir,
+ fileName));
+ }
+
+ @Test
+ public void testCopyTempFileToWorkAndServiceabilityDir() throws Exception {
+ copyTempFileToWorkAndServiceability(APPS_DIR, fileName, getWorkDir());
+ copyTempFileToWorkAndServiceability(APPS_DIR, fileName,
+ getServiceabilityDir());
+
+ File file = new File(getWorkDir(), "temp.txt");
+ assertTrue("temp file copied to work dir", file.exists());
+ file = new File(getServiceabilityDir(), "temp.txt");
+ assertTrue("temp file copied to serviceability dir", file.exists());
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/FormTagsDeploymentForCleanStartVerificationTests.java b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/FormTagsDeploymentForCleanStartVerificationTests.java
new file mode 100644
index 0000000..8e5f669
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/java/org/eclipse/virgo/server/svt/startclean/FormTagsDeploymentForCleanStartVerificationTests.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.server.svt.startclean;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+
+import org.eclipse.virgo.server.svt.AbstractWebTests;
+import org.eclipse.virgo.server.svt.UrlWaitLatch;
+import org.junit.Test;
+
+
+
+public class FormTagsDeploymentForCleanStartVerificationTests extends
+ AbstractWebTests {
+
+ private static final String APP_URI_PAR = "./apps/formtags-par-2.0.1.BUILD-20100413113234.par";
+ private static final String APP_URI_WAR = "./apps/formtags-war-2.0.1.BUILD-20100413113234.war";
+ private static final String APP_URI_SHARED_LIBRARIES_WAR = "./apps/formtags-shared-libs-2.0.1.BUILD-20100413113234.war";
+
+ private static String[] signature = null;
+ private static Object[] params = null;
+
+ String artifactType = null;
+ String artifactName = null;
+ String artifactVersion = null;
+
+ @Test
+ public void testFormTagsParDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_PAR).toURI().toString() };
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ assertArtifactExists(artifactType, artifactName, artifactVersion);
+
+ ObjectName[] objectNameList = (ObjectName[]) getMBeanServerConnection()
+ .getAttribute(
+ getObjectName(artifactType, artifactName,
+ artifactVersion), "Dependents");
+ for (ObjectName objectName : objectNameList) {
+ assertParArtifactDependents(objectName);
+ }
+ UrlWaitLatch.waitFor("http://localhost:8080/formtags-par");
+ UrlWaitLatch.waitFor("http://localhost:8080/formtags-par/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-par/form.htm?id=1");
+ assertArtifactState(artifactType, artifactName, artifactVersion,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_WAR).toURI().toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-war-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType, artifactName, artifactVersion);
+ assertArtifactState(artifactType, artifactName, artifactVersion,
+ "ACTIVE");
+ }
+
+ @Test
+ public void testFormTagsSharedLibrariesWarDeploy() throws Exception {
+ signature = new String[] { String.class.getName() };
+ params = new Object[] { new File(APP_URI_SHARED_LIBRARIES_WAR).toURI()
+ .toString() };
+
+ CompositeData compositeData = deploy(signature, params);
+ artifactName = compositeData.get("symbolicName").toString();
+ artifactType = compositeData.get("type").toString();
+ artifactVersion = compositeData.get("version").toString();
+
+ waitForMBeanRegister(artifactType, artifactName, artifactVersion,
+ HALF_SECOND, TWO_MINUTES);
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234/list.htm");
+ UrlWaitLatch
+ .waitFor("http://localhost:8080/formtags-shared-libs-2.0.1.BUILD-20100413113234/form.htm?id=1");
+ assertArtifactExists(artifactType, artifactName, artifactVersion);
+ assertArtifactState(artifactType, artifactName, artifactVersion,
+ "ACTIVE");
+ }
+
+ private static CompositeData deploy(String[] signature, Object[] params)
+ throws Exception {
+ CompositeData compsiteData = (CompositeData) getMBeanServerConnection()
+ .invoke(
+ new ObjectName(
+ "org.eclipse.virgo.kernel:category=Control,type=Deployer"),
+ "deploy", params, signature);
+ return compsiteData;
+ }
+
+ private void assertArtifactExists(String type, String name, String version)
+ throws IOException, Exception, MalformedObjectNameException {
+ assertTrue(String.format("Artifact %s:%s:%s does not exist", type,
+ name, version), getMBeanServerConnection().isRegistered(
+ getObjectName(type, name, version)));
+ }
+
+ private void assertArtifactState(String type, String name, String version,
+ String state) throws MalformedObjectNameException, IOException,
+ Exception {
+ assertEquals(String.format("Artifact %s:%s:%s is not in state %s",
+ type, name, version, state), state, getMBeanServerConnection()
+ .getAttribute(getObjectName(type, name, version), "State"));
+ }
+
+ private void assertParArtifactDependents(ObjectName objectName)
+ throws MalformedObjectNameException, IOException, Exception {
+
+ assertTrue("par dependent artifact does not exist",
+ getMBeanServerConnection().isRegistered(objectName));
+ assertEquals(String.format("par dependent artifact is not in state %s",
+ "ACTIVE"), "ACTIVE", getMBeanServerConnection().getAttribute(
+ objectName, "State"));
+ }
+}
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/app1.jar b/org.eclipse.virgo.server.svt/src/test/resources/app1.jar
new file mode 100644
index 0000000..6165601
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/app1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/appA.par b/org.eclipse.virgo.server.svt/src/test/resources/appA.par
new file mode 100644
index 0000000..de37ef2
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/appA.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundleA.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundleA.jar
new file mode 100644
index 0000000..352088a
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundleA.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/appA.par b/org.eclipse.virgo.server.svt/src/test/resources/bundles/appA.par
new file mode 100644
index 0000000..4e68e97
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/appA.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleA.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleA.jar
new file mode 100644
index 0000000..7fed148
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleA.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleB.war b/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleB.war
new file mode 100644
index 0000000..63d495e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/bundleB.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar
new file mode 100644
index 0000000..9bf1020
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.freemarker-2.3.15.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar
new file mode 100644
index 0000000..9fcc5ae
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.javax.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
new file mode 100644
index 0000000..a8ef066
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
new file mode 100644
index 0000000..7e45c21
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.apache.commons.pool-1.3.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
new file mode 100644
index 0000000..8a27959
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
new file mode 100644
index 0000000..31d1164
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.antlr-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
new file mode 100644
index 0000000..3b9a810
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.asm-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
new file mode 100644
index 0000000..1508f97
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.eclipse.persistence.jpa-1.0.0.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar
new file mode 100644
index 0000000..41dc982
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/com.springsource.org.h2-1.0.71.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/foo.properties b/org.eclipse.virgo.server.svt/src/test/resources/bundles/foo.properties
new file mode 100644
index 0000000..74d0a43
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/foo.properties
@@ -0,0 +1 @@
+foo=bar
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
new file mode 100644
index 0000000..5ed2f3b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/formtags-shared-services-service-2.0.1.BUILD-20100413113234.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.domain.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.domain.jar
new file mode 100644
index 0000000..097a95c
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.domain.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.api.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.api.jar
new file mode 100644
index 0000000..55d136d
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.api.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.impl-en.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.impl-en.jar
new file mode 100644
index 0000000..6bbfdeb
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/hello.service.impl-en.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/bundles/org.springframework.dmServer.testtool.incoho.domain-1.0.0.RELEASE.jar b/org.eclipse.virgo.server.svt/src/test/resources/bundles/org.springframework.dmServer.testtool.incoho.domain-1.0.0.RELEASE.jar
new file mode 100644
index 0000000..617191f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/bundles/org.springframework.dmServer.testtool.incoho.domain-1.0.0.RELEASE.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/com.springsource.test.properties b/org.eclipse.virgo.server.svt/src/test/resources/com.springsource.test.properties
new file mode 100644
index 0000000..62bc34b
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/com.springsource.test.properties
@@ -0,0 +1,2 @@
+foo=spring
+bar=source
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/configadminsample.jar b/org.eclipse.virgo.server.svt/src/test/resources/configadminsample.jar
new file mode 100644
index 0000000..b753e80
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/configadminsample.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/configservice.war b/org.eclipse.virgo.server.svt/src/test/resources/configservice.war
new file mode 100644
index 0000000..c20a449
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/configservice.war
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/eclipselink1.jar b/org.eclipse.virgo.server.svt/src/test/resources/eclipselink1.jar
new file mode 100644
index 0000000..042a020
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/eclipselink1.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/eclipselink2.jar b/org.eclipse.virgo.server.svt/src/test/resources/eclipselink2.jar
new file mode 100644
index 0000000..0e43bdc
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/eclipselink2.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/foo.properties b/org.eclipse.virgo.server.svt/src/test/resources/foo.properties
new file mode 100644
index 0000000..b2d4542
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/foo.properties
@@ -0,0 +1 @@
+foo=boo
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/formtags-par-1.4.0.RELEASE_FAILURE.par b/org.eclipse.virgo.server.svt/src/test/resources/formtags-par-1.4.0.RELEASE_FAILURE.par
new file mode 100644
index 0000000..aa938b0
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/formtags-par-1.4.0.RELEASE_FAILURE.par
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/libraries/org.springframework.spring-library-2.5.4.A.libd b/org.eclipse.virgo.server.svt/src/test/resources/libraries/org.springframework.spring-library-2.5.4.A.libd
new file mode 100644
index 0000000..b2fc534
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/libraries/org.springframework.spring-library-2.5.4.A.libd
@@ -0,0 +1,17 @@
+Library-SymbolicName: org.springframework.spring
+Library-Version: 2.5.4.A
+Library-Name: Spring Framework
+Import-Bundle:
+ org.springframework.aop;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.aspects;version="[2.5.4.A, 2.5.4.A]";import-scope:=application,
+ org.springframework.beans;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.context;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.context.support;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.core;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.jdbc;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.jms;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.orm;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.transaction;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.web;version="[2.5.4.A, 2.5.4.A]",
+ org.springframework.web.servlet;version="[2.5.4.A, 2.5.4.A]",
+ com.springsource.org.aopalliance;version="[1.0.0, 1.0.0]"
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.apps.repository.properties b/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.apps.repository.properties
new file mode 100644
index 0000000..410e42e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.apps.repository.properties
@@ -0,0 +1,4 @@
+hosted-repository.type=external
+hosted-repository.searchPattern=${user.home}/hosted/*
+
+
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.repository.properties b/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.repository.properties
new file mode 100644
index 0000000..80edbdd
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/org.eclipse.virgo.repository.properties
@@ -0,0 +1,14 @@
+ext.type=external
+ext.searchPattern=repository/ext/{artifact}
+
+usr.type=watched
+usr.watchDirectory=repository/usr
+
+watched-repo.type=watched
+watched-repo.watchDirectory=watched-repo
+
+remote-repo.type=remote
+remote-repo.uri=http://localhost:8080/org.eclipse.virgo.apps.repository/hosted-repository
+remote-repo.indexRefreshInterval=1
+
+chain=ext,usr,watched-repo,remote-repo
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/scopedplan.plan b/org.eclipse.virgo.server.svt/src/test/resources/scopedplan.plan
new file mode 100644
index 0000000..33ba84e
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/scopedplan.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="scoped.plan" version="1.0.0" scoped="true" atomic="false"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="bundle" name="bundleA" version="[1.0.0,2.0)"/>
+ <artifact type="bundle" name="bundleB" version="[1.0.0,2.0)"/>
+ <artifact type="configuration" name="foo" version="0"/>
+</plan>
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/spring.jar b/org.eclipse.virgo.server.svt/src/test/resources/spring.jar
new file mode 100644
index 0000000..4e0491f
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/spring.jar
Binary files differ
diff --git a/org.eclipse.virgo.server.svt/src/test/resources/temp.txt b/org.eclipse.virgo.server.svt/src/test/resources/temp.txt
new file mode 100644
index 0000000..13e6578
--- /dev/null
+++ b/org.eclipse.virgo.server.svt/src/test/resources/temp.txt
@@ -0,0 +1 @@
+TempFile used for verifying the removal of directories Work and Serviceability
\ No newline at end of file
diff --git a/test-apps/appA.par b/test-apps/appA.par
new file mode 100644
index 0000000..6042240
--- /dev/null
+++ b/test-apps/appA.par
Binary files differ
diff --git a/test-apps/bundleA.jar b/test-apps/bundleA.jar
new file mode 100644
index 0000000..f482de9
--- /dev/null
+++ b/test-apps/bundleA.jar
Binary files differ
diff --git a/test-apps/bundleB.war b/test-apps/bundleB.war
new file mode 100644
index 0000000..63d495e
--- /dev/null
+++ b/test-apps/bundleB.war
Binary files differ
diff --git a/test-apps/foo.properties b/test-apps/foo.properties
new file mode 100644
index 0000000..74d0a43
--- /dev/null
+++ b/test-apps/foo.properties
@@ -0,0 +1 @@
+foo=bar
diff --git a/test-apps/parreferencedplan.plan b/test-apps/parreferencedplan.plan
new file mode 100644
index 0000000..7a6c1e8
--- /dev/null
+++ b/test-apps/parreferencedplan.plan
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="parreferenced.plan" version="1.0.0" scoped="false" atomic="true"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="par" name="appA" version="[1.0.0,2.0)"/>
+
+</plan>
diff --git a/test-apps/scopedplan.plan b/test-apps/scopedplan.plan
new file mode 100644
index 0000000..60fbb30
--- /dev/null
+++ b/test-apps/scopedplan.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="scoped.plan" version="1.0.0" scoped="true" atomic="true"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="bundle" name="bundleA" version="[1.0.0,2.0)"/>
+ <artifact type="bundle" name="bundleB" version="[1.0.0,2.0)"/>
+ <artifact type="configuration" name="foo" version="0"/>
+</plan>
diff --git a/test-apps/unscopedplan.plan b/test-apps/unscopedplan.plan
new file mode 100644
index 0000000..97ffa08
--- /dev/null
+++ b/test-apps/unscopedplan.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="unscoped.plan" version="1.0.0" scoped="false" atomic="false"
+ xmlns="http://www.springsource.org/schema/dm-server/plan"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
+ http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
+
+ <artifact type="bundle" name="bundleA" version="[1.0.0,2.0)"/>
+ <artifact type="bundle" name="bundleB" version="[1.0.0,2.0)"/>
+ <artifact type="configuration" name="foo" version="0"/>
+</plan>