Author: chris.laprun(a)jboss.com
Date: 2010-06-17 14:18:57 -0400 (Thu, 17 Jun 2010)
New Revision: 3370
Modified:
components/wsrp/trunk/wsrp-producer-war/pom.xml
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java
Log:
- Moved some common code to WSRPProducerBaseTest.
- Added v2.ServiceDescriptionTestCase, which currently doesn't work. :(
- Removed log file use in cargo config.
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-17 16:42:42 UTC (rev 3369)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-06-17 18:18:57 UTC (rev 3370)
@@ -128,7 +128,7 @@
<scope>test</scope>
<version>${project.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-controller</artifactId>
<scope>test</scope>
@@ -142,10 +142,10 @@
</dependency>
<dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-api</artifactId>
- <version>1.0.0.Alpha2</version>
- <scope>test</scope>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-api</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -164,19 +164,19 @@
<artifactId>arquillian-jbossas-remote-51</artifactId>
<version>1.0.0.Alpha2</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <version>5.1.0.GA</version>
- <scope>test</scope>
- <type>pom</type>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>5.1.0.GA</version>
+ <scope>test</scope>
+ <type>pom</type>
</dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-server-manager</artifactId>
- <version>1.0.3.GA</version>
- <scope>test</scope>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-server-manager</artifactId>
+ <version>1.0.3.GA</version>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -195,59 +195,59 @@
</configuration>
</plugin>
<plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <finalName>test</finalName>
- <appendAssemblyId>true</appendAssemblyId>
- <!-- we don't want to add these archives into the repo -->
- <attach>false</attach>
-
<outputDirectory>${project.build.directory}/test-archives</outputDirectory>
- <descriptors>
- <descriptor>src/test/assembly/test-producer.xml</descriptor>
-
<descriptor>src/test/assembly/test-markup-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-renderparam-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-basic-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-dispatcher-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-getlocales-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-encodeurl-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-usercontext-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-multivalued-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-implicitcloning-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-resource-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-resourcenoencodeurl-portlet.xml</descriptor>
-
<descriptor>src/test/assembly/test-applicationscope-portlet.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>assemble</id>
- <!-- note that package phase happens after the test phase and before the
integration test phase -->
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-packaging-maven-plugin</artifactId>
- <version>2.1.1</version>
- </dependency>
- </dependencies>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>test</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <!-- we don't want to add these archives into the repo -->
+ <attach>false</attach>
+
<outputDirectory>${project.build.directory}/test-archives</outputDirectory>
+ <descriptors>
+
<descriptor>src/test/assembly/test-producer.xml</descriptor>
+
<descriptor>src/test/assembly/test-markup-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-renderparam-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-session-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-basic-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-dispatcher-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-getlocales-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-encodeurl-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-usercontext-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-multivalued-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-implicitcloning-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-resource-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-resourcenoencodeurl-portlet.xml</descriptor>
+
<descriptor>src/test/assembly/test-applicationscope-portlet.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <!-- note that package phase happens after the test phase and before
the integration test phase -->
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+ </dependencies>
</plugin>
@@ -262,104 +262,99 @@
</excludes>
</configuration>
<executions>
- <execution>
- <id>integration-tests</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <!--<skip>false</skip>-->
- <includes>
-
<include>org/gatein/wsrp/protocol/v1/MarkupTestCase.class</include>
-
<include>org/gatein/wsrp/protocol/v1/PortletManagementTestCase.class</include>
- <!--
<include>org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.class</include>
-->
-
<include>org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.class</include>
- </includes>
- <excludes>
- <exclude>org/gatein/wsrp/producer/**</exclude>
- <exclude>org/gatein/wsrp/registration/**</exclude>
- </excludes>
- </configuration>
- </execution>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <!--<skip>false</skip>-->
+ <includes>
+
<include>org/gatein/wsrp/protocol/v1/MarkupTestCase.class</include>
+
<include>org/gatein/wsrp/protocol/v1/PortletManagementTestCase.class</include>
+ <!--
<include>org/gatein/wsrp/protocol/v1/ReleaseSessionTestCase.class</include>
-->
+
<include>org/gatein/wsrp/protocol/v1/ServiceDescriptionTestCase.class</include>
+
<include>org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.class</include>
+ </includes>
+ <excludes>
+ <exclude>org/gatein/wsrp/producer/**</exclude>
+ <exclude>org/gatein/wsrp/registration/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.0.1</version>
- <configuration>
- <container>
- <containerId>jboss51x</containerId>
- <zipUrlInstaller>
- <url>${JBOSS_ZIP_URL}</url>
- <installDir>${basedir}/target/servers</installDir>
- </zipUrlInstaller>
- <log>${basedir}/target/jboss51x/container.log</log>
- <systemProperties>
- <!-- Since the tests run on the server, we need to pass system
properties to the
- server so that the tests can use them. -->
- <!-- The tests need to deploy and undeploy artifacts during the test
so we need to pass
- properties to enable this behaviour. -->
-
<jboss.deploy.dir>${jboss.server.home.dir}/conf</jboss.deploy.dir>
-
<test.deployables.dir>${basedir}/target/test-archives</test.deployables.dir>
-
<jboss.deploy.url.prefix>http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=</jboss.deploy.url.prefix>
-
<jboss.undeploy.url.prefix>http://localhost:8080//jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=</jboss.undeploy.url.prefix>
- </systemProperties>
- </container>
- <wait>false</wait>
- <configuration>
- <home>${basedir}/target/cargo</home>
- <properties>
-
<cargo.jvmargs>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</cargo.jvmargs>
- </properties>
- <deployables>
- <deployable>
- <groupId>org.gatein.wsrp</groupId>
- <artifactId>wsrp-producer</artifactId>
- <type>war</type>
- <properties>
- <context>wsrp-producer</context>
- </properties>
-
<pingURL>http://localhost:8080/wsrp-producer/MarkupService?WSDL</pingURL>
- </deployable>
- <deployable>
-
<location>${basedir}/target/test-archives/test-producer.sar</location>
- <type>sar</type>
- </deployable>
- </deployables>
- <configfiles>
- <configfile>
-
<file>${basedir}/target/servers/jboss-5.1.0.GA-jdk6/jboss-5.1.0.GA/server/default/conf/jboss-log4j.xml</file>
- <tofile>/conf/jboss-log4j.xml</tofile>
- </configfile>
- </configfiles>
- </configuration>
- </configuration>
- <executions>
- <execution>
- <id>pre-integration-start-server</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>post-integration-stop-server</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0.1</version>
+ <configuration>
+ <container>
+ <containerId>jboss51x</containerId>
+ <zipUrlInstaller>
+ <url>${JBOSS_ZIP_URL}</url>
+ <installDir>${basedir}/target/servers</installDir>
+ </zipUrlInstaller>
+ <log>${basedir}/target/jboss51x/container.log</log>
+ <systemProperties>
+ <!-- Since the tests run on the server, we need to pass system
properties to the
+ server so that the tests can use them. -->
+ <!-- The tests need to deploy and undeploy artifacts during the
test so we need to pass
+ properties to enable this behaviour. -->
+
<jboss.deploy.dir>${jboss.server.home.dir}/conf</jboss.deploy.dir>
+
<test.deployables.dir>${basedir}/target/test-archives</test.deployables.dir>
+
<jboss.deploy.url.prefix>http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=</jboss.deploy.url.prefix>
+
<jboss.undeploy.url.prefix>http://localhost:8080//jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service%3DMainDeployer&methodName=undeploy&argType=java.net.URL&arg0=</jboss.undeploy.url.prefix>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <home>${basedir}/target/cargo</home>
+ <properties>
+
<cargo.jvmargs>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</cargo.jvmargs>
+ </properties>
+ <deployables>
+ <deployable>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer</artifactId>
+ <type>war</type>
+ <properties>
+ <context>wsrp-producer</context>
+ </properties>
+
<pingURL>http://localhost:8080/wsrp-producer/MarkupService?WSDL</pingURL>
+ </deployable>
+ <deployable>
+
<location>${basedir}/target/test-archives/test-producer.sar</location>
+ <type>sar</type>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>pre-integration-start-server</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-integration-stop-server</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
- <testResources>
- <testResource>
- <directory>src/test/jboss-resources</directory>
- </testResource>
- </testResources>
+ <testResources>
+ <testResource>
+ <directory>src/test/jboss-resources</directory>
+ </testResource>
+ </testResources>
</build>
</project>
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-17
16:42:42 UTC (rev 3369)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/producer/WSRPProducerBaseTest.java 2010-06-17
18:18:57 UTC (rev 3370)
@@ -10,7 +10,7 @@
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
- * This software is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
@@ -23,55 +23,50 @@
package org.gatein.wsrp.producer;
+import junit.framework.TestCase;
+import org.gatein.registration.RegistrationException;
+import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
+
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
-import java.nio.channels.FileChannel;
-import javax.net.ssl.HttpsURLConnection;
-
-import junit.framework.TestCase;
-import org.gatein.common.NotYetImplemented;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 8808 $
*/
public abstract class WSRPProducerBaseTest extends TestCase
{
- protected WSRPProducerImpl producer = WSRPProducerImpl.getInstance();
-
protected WSRPProducerBaseTest(String name) throws Exception
{
super(name);
}
+ protected abstract WSRPProducer getProducer();
+
public void deploy(String warFileName) throws Exception
{
- String deployURLPrefix = System.getProperty("jboss.deploy.url.prefix");
- if (deployURLPrefix != null)
- {
- File archiveDirectory = getDirectory("test.deployables.dir");
- File archiveFile = getArchive(warFileName, archiveDirectory);
-
- String deployURLString = deployURLPrefix + archiveFile.getAbsolutePath();
-
- URL deployURL = new URL(deployURLString);
- URLConnection connection = deployURL.openConnection();
-
- BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
- reader.readLine();
- reader.close();
- }
- else
- {
- throw new Exception ("Could not find the jboss.deploy.url.prefix system
property.");
- }
+ String deployURLPrefix = System.getProperty("jboss.deploy.url.prefix");
+ if (deployURLPrefix != null)
+ {
+ File archiveDirectory = getDirectory("test.deployables.dir");
+ File archiveFile = getArchive(warFileName, archiveDirectory);
+
+ String deployURLString = deployURLPrefix + archiveFile.getAbsolutePath();
+
+ URL deployURL = new URL(deployURLString);
+ URLConnection connection = deployURL.openConnection();
+
+ BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
+ reader.readLine();
+ reader.close();
+ }
+ else
+ {
+ throw new Exception("Could not find the jboss.deploy.url.prefix system
property.");
+ }
}
public void undeploy(String warFileName) throws Exception
@@ -81,61 +76,85 @@
{
File archiveDirectory = getDirectory("test.deployables.dir");
File archiveFile = getArchive(warFileName, archiveDirectory);
-
+
String undeployURLString = undeployURLPrefix + archiveFile.getAbsolutePath();
-
+
URL undeployURL = new URL(undeployURLString);
URLConnection connection = undeployURL.openConnection();
-
+
BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
reader.readLine();
reader.close();
}
else
{
- throw new Exception ("Could not find the jboss.deploy.url.prefix system
property.");
+ throw new Exception("Could not find the jboss.deploy.url.prefix system
property.");
}
}
-
- private File getDirectory (String property) throws Exception
+
+ protected void resetRegistrationInfo() throws RegistrationException
{
- String deployableProperty = System.getProperty(property);
- if (deployableProperty != null)
- {
- File deployableDir = new File(deployableProperty);
- if (deployableDir.exists() && deployableDir.isDirectory())
- {
- return deployableDir;
- }
- else
- {
- throw new Error("Found a system property for \'" + property
+ "\' [" + deployableProperty + "] but value does not correspond to a
directory.");
- }
- }
- else
- {
- throw new Error ("Could not find the system property \'" +
property + "\' cannot deploy test archives.");
- }
+ WSRPProducer producer = getProducer();
+ ProducerRegistrationRequirements registrationRequirements =
producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequired(false);
+ registrationRequirements.clearRegistrationProperties();
+ registrationRequirements.clearRegistrationPropertyChangeListeners();
+ producer.getRegistrationManager().clear();
+
registrationRequirements.removeRegistrationPropertyChangeListener(producer.getRegistrationManager());
}
-
-
+
+ private File getDirectory(String property) throws Exception
+ {
+ String deployableProperty = System.getProperty(property);
+ if (deployableProperty != null)
+ {
+ File deployableDir = new File(deployableProperty);
+ if (deployableDir.exists() && deployableDir.isDirectory())
+ {
+ return deployableDir;
+ }
+ else
+ {
+ throw new Error("Found a system property for \'" + property +
"\' [" + deployableProperty + "] but value does not correspond to a
directory.");
+ }
+ }
+ else
+ {
+ throw new Error("Could not find the system property \'" + property
+ "\' cannot deploy test archives.");
+ }
+ }
+
+
private File getArchive(String fileName, File deployDirectory) throws Exception
{
- if (fileName != null && deployDirectory != null &&
deployDirectory.exists() && deployDirectory.isDirectory())
- {
- File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator
+ fileName);
- if (archiveFile.exists())
- {
- return archiveFile;
- }
- else
- {
- throw new Exception ("Archive " + fileName + " in directory
" + deployDirectory + " does not exist. Cannot deploy this file");
- }
- }
- else
- {
- throw new Exception("Cannot find archive to deploy. Archive name ["
+ fileName + "] is null or the deploy directory + [" + deployDirectory + "]
is not a directory");
- }
+ if (fileName != null && deployDirectory != null &&
deployDirectory.exists() && deployDirectory.isDirectory())
+ {
+ File archiveFile = new File(deployDirectory.getAbsoluteFile() + File.separator +
fileName);
+ if (archiveFile.exists())
+ {
+ return archiveFile;
+ }
+ else
+ {
+ throw new Exception("Archive " + fileName + " in directory
" + deployDirectory + " does not exist. Cannot deploy this file");
+ }
+ }
+ else
+ {
+ throw new Exception("Cannot find archive to deploy. Archive name [" +
fileName + "] is null or the deploy directory + [" + deployDirectory + "]
is not a directory");
+ }
}
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ resetRegistrationInfo();
+ }
+
+ public void tearDown() throws Exception
+ {
+ resetRegistrationInfo();
+ super.tearDown();
+ }
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-17
16:42:42 UTC (rev 3369)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v1/V1ProducerBaseTest.java 2010-06-17
18:18:57 UTC (rev 3370)
@@ -31,7 +31,6 @@
import org.gatein.wsrp.producer.ProducerHolder;
import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.WSRPProducerBaseTest;
-import org.gatein.wsrp.producer.WSRPProducerImpl;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.v1.WSRP1Producer;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -61,7 +60,7 @@
public abstract class V1ProducerBaseTest extends WSRPProducerBaseTest
{
private static final String CONSUMER = "test-consumer";
- protected WSRP1Producer producer = WSRP1Producer.getInstance();
+ protected WSRP1Producer producer = ProducerHolder.getV1Producer();
public V1ProducerBaseTest() throws Exception
@@ -74,20 +73,12 @@
super(name);
}
-
- public void setUp() throws Exception
+ @Override
+ protected WSRPProducer getProducer()
{
- super.setUp();
-
- resetRegistrationInfo();
+ return producer;
}
- public void tearDown() throws Exception
- {
- resetRegistrationInfo();
- super.tearDown();
- }
-
/**
* Checks that the specified portlet description corresponds to the expected
description of test-basic-portlet. If
* the handle parameter is not null, checks that it corresponds to the specified
portlet decription.
@@ -201,16 +192,6 @@
}
}
- protected void resetRegistrationInfo() throws RegistrationException
- {
- ProducerRegistrationRequirements registrationRequirements =
producer.getConfigurationService().getConfiguration().getRegistrationRequirements();
- registrationRequirements.setRegistrationRequired(false);
- registrationRequirements.clearRegistrationProperties();
- registrationRequirements.clearRegistrationPropertyChangeListeners();
- producer.getRegistrationManager().clear();
-
registrationRequirements.removeRegistrationPropertyChangeListener(producer.getRegistrationManager());
- }
-
protected V1GetServiceDescription getNoRegistrationServiceDescriptionRequest()
{
V1GetServiceDescription gs = WSRP1TypeFactory.createGetServiceDescription();
@@ -235,7 +216,7 @@
assertEquals(message + "Extensions", expected.getExtensions(),
tested.getExtensions());
assertEquals(message + "Locales", expected.getLocales(),
tested.getLocales());
assertEquals(message + "Modes", expected.getModes(),
tested.getModes());
-
+
Collections.sort(expected.getWindowStates());
Collections.sort(tested.getWindowStates());
assertEquals(message + "Window states", expected.getWindowStates(),
tested.getWindowStates());
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java 2010-06-17
16:42:42 UTC (rev 3369)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/ServiceDescriptionTestCase.java 2010-06-17
18:18:57 UTC (rev 3370)
@@ -24,8 +24,16 @@
package org.gatein.wsrp.protocol.v2;
import org.gatein.common.util.ParameterValidation;
+import org.gatein.wsrp.servlet.ServletAccess;
import org.gatein.wsrp.spec.v2.WSRP2Constants;
import org.gatein.wsrp.test.ExtendedAssert;
+import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.MockHttpServletResponse;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.After;
+import org.junit.Before;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.ServiceDescription;
@@ -38,11 +46,39 @@
*/
public class ServiceDescriptionTestCase extends V2ProducerBaseTest
{
- protected ServiceDescriptionTestCase() throws Exception
+ public ServiceDescriptionTestCase() throws Exception
{
super(ServiceDescriptionTestCase.class.getSimpleName());
}
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class);
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.setUp();
+ //hack to get around having to have a httpservletrequest when accessing the
producer services
+ //I don't know why its really needed, seems to be a dependency where wsrp
connects with the pc module
+
ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(null),
MockHttpServletResponse.createMockResponse());
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (System.getProperty("test.deployables.dir") != null)
+ {
+ super.tearDown();
+ }
+ }
+
+
public void testSupportedOptions() throws OperationFailed, InvalidRegistration
{
ServiceDescription description =
producer.getServiceDescription(getNoRegistrationServiceDescriptionRequest());
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java 2010-06-17
16:42:42 UTC (rev 3369)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/V2ProducerBaseTest.java 2010-06-17
18:18:57 UTC (rev 3370)
@@ -25,6 +25,7 @@
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.producer.ProducerHolder;
+import org.gatein.wsrp.producer.WSRPProducer;
import org.gatein.wsrp.producer.WSRPProducerBaseTest;
import org.gatein.wsrp.producer.v2.WSRP2Producer;
import org.oasis.wsrp.v2.GetServiceDescription;
@@ -35,13 +36,25 @@
*/
public class V2ProducerBaseTest extends WSRPProducerBaseTest
{
- protected WSRP2Producer producer = ProducerHolder.getV2Producer();
+ protected WSRP2Producer producer = ProducerHolder.getProducer(true);
+ public V2ProducerBaseTest() throws Exception
+ {
+ this("V2ProducerBaseTest");
+ }
+
protected V2ProducerBaseTest(String name) throws Exception
{
super(name);
+ producer.start();
}
+ @Override
+ protected WSRPProducer getProducer()
+ {
+ return producer;
+ }
+
protected GetServiceDescription getNoRegistrationServiceDescriptionRequest()
{
GetServiceDescription gs = WSRPTypeFactory.createGetServiceDescription();