[webbeans-commits] Webbeans SVN: r1824 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-08 19:41:10 -0400 (Sun, 08 Mar 2009)
New Revision: 1824
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
Log:
Broken test
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 22:37:17 UTC (rev 1823)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 23:41:10 UTC (rev 1824)
@@ -30,8 +30,6 @@
import org.jboss.jsr299.tck.impl.packaging.Artifact;
import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
import org.jboss.jsr299.tck.impl.packaging.Packaging;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -53,7 +51,6 @@
};
private PomeranianInterface dog;
- @BeforeMethod(alwaysRun = true,dependsOnMethods="beforeMethod")
public void setupTest()
{
dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
@@ -76,6 +73,7 @@
@SpecAssertion(section = "7.5.6", id = "a")
public void testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -90,6 +88,7 @@
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "c"), @SpecAssertion(section = "7.5.6", id = "f"), @SpecAssertion(section = "7.5.6", id = "i"), @SpecAssertion(section = "7.5.8", id = "f") })
public void testAfterTransactionCompletionObserver()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
assert !getCurrentManager().resolveObservers("event").isEmpty();
@@ -102,6 +101,7 @@
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "d"), @SpecAssertion(section = "7.5.6", id = "j") })
public void testAfterTransactionSuccessObserver()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -109,10 +109,14 @@
assert dog.isCorrectTransactionState();
}
- @Test(groups = { "events", "integration" })
- @SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "e"), @SpecAssertion(section = "7.5.6", id = "k") })
+ @Test(groups = { "events", "integration", "ri-broken" })
+ @SpecAssertions({
+ @SpecAssertion(section = "7.5.6", id = "e"),
+ @SpecAssertion(section = "7.5.6", id = "k")
+ })
public void testAfterTransactionFailureObserver()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -124,6 +128,7 @@
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "b"), @SpecAssertion(section = "7.5.6", id = "h") })
public void testBeforeTransactionCompletionObserver()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -142,6 +147,7 @@
@SpecAssertion(section = "7.5.7", id = "c")
public void testAsynchronousObserverAlsoTransactional()
{
+ setupTest();
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1823 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-08 18:37:17 -0400 (Sun, 08 Mar 2009)
New Revision: 1823
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
Log:
Added dependency to the @BeforeMethod so that abstract one runs before.
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 22:33:13 UTC (rev 1822)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 22:37:17 UTC (rev 1823)
@@ -53,7 +53,7 @@
};
private PomeranianInterface dog;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true,dependsOnMethods="beforeMethod")
public void setupTest()
{
dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1822 - in tck/trunk: impl and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-08 18:33:13 -0400 (Sun, 08 Mar 2009)
New Revision: 1822
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningInstancesNotDestroyedTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml
Modified:
tck/trunk/impl/pom.xml
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
tck/trunk/pom.xml
Log:
conversation tests
Modified: tck/trunk/impl/pom.xml
===================================================================
--- tck/trunk/impl/pom.xml 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/pom.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -91,6 +91,11 @@
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ </dependency>
</dependencies>
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,109 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.jboss.jsr299.tck.AbstractDeclarativeTest;
-
-public abstract class AbstractConversationTest extends AbstractDeclarativeTest
-{
-
- private static final long TIMEOUT = 200;
-
- protected String getCid(HttpClient client) throws Exception
- {
- HttpMethod method = new GetMethod(getConversationStatusPath("cid"));
- ObjectInputStream ois = null;
- try
- {
- client.executeMethod(method);
- ois = new ObjectInputStream(method.getResponseBodyAsStream());
- return (String) ois.readObject();
- }
- finally
- {
- if (ois != null)
- {
- ois.close();
- }
- method.releaseConnection();
- }
-
- }
-
- protected boolean isCloudDestroyed(HttpClient client) throws Exception
- {
- HttpMethod method = new GetMethod(getConversationStatusPath("cloudDestroyed"));
- try
- {
- client.executeMethod(method);
- if (method.getStatusCode() == 200)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- finally
- {
- method.releaseConnection();
- }
- }
-
- protected void resetCloud(HttpClient client) throws Exception
- {
- HttpMethod method = new GetMethod(getConversationStatusPath("resetCloud"));
- try
- {
- client.executeMethod(method);
- }
- finally
- {
- method.releaseConnection();
- }
- }
-
- protected void invalidateSession(HttpClient client) throws Exception
- {
- HttpMethod method = new GetMethod(getConversationStatusPath("invalidateSession"));
- try
- {
- client.executeMethod(method);
- }
- finally
- {
- method.releaseConnection();
- }
- }
-
- protected String getConversationStatusPath(String method)
- {
- return super.getContextPath() + "conversation-status?method=" + method;
- }
-
- protected URL getConversationStatusURL(String method) throws MalformedURLException
- {
- return new URL(getConversationStatusPath(method));
- }
-
- protected void request(HttpClient client, String viewId) throws Exception
- {
- HttpMethod method = new GetMethod(getContextPath() + viewId);
- try
- {
- client.executeMethod(method);
- assert method.getStatusCode() == 200;
- }
- finally
- {
- method.releaseConnection();
- }
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,37 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import java.io.Serializable;
-
-import javax.annotation.Named;
-import javax.annotation.PreDestroy;
-import javax.context.ConversationScoped;
-
-@ConversationScoped
-@Named
-public class Cloud implements Serializable
-{
-
- private static boolean destroyed = false;
-
- @PreDestroy
- public void destroy()
- {
- destroyed = true;
- }
-
- public static boolean isDestroyed()
- {
- return destroyed;
- }
-
- public static void setDestroyed(boolean destroyed)
- {
- Cloud.destroyed = destroyed;
- }
-
- public String getName()
- {
- return "Pete";
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,19 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import javax.annotation.Named;
-import javax.context.Conversation;
-import javax.inject.Current;
-
-@Named
-public class CloudController
-{
-
- @Current Conversation conversation;
-
- public String getBeginConversation()
- {
- conversation.begin();
- return "begun conversation";
- }
-
-}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -19,6 +19,7 @@
* Spec version: PRD2
*/
@Artifact
+
public class ConversationContextTest extends AbstractDeclarativeTest
{
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,58 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import javax.context.Conversation;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.jsr299.tck.impl.ConfigurationImpl;
-
-public class ConversationStatusServlet extends HttpServlet
-{
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- String method = req.getParameter("method");
- if ("cid".equals(method))
- {
- serializeToResponse(ConfigurationImpl.get().getManagers().getManager().getInstanceByType(Conversation.class).getId(), resp);
- }
- else if ("cloudDestroyed".equals(method))
- {
- if (Cloud.isDestroyed())
- {
- resp.setStatus(HttpServletResponse.SC_OK);
- }
- else
- {
- resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
- else if ("invalidateSession".equals(method))
- {
- req.getSession().invalidate();
- }
- else if ("resetCloud".equals(method))
- {
- Cloud.setDestroyed(false);
- }
- else
- {
- resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- private void serializeToResponse(Object object, HttpServletResponse resp) throws IOException
- {
- ObjectOutputStream oos = new ObjectOutputStream(resp.getOutputStream());
- oos.writeObject(object);
- oos.flush();
- oos.close();
- }
-
-}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,40 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.impl.packaging.Artifact;
-import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
-import org.jboss.jsr299.tck.impl.packaging.Resource;
-import org.jboss.jsr299.tck.impl.packaging.Resources;
-import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson
- *
- * Spec version: PRD2
- */
-@Artifact
-@IntegrationTest(runLocally=true)
-@Resources({
- @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
- @Resource(destination="clouds.jspx", source="clouds.jsf"),
- @Resource(destination="cloud.jspx", source="cloud.jsf")
-})
-public class InvalidatingSessionDestroysConversationTest extends AbstractConversationTest
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "a")
- public void testInvalidatingSessionDestroysConversation() throws Exception
- {
- HttpClient client = new HttpClient();
- resetCloud(client);
- request(client, "/clouds.jsf");
- assert !isCloudDestroyed(client);
- invalidateSession(client);
- assert isCloudDestroyed(client);
- }
-
-}
\ No newline at end of file
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,38 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.impl.packaging.Artifact;
-import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
-import org.jboss.jsr299.tck.impl.packaging.Resource;
-import org.jboss.jsr299.tck.impl.packaging.Resources;
-import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson
- *
- * Spec version: PRD2
- */
-@Artifact
-@IntegrationTest(runLocally=true)
-@Resources({
- @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
- @Resource(destination="clouds.jspx", source="clouds.jsf"),
- @Resource(destination="cloud.jspx", source="cloud.jsf")
-})
-public class LongRunningInstancesNotDestroyedTest extends AbstractConversationTest
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "k")
- public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
- {
- HttpClient client = new HttpClient();
- resetCloud(client);
- request(client, "/clouds.jsf");
- assert !isCloudDestroyed(client);
- }
-
-}
\ No newline at end of file
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,61 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.impl.packaging.Artifact;
-import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
-import org.jboss.jsr299.tck.impl.packaging.Resource;
-import org.jboss.jsr299.tck.impl.packaging.Resources;
-import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson
- *
- * Spec version: PRD2
- */
-@Artifact
-@IntegrationTest(runLocally=true)
-@Resources({
- @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
- @Resource(destination="home.jspx", source="home.jsf"),
- @Resource(destination="cloud.jspx", source="cloud.jsf"),
- @Resource(destination="clouds.jspx", source="clouds.jsf")
-})
-public class MultiRequestConversationContextTest extends AbstractConversationTest
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "hb")
- public void testConversationIdSetByContainerIsUnique() throws Exception
- {
- HttpClient client = new HttpClient();
- request(client, "/home.jsf");
- String cid1 = getCid(client);
- request(client, "/home.jsf");
- String cid2 = getCid(client);
- assert !cid1.equals(cid2);
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "j")
- public void testTransientConversationInstancesDestroyedAtRequestEnd() throws Exception
- {
- HttpClient client = new HttpClient();
- resetCloud(client);
- request(client, "/cloud.jsf");
- assert isCloudDestroyed(client);
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "k")
- public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
- {
- HttpClient client = new HttpClient();
- resetCloud(client);
- request(client, "/clouds.jsf");
- assert !isCloudDestroyed(client);
- }
-
-}
\ No newline at end of file
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,205 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import java.io.ObjectInputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public abstract class AbstractConversationTest extends AbstractDeclarativeTest
+{
+
+ public static final String CID_HEADER_NAME = "org.jboss.jsr299.tck.cid";
+
+ private static final long TIMEOUT = 200;
+
+ protected String getCid(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("cid"));
+ ObjectInputStream ois = null;
+ try
+ {
+ client.executeMethod(method);
+ ois = new ObjectInputStream(method.getResponseBodyAsStream());
+ return (String) ois.readObject();
+ }
+ finally
+ {
+ if (ois != null)
+ {
+ ois.close();
+ }
+ method.releaseConnection();
+ }
+ }
+
+
+
+ protected boolean isCloudDestroyed(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("cloudDestroyed"));
+ try
+ {
+ client.executeMethod(method);
+ if (method.getStatusCode() == 200)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected void resetCloud(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("resetCloud"));
+ try
+ {
+ client.executeMethod(method);
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected void invalidateSession(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("invalidateSession"));
+ try
+ {
+ client.executeMethod(method);
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected String getConversationStatusPath(String method)
+ {
+ return super.getContextPath() + "conversation-status?method=" + method;
+ }
+
+ protected URL getConversationStatusURL(String method) throws MalformedURLException
+ {
+ return new URL(getConversationStatusPath(method));
+ }
+
+ protected String request(HttpClient client, String viewId) throws Exception
+ {
+ HttpMethod method = new GetMethod(getPath(viewId));
+ try
+ {
+ client.executeMethod(method);
+ assert method.getStatusCode() == 200;
+ return method.getResponseHeader(CID_HEADER_NAME).getValue();
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected String getBodyAsString(HttpClient client, String viewId) throws Exception
+ {
+ HttpMethod method = new GetMethod(getPath(viewId));
+ try
+ {
+ client.executeMethod(method);
+ assert method.getStatusCode() == 200;
+ return method.getResponseBodyAsString();
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected boolean hasRained(HttpClient client, String viewId) throws Exception
+ {
+ HttpMethod method = new GetMethod(getPath(viewId));
+ try
+ {
+ client.executeMethod(method);
+ assert method.getStatusCode() == 200;
+ return method.getResponseHeader(Cloud.RAINED_HEADER_NAME).getValue().equals("true") ? true : false;
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected String getPath(String viewId)
+ {
+ return getContextPath() + viewId;
+ }
+
+ protected boolean isActiveBeforeApplyRequestValues(HttpClient client, String viewId) throws Exception
+ {
+ HttpMethod method = new GetMethod(getPath(viewId));
+ try
+ {
+ client.executeMethod(method);
+ assert method.getStatusCode() == 200;
+ return Boolean.valueOf(method.getResponseHeader(ConversationTestPhaseListener.ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME).getValue());
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected <T> Set<T> getElements(HtmlElement rootElement, Class<T> elementClass)
+ {
+ Set<T> result = new HashSet<T>();
+
+ for (HtmlElement element : rootElement.getAllHtmlChildElements())
+ {
+ result.addAll(getElements(element, elementClass));
+ }
+
+ if (elementClass.isInstance(rootElement))
+ {
+ result.add(elementClass.cast(rootElement));
+ }
+ return result;
+
+ }
+
+ protected <T extends HtmlElement> T getFirstMatchingElement(HtmlPage page, Class<T> elementClass, String id)
+ {
+
+ Set<T> inputs = getElements(page.getBody(), elementClass);
+ for (T input : inputs)
+ {
+ if (input.getId().contains(id))
+ {
+ return input;
+ }
+ }
+ return null;
+ }
+
+ protected String getCid(HtmlPage page)
+ {
+ return page.getWebResponse().getResponseHeaderValue(AbstractConversationTest.CID_HEADER_NAME);
+ }
+
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java (from rev 1815, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,112 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.Classes;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="home.jspx", source="home.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="rain.jspx", source="rain.jsf")
+})
+public class ClientConversationContextTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "hb")
+ public void testConversationIdSetByContainerIsUnique() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ request(client, "/home.jsf");
+ String cid1 = getCid(client);
+ request(client, "/home.jsf");
+ String cid2 = getCid(client);
+ assert !cid1.equals(cid2);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "j")
+ public void testTransientConversationInstancesDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/cloud.jsf");
+ assert isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "n")
+ public void testManualCidPropagation() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ String cid = request(client, "/clouds.jsf");
+ String cid2 = request(client, "/clouds.jsf?cid=" + cid);
+ assert cid.equals(cid2);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "o")
+ public void testConversationNotPropagated() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ String cid = request(client, "/clouds.jsf");
+ String cid2 = request(client, "/clouds.jsf");
+ assert !cid.equals(cid2);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "p")
+ public void testConversationsDontCrossSessionBoundary() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ String cid = request(client, "/rain.jsf");
+ assert hasRained(client, "/cloud.jsf?cid=" + cid);
+ invalidateSession(client);
+ assert !hasRained(client, "/cloud.jsf?cid=" + cid);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "b")
+ public void testConversationActiveDuringNonFacesRequest() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ assert getBodyAsString(client, "/cloud.jsf").contains(Cloud.NAME);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "s")
+ public void testConversationPropagationToNonExistentConversationLeadsToTransientConversation() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ assert !request(client, "/cloud.jsf?cid=org.jboss.jsr299").equals("org.jboss.jsr299");
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,54 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.annotation.PreDestroy;
+import javax.context.ConversationScoped;
+
+@ConversationScoped
+@Named
+public class Cloud implements Serializable
+{
+
+ public static final String NAME = Cloud.class.getName() + ".Pete";
+
+ public static final String RAINED_HEADER_NAME = Cloud.class.getName() + ".rained";
+
+ private static boolean destroyed = false;
+
+ private boolean rained;
+
+ @PreDestroy
+ public void destroy()
+ {
+ destroyed = true;
+ }
+
+ public static boolean isDestroyed()
+ {
+ return destroyed;
+ }
+
+ public static void setDestroyed(boolean destroyed)
+ {
+ Cloud.destroyed = destroyed;
+ }
+
+ public String getName()
+ {
+ return NAME;
+ }
+
+ public String getRain()
+ {
+ rained = true;
+ return "rain!";
+ }
+
+ public boolean isRained()
+ {
+ return rained;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.inject.Current;
+
+@Named
+public class CloudController
+{
+
+ @Current Conversation conversation;
+
+ public String getBeginConversation()
+ {
+ conversation.begin();
+ return "begun conversation";
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,58 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.context.Conversation;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.jsr299.tck.impl.ConfigurationImpl;
+
+public class ConversationStatusServlet extends HttpServlet
+{
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ String method = req.getParameter("method");
+ if ("cid".equals(method))
+ {
+ serializeToResponse(ConfigurationImpl.get().getManagers().getManager().getInstanceByType(Conversation.class).getId(), resp);
+ }
+ else if ("cloudDestroyed".equals(method))
+ {
+ if (Cloud.isDestroyed())
+ {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ }
+ else
+ {
+ resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+ else if ("invalidateSession".equals(method))
+ {
+ req.getSession().invalidate();
+ }
+ else if ("resetCloud".equals(method))
+ {
+ Cloud.setDestroyed(false);
+ }
+ else
+ {
+ resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ private void serializeToResponse(Object object, HttpServletResponse resp) throws IOException
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(resp.getOutputStream());
+ oos.writeObject(object);
+ oos.flush();
+ oos.close();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,52 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import javax.context.ContextNotActiveException;
+import javax.context.Conversation;
+import javax.context.ConversationScoped;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.jsr299.tck.impl.ConfigurationImpl;
+
+public class ConversationTestPhaseListener implements PhaseListener
+{
+
+ public static final String ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME = "org.jboss.jsr299.tck.activeBeforeApplyRequestValues";
+
+ private boolean activeBeforeApplyRequestValues;
+
+ public void afterPhase(PhaseEvent event)
+ {
+ }
+
+ public void beforePhase(PhaseEvent event)
+ {
+ if (event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+ {
+ try
+ {
+ ConfigurationImpl.get().getManagers().getManager().getContext(ConversationScoped.class);
+ activeBeforeApplyRequestValues = true;
+ }
+ catch (ContextNotActiveException e)
+ {
+ activeBeforeApplyRequestValues = false;
+ }
+ }
+ if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+ {
+ HttpServletResponse response = (HttpServletResponse) event.getFacesContext().getExternalContext().getResponse();
+ response.addHeader(AbstractConversationTest.CID_HEADER_NAME, ConfigurationImpl.get().getManagers().getManager().getInstanceByType(Conversation.class).getId());
+ response.addHeader(Cloud.RAINED_HEADER_NAME, new Boolean(ConfigurationImpl.get().getManagers().getManager().getInstanceByType(Cloud.class).isRained()).toString());
+ response.addHeader(ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME, new Boolean(activeBeforeApplyRequestValues).toString());
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,43 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.Classes;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf")
+})
+public class InvalidatingSessionDestroysConversationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "q")
+ public void testInvalidatingSessionDestroysConversation() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ invalidateSession(client);
+ assert isCloudDestroyed(client);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,76 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.Classes;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="storm.jspx", source="storm.jsf"),
+ @Resource(destination="thunder.jspx", source="thunder.jsf"),
+ @Resource(destination="lightening.jspx", source="lightening.jsf")
+})
+public class LongRunningConversationPropagatedByFacesContextTest extends AbstractConversationTest
+{
+
+ private static final String STORM_STRENGTH = "12";
+ private static final String REDIRECT_STORM_STRENGTH = "15";
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "l")
+ public void testConversationPropagated() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ HtmlPage storm = webClient.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+ HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
+ stormStrength.setValueAttribute(STORM_STRENGTH);
+ String stormCid = getCid(storm);
+ HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
+ HtmlPage thunder = thunderButton.click();
+ assert stormCid.equals(getCid(thunder));
+ stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
+ assert stormStrength.getValueAttribute().equals(STORM_STRENGTH);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "m")
+ public void testConversationPropagatedOverRedirect() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ HtmlPage storm = webClient.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+ HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
+ stormStrength.setValueAttribute(REDIRECT_STORM_STRENGTH);
+ String stormCid = getCid(storm);
+ HtmlSubmitInput lighteningButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "lighteningButton");
+ HtmlPage lightening = lighteningButton.click();
+ assert lightening.getWebResponse().getRequestUrl().toString().contains("lightening.jsf");
+ assert stormCid.equals(getCid(lightening));
+ stormStrength = getFirstMatchingElement(lightening, HtmlTextInput.class, "stormStrength");
+ assert stormStrength.getValueAttribute().equals(REDIRECT_STORM_STRENGTH);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningInstancesNotDestroyedTest.java (from rev 1818, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningInstancesNotDestroyedTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningInstancesNotDestroyedTest.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,41 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.Classes;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf")
+})
+public class LongRunningInstancesNotDestroyedTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningInstancesNotDestroyedTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,44 @@
+package org.jboss.jsr299.tck.tests.context.conversation.client;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.ConversationScoped;
+import javax.inject.Current;
+
+@Named
+@ConversationScoped
+public class Storm implements Serializable
+{
+
+ @Current Conversation conversation;
+
+ private String strength;
+
+ public String thunder()
+ {
+ return "thunder";
+ }
+
+ public String lightening()
+ {
+ return "lightening";
+ }
+
+ public void beginConversation()
+ {
+ conversation.begin();
+ }
+
+ public String getStrength()
+ {
+ return strength;
+ }
+
+ public void setStrength(String strength)
+ {
+ this.strength = strength;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/beans.xml 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/beans.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,8 +0,0 @@
-<Beans xmlns="urn:java:ee"
- xmlns:test="urn:java:org.jboss.jsr299.tck.tests.context.dependent">
- <Deploy>
- <Standard />
- <Production />
- <test:AnotherDeploymentType />
- </Deploy>
-</Beans>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client
___________________________________________________________________
Name: svn:ignore
+ .faces-config.xml.jsfdia
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf (from rev 1818, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="#{cloud.name}" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf (from rev 1818, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="#{cloud.name}" />
+ <h:outputText value="#{cloudController.beginConversation}" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<faces-config version="1.2"
+ 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-facesconfig_1_2.xsd">
+
+ <lifecycle>
+ <phase-listener>org.jboss.jsr299.tck.tests.context.conversation.client.ConversationTestPhaseListener</phase-listener>
+ </lifecycle>
+
+ <navigation-rule>
+ <from-view-id>/storm.jspx</from-view-id>
+ <navigation-case>
+ <from-outcome>thunder</from-outcome>
+ <to-view-id>/thunder.jspx</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/storm.jspx</from-view-id>
+ <navigation-case>
+ <from-outcome>lightening</from-outcome>
+ <to-view-id>/lightening.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf (from rev 1818, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml" version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
+ <jsp:directive.page contentType="text/html" />
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:inputText value="#{storm.strength}" id="stormStrength" />
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="#{cloud.rain}" />
+ <h:outputText value="#{cloudController.beginConversation}" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="form">
+ <h:inputText value="#{storm.strength}" id="stormStrength" />
+ <h:commandButton action="#{storm.beginConversation}" value="Thunder" id="beginConversationButton"/>
+ <h:commandButton action="#{storm.thunder}" value="Thunder" id="thunderButton"/>
+ <h:commandButton action="#{storm.lightening}" value="Thunder" id="lighteningButton"/>
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml" version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
+ <jsp:directive.page contentType="text/html" />
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:inputText value="#{storm.strength}" id="stormStrength" />
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml (from rev 1818, tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml)
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -0,0 +1,42 @@
+<?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>JSR-299 TCK</display-name>
+
+ <!-- JSF -->
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.jspx</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Conversation Status Servlet</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.conversation.client.ConversationStatusServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Conversation Status Servlet</servlet-name>
+ <url-pattern>/conversation-status</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <jsp:directive.page contentType="text/html"/>
- <html>
- <head>
- </head>
- <body>
- <f:view>
- <h:outputText value="#{cloud.name}" />
- </f:view>
- </body>
- </html>
-</jsp:root>
-
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <jsp:directive.page contentType="text/html"/>
- <html>
- <head>
- </head>
- <body>
- <f:view>
- <h:outputText value="#{cloud.name}" />
- <h:outputText value="#{cloudController.beginConversation}" />
- </f:view>
- </body>
- </html>
-</jsp:root>
-
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
- doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <jsp:directive.page contentType="text/html"/>
- <html>
- <head>
- </head>
- <body>
-
- </body>
- </html>
-</jsp:root>
-
Deleted: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -1,42 +0,0 @@
-<?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>JSR-299 TCK</display-name>
-
- <!-- JSF -->
-
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
-
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.jspx</param-value>
- </context-param>
-
- <servlet>
- <servlet-name>Conversation Status Servlet</servlet-name>
- <servlet-class>org.jboss.jsr299.tck.tests.context.conversation.ConversationStatusServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>Conversation Status Servlet</servlet-name>
- <url-pattern>/conversation-status</url-pattern>
- </servlet-mapping>
-
- <session-config>
- <session-timeout>10</session-timeout>
- </session-config>
-
-</web-app>
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -5045,8 +5045,9 @@
<note>Not required</note>
</assertion>
- <assertion id="u">
+ <assertion id="u" testable="false">
<text>The container ensures that a long-running conversation may be associated with at most one request at a time, by blocking or rejecting concurrent requests</text>
+ <note>Cannot test as their as what happens is not well defined</note>
</assertion>
</section>
@@ -5070,7 +5071,7 @@
</assertion>
</section>
- <section id="9" title="XML based metadata">
+ <!-- <section id="9" title="XML based metadata">
<assertion id="a">
<text>XML-based bean declarations define additional beans?they do not redefine or disable any bean that was declared via annotations</text>
</assertion>
@@ -5671,6 +5672,6 @@
<section id="9.6.2" title="Child elements of a producer method declaration">
- </section>
+ </section>-->
</specification>
Modified: tck/trunk/pom.xml
===================================================================
--- tck/trunk/pom.xml 2009-03-08 22:23:49 UTC (rev 1821)
+++ tck/trunk/pom.xml 2009-03-08 22:33:13 UTC (rev 1822)
@@ -135,6 +135,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.4</version>
+ </dependency>
</dependencies>
</dependencyManagement>
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1821 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-08 18:23:49 -0400 (Sun, 08 Mar 2009)
New Revision: 1821
Modified:
doc/trunk/reference/en-US/ri-spi.xml
Log:
Added a section on the transaction services SPI.
Modified: doc/trunk/reference/en-US/ri-spi.xml
===================================================================
--- doc/trunk/reference/en-US/ri-spi.xml 2009-03-08 21:56:27 UTC (rev 1820)
+++ doc/trunk/reference/en-US/ri-spi.xml 2009-03-08 22:23:49 UTC (rev 1821)
@@ -192,6 +192,66 @@
</section>
+ <section>
+ <title>Transaction Services</title>
+
+ <para>
+ The Web Beans RI must delegate JTA activities to the container.
+ The SPI provides a couple hooks to easily achieve this with the
+ <literal>TransactionServices</literal> interface.
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[public interface TransactionServices
+{
+ /**
+ * Possible status conditions for a transaction. This can be used by SPI
+ * providers to keep track for which status an observer is used.
+ */
+ public static enum Status
+ {
+ ALL, SUCCESS, FAILURE
+ }
+
+ /**
+ * Registers a synchronization object with the currently executing
+ * transaction.
+ *
+ * @see javax.transaction.Synchronization
+ * @param synchronizedObserver
+ */
+ public void registerSynchronization(Synchronization synchronizedObserver);
+
+ /**
+ * Queries the status of the current execution to see if a transaction is
+ * currently active.
+ *
+ * @return true if a transaction is active
+ */
+ public boolean isTransactionActive();
+}]]></programlisting>
+
+ <para>
+ The enumeration <literal>Status</literal> is a convenience for implementors
+ to be able to keep track of whether a synchronization is supposed to notify
+ an observer only when the transaction is successful, or after a failure, or
+ regardless of the status of the transaction.
+ </para>
+
+ <para>
+ Any <literal>javax.transaction.Synchronization</literal> implementation
+ may be passed to the <literal>registerSynchronization()</literal> method
+ and the SPI implementation should immediately register the synchronization
+ with the JTA transaction manager used for the EJBs.
+ </para>
+
+ <para>
+ To make it easier to determine whether or not a transaction is currently
+ active for the requesting thread, the <literal>isTransactionActive()</literal>
+ method can be used. The SPI implementation should query the same
+ JTA transaction manager used for the EJBs.
+ </para>
+ </section>
+
<section>
<title>The application context</title>
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1820 - in ri/trunk: spi and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-08 17:56:27 -0400 (Sun, 08 Mar 2009)
New Revision: 1820
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
ri/trunk/spi/pom.xml
ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
Log:
Commit the SPI
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-03-08 21:41:55 UTC (rev 1819)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-03-08 21:56:27 UTC (rev 1820)
@@ -40,7 +40,6 @@
return false;
}
- @Override
public void registerSynchronization(Synchronization synchronizedObserver)
{
// TODO Auto-generated method stub
Modified: ri/trunk/spi/pom.xml
===================================================================
--- ri/trunk/spi/pom.xml 2009-03-08 21:41:55 UTC (rev 1819)
+++ ri/trunk/spi/pom.xml 2009-03-08 21:56:27 UTC (rev 1820)
@@ -39,6 +39,10 @@
<artifactId>servlet-api</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
</dependencies>
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java 2009-03-08 21:41:55 UTC (rev 1819)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java 2009-03-08 21:56:27 UTC (rev 1820)
@@ -1,5 +1,7 @@
package org.jboss.webbeans.transaction.spi;
+import javax.transaction.Synchronization;
+
/**
* <p>
* The container must implement the services related to transactional behavior
@@ -11,7 +13,7 @@
* observer methods which are activated based on the phase and status of a
* currently active transaction. In order to use these abilities, the container
* must provide these intermediary services which in turn may interact with an
- * application server and JTA or any other type of transaction service provider.
+ * application server and JTA.
* </p>
*
* @author David Allen
@@ -20,7 +22,8 @@
public interface TransactionServices
{
/**
- * Possible status conditions for a transaction.
+ * Possible status conditions for a transaction. This can be used by SPI
+ * providers to keep track for which status an observer is used.
*/
public static enum Status
{
@@ -28,31 +31,15 @@
}
/**
- * Registers a task to be executed immediately before the current transaction
- * is committed or rolled back.
+ * Registers a synchronization object with the currently executing
+ * transaction.
*
- * @param task The Runnable that will be executed
+ * @see javax.transaction.Synchronization
+ * @param synchronizedObserver
*/
- public void executeBeforeTransactionCompletion(Runnable task);
+ public void registerSynchronization(Synchronization synchronizedObserver);
/**
- * Registers a task to be executed immediately after the current transaction
- * is committed or rolled back.
- *
- * @param task The Runnable that will be executed
- */
- public void executeAfterTransactionCompletion(Runnable task);
-
- /**
- * Registers a task to be executed immediately after the current transaction
- * is committed or rolled back, but only one depending on the status
- * provided.
- *
- * @param task The Runnable that will be executed
- */
- public void executeAfterTransactionCompletion(Runnable task, Status desiredStatus);
-
- /**
* Queries the status of the current execution to see if a transaction is
* currently active.
*
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1819 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: mock and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-08 17:41:55 -0400 (Sun, 08 Mar 2009)
New Revision: 1819
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
Log:
Changes for the corresponding changes to the SPI with TransactionServices.
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java 2009-03-08 21:41:55 UTC (rev 1819)
@@ -0,0 +1,63 @@
+package org.jboss.webbeans.event;
+
+import static javax.transaction.Status.STATUS_COMMITTED;
+
+import javax.transaction.Synchronization;
+
+import org.jboss.webbeans.transaction.spi.TransactionServices;
+
+/**
+ * A JTA transaction sychronization which wraps a Runnable.
+ *
+ * @author David Allen
+ *
+ */
+public class TransactionSynchronizedRunnable implements Synchronization
+{
+ private final TransactionServices.Status desiredStatus;
+ private final Runnable task;
+ private final boolean before;
+
+ public TransactionSynchronizedRunnable(Runnable task, boolean before)
+ {
+ this(task, TransactionServices.Status.ALL, before);
+ }
+
+ public TransactionSynchronizedRunnable(Runnable task, TransactionServices.Status desiredStatus)
+ {
+ this(task, desiredStatus, false); // Status is only applicable after the transaction
+ }
+
+ private TransactionSynchronizedRunnable(Runnable task, TransactionServices.Status desiredStatus, boolean before)
+ {
+ this.task = task;
+ this.desiredStatus = desiredStatus;
+ this.before = before;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.transaction.Synchronization#afterCompletion(int)
+ */
+ public void afterCompletion(int status)
+ {
+ if ((desiredStatus == TransactionServices.Status.SUCCESS && status == STATUS_COMMITTED) || (desiredStatus == TransactionServices.Status.FAILURE && status != STATUS_COMMITTED) || (desiredStatus == TransactionServices.Status.ALL))
+ {
+ task.run();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.transaction.Synchronization#beforeCompletion()
+ */
+ public void beforeCompletion()
+ {
+ if (before)
+ {
+ task.run();
+ }
+ }
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-08 21:02:09 UTC (rev 1818)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-08 21:41:55 UTC (rev 1819)
@@ -27,6 +27,7 @@
import javax.event.BeforeTransactionCompletion;
import javax.inject.DefinitionException;
import javax.inject.manager.Bean;
+import javax.transaction.Synchronization;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -36,7 +37,7 @@
* @author David Allen
*
*/
-public class TransactionalObserverImpl<T> extends ObserverImpl<T>
+class TransactionalObserverImpl<T> extends ObserverImpl<T>
{
/**
* The known transactional phases a transactional event observer can be
@@ -44,36 +45,7 @@
*/
protected enum TransactionObservationPhase
{
- BEFORE_COMPLETION
- {
- void registerTask(TransactionServices transactionServices, Runnable task)
- {
- transactionServices.executeBeforeTransactionCompletion(task);
- }
- },
- AFTER_COMPLETION
- {
- void registerTask(TransactionServices transactionServices, Runnable task)
- {
- transactionServices.executeAfterTransactionCompletion(task);
- }
- },
- AFTER_FAILURE
- {
- void registerTask(TransactionServices transactionServices, Runnable task)
- {
- transactionServices.executeAfterTransactionCompletion(task, TransactionServices.Status.SUCCESS);
- }
- },
- AFTER_SUCCESS
- {
- void registerTask(TransactionServices transactionServices, Runnable task)
- {
- transactionServices.executeAfterTransactionCompletion(task, TransactionServices.Status.FAILURE);
- }
- };
-
- abstract void registerTask(TransactionServices transactionServices, Runnable task);
+ BEFORE_COMPLETION, AFTER_COMPLETION, AFTER_FAILURE, AFTER_SUCCESS
}
private TransactionObservationPhase transactionObservationPhase;
@@ -87,7 +59,7 @@
public static boolean isObserverMethodTransactional(AnnotatedMethod<?> observer)
{
boolean transactional = true;
- if ((observer.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionSuccess.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionFailure.class).isEmpty()))
+ if ((observer.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty()) && (observer.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty()) && (observer.getAnnotatedParameters(AfterTransactionSuccess.class).isEmpty()) && (observer.getAnnotatedParameters(AfterTransactionFailure.class).isEmpty()))
{
transactional = false;
}
@@ -175,7 +147,24 @@
{
deferredEvent = new AsynchronousTransactionalEventNotification<T>(event, this);
}
- transactionObservationPhase.registerTask(manager.getTransactionServices(), deferredEvent);
+ Synchronization synchronization = null;
+ if (transactionObservationPhase.equals(TransactionObservationPhase.BEFORE_COMPLETION))
+ {
+ synchronization = new TransactionSynchronizedRunnable(deferredEvent, true);
+ }
+ else if (transactionObservationPhase.equals(TransactionObservationPhase.AFTER_COMPLETION))
+ {
+ synchronization = new TransactionSynchronizedRunnable(deferredEvent, false);
+ }
+ else if (transactionObservationPhase.equals(TransactionObservationPhase.AFTER_SUCCESS))
+ {
+ synchronization = new TransactionSynchronizedRunnable(deferredEvent, TransactionServices.Status.SUCCESS);
+ }
+ else if (transactionObservationPhase.equals(TransactionObservationPhase.AFTER_FAILURE))
+ {
+ synchronization = new TransactionSynchronizedRunnable(deferredEvent, TransactionServices.Status.FAILURE);
+ }
+ manager.getTransactionServices().registerSynchronization(synchronization);
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-03-08 21:02:09 UTC (rev 1818)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockTransactionServices.java 2009-03-08 21:41:55 UTC (rev 1819)
@@ -17,6 +17,8 @@
package org.jboss.webbeans.mock;
+import javax.transaction.Synchronization;
+
import org.jboss.webbeans.transaction.spi.TransactionServices;
/**
@@ -31,27 +33,6 @@
{
/* (non-Javadoc)
- * @see org.jboss.webbeans.transaction.spi.TransactionServices#executeAfterTransactionCompletion(java.lang.Runnable)
- */
- public void executeAfterTransactionCompletion(Runnable task)
- {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.transaction.spi.TransactionServices#executeAfterTransactionCompletion(java.lang.Runnable, org.jboss.webbeans.transaction.spi.TransactionServices.Status)
- */
- public void executeAfterTransactionCompletion(Runnable task, Status desiredStatus)
- {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.webbeans.transaction.spi.TransactionServices#executeBeforeTransactionCompletion(java.lang.Runnable)
- */
- public void executeBeforeTransactionCompletion(Runnable task)
- {
- }
-
- /* (non-Javadoc)
* @see org.jboss.webbeans.transaction.spi.TransactionServices#isTransactionActive()
*/
public boolean isTransactionActive()
@@ -59,4 +40,11 @@
return false;
}
+ @Override
+ public void registerSynchronization(Synchronization synchronizedObserver)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1818 - in extensions/trunk/se: src/main/java/org/jboss/webbeans/environment/se and 8 other directories.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-03-08 17:02:09 -0400 (Sun, 08 Mar 2009)
New Revision: 1818
Added:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/NoopTransactionService.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/ShutdownRequest.java
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/StartMainTest.java
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/MainTestBean.java
extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/ParametersTestBean.java
extensions/trunk/se/src/test/resources/
extensions/trunk/se/src/test/resources/beans.xml
extensions/trunk/se/src/test/resources/log4j.properties
Removed:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentMetadata.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansDeploymentProperties.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Setup.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Start.java
Modified:
extensions/trunk/se/pom.xml
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java
extensions/trunk/se/src/main/resources/log4j.properties
Log:
Added NoOp Transaction Service. Added Test. Added optional ShutdownRequest event.
Modified: extensions/trunk/se/pom.xml
===================================================================
--- extensions/trunk/se/pom.xml 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/pom.xml 2009-03-08 21:02:09 UTC (rev 1818)
@@ -100,7 +100,6 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-ri-spi</artifactId>
</dependency>
-
<!-- TODO (PR): remove this dependency -->
<dependency>
<groupId>org.jboss.webbeans</groupId>
@@ -120,10 +119,16 @@
</exclusion>
</exclusions>
</dependency>
+ <!-- TODO: these have to go or be replaced with mocks -->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
</dependencies>
</project>
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -16,7 +16,12 @@
*/
package org.jboss.webbeans.environment.se;
+import javax.event.Observes;
import org.jboss.webbeans.environment.se.boot.WebBeansBootstrap;
+import org.jboss.webbeans.environment.se.events.Shutdown;
+import org.jboss.webbeans.environment.se.events.ShutdownRequest;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
/**
* This is the main class that should always be called from the command
@@ -29,23 +34,24 @@
public class StartMain
{
- String[] args;
+ private WebBeansBootstrap webBeansBootstrap;
+ private String[] args;
+ private boolean hasShutdownBeenCalled = false;
+ Log log = Logging.getLog( StartMain.class );
public StartMain( String[] commandLineArgs )
{
this.args = commandLineArgs;
}
- public void go()
+ private void go()
{
- WebBeansBootstrap webBeansBootstrap = new WebBeansBootstrap( args );
+ webBeansBootstrap = new WebBeansBootstrap( args );
webBeansBootstrap.initialize();
webBeansBootstrap.boot();
- webBeansBootstrap.shutdown();
-
}
/**
@@ -57,39 +63,27 @@
{
new StartMain( args ).go();
}
+
/**
- * When an exception happens in your main app, you don't want
- * the manager to come down in a screaming heap. Well, not all the time.
- * Sometimes you just want to exit gently. This method will detect such
- * times and behave appropriately.
- * @param e
+ * The observer of the optional shutdown request which will in turn fire the
+ * Shutdown event.
+ * @param shutdownRequest
*/
-// private void handleException( Throwable e )
-// {
-// // check for a 'special' root cause
-// boolean dealtWith = false;
-// Throwable cause = e.getCause();
-//
-// while (cause != null)
-// {
-// if (cause instanceof CleanShutdownException)
-// {
-// // This is a request to shut down silently, so swollow it.
-// // Hoewver, if there's a message, then print it to stdout
-// if (cause.getMessage() != null)
-// {
-// System.out.println( cause.getMessage() );
-// }
-//
-// dealtWith = true;
-// }
-//
-// cause = cause.getCause();
-// }
-//
-// if (!dealtWith)
-// {
-// e.printStackTrace();
-// }
-// }
+ public void shutdown( @Observes ShutdownRequest shutdownRequest )
+ {
+ synchronized (this)
+ {
+
+ if (!hasShutdownBeenCalled)
+ {
+ hasShutdownBeenCalled = true;
+ webBeansBootstrap.shutdown();
+ } else
+ {
+ log.debug( "Skipping spurious call to shutdown");
+ log.trace( Thread.currentThread().getStackTrace() );
+ }
+ }
+ }
+
}
Added: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/NoopTransactionService.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/NoopTransactionService.java (rev 0)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/NoopTransactionService.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+
+package org.jboss.webbeans.environment.se.boot;
+
+import org.omg.IOP.TransactionService;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class NoopTransactionService implements TransactionService {
+
+}
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/boot/WebBeansBootstrap.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -18,7 +18,6 @@
import java.lang.annotation.Annotation;
import java.util.List;
-import javax.inject.manager.Manager;
import javax.transaction.Transaction;
import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
@@ -38,6 +37,7 @@
import org.jboss.webbeans.literal.InitializedLiteral;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.manager.api.WebBeansManager;
/**
* Bootstrap class for for WebBeans in SE environment. Provides no JNDI binding.
@@ -80,14 +80,14 @@
{
throw new IllegalStateException( "EjbResolver is not set" );
}
- this.manager = new ManagerImpl( getNamingContext(), getEjbResolver(), getResourceLoader() );
+ this.manager = new ManagerImpl( getNamingContext(), getEjbResolver(), getResourceLoader(), getTransactionServices() );
CurrentManager.setRootManager( manager );
lifecycle.initialize();
}
@Override
- public Manager getManager()
+ public WebBeansManager getManager()
{
return manager;
}
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/AbstractScanner.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -41,6 +41,7 @@
{
private static class Handler
{
+ public static final String BEANS_XML = "beans.xml";
private ClassDescriptor classDescriptor;
private Set<FileDescriptor> fileDescriptors;
private Set<DeploymentHandler> deploymentHandlers;
@@ -81,7 +82,7 @@
}
} else
{
- if ( name.equals ("beans.xml" ) )
+ if ( name.equals (BEANS_XML) )
{
deploymentHandler.getResources( ).addAll( getAllFileDescriptors( ) );
handled = true;
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/ClassDeploymentMetadata.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,26 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.deployment;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-public interface ClassDeploymentMetadata
- extends DeploymentMetadata
-{
-
-}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentMetadata.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentMetadata.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentMetadata.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.deployment;
-
-
-/**
- * Metadata about resources the deployment handler is interested in
- *
- * @author pmuir
- *
- */
-public interface DeploymentMetadata
-{
- /**
- * A file name suffixes that this deployment handler is interested in
- */
- public String getFileNameSuffix( );
-}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/DeploymentStrategy.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,180 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.deployment;
-
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A {@link DeploymentStrategy} coordinates the deployment of resources for a
- * Web Beans SE application.
- *
- * @author Pete Muir
- *
- */
-public abstract class DeploymentStrategy
-{
- private static final LogProvider log = Logging.getLogProvider( DeploymentStrategy.class );
- private Scanner scanner;
- private List<File> files = new ArrayList<File>( );
- private Set<DeploymentHandler> deploymentHandlers;
-
- /**
- * The key under which to list possible scanners. System properties take
- * precedence over /META-INF/seam-scanner.properties. Entries will be tried
- * in sequential order until a Scanner can be loaded.
- *
- * This can be specified as a System property or in
- * /META-INF/seam-deployment.properties
- */
- public static final String SCANNERS_KEY = "org.jboss.webbeans.environment.se.deployment.scanners";
-
- /**
- * Do the scan for resources
- *
- * Should only be called by Seam
- *
- */
- public abstract void scan( );
-
- /**
- * Get the scanner being used
- *
- */
- protected Scanner getScanner( )
- {
- if ( scanner == null )
- {
- initScanner( );
- }
-
- return scanner;
- }
-
- /**
- * Get the classloader to use
- */
- public abstract ClassLoader getClassLoader( );
-
- /**
- * Get (or modify) any registered {@link DeploymentHandler}s
- *
- * Implementations of {@link DeploymentStrategy} may add default
- * {@link DeploymentHandler}s
- */
- public Set<DeploymentHandler> getDeploymentHandlers( )
- {
- if ( deploymentHandlers == null )
- {
- initDeploymentHandlers( );
- }
-
- return this.deploymentHandlers;
- }
-
- private void initDeploymentHandlers( )
- {
- this.deploymentHandlers = new HashSet<DeploymentHandler>( );
-
- }
-
- protected void initScanner( )
- {
- List<String> scanners =
- new WebBeansDeploymentProperties( getClassLoader( ) ).getPropertyValues( SCANNERS_KEY );
-
- for ( String className : scanners )
- {
- Scanner scanner = instantiateScanner( className );
-
- if ( scanner != null )
- {
- log.debug( "Using " + scanner.toString( ) );
- this.scanner = scanner;
-
- return;
- }
- }
-
- log.debug( "Using default URLScanner" );
- ////this.scanner = new URLScanner( this );
- }
-
- private Scanner instantiateScanner( String className )
- {
- try
- {
- Class<Scanner> scannerClass = (Class<Scanner>) getClassLoader( ).loadClass( className );
- Constructor<Scanner> constructor = scannerClass.getConstructor( new Class[] { DeploymentStrategy.class } );
-
- return constructor.newInstance( new Object[] { this } );
- } catch ( ClassNotFoundException e )
- {
- log.trace( "Unable to use " + className + " as scanner (class not found)", e );
- } catch ( NoClassDefFoundError e )
- {
- log.trace( "Unable to use " + className + " as scanner (dependency not found)", e );
- } catch ( ClassCastException e )
- {
- log.trace( "Unable to use " + className +
- " as scanner (class does not implement org.jboss.seam.deployment.Scanner)" );
- } catch ( InstantiationException e )
- {
- log.trace( "Unable to instantiate scanner " + className, e );
- } catch ( IllegalAccessException e )
- {
- log.trace( "Unable to instantiate scanner " + className, e );
- } catch ( SecurityException e )
- {
- log.trace( className + " must declare public " + className +
- "( ClassLoader classLoader, String ... resourceNames )", e );
- } catch ( NoSuchMethodException e )
- {
- log.trace( className + " must declare public " + className +
- "( ClassLoader classLoader, String ... resourceNames )", e );
- } catch ( IllegalArgumentException e )
- {
- log.trace( className + " must declare public " + className +
- "( ClassLoader classLoader, String ... resourceNames )", e );
- } catch ( InvocationTargetException e )
- {
- log.trace( className + " must declare public " + className +
- "( ClassLoader classLoader, String ... resourceNames )", e );
- }
-
- return null;
- }
-
- public List<File> getFiles( )
- {
- return files;
- }
-
- public void setFiles( List<File> files )
- {
- this.files = files;
- }
-
-}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/StandardDeploymentStrategy.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,88 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.deployment;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * The standard deployment strategy used with Seam, deploys non-hot-deployable
- * Seam components and namespaces
- *
- * @author Pete Muir
- *
- */
-public class StandardDeploymentStrategy
- extends DeploymentStrategy
-{
- private ClassLoader classLoader;
-
- /**
- * The files used to identify a Seam archive
- */
- public static final String[] RESOURCE_NAMES = { "beans.xml" };
-
- private SimpleWebBeansDeploymentHandler simpleWebBeansDeploymentHandler;
- private WebBeansXmlDeploymentHandler webBeansXmlDeploymentHandler;
-
- /**
- * @param classLoader The classloader used to load and handle resources
- */
- public StandardDeploymentStrategy( ClassLoader classLoader )
- {
- this.classLoader = Thread.currentThread( ).getContextClassLoader( );
- simpleWebBeansDeploymentHandler = new SimpleWebBeansDeploymentHandler( );
- getDeploymentHandlers( ).add( simpleWebBeansDeploymentHandler );
- webBeansXmlDeploymentHandler = new WebBeansXmlDeploymentHandler( );
- getDeploymentHandlers( ).add( webBeansXmlDeploymentHandler );
- }
-
- @Override
- public ClassLoader getClassLoader( )
- {
- return classLoader;
- }
-
- /**
- * Get all annotated components known to this strategy
- */
- public Set<ClassDescriptor> getSimpleWebBeans( )
- {
- return Collections.unmodifiableSet( simpleWebBeansDeploymentHandler.getClasses( ) );
- }
-
- /**
- * Get all beans.xml locations
- */
- public Set<FileDescriptor> getWebBeansXMLs( )
- {
- Set<FileDescriptor> fileDescriptors = new HashSet<FileDescriptor>( );
- fileDescriptors.addAll( webBeansXmlDeploymentHandler.getResources( ) );
-
- return Collections.unmodifiableSet( fileDescriptors );
- }
-
- @Override
- public void scan( )
- {
- getScanner( ).scanResources( RESOURCE_NAMES );
- getScanner( ).scanDirectories( getFiles( ).toArray( new File[0] ) );
- }
-
-}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansDeploymentProperties.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansDeploymentProperties.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/deployment/WebBeansDeploymentProperties.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,136 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.deployment;
-
-import org.jboss.webbeans.environment.se.util.EnumerationEnumeration;
-import static org.jboss.webbeans.util.Strings.split;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-public class WebBeansDeploymentProperties
-{
- private ClassLoader classLoader;
- private Enumeration<URL> urlEnum;
-
- public WebBeansDeploymentProperties( ClassLoader classLoader )
- {
- this.classLoader = classLoader;
- }
-
- /**
- * The resource bundle used to control Seam deployment
- */
- public static final String RESOURCE_BUNDLE = "META-INF/seam-deployment.properties";
-
- // All resource bundles to use, including legacy names
- private static final String[] RESOURCE_BUNDLES = { RESOURCE_BUNDLE, "META-INF/seam-scanner.properties" };
-
- /**
- * Get a list of possible values for a given key.
- *
- * First, System properties are tried, followed by the specified resource
- * bundle (first in classpath only).
- *
- * Colon (:) deliminated lists are split out.
- *
- */
- public List<String> getPropertyValues( String key )
- {
- List<String> values = new ArrayList<String>( );
- addPropertiesFromSystem( key, values );
- addPropertiesFromResourceBundle( key, values );
-
- return values;
- }
-
- private void addPropertiesFromSystem( String key, List<String> values )
- {
- addProperty( key,
- System.getProperty( key ),
- values );
- }
-
- private void addPropertiesFromResourceBundle( String key, List<String> values )
- {
- try
- {
- while ( getResources( ).hasMoreElements( ) )
- {
- URL url = getResources( ).nextElement( );
- Properties properties = new Properties( );
- InputStream propertyStream = url.openStream( );
-
- try
- {
- properties.load( propertyStream );
- addProperty( key,
- properties.getProperty( key ),
- values );
- } finally
- {
- if ( propertyStream != null )
- {
- propertyStream.close( );
- }
- }
- }
- } catch ( IOException e )
- {
- // No - op, file is optional
- }
- }
-
- /*
- * Add the property to the set of properties only if it hasn't already been added
- */
- private void addProperty( String key, String value, List<String> values )
- {
- if ( value != null )
- {
- String[] properties = split( value, ":" );
-
- for ( String property : properties )
- {
- values.add( property );
- }
- }
- }
-
- private Enumeration<URL> getResources( )
- throws IOException
- {
- if ( urlEnum == null )
- {
- Enumeration<URL>[] enumerations = new Enumeration[RESOURCE_BUNDLES.length];
-
- for ( int i = 0; i < RESOURCE_BUNDLES.length; i++ )
- {
- enumerations[i] = classLoader.getResources( RESOURCE_BUNDLES[i] );
- }
-
- urlEnum = new EnumerationEnumeration<URL>( enumerations );
- }
-
- return urlEnum;
- }
-}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Setup.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Setup.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Setup.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.events;
-
-
-/**
- * The event which is fired after the manager initialises but before the
- * "Start" event is fired (causing the application to begin).
- * Applications may observe this event in order to perform any additional setup
- * necessary, however it is most useful for setup required to make injection
- * of certain custom beans possible - for example: setting up custom contexts.
- * @author Peter Royle
- */
-public class Setup
-{
-}
Added: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/ShutdownRequest.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/ShutdownRequest.java (rev 0)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/ShutdownRequest.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.jboss.webbeans.environment.se.events;
+
+/**
+* Should be fired by application to trigger shutting down of the WebBEans SE
+ * manager. This will in turn fire the Shutdown
+ * @author Peter Royle
+ */
+public class ShutdownRequest
+{
+
+ public ShutdownRequest()
+ {
+ }
+}
Deleted: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Start.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Start.java 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/events/Start.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-package org.jboss.webbeans.environment.se.events;
-
-
-/**
- * The event which is fired after the manager initialises and is ready for the
- * application to start. Applications should provide a method which observes
- * this event as a means of starting the application.
- * @author Peter Royle
- */
-public class Start
-{
-}
Modified: extensions/trunk/se/src/main/resources/log4j.properties
===================================================================
--- extensions/trunk/se/src/main/resources/log4j.properties 2009-03-08 20:58:51 UTC (rev 1817)
+++ extensions/trunk/se/src/main/resources/log4j.properties 2009-03-08 21:02:09 UTC (rev 1818)
@@ -15,7 +15,7 @@
# limitations under the License.
#
# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=TRACE, A1
+log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
Added: extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/StartMainTest.java
===================================================================
--- extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/StartMainTest.java (rev 0)
+++ extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/StartMainTest.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,75 @@
+/**
+ * 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.
+ */
+package org.jboss.webbeans.environment.se;
+
+import javax.inject.manager.Manager;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.environment.se.beans.MainTestBean;
+import org.jboss.webbeans.environment.se.beans.ParametersTestBean;
+import org.jboss.webbeans.environment.se.events.ShutdownRequest;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class StartMainTest extends TestCase {
+
+ public static String[] ARGS = new String[] { "arg1", "arg2", "arg 3"};
+
+ public StartMainTest(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test of main method, of class StartMain. Checks that the beans
+ * found in the org.jboss.webbeans.environment.se.beans package are
+ * initialised as expected.
+ */
+ public void testMain()
+ {
+ String[] args = ARGS ;
+ StartMain.main( args );
+
+ Manager manager = CurrentManager.rootManager();
+ MainTestBean mainTestBean = manager.getInstanceByType( MainTestBean.class );
+ Assert.assertNotNull( mainTestBean );
+
+ ParametersTestBean paramsBean = mainTestBean.getParametersTestBean();
+ Assert.assertNotNull( paramsBean );
+ Assert.assertNotNull( paramsBean.getParam1() );
+ Assert.assertEquals( ARGS[0], paramsBean.getParam1() );
+ Assert.assertNotNull( paramsBean.getParam2() );
+ Assert.assertEquals( ARGS[1], paramsBean.getParam2() );
+ Assert.assertNotNull( paramsBean.getParam3() );
+ Assert.assertEquals( ARGS[2], paramsBean.getParam3() );
+
+ manager.fireEvent( new ShutdownRequest() );
+ }
+
+}
Added: extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/MainTestBean.java
===================================================================
--- extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/MainTestBean.java (rev 0)
+++ extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/MainTestBean.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+package org.jboss.webbeans.environment.se.beans;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class MainTestBean
+{
+
+ boolean initialised = false;
+ ParametersTestBean parametersTestBean;
+
+ @Initializer
+ public void init(@Current ParametersTestBean paramsTestBean)
+ {
+ this.initialised = true;
+ this.parametersTestBean = paramsTestBean;
+ }
+
+ public ParametersTestBean getParametersTestBean()
+ {
+ return parametersTestBean;
+ }
+
+ public boolean isInitialised()
+ {
+ return initialised;
+ }
+
+
+}
Added: extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/ParametersTestBean.java
===================================================================
--- extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/ParametersTestBean.java (rev 0)
+++ extensions/trunk/se/src/test/java/org/jboss/webbeans/environment/se/beans/ParametersTestBean.java 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+
+package org.jboss.webbeans.environment.se.beans;
+
+import java.util.List;
+import javax.inject.Initializer;
+import junit.framework.Assert;
+import org.jboss.webbeans.environment.se.StartMainTest;
+import org.jboss.webbeans.environment.se.bindings.Parameters;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class ParametersTestBean {
+
+ String param1;
+ String param2;
+ String param3;
+
+ @Initializer
+ public void init(@Parameters List<String> params) {
+ Assert.assertNotNull( params );
+ Assert.assertEquals( "Unexpected number of arguments", StartMainTest.ARGS.length, params.size() );
+ param1 = params.get( 0 );
+ param2 = params.get( 1 );
+ param3 = params.get( 2 );
+ }
+
+ public String getParam1()
+ {
+ return param1;
+ }
+
+ public String getParam2()
+ {
+ return param2;
+ }
+
+ public String getParam3()
+ {
+ return param3;
+ }
+
+}
Added: extensions/trunk/se/src/test/resources/beans.xml
===================================================================
--- extensions/trunk/se/src/test/resources/beans.xml (rev 0)
+++ extensions/trunk/se/src/test/resources/beans.xml 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,19 @@
+<!--
+
+ 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.
+
+-->
+<beans></beans>
Added: extensions/trunk/se/src/test/resources/log4j.properties
===================================================================
--- extensions/trunk/se/src/test/resources/log4j.properties (rev 0)
+++ extensions/trunk/se/src/test/resources/log4j.properties 2009-03-08 21:02:09 UTC (rev 1818)
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=DEBUG, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1817 - in ri/trunk: version-matrix and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-08 16:58:51 -0400 (Sun, 08 Mar 2009)
New Revision: 1817
Modified:
ri/trunk/jboss-as/build.properties
ri/trunk/version-matrix/pom.xml
Log:
minor
Modified: ri/trunk/jboss-as/build.properties
===================================================================
--- ri/trunk/jboss-as/build.properties 2009-03-08 17:56:37 UTC (rev 1816)
+++ ri/trunk/jboss-as/build.properties 2009-03-08 20:58:51 UTC (rev 1817)
@@ -1,5 +1,9 @@
+# Container a number of properties associated with installing Web Beans into JBoss AS and running the TCK in JBoss AS
#jboss.home=/Applications/jboss-5.0.1.GA
-java.opts=-Xms128m -Xmx256m -XX:MaxPermSize=128m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+java.opts=-Xms128m -Xmx256m -XX:MaxPermSize=128m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 # recommended minimum JAVA_OPTS for running JBoss with the TCK
+# jboss.shutdown.delay=15000 # time to allow before attempting to restart JBoss AS
+# jboss.deployments.restart = 25 # maximum number of TCK tests to deploy before restarting JBoss AS
webbeans-ri-int.version=5.2.0-SNAPSHOT
webbeans.version=1.0.0-SNAPSHOT
jboss-ejb3.version=1.0.0
+
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-03-08 17:56:37 UTC (rev 1816)
+++ ri/trunk/version-matrix/pom.xml 2009-03-08 20:58:51 UTC (rev 1817)
@@ -412,4 +412,19 @@
</pluginManagement>
</build>
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
</project>
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1816 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-08 13:56:37 -0400 (Sun, 08 Mar 2009)
New Revision: 1816
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/DogAgent.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/Pomeranian.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/PomeranianInterface.java
Log:
Added support for asynchronously called transactional observers; updated tests for transactional observers.
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.jboss.webbeans.event;
+
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * @author David Allen
+ *
+ */
+public class AsynchronousTransactionalEventNotification<T> extends DeferredEventNotification<T>
+{
+ private static Log log = Logging.getLog(DeferredEventNotification.class);
+
+ public AsynchronousTransactionalEventNotification(T event, ObserverImpl<T> observer)
+ {
+ super(event, observer);
+ }
+
+ @Override
+ public void run()
+ {
+ // Let the event be deferred again as just an asynchronous event
+ DependentContext.INSTANCE.setActive(true);
+ try
+ {
+ log.trace("Sending event [" + event + "] asynchronously to transaction observer " + observer);
+ observer.sendEventAsynchronously(event);
+ }
+ catch (Exception e)
+ {
+ log.error("Failure while queuing observer for event [" + event + "]", e);
+ }
+ finally
+ {
+ DependentContext.INSTANCE.setActive(false);
+ }
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/AsynchronousTransactionalEventNotification.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-03-08 16:07:18 UTC (rev 1815)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -31,9 +31,9 @@
private static Log log = Logging.getLog(DeferredEventNotification.class);
// The observer
- private ObserverImpl<T> observer;
+ protected ObserverImpl<T> observer;
// The event object
- private T event;
+ protected T event;
/**
* Creates a new deferred event notifier.
@@ -52,15 +52,22 @@
DependentContext.INSTANCE.setActive(true);
try
{
+ log.debug("Sending event [" + event + "] directly to observer " + observer);
observer.sendEvent(event);
}
- catch (RuntimeException e)
+ catch (Exception e)
{
- log.error("Failure while notifying an observer of an event", e);
+ log.error("Failure while notifying an observer of event [" + event + "]", e);
}
finally
{
DependentContext.INSTANCE.setActive(false);
}
}
+
+ @Override
+ public String toString()
+ {
+ return "Deferred event [" + event + "] for [" + observer + "]";
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -28,6 +28,8 @@
import javax.event.Observer;
import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
import org.jboss.webbeans.util.collections.ForwardingMap;
@@ -40,7 +42,8 @@
*/
public class EventManager
{
-
+ private static Log log = Logging.getLog(EventManager.class);
+
/**
* An event type -> observer list map
*/
@@ -142,6 +145,7 @@
{
EventObserver<T> eventObserver = new EventObserver<T>(observer, eventType, bindings);
registeredObservers.put(eventType, eventObserver);
+ log.debug("Added observer " + observer + " observing event type " + eventType);
}
/**
@@ -160,11 +164,13 @@
{
for (EventObserver<?> observer : registeredObservers.get(clazz))
{
+ log.debug("Checking observer " + observer + " to see if it is interested in event [" + event + "]");
if (observer.isObserverInterested(bindings))
{
@SuppressWarnings("unchecked")
Observer<T> o = (Observer<T>) observer.getObserver();
interestedObservers.add(o);
+ log.debug("Added observer " + observer + " for event [" + event + "]");
}
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -23,6 +23,7 @@
import javax.event.AfterTransactionCompletion;
import javax.event.AfterTransactionFailure;
import javax.event.AfterTransactionSuccess;
+import javax.event.Asynchronously;
import javax.event.BeforeTransactionCompletion;
import javax.inject.DefinitionException;
import javax.inject.manager.Bean;
@@ -85,10 +86,10 @@
*/
public static boolean isObserverMethodTransactional(AnnotatedMethod<?> observer)
{
- boolean transactional = false;
- if ((!observer.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty()) || (!observer.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty()) || (!observer.getAnnotatedParameters(AfterTransactionSuccess.class).isEmpty()) || (!observer.getAnnotatedParameters(AfterTransactionFailure.class).isEmpty()))
+ boolean transactional = true;
+ if ((observer.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionSuccess.class).isEmpty()) || (observer.getAnnotatedParameters(AfterTransactionFailure.class).isEmpty()))
{
- transactional = true;
+ transactional = false;
}
return transactional;
}
@@ -165,7 +166,15 @@
*/
private void deferEvent(T event)
{
- DeferredEventNotification<T> deferredEvent = new DeferredEventNotification<T>(event, this);
+ DeferredEventNotification<T> deferredEvent = null;
+ if (this.observerMethod.getAnnotatedParameters(Asynchronously.class).isEmpty())
+ {
+ deferredEvent = new DeferredEventNotification<T>(event, this);
+ }
+ else
+ {
+ deferredEvent = new AsynchronousTransactionalEventNotification<T>(event, this);
+ }
transactionObservationPhase.registerTask(manager.getTransactionServices(), deferredEvent);
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/DogAgent.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/DogAgent.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/DogAgent.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -1,18 +1,17 @@
package org.jboss.jsr299.tck.tests.event.transactionalObservers;
+import static javax.ejb.TransactionManagementType.BEAN;
+
import javax.annotation.Named;
import javax.annotation.Resource;
import javax.annotation.security.RunAs;
import javax.ejb.EJBException;
-import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.inject.Current;
import javax.inject.manager.Manager;
import javax.transaction.UserTransaction;
-import static javax.ejb.TransactionManagementType.BEAN;
-
@Stateless
@TransactionManagement(BEAN)
@RunAs("Bubba")
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -30,6 +30,8 @@
import org.jboss.jsr299.tck.impl.packaging.Artifact;
import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
import org.jboss.jsr299.tck.impl.packaging.Packaging;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -49,27 +51,45 @@
private static final Annotation TAME_LITERAL = new AnnotationLiteral<Tame>()
{
};
+ private PomeranianInterface dog;
+ @BeforeMethod(alwaysRun = true)
+ public void setupTest()
+ {
+ dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
+ }
+
+// @AfterMethod(alwaysRun = true)
+// public void teardownTest()
+// {
+// try
+// {
+// dog.removeSessionBean();
+// }
+// catch (Exception e)
+// {
+// // Not important since the bean is now gone one way or the other
+// }
+// }
+
@Test(groups = { "events", "integration" })
@SpecAssertion(section = "7.5.6", id = "a")
public void testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress()
{
- PomeranianInterface dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
assert dogAgent != null;
dogAgent.sendOutsideTransaction(BigInteger.TEN);
assert dog.isCorrectTransactionState();
- //TODO Fix the security contexts
-// assert dog.isCorrectContext();
+ // TODO Fix the security contexts
+ // assert dog.isCorrectContext();
}
@Test(groups = { "events", "integration" })
- @SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "c"), @SpecAssertion(section = "7.5.6", id = "f"), @SpecAssertion(section = "7.5.6", id = "i") })
+ @SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "c"), @SpecAssertion(section = "7.5.6", id = "f"), @SpecAssertion(section = "7.5.6", id = "i"), @SpecAssertion(section = "7.5.8", id = "f") })
public void testAfterTransactionCompletionObserver()
{
- PomeranianInterface dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
assert !getCurrentManager().resolveObservers("event").isEmpty();
@@ -82,7 +102,6 @@
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "d"), @SpecAssertion(section = "7.5.6", id = "j") })
public void testAfterTransactionSuccessObserver()
{
- PomeranianInterface dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -90,11 +109,10 @@
assert dog.isCorrectTransactionState();
}
- @Test(groups = { "events", "integration", "broken" })
+ @Test(groups = { "events", "integration" })
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "e"), @SpecAssertion(section = "7.5.6", id = "k") })
public void testAfterTransactionFailureObserver()
{
- PomeranianInterface dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -106,7 +124,6 @@
@SpecAssertions( { @SpecAssertion(section = "7.5.6", id = "b"), @SpecAssertion(section = "7.5.6", id = "h") })
public void testBeforeTransactionCompletionObserver()
{
- PomeranianInterface dog = (PomeranianInterface) getCurrentManager().getInstanceByName("Teddy");
dog.setCorrectContext(false);
dog.setCorrectTransactionState(false);
Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
@@ -121,11 +138,15 @@
assert false;
}
- @Test(groups = { "stub", "events" })
+ @Test(groups = { "events", "broken" })
@SpecAssertion(section = "7.5.7", id = "c")
public void testAsynchronousObserverAlsoTransactional()
{
- assert false;
+ dog.setCorrectContext(false);
+ dog.setCorrectTransactionState(false);
+ Agent dogAgent = getCurrentManager().getInstanceByType(Agent.class);
+ dogAgent.sendInTransaction('a');
+ assert dog.isCorrectTransactionState();
}
/**
@@ -141,23 +162,11 @@
assert false;
}
- /**
- * Otherwise, if the observer method is a transactional observer method and
- * there is currently a JTA transaction in progress, the observer object
- * calls the observer method during the appropriate transaction completion
- * phase.
- */
- @Test(groups = { "stub", "events" })
- @SpecAssertion(section = "7.5.8", id = "f")
- public void testTransactionalObserverMethodCalledDuringTransactionCompletionPhase()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "events", "integration" })
+ @Test(groups = { "broken", "events", "integration" })
@SpecAssertion(section = "7.5.8", id = "p")
public void testTransactionalObserverThrownExceptionIsCaughtAndLogged()
{
+ // TODO There really is no way to verify that something is logged
assert false;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/Pomeranian.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/Pomeranian.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/Pomeranian.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -1,16 +1,16 @@
package org.jboss.jsr299.tck.tests.event.transactionalObservers;
import static javax.ejb.TransactionManagementType.BEAN;
-import static javax.transaction.Status.STATUS_COMMITTED;
import static javax.transaction.Status.STATUS_NO_TRANSACTION;
-import static javax.transaction.Status.STATUS_ROLLEDBACK;
import java.math.BigInteger;
+import java.util.logging.Logger;
import javax.annotation.Named;
import javax.annotation.Resource;
import javax.context.SessionScoped;
import javax.ejb.EJBException;
+import javax.ejb.Remove;
import javax.ejb.SessionContext;
import javax.ejb.Stateful;
import javax.ejb.TransactionManagement;
@@ -30,6 +30,8 @@
@SessionScoped
public class Pomeranian implements PomeranianInterface
{
+ private static final Logger log = Logger.getLogger(Pomeranian.class.getName());
+
@Resource
private UserTransaction transaction;
@@ -68,14 +70,11 @@
{
try
{
- if (transaction.getStatus() == STATUS_COMMITTED)
+ log.warning("Observing integer event with tx status: " + transaction.getStatus());
+ if (transaction.getStatus() == STATUS_NO_TRANSACTION)
{
setCorrectTransactionState(true);
}
- else
- {
- throw new EJBException("Incorrect transaction state " + transaction.getStatus());
- }
}
catch (SystemException e)
{
@@ -92,14 +91,10 @@
{
try
{
- if (transaction.getStatus() == STATUS_ROLLEDBACK)
+ if (transaction.getStatus() == STATUS_NO_TRANSACTION)
{
setCorrectTransactionState(true);
}
- else
- {
- throw new EJBException("Incorrect transaction state " + transaction.getStatus());
- }
}
catch (SystemException e)
{
@@ -120,6 +115,7 @@
{
setCorrectContext(true);
}
+ log.warning("Principal caller is " + context.getCallerPrincipal().getName());
}
catch (SystemException e)
{
@@ -135,15 +131,12 @@
{
setCorrectTransactionState(true);
}
- else
- {
- throw new EJBException("Incorrect transaction state " + transaction.getStatus());
- }
if (context.getCallerPrincipal().getName().equals("Bubba"))
{
setCorrectContext(true);
}
+ log.warning("Principal caller is " + context.getCallerPrincipal().getName());
}
catch (SystemException e)
{
@@ -151,6 +144,22 @@
}
}
+ public void observeCharEvent(Character event)
+ {
+ try
+ {
+ log.warning("Observing character event with tx status: " + transaction.getStatus());
+ if (transaction.getStatus() == STATUS_NO_TRANSACTION)
+ {
+ setCorrectTransactionState(true);
+ }
+ }
+ catch (SystemException e)
+ {
+ throw new EJBException("Failed to detect transaction status", e);
+ }
+ }
+
public boolean isCorrectContext()
{
return correctContext;
@@ -170,5 +179,11 @@
{
this.correctTransactionState = correctTransactionState;
}
+
+ @Remove
+ public void removeSessionBean()
+ {
+
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/PomeranianInterface.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/PomeranianInterface.java 2009-03-08 16:07:18 UTC (rev 1815)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/PomeranianInterface.java 2009-03-08 17:56:37 UTC (rev 1816)
@@ -31,6 +31,8 @@
public void observeBigIntegerEvent(BigInteger event);
public void observeDoubleEvent(Double event);
+
+ public void observeCharEvent(Character event);
public boolean isCorrectContext();
@@ -39,4 +41,6 @@
public boolean isCorrectTransactionState();
public void setCorrectTransactionState(boolean correctTransactionState);
+
+ public void removeSessionBean();
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r1815 - ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation and 5 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-08 12:07:18 -0400 (Sun, 08 Mar 2009)
New Revision: 1815
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/JsfConversationLifecycleTest.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Conversation tests, restart jboss during tck run...
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -37,6 +37,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.context.DependentInstancesStore;
+import org.jboss.webbeans.conversation.ConversationImpl;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
@@ -62,7 +63,7 @@
{
@SuppressWarnings("unchecked")
- private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new HashSet<Class<?>>(Arrays.asList(Event.class, ManagerImpl.class));
+ private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new HashSet<Class<?>>(Arrays.asList(Event.class, ManagerImpl.class, ConversationImpl.class));
private boolean proxyable;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -222,7 +222,7 @@
}
else if (deploymentTypes.size() > 1)
{
- throw new DefinitionException("At most one scope may be specified");
+ throw new DefinitionException("At most one deployment type may be specified");
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -172,7 +172,7 @@
public String toString()
{
StringBuilder buffer = new StringBuilder();
- buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+ buffer.append(Names.scopeTypeToString(getScopeType()));
if (getName() == null)
{
buffer.append("unnamed producer method bean");
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -21,8 +21,8 @@
import javax.context.Conversation;
import javax.context.RequestScoped;
import javax.inject.Initializer;
+import javax.inject.Standard;
-import org.jboss.webbeans.WebBean;
import org.jboss.webbeans.conversation.bindings.ConversationInactivityTimeout;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -35,7 +35,7 @@
*/
@RequestScoped
@Named("conversation")
-@WebBean
+@Standard
public class ConversationImpl implements Conversation
{
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -4,7 +4,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -34,6 +33,8 @@
public static final String JBOSS_AS_DIR_PROPERTY_NAME = "jboss-as.dir";
public static final String JBOSS_BOOT_TIMEOUT_PROPERTY_NAME = "jboss.boot.timeout";
public static final String FORCE_RESTART_PROPERTY_NAME = "jboss.force.restart";
+ public static final String MAX_DEPLOYMENTS_PROPERTY_NAME = "jboss.deployments.restart";
+ public static final String SHUTDOWN_DELAY_PROPERTY_NAME = "jboss.shutdown.delay";
private static Logger log = Logger.getLogger(AbstractContainersImpl.class);
@@ -46,6 +47,12 @@
private long bootTimeout;
private String javaOpts;
+ private boolean forceRestart;
+
+ protected int maxDeployments;
+
+ private int jbossShutdownDelay;
+
public AbstractContainersImpl()
{
this.properties = new DeploymentProperties();
@@ -127,7 +134,15 @@
jbossHome = jbossHomeFile.getPath();
log.info("Using JBoss instance in " + jbossHome + " at URL " + configuration.getHost());
this.bootTimeout = properties.getLongValue(JBOSS_BOOT_TIMEOUT_PROPERTY_NAME, 240000, false);
- if (properties.getBooleanValue(FORCE_RESTART_PROPERTY_NAME, false, false))
+ this.forceRestart = properties.getBooleanValue(FORCE_RESTART_PROPERTY_NAME, false, false);
+ this.maxDeployments = properties.getIntValue(MAX_DEPLOYMENTS_PROPERTY_NAME, 25, false);
+ this.jbossShutdownDelay = properties.getIntValue(SHUTDOWN_DELAY_PROPERTY_NAME, 15000, false);
+ restartJboss();
+ }
+
+ protected void restartJboss() throws IOException
+ {
+ if (forceRestart)
{
if (isJBossUp())
{
@@ -135,7 +150,7 @@
shutDownJBoss();
try
{
- Thread.sleep(10000);
+ Thread.sleep(jbossShutdownDelay);
}
catch (InterruptedException e)
{
@@ -176,10 +191,6 @@
launch("shutdown", "-S");
throw new IllegalStateException("Error connecting to JBoss instance");
}
- else
- {
- return;
- }
}
protected void loadProperties(File file) throws IOException
Modified: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -29,6 +29,7 @@
private DeploymentManager deploymentManager;
private final File tmpdir;
+ private int deploymentCounter = 0;
public ProfileServiceContainersImpl() throws Exception
@@ -76,7 +77,7 @@
if (status.isFailed())
{
failure = status.getFailure();
- undeploy(name);
+ doUndeploy(name);
}
}
catch (Exception e)
@@ -102,7 +103,7 @@
}
}
- public void undeploy(String name) throws IOException
+ private void doUndeploy(String name) throws IOException
{
try
{
@@ -113,16 +114,56 @@
undeployProgress.run();
if (undeployProgress.getDeploymentStatus().isFailed())
{
- failedUndeployments.add(name);
+ failedUndeployments.add(name);
}
+ else
+ {
+ deploymentCounter++;
+ }
}
catch (Exception e)
{
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
}
}
+
+ public void undeploy(String name) throws IOException
+ {
+ try
+ {
+ doUndeploy(name);
+ }
+ finally
+ {
+ if (deploymentCounter >= maxDeployments)
+ {
+ deploymentCounter = 0;
+ // Let everything stablise
+ removeFailedUnDeployments();
+ try
+ {
+ Thread.sleep(5000);
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ restartJboss();
+ try
+ {
+ initDeploymentManager();
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ }
+ }
/**
* Obtain the Deployment Manager
@@ -143,30 +184,36 @@
@Override
public void cleanup() throws IOException
{
+ removeFailedUnDeployments();
super.cleanup();
- List<String> remainingDeployments = new ArrayList<String>();
- for (String name : failedUndeployments)
- {
- try
- {
- DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
- undeployProgress.run();
- if (undeployProgress.getDeploymentStatus().isFailed())
- {
- remainingDeployments.add(name);
- }
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
- if (remainingDeployments.size() > 0)
- {
- //log.error("Failed to undeploy these artifacts: " + remainingDeployments);
- }
}
+
+ private void removeFailedUnDeployments() throws IOException
+ {
+ List<String> remainingDeployments = new ArrayList<String>();
+ for (String name : failedUndeployments)
+ {
+ try
+ {
+ DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
+ undeployProgress.run();
+ if (undeployProgress.getDeploymentStatus().isFailed())
+ {
+ remainingDeployments.add(name);
+ }
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ if (remainingDeployments.size() > 0)
+ {
+ //log.error("Failed to undeploy these artifacts: " + remainingDeployments);
+ }
+ failedUndeployments.clear();
+ }
}
Modified: ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml 2009-03-08 16:05:27 UTC (rev 1814)
+++ ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml 2009-03-08 16:07:18 UTC (rev 1815)
@@ -6,7 +6,7 @@
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
- <param name="ConversionPattern" value="%-5p [%c{6}] %m%n"/>
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{6}] %m%n"/>
</layout>
</appender>
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -35,6 +35,53 @@
}
+ protected boolean isCloudDestroyed(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("cloudDestroyed"));
+ try
+ {
+ client.executeMethod(method);
+ if (method.getStatusCode() == 200)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected void resetCloud(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("resetCloud"));
+ try
+ {
+ client.executeMethod(method);
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
+ protected void invalidateSession(HttpClient client) throws Exception
+ {
+ HttpMethod method = new GetMethod(getConversationStatusPath("invalidateSession"));
+ try
+ {
+ client.executeMethod(method);
+ }
+ finally
+ {
+ method.releaseConnection();
+ }
+ }
+
protected String getConversationStatusPath(String method)
{
return super.getContextPath() + "conversation-status?method=" + method;
@@ -47,7 +94,7 @@
protected void request(HttpClient client, String viewId) throws Exception
{
- HttpMethod method = new GetMethod(getContextPath() + "/home.jsf");
+ HttpMethod method = new GetMethod(getContextPath() + viewId);
try
{
client.executeMethod(method);
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,37 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.annotation.PreDestroy;
+import javax.context.ConversationScoped;
+
+@ConversationScoped
+@Named
+public class Cloud implements Serializable
+{
+
+ private static boolean destroyed = false;
+
+ @PreDestroy
+ public void destroy()
+ {
+ destroyed = true;
+ }
+
+ public static boolean isDestroyed()
+ {
+ return destroyed;
+ }
+
+ public static void setDestroyed(boolean destroyed)
+ {
+ Cloud.destroyed = destroyed;
+ }
+
+ public String getName()
+ {
+ return "Pete";
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.inject.Current;
+
+@Named
+public class CloudController
+{
+
+ @Current Conversation conversation;
+
+ public String getBeginConversation()
+ {
+ conversation.begin();
+ return "begun conversation";
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import javax.context.Conversation;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+public class ConversationBeginTest extends AbstractDeclarativeTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "f")
+ public void testConversationBeginMakesConversationLongRunning()
+ {
+ Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
+ conversation.begin();
+ assert conversation.isLongRunning();
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -1,6 +1,11 @@
package org.jboss.jsr299.tck.tests.context.conversation;
+import java.lang.annotation.Annotation;
+
import javax.context.Conversation;
+import javax.context.RequestScoped;
+import javax.inject.Current;
+import javax.inject.Standard;
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractDeclarativeTest;
@@ -23,22 +28,48 @@
{
assert !getCurrentManager().getInstanceByType(Conversation.class).isLongRunning();
}
-
+
@Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "ha")
- public void testConversationIdMayBeSetByApplication()
+ @SpecAssertion(section = "8.5.4", id = "ia")
+ public void testBeanWithTypeConversation()
{
- Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
- conversation.begin("foo");
+ assert getCurrentManager().resolveByType(Conversation.class).size() == 1;
}
@Test(groups = { "contexts" })
- @SpecAssertion(section = "8.5.4", id = "hb")
- public void testConversationIdSetByContainer()
+ @SpecAssertion(section = "8.5.4", id = "ib")
+ public void testBeanWithRequestScope()
{
- Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
- conversation.begin();
- assert conversation.getId() != null;
+ assert getCurrentManager().resolveByType(Conversation.class).iterator().next().getScopeType().equals(RequestScoped.class);
}
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "ic")
+ public void testBeanWithDeploymentTypeStandard()
+ {
+ assert getCurrentManager().resolveByType(Conversation.class).iterator().next().getDeploymentType().equals(Standard.class);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "id")
+ public void testBeanWithBindingCurrent()
+ {
+ boolean found = false;
+ for (Annotation binding : getCurrentManager().resolveByType(Conversation.class).iterator().next().getBindings())
+ {
+ if (binding.annotationType().equals(Current.class))
+ {
+ found = true;
+ }
+ }
+ assert found;
+ }
+
+ @Test(groups = { "contexts", "ri-broken" })
+ @SpecAssertion(section = "8.5.4", id = "ie")
+ public void testBeanWithNameJavaxContextConversation()
+ {
+ assert getCurrentManager().resolveByType(Conversation.class).iterator().next().getName().equals("javax.context.conversation");
+ }
}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,31 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import javax.context.Conversation;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+public class ConversationEndTest extends AbstractDeclarativeTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "g")
+ public void testConversationEndMakesConversationTransient()
+ {
+ Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
+ conversation.begin();
+ assert conversation.isLongRunning();
+ conversation.end();
+ assert !conversation.isLongRunning();
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import javax.context.Conversation;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+public class ConversationIdSetByApplicationTest extends AbstractDeclarativeTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "ha")
+ public void testConversationIdMayBeSetByApplication()
+ {
+ Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
+ conversation.begin("foo");
+ assert conversation.getId().equals("foo");
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import javax.context.Conversation;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.AbstractDeclarativeTest;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+public class ConversationIdSetByContainerTest extends AbstractDeclarativeTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "f")
+ public void testConversationBeginMakesConversationLongRunning()
+ {
+ Conversation conversation = getCurrentManager().getInstanceByType(Conversation.class);
+ conversation.begin();
+ assert conversation.isLongRunning();
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -22,6 +22,25 @@
{
serializeToResponse(ConfigurationImpl.get().getManagers().getManager().getInstanceByType(Conversation.class).getId(), resp);
}
+ else if ("cloudDestroyed".equals(method))
+ {
+ if (Cloud.isDestroyed())
+ {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ }
+ else
+ {
+ resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+ else if ("invalidateSession".equals(method))
+ {
+ req.getSession().invalidate();
+ }
+ else if ("resetCloud".equals(method))
+ {
+ Cloud.setDestroyed(false);
+ }
else
{
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,40 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf")
+})
+public class InvalidatingSessionDestroysConversationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "a")
+ public void testInvalidatingSessionDestroysConversation() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ invalidateSession(client);
+ assert isCloudDestroyed(client);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/JsfConversationLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/JsfConversationLifecycleTest.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/JsfConversationLifecycleTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -1,133 +0,0 @@
-package org.jboss.jsr299.tck.tests.context.conversation;
-
-import org.hibernate.tck.annotations.SpecAssertion;
-import org.jboss.jsr299.tck.AbstractDeclarativeTest;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author Nicklas Karlsson
- *
- * Spec version: PRD2
- */
-public class JsfConversationLifecycleTest extends AbstractDeclarativeTest
-{
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "a")
- public void testContextActiveFromBeginningOfApplyRequestValuesPhasetoResponseCompleteForJsfRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "b")
- public void testContextActiveDuringRenderResponsePhaseForNonFacesJsfRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "c")
- public void testJsfRequestHasExactlyOneAssociatedConversation()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "d")
- public void testAssociatedConversationOfJsfRequestIsDeterminedAtEndOfRestoreViewPhase()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "d")
- public void testAssociatedConversationOfJsfRequestDoesNotChangeDuringRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "j")
- public void testTransientConversationIsDestroyedAtEndOfJsfRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "j")
- public void testTransientConversationContextIsDestroyedAtEndOfJsfRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "k")
- public void testLongRunningConversationNotDestroyedAtEndOfJsfRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "l")
- public void testLongRunningConversationOfJsfRenderingRequestIsPropagatedToRequestFromRenderedPage()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "m")
- public void testLongRunningConversationOfJsfRedirectIsPropagatedToNonFacesRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "n")
- public void testLongRunningConversationManuallyPropagatedToNonFacesRequest()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "o")
- public void testNewTransientRequestIsCreatedWhenNoConversationIsPropagated()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "p")
- public void testLongRunningConversationsMayNotCrossHttpSessions()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "q")
- public void testAllLongRunningConversationContextsOfInvalidatedHttpSessionAreDestroyed()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "r")
- public void testManagerCanDestroyOrphanedLongRunningConversations()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "s")
- public void testNewTransientConversationIsCreatedWhenConversationCannotBeRestored()
- {
- assert false;
- }
-
- @Test(groups = { "stub", "contexts" })
- @SpecAssertion(section = "8.5.4", id = "u")
- public void testConcurrentRequestsToLongRunningConversationsAreHandled()
- {
- assert false;
- }
-}
\ No newline at end of file
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,38 @@
+package org.jboss.jsr299.tck.tests.context.conversation;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.jboss.jsr299.tck.impl.packaging.Artifact;
+import org.jboss.jsr299.tck.impl.packaging.IntegrationTest;
+import org.jboss.jsr299.tck.impl.packaging.Resource;
+import org.jboss.jsr299.tck.impl.packaging.Resources;
+import org.jboss.jsr299.tck.impl.packaging.war.WarArtifactDescriptor;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ * Spec version: PRD2
+ */
+@Artifact
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf")
+})
+public class LongRunningInstancesNotDestroyedTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ }
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningInstancesNotDestroyedTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/MultiRequestConversationContextTest.java 2009-03-08 16:07:18 UTC (rev 1815)
@@ -19,7 +19,9 @@
@IntegrationTest(runLocally=true)
@Resources({
@Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
- @Resource(destination="home.jspx", source="home.jsf")
+ @Resource(destination="home.jspx", source="home.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf")
})
public class MultiRequestConversationContextTest extends AbstractConversationTest
{
@@ -35,5 +37,25 @@
String cid2 = getCid(client);
assert !cid1.equals(cid2);
}
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "j")
+ public void testTransientConversationInstancesDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/cloud.jsf");
+ assert isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "8.5.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ resetCloud(client);
+ request(client, "/clouds.jsf");
+ assert !isCloudDestroyed(client);
+ }
}
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="#{cloud.name}" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf 2009-03-08 16:07:18 UTC (rev 1815)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns="http://www.w3.org/1999/xhtml"
+ version="2.0">
+ <jsp:output doctype-root-element="html"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="#{cloud.name}" />
+ <h:outputText value="#{cloudController.beginConversation}" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-08 16:05:27 UTC (rev 1814)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-08 16:07:18 UTC (rev 1815)
@@ -4979,10 +4979,26 @@
<text>All long-running conversations have a string-valued unique identifier, ~which may be set by the application when the conversation is marked long-running,~ or generated by the container</text>
</assertion>
- <assertion id="i">
- <text>The container provides a built-in bean with bean type javax.context.Conversation, scope @RequestScoped, deployment type @Standard and binding @Current, named javax.context.conversation</text>
+ <assertion id="ia">
+ <text>The container provides a built-in bean with bean type javax.context.Conversation~, scope @RequestScoped, deployment type @Standard and binding @Current, named javax.context.conversation~</text>
</assertion>
+ <assertion id="ib">
+ <text>The container provides a built-in bean with ~bean type javax.context.Conversation~, scope @RequestScoped~, deployment type @Standard and binding @Current, named javax.context.conversation~</text>
+ </assertion>
+
+ <assertion id="ic">
+ <text>The container provides a built-in bean with~ bean type javax.context.Conversation, scope @RequestScoped,~ deployment type @Standard~ and binding @Current, named javax.context.conversation~</text>
+ </assertion>
+
+ <assertion id="id">
+ <text>The container provides a built-in bean with bean type ~javax.context.Conversation, scope @RequestScoped, deployment type @Standard and~ binding @Current~, named javax.context.conversation~</text>
+ </assertion>
+
+ <assertion id="ie">
+ <text>The container provides a built-in bean with bean type ~javax.context.Conversation, scope @RequestScoped, deployment type @Standard and binding @Current,~ named javax.context.conversation</text>
+ </assertion>
+
<assertion id="j">
<text>If the conversation associated with the current JSF request is in the transient state at the end of a JSF request, it is destroyed, and the conversation context is also destroyed</text>
</assertion>
@@ -5015,8 +5031,9 @@
<text>When the HTTP servlet session is invalidated, all long-running conversation contexts created during the current session are destroyed</text>
</assertion>
- <assertion id="r">
+ <assertion id="r" testable="false">
<text>The container is permitted to arbitrarily destroy any long-running conversation that is associated with no current JSF request, in order to conserve resources</text>
+ <note>In other words, this is unspecified</note>
</assertion>
<assertion id="s">
15 years, 9 months