[webbeans-commits] Webbeans SVN: r2357 - test-harness/trunk/tomcat/src/main/resources/META-INF.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 15:09:28 -0400 (Wed, 08 Apr 2009)
New Revision: 2357
Modified:
test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties
Log:
shorter shutdown :-)
Modified: test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties
===================================================================
--- test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-08 19:03:18 UTC (rev 2356)
+++ test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-08 19:09:28 UTC (rev 2357)
@@ -1 +1,2 @@
org.jboss.testharness.spi.Containers=org.jboss.testharness.integration.tomcat.TomcatConnector
+org.jboss.testharness.container.shutdownDelay=4000
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2356 - in extensions/trunk/tomcat/tests: src/test/resources/org/jboss/testharness/impl/packaging/jsr299 and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 15:03:18 -0400 (Wed, 08 Apr 2009)
New Revision: 2356
Added:
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
Modified:
extensions/trunk/tomcat/tests/
Log:
minor
Property changes on: extensions/trunk/tomcat/tests
___________________________________________________________________
Name: svn:ignore
+
.classpath
.settings
target
.project
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
===================================================================
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2355 - in test-harness/trunk: tomcat and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 15:00:07 -0400 (Wed, 08 Apr 2009)
New Revision: 2355
Modified:
test-harness/trunk/pom.xml
test-harness/trunk/tomcat/
test-harness/trunk/tomcat/pom.xml
test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java
Log:
fixes for the tomcat connector
Modified: test-harness/trunk/pom.xml
===================================================================
--- test-harness/trunk/pom.xml 2009-04-08 18:59:16 UTC (rev 2354)
+++ test-harness/trunk/pom.xml 2009-04-08 19:00:07 UTC (rev 2355)
@@ -124,6 +124,12 @@
<artifactId>catalina</artifactId>
<version>6.0.18</version>
</dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Property changes on: test-harness/trunk/tomcat
___________________________________________________________________
Name: svn:ignore
+
.classpath
.project
target
bin
.settings
Modified: test-harness/trunk/tomcat/pom.xml
===================================================================
--- test-harness/trunk/tomcat/pom.xml 2009-04-08 18:59:16 UTC (rev 2354)
+++ test-harness/trunk/tomcat/pom.xml 2009-04-08 19:00:07 UTC (rev 2355)
@@ -17,16 +17,16 @@
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness-api</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>catalina</artifactId>
- </dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
</dependencies>
Modified: test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java
===================================================================
--- test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java 2009-04-08 18:59:16 UTC (rev 2354)
+++ test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java 2009-04-08 19:00:07 UTC (rev 2355)
@@ -5,9 +5,16 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
+import org.apache.commons.httpclient.Credentials;
+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;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.log4j.Logger;
import org.jboss.testharness.api.DeploymentException;
import org.jboss.testharness.spi.Containers;
import org.jboss.testharness.spi.helpers.AbstractContainerConnector;
@@ -21,16 +28,24 @@
public class TomcatConnector extends AbstractContainerConnector implements Containers
{
+ private static final Logger log = Logger.getLogger(TomcatConnector.class);
+
private static final String SERVER_HOME_PROPERTY_NAME = "tomcat.home";
private String binDirectory;
private final File tmpdir;
+ private final HttpClient client;
public TomcatConnector() throws IOException
{
+ log.info("You must add the the tests/secret user to Tomcat, for example, in $CATALINA_BASE/conf/tomcat-users.xml add <user name=\"tests\" password=\"secret\" roles=\"standard,manager\" />");
tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
tmpdir.mkdir();
tmpdir.deleteOnExit();
+ client = new HttpClient();
+ client.getParams().setAuthenticationPreemptive(true);
+ Credentials credentials = new UsernamePasswordCredentials("tests", "secret");
+ client.getState().setCredentials(new AuthScope(null, 8080, null), credentials);
}
@Override
@@ -67,37 +82,38 @@
public void deploy(InputStream stream, String name) throws DeploymentException, IOException
{
- String deployUrl = getManagerUrl("deploy", "path=/" + name, "update=true");
- URLConnection connection = new URL(deployUrl).openConnection();
- if (!(connection instanceof HttpURLConnection))
+ String deployUrl = getManagerUrl("deploy", "path=/" + getContextName(name), "update=true");
+ PutMethod put = new PutMethod(deployUrl);
+ put.setRequestEntity(new InputStreamRequestEntity(stream));
+ try
{
- throw new IllegalStateException("Not an http connection! " + connection);
+ int status = client.executeMethod(put);
+ if (status != HttpURLConnection.HTTP_OK)
+ {
+ throw new DeploymentException(new String(put.getResponseBody()));
+ }
}
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
- httpConnection.setRequestMethod("PUT");
- httpConnection.connect();
- copy(stream, httpConnection.getOutputStream());
- httpConnection.disconnect();
- if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+ finally
{
- throw new DeploymentException(httpConnection.getResponseMessage());
+ put.releaseConnection();
}
}
public void undeploy(String name) throws IOException
{
- String deployUrl = getManagerUrl("undeploy", "path=/" + name);
- URLConnection connection = new URL(deployUrl).openConnection();
- if (!(connection instanceof HttpURLConnection))
+ String deployUrl = getManagerUrl("undeploy", "path=/" + getContextName(name));
+ HttpMethod get = new GetMethod(deployUrl);
+ try
{
- throw new IllegalStateException("Not an http connection! " + connection);
+ int status = client.executeMethod(get);
+ if (status != HttpURLConnection.HTTP_OK)
+ {
+ throw new IllegalStateException(new String(get.getResponseBody()));
+ }
}
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
- httpConnection.connect();
- httpConnection.disconnect();
- if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+ finally
{
- throw new IllegalStateException("Error undeploying app " + httpConnection.getResponseMessage());
+ get.releaseConnection();
}
}
@@ -118,5 +134,10 @@
}
return url;
}
+
+ protected String getContextName(String name)
+ {
+ return name.substring(0, name.length() - 4);
+ }
}
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2354 - in extensions/trunk/tomcat: build and 27 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 14:59:16 -0400 (Wed, 08 Apr 2009)
New Revision: 2354
Added:
extensions/trunk/tomcat/build.properties
extensions/trunk/tomcat/tests/
extensions/trunk/tomcat/tests/pom.xml
extensions/trunk/tomcat/tests/src/
extensions/trunk/tomcat/tests/src/etc/
extensions/trunk/tomcat/tests/src/etc/header.txt
extensions/trunk/tomcat/tests/src/main/
extensions/trunk/tomcat/tests/src/main/java/
extensions/trunk/tomcat/tests/src/main/resources/
extensions/trunk/tomcat/tests/src/test/
extensions/trunk/tomcat/tests/src/test/debug-resources/
extensions/trunk/tomcat/tests/src/test/debug-resources/META-INF/
extensions/trunk/tomcat/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties
extensions/trunk/tomcat/tests/src/test/java/
extensions/trunk/tomcat/tests/src/test/java/org/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/ExampleTest.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Game.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Generator.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Mock.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockExampleTest.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockSentenceTranslator.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Random.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceParser.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceTranslator.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/TextTranslator.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Translator.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/LookupTest.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Mouse.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/RatServlet.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/ServletInjectionTest.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Sewer.java
extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Vole.java
extensions/trunk/tomcat/tests/src/test/resources/
extensions/trunk/tomcat/tests/src/test/resources/org/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/war/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/war/custom-web.xml
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/examples/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/examples/beans.xml
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context-servlet-injection.xml
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context.xml
extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/web-servlet-injection.xml
extensions/trunk/tomcat/tests/unit-tests.xml
Modified:
extensions/trunk/tomcat/
extensions/trunk/tomcat/build/pom.xml
extensions/trunk/tomcat/pom.xml
Log:
add tests
Property changes on: extensions/trunk/tomcat
___________________________________________________________________
Name: svn:ignore
+
target
Modified: extensions/trunk/tomcat/build/pom.xml
===================================================================
--- extensions/trunk/tomcat/build/pom.xml 2009-04-08 16:29:47 UTC (rev 2353)
+++ extensions/trunk/tomcat/build/pom.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -18,21 +18,25 @@
<dependency>
<groupId>org.jboss.webbeans.tomcat</groupId>
<artifactId>webbeans-tomcat-int</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
Added: extensions/trunk/tomcat/build.properties
===================================================================
--- extensions/trunk/tomcat/build.properties (rev 0)
+++ extensions/trunk/tomcat/build.properties 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1 @@
+tomcat.home=/Applications/apache-tomcat-6.0.18
Modified: extensions/trunk/tomcat/pom.xml
===================================================================
--- extensions/trunk/tomcat/pom.xml 2009-04-08 16:29:47 UTC (rev 2353)
+++ extensions/trunk/tomcat/pom.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -16,8 +16,9 @@
<modules>
<module>int</module>
+ <module>build</module>
<module>support</module>
- <module>build</module>
+ <module>tests</module>
</modules>
<description>
Added: extensions/trunk/tomcat/tests/pom.xml
===================================================================
--- extensions/trunk/tomcat/tests/pom.xml (rev 0)
+++ extensions/trunk/tomcat/tests/pom.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>webbeans-tomcat-parent</artifactId>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <artifactId>webbeans-tomcat-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Web Beans Tomcat Integration Tests</name>
+ <url>http://www.seamframework.org/WebBeans</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ <exclusions>
+ <exclusion>
+ <artifactId>junit</artifactId>
+ <groupId>junit</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-core-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-tomcat</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-spi</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <defaultGoal>test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>unit-tests.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-report</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report-only</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
+ <outputName>test-report</outputName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>incontainer</id>
+ <activation>
+ <property>
+ <name>incontainer</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <stripVersion>true</stripVersion>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <artifactId>webbeans-tomcat</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ <artifactItem>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>unit-tests.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ <systemProperties>
+ <property>
+ <name>org.jboss.testharness.standalone</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.extraConfigurationDir</name>
+ <value>../</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.forceRestart</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.runIntegrationTests</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.libraryDirectory</name>
+ <value>target/dependency/lib</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.outputDirectory</name>
+ <value>target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>write-artifacts-to-disk</id>
+ <activation>
+ <property>
+ <name>dumpArtifacts</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-artifacts</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.jboss.testharness.api.TCK</mainClass>
+ <classpathScope>test</classpathScope>
+ <systemProperties>
+ <systemProperty>
+ <key>dumpArtifacts</key>
+ <value>true</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.outputDirectory</key>
+ <value>target/test-artifacts</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.libraryDirectory</key>
+ <value>target/dependency/lib</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: extensions/trunk/tomcat/tests/src/etc/header.txt
===================================================================
--- extensions/trunk/tomcat/tests/src/etc/header.txt (rev 0)
+++ extensions/trunk/tomcat/tests/src/etc/header.txt 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,14 @@
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+Licensed 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.
Added: extensions/trunk/tomcat/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties
===================================================================
--- extensions/trunk/tomcat/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,7 @@
+# Configuration for running incontainer tests from your IDE
+# Alter the path webbeans accordingly (relative from the tck/impl dir)
+org.jboss.testharness.standalone=false
+org.jboss.testharness.container.extraConfigurationDir=../
+org.jboss.testharness.container.forceRestart=false
+org.jboss.testharness.libraryDirectory=target/dependency/lib
+org.jboss.testharness.runIntegrationTests=true
\ No newline at end of file
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/ExampleTest.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/ExampleTest.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/ExampleTest.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,67 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.jboss.webbeans.test.ServletLifecycleContainersImpl;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@Artifact
+public class ExampleTest extends AbstractWebBeansTest
+{
+
+ @Override
+ @BeforeClass
+ public void beforeClass() throws Throwable
+ {
+ getCurrentConfiguration().setStandaloneContainers(new ServletLifecycleContainersImpl());
+ super.beforeClass();
+ }
+
+ @Test
+ public void testGameGenerator() throws Exception {
+
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ Game game1 = getCurrentManager().getInstanceByType(Game.class);
+ Game game2 = getCurrentManager().getInstanceByType(Game.class);
+ assert game1!=game2;
+ assert game1.getNumber()!=game2.getNumber();
+ Generator gen1 = getCurrentManager().getInstanceByType(Generator.class);
+ Generator gen2 = getCurrentManager().getInstanceByType(Generator.class);
+ assert gen1.getRandom()!=null;
+ assert gen1.getRandom()==gen2.getRandom();
+ }
+
+ }.run();
+ }
+
+ @Test
+ public void testSentenceTranslator() throws Exception {
+
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ TextTranslator tt1 = getCurrentManager().getInstanceByType(TextTranslator.class);
+ try
+ {
+ tt1.translate("hello world");
+ assert false;
+ }
+ catch (UnsupportedOperationException uoe)
+ {
+ //expected
+ }
+ }
+
+ }.run();
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Game.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Game.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Game.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import javax.inject.Initializer;
+
+public class Game
+{
+ private final int number;
+
+ @Initializer
+ Game(@Random int number)
+ {
+ this.number = number;
+ }
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Generator.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Generator.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Generator.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Produces;
+
+@ApplicationScoped
+public class Generator {
+
+ private int lastInt = 0;
+ private java.util.Random random = new java.util.Random( System.currentTimeMillis() );
+
+ java.util.Random getRandom()
+ {
+ return random;
+ }
+
+ @Produces @Random int next() {
+ int nextInt = getRandom().nextInt(100);
+ while (nextInt == lastInt)
+ {
+ nextInt = getRandom().nextInt(100);
+ }
+ lastInt = nextInt;
+ return nextInt;
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Mock.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Mock.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Mock.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+public @interface Mock
+{
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockExampleTest.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockExampleTest.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockExampleTest.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,30 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact
+@BeansXml("beans.xml")
+public class MockExampleTest extends AbstractWebBeansTest
+{
+
+ @Test
+ public void testMockSentenceTranslator() throws Exception
+ {
+
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ TextTranslator tt2 = getCurrentManager().getInstanceByType(TextTranslator.class);
+ assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals( tt2.translate("Hello world. How's tricks?") );
+ }
+
+ }.run();
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockSentenceTranslator.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockSentenceTranslator.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/MockSentenceTranslator.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+@Mock
+public class MockSentenceTranslator implements Translator
+{
+ public String translate(String sentence)
+ {
+ return "Lorem ipsum dolor sit amet";
+ }
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Random.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Random.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Random.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Random
+{
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceParser.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceParser.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceParser.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SentenceParser
+{
+ public List<String> parse(String text)
+ {
+ return Arrays.asList(text.split("[.?]"));
+ }
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceTranslator.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceTranslator.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/SentenceTranslator.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+public class SentenceTranslator implements Translator
+{
+ public String translate(String sentence)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
\ No newline at end of file
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/TextTranslator.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/TextTranslator.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/TextTranslator.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,28 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+import javax.inject.Initializer;
+
+public class TextTranslator
+{
+
+ private SentenceParser sentenceParser;
+ private Translator sentenceTranslator;
+
+ @Initializer
+ TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator)
+ {
+ this.sentenceParser = sentenceParser;
+ this.sentenceTranslator = sentenceTranslator;
+ }
+
+ public String translate(String text)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String sentence: sentenceParser.parse(text))
+ {
+ sb.append(sentenceTranslator.translate(sentence)).append(". ");
+ }
+ return sb.toString().trim();
+ }
+
+}
\ No newline at end of file
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Translator.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Translator.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/examples/Translator.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,9 @@
+package org.jboss.webbeans.test.tomcat.examples;
+
+
+public interface Translator
+{
+
+ public String translate(String sentence);
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/LookupTest.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/LookupTest.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/LookupTest.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,36 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+@Artifact(addCurrentPackage=false)
+@IntegrationTest
+@Resources({
+ @Resource(source="context.xml", destination="/META-INF/context.xml")
+})
+(a)Classes({Mouse.class, Vole.class, LookupTest.class})
+public class LookupTest extends AbstractWebBeansTest
+{
+
+ @Test
+ public void testManagerInJndi() throws Exception
+ {
+ assert getCurrentManager().getInstanceByType(Mouse.class).getManager() != null;
+ assert getCurrentManager().getInstanceByType(Mouse.class).getManager().equals(getCurrentManager());
+ }
+
+ @Test
+ public void testResource() throws Exception
+ {
+ assert getCurrentManager().getInstanceByType(Vole.class).getManager() != null;
+ assert getCurrentManager().getInstanceByType(Vole.class).getManager().equals(getCurrentManager());
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Mouse.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Mouse.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Mouse.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class Mouse
+{
+
+ public Manager getManager()
+ {
+ try
+ {
+ return (Manager) new InitialContext().lookup("java:comp/env/app/Manager");
+ }
+ catch (NamingException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/RatServlet.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/RatServlet.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/RatServlet.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,29 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+import java.io.IOException;
+
+import javax.inject.Current;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class RatServlet extends HttpServlet
+{
+
+ @Current Sewer sewer;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ if (sewer.getName().equals(Sewer.NAME))
+ {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ }
+ else
+ {
+ resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/ServletInjectionTest.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/ServletInjectionTest.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/ServletInjectionTest.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,54 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@Artifact(addCurrentPackage=false)
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(source="context-servlet-injection.xml", destination="/META-INF/context.xml"),
+ @Resource(source="web-servlet-injection.xml", destination="/WEB-INF/web.xml")
+})
+@Classes({
+ RatServlet.class,
+ Sewer.class
+})
+public class ServletInjectionTest extends AbstractWebBeansTest
+{
+
+ private static final Logger log = Logger.getLogger(ServletInjectionTest.class);
+
+ @Override
+ @BeforeClass
+ public void beforeClass() throws Throwable
+ {
+ log.info("To run the servlet injection test you must add tomcat-support.jar to $CATALINA_BASE/lib");
+ super.beforeClass();
+ }
+
+
+ @Test
+ public void testServletInjection() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ HttpMethod method = new GetMethod(getContextPath() + "/rat");
+ assert client.executeMethod(method) == HttpServletResponse.SC_OK;
+ }
+
+
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Sewer.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Sewer.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Sewer.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+public class Sewer
+{
+
+ public static String NAME = "Sewer8";
+
+ public String getName()
+ {
+ return NAME;
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Vole.java
===================================================================
--- extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Vole.java (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/java/org/jboss/webbeans/test/tomcat/lookup/Vole.java 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.test.tomcat.lookup;
+
+import javax.annotation.Resource;
+import javax.inject.manager.Manager;
+
+public class Vole
+{
+
+ @Resource(mappedName="java:comp/env/app/Manager")
+ Manager manager;
+
+ public Manager getManager()
+ {
+ return manager;
+ }
+
+}
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/war/custom-web.xml
===================================================================
--- extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/war/custom-web.xml (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/resources/org/jboss/testharness/impl/packaging/war/custom-web.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>JBoss Test Harness</display-name>
+
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.jboss.webbeans.environment.servlet.Listener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <servlet-class>org.jboss.testharness.impl.runner.servlet.ServletTestRunner</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JBoss Test Harness Test Runner</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/examples/beans.xml
===================================================================
--- extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/examples/beans.xml (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/examples/beans.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.webbeans.test.tomcat.examples">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:Mock />
+ </Deploy>
+</Beans>
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context-servlet-injection.xml
===================================================================
--- extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context-servlet-injection.xml (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context-servlet-injection.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,9 @@
+<Context>
+ <Resource name="app/Manager" auth="Container"
+ type="javax.inject.manager.Manager"
+ factory="org.jboss.webbeans.resources.ManagerObjectFactory"/>
+<!-- Uncomment to enable injection into Servlet -->
+ <Listener className="org.jboss.webbeans.environment.tomcat.WebBeansLifecycleListener" />
+
+
+</Context>
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context.xml
===================================================================
--- extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context.xml (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/context.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,9 @@
+<Context>
+ <Resource name="app/Manager" auth="Container"
+ type="javax.inject.manager.Manager"
+ factory="org.jboss.webbeans.resources.ManagerObjectFactory"/>
+<!-- Uncomment to enable injection into Servlet -->
+<Listener className="org.jboss.webbeans.environment.tomcat.WebBeansLifecycleListener" />
+
+
+</Context>
Added: extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/web-servlet-injection.xml
===================================================================
--- extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/web-servlet-injection.xml (rev 0)
+++ extensions/trunk/tomcat/tests/src/test/resources/org/jboss/webbeans/test/tomcat/lookup/web-servlet-injection.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <display-name>JBoss Test Harness</display-name>
+
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>org.jboss.webbeans.environment.servlet.Listener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Rat Servlet</servlet-name>
+ <servlet-class>org.jboss.webbeans.test.tomcat.lookup.RatServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Rat Servlet</servlet-name>
+ <url-pattern>/rat</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: extensions/trunk/tomcat/tests/unit-tests.xml
===================================================================
--- extensions/trunk/tomcat/tests/unit-tests.xml (rev 0)
+++ extensions/trunk/tomcat/tests/unit-tests.xml 2009-04-08 18:59:16 UTC (rev 2354)
@@ -0,0 +1,26 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="Web Beans Tomcat Integration" verbose="1" >
+
+ <test name="Web Beans Tomcat Integration">
+ <method-selectors>
+ <method-selector>
+ <selector-class name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector" />
+ </method-selector>
+ <method-selector>
+ <selector-class name="org.jboss.testharness.impl.testng.ExcludeIncontainerUnderInvestigationMethodSelector" />
+ </method-selector>
+ </method-selectors>
+ <groups>
+ <run>
+ <exclude name="stub" />
+ <exclude name="broken" />
+ </run>
+ </groups>
+ <packages>
+ <package name="org.jboss.webbeans.test.tomcat.examples" />
+ <package name="org.jboss.webbeans.test.tomcat.lookup" />
+ </packages>
+ </test>
+
+</suite>
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2353 - in tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/tests/context/application and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-08 12:29:47 -0400 (Wed, 08 Apr 2009)
New Revision: 2353
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml
Log:
Fixed application context tests
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-04-08 15:30:21 UTC (rev 2352)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-04-08 16:29:47 UTC (rev 2353)
@@ -66,11 +66,11 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- TextPage firstRequestResult = webClient.getPage(getContextPath() + "IntrospectRequestScope");
+ TextPage firstRequestResult = webClient.getPage(getContextPath() + "IntrospectApplication");
assert firstRequestResult.getContent() != null;
assert Double.parseDouble(firstRequestResult.getContent()) != 0;
// Make a second request and make sure the same context is used
- TextPage secondRequestResult = webClient.getPage(getContextPath() + "IntrospectRequestScope");
+ TextPage secondRequestResult = webClient.getPage(getContextPath() + "IntrospectApplication");
assert secondRequestResult.getContent() != null;
assert Double.parseDouble(secondRequestResult.getContent()) == Double.parseDouble(firstRequestResult.getContent());
}
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml 2009-04-08 15:30:21 UTC (rev 2352)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml 2009-04-08 16:29:47 UTC (rev 2353)
@@ -22,7 +22,7 @@
</servlet>
<servlet>
<display-name>Introspection Service for Application Context</display-name>
- <servlet-name>applicatoinIntrospector</servlet-name>
+ <servlet-name>applicationIntrospector</servlet-name>
<servlet-class>org.jboss.jsr299.tck.tests.context.application.IntrospectApplication</servlet-class>
</servlet>
<servlet-mapping>
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2352 - ri/trunk/tests/src/test/debug-resources/META-INF.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 11:30:21 -0400 (Wed, 08 Apr 2009)
New Revision: 2352
Added:
ri/trunk/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties
Removed:
ri/trunk/tests/src/test/debug-resources/META-INF/web-beans-tck.properties
Log:
Fix properties file
Copied: ri/trunk/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties (from rev 2343, ri/trunk/tests/src/test/debug-resources/META-INF/web-beans-tck.properties)
===================================================================
--- ri/trunk/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties (rev 0)
+++ ri/trunk/tests/src/test/debug-resources/META-INF/jboss-test-harness.properties 2009-04-08 15:30:21 UTC (rev 2352)
@@ -0,0 +1,7 @@
+# Configuration for running incontainer tests from your IDE
+# Alter the path webbeans accordingly (relative from the tck/impl dir)
+org.jboss.testharness.standalone=false
+org.jboss.testharness.container.extraConfigurationDir=../../webbeans/jboss-as
+org.jboss.testharness.container.forceRestart=false
+org.jboss.testharness.libraryDirectory=../../webbeans/impl/target/dependency/lib
+org.jboss.testharness.runIntegrationTests=true
\ No newline at end of file
Deleted: ri/trunk/tests/src/test/debug-resources/META-INF/web-beans-tck.properties
===================================================================
--- ri/trunk/tests/src/test/debug-resources/META-INF/web-beans-tck.properties 2009-04-08 14:25:55 UTC (rev 2351)
+++ ri/trunk/tests/src/test/debug-resources/META-INF/web-beans-tck.properties 2009-04-08 15:30:21 UTC (rev 2352)
@@ -1,7 +0,0 @@
-# Configuration for running incontainer tests from your IDE
-# Alter the path webbeans accordingly (relative from the tck/impl dir)
-org.jboss.testharness.standalone=false
-jboss-as.dir=../../webbeans/jboss-as
-jboss.force.restart=false
-org.jboss.testharness.libraryDirectory=../../webbeans/impl/target/dependency/lib
-org.jboss.testharness.runIntegrationTests=true
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2351 - in test-harness/trunk: api/src/main/java/org/jboss/testharness/spi/helpers and 14 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 10:25:55 -0400 (Wed, 08 Apr 2009)
New Revision: 2351
Added:
test-harness/trunk/tomcat/
test-harness/trunk/tomcat/pom.xml
test-harness/trunk/tomcat/src/
test-harness/trunk/tomcat/src/main/
test-harness/trunk/tomcat/src/main/java/
test-harness/trunk/tomcat/src/main/java/org/
test-harness/trunk/tomcat/src/main/java/org/jboss/
test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/
test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/
test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/
test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java
test-harness/trunk/tomcat/src/main/resources/
test-harness/trunk/tomcat/src/main/resources/META-INF/
test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties
test-harness/trunk/tomcat/src/main/resources/log4j.xml
test-harness/trunk/tomcat/src/test/
test-harness/trunk/tomcat/src/test/debug-resources/
test-harness/trunk/tomcat/src/test/debug-resources/META-INF/
test-harness/trunk/tomcat/src/test/debug-resources/META-INF/web-beans-tck.properties
test-harness/trunk/tomcat/src/test/java/
test-harness/trunk/tomcat/src/test/resources/
Modified:
test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java
test-harness/trunk/pom.xml
Log:
add tomcat connector - untested
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java 2009-04-08 14:11:07 UTC (rev 2350)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java 2009-04-08 14:25:55 UTC (rev 2351)
@@ -53,18 +53,31 @@
OutputStream os = new FileOutputStream(file);
try
{
- byte[] buf = new byte[1024];
- int i = 0;
- while ((i = inputStream.read(buf)) != -1)
- {
- os.write(buf, 0, i);
- }
- }
- finally
- {
+ copy(inputStream, os);
+ }
+ finally
+ {
os.close();
- }
+ }
}
+
+ public static void copy(InputStream source, OutputStream destination) throws IOException
+ {
+ if (source == null)
+ {
+ throw new IllegalArgumentException("source cannot be null");
+ }
+ if (destination == null)
+ {
+ throw new IllegalArgumentException("destination cannot be null");
+ }
+ byte[] readBuffer = new byte[2156];
+ int bytesIn = 0;
+ while((bytesIn = source.read(readBuffer)) != -1)
+ {
+ destination.write(readBuffer, 0, bytesIn);
+ }
+ }
public AbstractContainerConnector() throws IOException
{
Modified: test-harness/trunk/pom.xml
===================================================================
--- test-harness/trunk/pom.xml 2009-04-08 14:11:07 UTC (rev 2350)
+++ test-harness/trunk/pom.xml 2009-04-08 14:25:55 UTC (rev 2351)
@@ -44,6 +44,7 @@
<module>impl</module>
<module>tests</module>
<module>jboss</module>
+ <module>tomcat</module>
</modules>
<dependencyManagement>
@@ -117,6 +118,12 @@
<version>5.0.1.GA</version>
<type>pom</type>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.18</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Added: test-harness/trunk/tomcat/pom.xml
===================================================================
--- test-harness/trunk/tomcat/pom.xml (rev 0)
+++ test-harness/trunk/tomcat/pom.xml 2009-04-08 14:25:55 UTC (rev 2351)
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>jboss-test-harness-parent</artifactId>
+ <groupId>org.jboss.test-harness</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-tomcat</artifactId>
+ <name>JBoss Test Harness deployment for Apache Tomcat</name>
+ <description>Implements the JBoss Test Harness deployment SPI for Apache Tomcat</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java
===================================================================
--- test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java (rev 0)
+++ test-harness/trunk/tomcat/src/main/java/org/jboss/testharness/integration/tomcat/TomcatConnector.java 2009-04-08 14:25:55 UTC (rev 2351)
@@ -0,0 +1,122 @@
+package org.jboss.testharness.integration.tomcat;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.Containers;
+import org.jboss.testharness.spi.helpers.AbstractContainerConnector;
+
+/**
+ *
+ * @author jeffgenender
+ * @author Pete Muir
+ *
+ */
+public class TomcatConnector extends AbstractContainerConnector implements Containers
+{
+
+ private static final String SERVER_HOME_PROPERTY_NAME = "tomcat.home";
+
+ private String binDirectory;
+ private final File tmpdir;
+
+ public TomcatConnector() throws IOException
+ {
+ tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
+ tmpdir.mkdir();
+ tmpdir.deleteOnExit();
+ }
+
+ @Override
+ protected String getServerHomePropertyName()
+ {
+ return SERVER_HOME_PROPERTY_NAME;
+ }
+
+ protected void shutdownServer() throws IOException
+ {
+ launch(getBinDirectory(), "shutdown", "");
+ }
+
+ @Override
+ protected void startServer() throws IOException
+ {
+ launch(getBinDirectory(), "startup", "");
+ }
+
+ protected String getBinDirectory()
+ {
+ if (binDirectory == null)
+ {
+ binDirectory = new File(getServerDirectory() + "/bin").getPath();
+ }
+ return binDirectory;
+ }
+
+ @Override
+ protected String getLogName()
+ {
+ return "tomcat.log";
+ }
+
+ public void deploy(InputStream stream, String name) throws DeploymentException, IOException
+ {
+ String deployUrl = getManagerUrl("deploy", "path=/" + name, "update=true");
+ URLConnection connection = new URL(deployUrl).openConnection();
+ if (!(connection instanceof HttpURLConnection))
+ {
+ throw new IllegalStateException("Not an http connection! " + connection);
+ }
+ HttpURLConnection httpConnection = (HttpURLConnection) connection;
+ httpConnection.setRequestMethod("PUT");
+ httpConnection.connect();
+ copy(stream, httpConnection.getOutputStream());
+ httpConnection.disconnect();
+ if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+ {
+ throw new DeploymentException(httpConnection.getResponseMessage());
+ }
+ }
+
+ public void undeploy(String name) throws IOException
+ {
+ String deployUrl = getManagerUrl("undeploy", "path=/" + name);
+ URLConnection connection = new URL(deployUrl).openConnection();
+ if (!(connection instanceof HttpURLConnection))
+ {
+ throw new IllegalStateException("Not an http connection! " + connection);
+ }
+ HttpURLConnection httpConnection = (HttpURLConnection) connection;
+ httpConnection.connect();
+ httpConnection.disconnect();
+ if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+ {
+ throw new IllegalStateException("Error undeploying app " + httpConnection.getResponseMessage());
+ }
+ }
+
+ protected String getManagerUrl(String command, String... parameters)
+ {
+ String url = getHttpUrl() + "manager/" + command ;
+ for (int i = 0; i < parameters.length; i ++)
+ {
+ String parameter = parameters[i];
+ if (i == 0)
+ {
+ url += "?" + parameter;
+ }
+ else
+ {
+ url += "&" + parameter;
+ }
+ }
+ return url;
+ }
+
+}
\ No newline at end of file
Added: test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties
===================================================================
--- test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties (rev 0)
+++ test-harness/trunk/tomcat/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-08 14:25:55 UTC (rev 2351)
@@ -0,0 +1 @@
+org.jboss.testharness.spi.Containers=org.jboss.testharness.integration.tomcat.TomcatConnector
Added: test-harness/trunk/tomcat/src/main/resources/log4j.xml
===================================================================
--- test-harness/trunk/tomcat/src/main/resources/log4j.xml (rev 0)
+++ test-harness/trunk/tomcat/src/main/resources/log4j.xml 2009-04-08 14:25:55 UTC (rev 2351)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{2}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ############### JBoss ################# -->
+ <category name="org.jboss">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="org.jboss.test">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="com.arjuna">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ############### Hibernate logging ################# -->
+
+ <category name="org.hibernate">
+ <priority value="ERROR"/>
+ </category>
+
+ <!--
+ <category name="org.hibernate.SQL">
+ <priority value="TRACE"/>
+ </category>
+
+ <category name="org.hibernate.type">
+ <priority value="TRACE"/>
+ </category>
+
+ <category name="org.hibernate.loader">
+ <priority value="TRACE"/>
+ </category>
+ <category name="org.hibernate.cache">
+ <priority value="TRACE"/>
+ </category>
+ -->
+
+ <category name="org.jboss.testharness">
+ <priority value="INFO"/>
+ </category>
+
+ <root>
+ <priority value="INFO"/>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: test-harness/trunk/tomcat/src/test/debug-resources/META-INF/web-beans-tck.properties
===================================================================
--- test-harness/trunk/tomcat/src/test/debug-resources/META-INF/web-beans-tck.properties (rev 0)
+++ test-harness/trunk/tomcat/src/test/debug-resources/META-INF/web-beans-tck.properties 2009-04-08 14:25:55 UTC (rev 2351)
@@ -0,0 +1,7 @@
+# Configuration for running incontainer tests from your IDE
+# Alter the path webbeans accordingly (relative from the tck/impl dir)
+org.jboss.testharness.standalone=false
+jboss-as.dir=../../webbeans/jboss-as
+jboss.force.restart=false
+org.jboss.testharness.libraryDirectory=../../webbeans/jboss-tck-runner/target/dependency/lib
+org.jboss.testharness.runIntegrationTests=true
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2350 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-08 10:11:07 -0400 (Wed, 08 Apr 2009)
New Revision: 2350
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/NearMiss.java
Log:
Do not store a bean from a different request context; using ID instead
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/NearMiss.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/NearMiss.java 2009-04-08 14:09:59 UTC (rev 2349)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/NearMiss.java 2009-04-08 14:11:07 UTC (rev 2350)
@@ -2,23 +2,18 @@
class NearMiss
{
- private SimpleRequestBean bean;
- private boolean sameBean = false;
+ private Double previousBeanId;
+ private boolean sameBean = false;
- public SimpleRequestBean getBean()
- {
- return bean;
- }
-
public void setBean(SimpleRequestBean bean)
{
- if (this.bean == null)
+ if (this.previousBeanId == null)
{
- this.bean = bean;
+ this.previousBeanId = bean.getId();
}
else
{
- sameBean = this.bean.getId() == bean.getId();
+ sameBean = this.previousBeanId == bean.getId();
}
}
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2349 - ri/trunk/impl/src/main/java/org/jboss/webbeans/event.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-08 10:09:59 -0400 (Wed, 08 Apr 2009)
New Revision: 2349
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
Log:
Changed context management to lifecycle management
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2009-04-08 13:58:54 UTC (rev 2348)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2009-04-08 14:09:59 UTC (rev 2349)
@@ -17,8 +17,9 @@
package org.jboss.webbeans.event;
-import org.jboss.webbeans.context.DependentContext;
-import org.jboss.webbeans.context.RequestContext;
+import org.jboss.webbeans.context.ContextLifecycle;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
@@ -50,8 +51,8 @@
public void run()
{
- RequestContext.INSTANCE.setActive(true);
- DependentContext.INSTANCE.setActive(true);
+ BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
+ ContextLifecycle.instance().beginRequest("async invocation", requestBeanStore);
try
{
log.debug("Sending event [" + event + "] directly to observer " + observer);
@@ -63,8 +64,7 @@
}
finally
{
- DependentContext.INSTANCE.setActive(false);
- RequestContext.INSTANCE.setActive(false);
+ ContextLifecycle.instance().endRequest("async invocation", requestBeanStore);
}
}
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2348 - ri/trunk/impl/src/main/java/org/jboss/webbeans/mock.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-08 09:58:54 -0400 (Wed, 08 Apr 2009)
New Revision: 2348
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
Log:
minor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-08 13:26:25 UTC (rev 2347)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-04-08 13:58:54 UTC (rev 2348)
@@ -32,6 +32,7 @@
bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
bootstrap.setApplicationContext(applicationBeanStore);
+ setInstance(this);
}
public void initialize()
15 years, 8 months