[webbeans-commits] Webbeans SVN: r1815 - ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Mar 8 12:07:19 EDT 2009


Author: pete.muir at 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")
- at WebBean
+ at 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;
+
+ at ConversationScoped
+ at 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;
+
+ at 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
+ */
+ at 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
+ */
+ at 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
+ */
+ at 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
+ */
+ at 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
+ */
+ at Artifact
+ at IntegrationTest(runLocally=true)
+ at 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
+ */
+ at Artifact
+ at IntegrationTest(runLocally=true)
+ at 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">




More information about the weld-commits mailing list