Weld SVN: r5897 - in cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests: implementation/enterprise/remove and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-02-20 14:03:56 -0500 (Sat, 20 Feb 2010)
New Revision: 5897
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java
Log:
backport CDITCK-113
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java 2010-02-20 18:51:28 UTC (rev 5896)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java 2010-02-20 19:03:56 UTC (rev 5897)
@@ -19,7 +19,7 @@
import javax.enterprise.inject.Alternative;
@Alternative
-class HelsinkiNonSerializable
+public class HelsinkiNonSerializable
{
public void ping()
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java 2010-02-20 18:51:28 UTC (rev 5896)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java 2010-02-20 19:03:56 UTC (rev 5897)
@@ -20,7 +20,7 @@
import javax.inject.Inject;
@RequestScoped
-class NumberConsumer
+public class NumberConsumer
{
@Inject int number;
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java 2010-02-20 18:51:28 UTC (rev 5896)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java 2010-02-20 19:03:56 UTC (rev 5897)
@@ -19,7 +19,7 @@
import javax.enterprise.context.RequestScoped;
@RequestScoped
-class SerializableCityConsumer
+public class SerializableCityConsumer
{
@Sleeping SerializableCity city;
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java 2010-02-20 18:51:28 UTC (rev 5896)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java 2010-02-20 19:03:56 UTC (rev 5897)
@@ -19,7 +19,7 @@
import javax.enterprise.inject.Alternative;
@Alternative
-class Television
+public class Television
{
public void turnOn() {}
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java 2010-02-20 18:51:28 UTC (rev 5896)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java 2010-02-20 19:03:56 UTC (rev 5897)
@@ -21,13 +21,13 @@
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
-class StateKeeper implements Serializable
+public class StateKeeper implements Serializable
{
/**
*
*/
- private static final long serialVersionUID = -7168331316716402245L;
-private boolean removeCalled = false;
+ private static final long serialVersionUID = -7168331316716402245L;
+ private boolean removeCalled = false;
private boolean beanDestroyed = false;
public boolean isRemoveCalled()
14 years, 10 months
Weld SVN: r5896 - in cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: implementation/enterprise/remove and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-02-20 13:51:28 -0500 (Sat, 20 Feb 2010)
New Revision: 5896
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java
Log:
CDITCK-113
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java 2010-02-20 18:48:21 UTC (rev 5895)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/HelsinkiNonSerializable.java 2010-02-20 18:51:28 UTC (rev 5896)
@@ -19,7 +19,7 @@
import javax.enterprise.inject.Alternative;
@Alternative
-class HelsinkiNonSerializable
+public class HelsinkiNonSerializable
{
public void ping()
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java 2010-02-20 18:48:21 UTC (rev 5895)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/NumberConsumer.java 2010-02-20 18:51:28 UTC (rev 5896)
@@ -20,7 +20,7 @@
import javax.inject.Inject;
@RequestScoped
-class NumberConsumer
+public class NumberConsumer
{
@Inject int number;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java 2010-02-20 18:48:21 UTC (rev 5895)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/SerializableCityConsumer.java 2010-02-20 18:51:28 UTC (rev 5896)
@@ -19,7 +19,7 @@
import javax.enterprise.context.RequestScoped;
@RequestScoped
-class SerializableCityConsumer
+public class SerializableCityConsumer
{
@Sleeping SerializableCity city;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java 2010-02-20 18:48:21 UTC (rev 5895)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/passivating/Television.java 2010-02-20 18:51:28 UTC (rev 5896)
@@ -19,7 +19,7 @@
import javax.enterprise.inject.Alternative;
@Alternative
-class Television
+public class Television
{
public void turnOn() {}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java 2010-02-20 18:48:21 UTC (rev 5895)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/remove/StateKeeper.java 2010-02-20 18:51:28 UTC (rev 5896)
@@ -21,13 +21,13 @@
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
-class StateKeeper implements Serializable
+public class StateKeeper implements Serializable
{
/**
*
*/
- private static final long serialVersionUID = -7168331316716402245L;
-private boolean removeCalled = false;
+ private static final long serialVersionUID = -7168331316716402245L;
+ private boolean removeCalled = false;
private boolean beanDestroyed = false;
public boolean isRemoveCalled()
14 years, 10 months
Weld SVN: r5895 - in cdi-tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/tests/implementation/enterprise and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-02-20 13:48:21 -0500 (Sat, 20 Feb 2010)
New Revision: 5895
Added:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/ejb-jar.xml
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/SingletonWithConversationScopeTest.java
Log:
port CDITCK-112 to trunk
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/SingletonWithConversationScopeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/SingletonWithConversationScopeTest.java 2010-02-20 18:44:00 UTC (rev 5894)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/SingletonWithConversationScopeTest.java 2010-02-20 18:48:21 UTC (rev 5895)
@@ -25,11 +25,13 @@
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.jboss.testharness.impl.packaging.Packaging;
import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.ear.EjbJarXml;
import org.testng.annotations.Test;
@ExpectedDeploymentException(DeploymentFailure.class)
@Artifact
@Packaging(PackagingType.EAR)
+@EjbJarXml("ejb-jar.xml")
@SpecVersion(spec="cdi", version="20091101")
public class SingletonWithConversationScopeTest extends AbstractJSR299Test
{
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/ejb-jar.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/ejb-jar.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/ejb-jar.xml 2010-02-20 18:48:21 UTC (rev 5895)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar 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/ejb-jar_3_1.xsd"
+ version="3.1">
+
+</ejb-jar>
Property changes on: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/implementation/enterprise/broken/singletonWithConversationScope/ejb-jar.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
Weld SVN: r5894 - in core/trunk/impl/src/main/java/org/jboss/weld: manager and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-02-20 13:44:00 -0500 (Sat, 20 Feb 2010)
New Revision: 5894
Added:
core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagers.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/manager/Transform.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
Log:
WELD-304
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -419,7 +419,7 @@
for (String name : namedAccessibleBeans.keySet())
{
- Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(Beans.removeDisabledAndSpecializedBeans(namedAccessibleBeans.get(name), beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes(), beanManager.getSpecializedBeans()));
+ Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(Beans.removeDisabledAndSpecializedBeans(namedAccessibleBeans.get(name), beanManager));
if (resolvedBeans.size() > 1)
{
throw new DeploymentException(AMBIGUOUS_EL_NAME, name, resolvedBeans);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -28,6 +28,7 @@
import static org.jboss.weld.logging.messages.BeanManagerMessage.TOO_MANY_ACTIVITIES;
import static org.jboss.weld.logging.messages.BeanManagerMessage.UNPROXYABLE_RESOLUTION;
import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_ELEMENT;
+import static org.jboss.weld.manager.BeanManagers.buildAccessibleClosure;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -385,22 +386,8 @@
this.childActivities = new CopyOnWriteArraySet<BeanManagerImpl>();
}
- private <T> Set<Iterable<T>> buildAccessibleClosure(Collection<BeanManagerImpl> hierarchy, Transform<T> transform)
- {
- Set<Iterable<T>> result = new HashSet<Iterable<T>>();
- hierarchy.add(this);
- result.add(transform.transform(this));
- for (BeanManagerImpl beanManager : accessibleManagers)
- {
- // Only add if we aren't already in the tree (remove cycles)
- if (!hierarchy.contains(beanManager))
- {
- result.addAll(beanManager.buildAccessibleClosure(new ArrayList<BeanManagerImpl>(hierarchy), transform));
- }
- }
- return result;
- }
+
private <T> Iterable<T> createDynamicAccessibleIterable(final Transform<T> transform)
{
return new Iterable<T>()
@@ -408,7 +395,7 @@
public Iterator<T> iterator()
{
- Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ Set<Iterable<T>> iterable = buildAccessibleClosure(BeanManagerImpl.this, new ArrayList<BeanManagerImpl>(), transform);
return Iterators.concat(Iterators.transform(iterable.iterator(), IterableToIteratorFunction.<T>instance()));
}
@@ -417,7 +404,7 @@
private <T> Iterable<T> createStaticAccessibleIterable(final Transform<T> transform)
{
- Set<Iterable<T>> iterable = buildAccessibleClosure(new ArrayList<BeanManagerImpl>(), transform);
+ Set<Iterable<T>> iterable = buildAccessibleClosure(this, new ArrayList<BeanManagerImpl>(), transform);
return Iterables.concat(iterable);
}
@@ -426,6 +413,11 @@
accessibleManagers.add(accessibleBeanManager);
beanResolver.clear();
}
+
+ public HashSet<BeanManagerImpl> getAccessibleManagers()
+ {
+ return accessibleManagers;
+ }
public void addBean(Bean<?> bean)
{
Added: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagers.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagers.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagers.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -0,0 +1,51 @@
+package org.jboss.weld.manager;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class BeanManagers
+{
+
+ private static class BeanManagerTransform implements Transform<BeanManagerImpl>
+ {
+
+ public static final BeanManagerTransform INSTANCE = new BeanManagerTransform();
+
+ public Iterable<BeanManagerImpl> transform(BeanManagerImpl beanManager)
+ {
+ return beanManager.getAccessibleManagers();
+ }
+
+ }
+
+ private BeanManagers() {}
+
+ public static Set<Iterable<BeanManagerImpl>> getAccessibleClosure(BeanManagerImpl beanManager)
+ {
+ Set<Iterable<BeanManagerImpl>> beanManagers = new HashSet<Iterable<BeanManagerImpl>>();
+ beanManagers.add(Collections.singleton(beanManager));
+ beanManagers.addAll(buildAccessibleClosure(beanManager, new HashSet<BeanManagerImpl>(), BeanManagerTransform.INSTANCE));
+ return beanManagers;
+ }
+
+ public static <T> Set<Iterable<T>> buildAccessibleClosure(BeanManagerImpl beanManager, Collection<BeanManagerImpl> hierarchy, Transform<T> transform)
+ {
+ Set<Iterable<T>> result = new HashSet<Iterable<T>>();
+ hierarchy.add(beanManager);
+ result.add(transform.transform(beanManager));
+ for (BeanManagerImpl accessibleBeanManager : beanManager.getAccessibleManagers())
+ {
+ // Only add if we aren't already in the tree (remove cycles)
+ if (!hierarchy.contains(accessibleBeanManager))
+ {
+ result.addAll(buildAccessibleClosure(accessibleBeanManager, new ArrayList<BeanManagerImpl>(hierarchy), transform));
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagers.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/manager/Transform.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/Transform.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/Transform.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -16,7 +16,7 @@
*/
package org.jboss.weld.manager;
-interface Transform<T>
+public interface Transform<T>
{
public Iterable<T> transform(BeanManagerImpl beanManager);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/NameBasedResolver.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -58,7 +58,7 @@
matchedBeans.add(bean);
}
}
- return Beans.removeDisabledAndSpecializedBeans(matchedBeans, beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes(), beanManager.getSpecializedBeans());
+ return Beans.removeDisabledAndSpecializedBeans(matchedBeans, beanManager);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -105,7 +105,7 @@
@Override
protected Set<T> filterResult(Set<T> matched)
{
- return Beans.removeDisabledAndSpecializedBeans(matched, beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes(), getBeanManager().getSpecializedBeans());
+ return Beans.removeDisabledAndSpecializedBeans(matched, beanManager);
}
@Override
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2010-02-20 18:05:53 UTC (rev 5893)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2010-02-20 18:44:00 UTC (rev 5894)
@@ -54,7 +54,6 @@
import javax.annotation.PreDestroy;
import javax.decorator.Decorator;
import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Alternative;
@@ -91,6 +90,7 @@
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.WeldParameter;
import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.manager.BeanManagers;
import org.jboss.weld.metadata.cache.InterceptorBindingModel;
import org.jboss.weld.metadata.cache.MergedStereotypes;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
@@ -580,7 +580,7 @@
* @param enabledDeploymentTypes The enabled deployment types
* @return The filtered beans
*/
- public static <T extends Bean<?>> Set<T> removeDisabledAndSpecializedBeans(Set<T> beans, Collection<Class<?>> enabledAlternativeClasses, Collection<Class<? extends Annotation>> enabledAlternativeSterotypes, Map<Contextual<?>, Contextual<?>> specializedBeans)
+ public static <T extends Bean<?>> Set<T> removeDisabledAndSpecializedBeans(Set<T> beans, BeanManagerImpl beanManager)
{
if (beans.size() == 0)
{
@@ -591,7 +591,7 @@
Set<T> result = new HashSet<T>();
for (T bean : beans)
{
- if (isBeanEnabled(bean, enabledAlternativeClasses, enabledAlternativeSterotypes) && !isSpecialized(bean, beans, specializedBeans))
+ if (isBeanEnabled(bean, beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes()) && !isSpecialized(bean, beans, beanManager))
{
result.add(bean);
}
@@ -661,16 +661,22 @@
*
* @param bean
* @param beans
- * @param specializedBeans
+ * @param allSpecializedBeans
* @return
*/
- public static <T extends Bean<?>> boolean isSpecialized(T bean, Set<T> beans, Map<Contextual<?>, Contextual<?>> specializedBeans)
+ public static <T extends Bean<?>> boolean isSpecialized(T bean, Set<T> beans, BeanManagerImpl beanManager)
{
- if (specializedBeans.containsKey(bean))
+ for (Iterable<BeanManagerImpl> beanManagers : BeanManagers.getAccessibleClosure(beanManager))
{
- if (beans.contains(specializedBeans.get(bean)))
+ for (BeanManagerImpl accessibleBeanManager : beanManagers)
{
- return true;
+ if (accessibleBeanManager.getSpecializedBeans().containsKey(bean))
+ {
+ if (beans.contains(accessibleBeanManager.getSpecializedBeans().get(bean)))
+ {
+ return true;
+ }
+ }
}
}
return false;
14 years, 10 months
Weld SVN: r5893 - core/trunk/osgi-bundle.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-02-20 13:05:53 -0500 (Sat, 20 Feb 2010)
New Revision: 5893
Modified:
core/trunk/osgi-bundle/pom.xml
Log:
restore missing export
Modified: core/trunk/osgi-bundle/pom.xml
===================================================================
--- core/trunk/osgi-bundle/pom.xml 2010-02-20 01:11:48 UTC (rev 5892)
+++ core/trunk/osgi-bundle/pom.xml 2010-02-20 18:05:53 UTC (rev 5893)
@@ -70,6 +70,7 @@
<_exportcontents>
javax.inject;
+ javax.decorator;
javax.enterprise.*;
version=${osgi.version},
org.jboss.weld.context;
14 years, 10 months
Weld SVN: r5892 - in core/trunk/impl/src/main/java/org/jboss/weld/bean: proxy and 1 other directory.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-02-19 20:11:48 -0500 (Fri, 19 Feb 2010)
New Revision: 5892
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
Log:
WELD-430
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-02-19 13:54:18 UTC (rev 5891)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-02-20 01:11:48 UTC (rev 5892)
@@ -523,6 +523,11 @@
}
}
+ public boolean hasInterceptors()
+ {
+ return this.isInterceptionCandidate() && (this.hasCdiBoundInterceptors() || this.hasDirectlyDefinedInterceptors());
+ }
+
protected void initDirectlyDefinedInterceptors()
{
if (beanManager.getClassDeclaredInterceptorsRegistry().getInterceptionModel(getType()) == null && InterceptionUtils.supportsEjb3InterceptorDeclaration())
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-02-19 13:54:18 UTC (rev 5891)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2010-02-20 01:11:48 UTC (rev 5892)
@@ -186,7 +186,7 @@
public void postConstruct(T instance)
{
- if (bean.isInterceptionCandidate() && (bean.hasCdiBoundInterceptors() || bean.hasDirectlyDefinedInterceptors()))
+ if (bean.hasInterceptors())
{
InterceptionUtils.executePostConstruct(instance);
}
@@ -198,13 +198,13 @@
public void preDestroy(T instance)
{
- if (!bean.isInterceptionCandidate() || !(bean.hasCdiBoundInterceptors() || bean.hasDirectlyDefinedInterceptors()))
+ if (bean.hasInterceptors())
{
- bean.defaultPreDestroy(instance);
+ InterceptionUtils.executePredestroy(instance);
}
else
{
- InterceptionUtils.executePredestroy(instance);
+ bean.defaultPreDestroy(instance);
}
}
@@ -244,7 +244,7 @@
}.run();
}
- if (bean.isInterceptionCandidate() && (bean.hasCdiBoundInterceptors() || bean.hasDirectlyDefinedInterceptors()))
+ if (bean.hasInterceptors())
{
return bean.applyInterceptors(instance, ctx);
}
@@ -253,6 +253,8 @@
return instance;
}
}
+
+
}
// Logger
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2010-02-19 13:54:18 UTC (rev 5891)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2010-02-20 01:11:48 UTC (rev 5892)
@@ -25,7 +25,9 @@
import javax.enterprise.inject.spi.Bean;
+import org.jboss.interceptor.proxy.LifecycleMixin;
import org.jboss.weld.Container;
+import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.serialization.spi.ContextualStore;
@@ -91,7 +93,16 @@
{
try
{
- return Proxies.<T>createProxy(new ClientProxyMethodHandler(bean, id), TypeInfo.of(bean.getTypes()).add(Serializable.class));
+ TypeInfo typeInfo;
+ if ((bean instanceof AbstractClassBean) && ((AbstractClassBean)bean).hasInterceptors())
+ {
+ typeInfo = TypeInfo.of(bean.getTypes()).add(Serializable.class).add(LifecycleMixin.class);
+ }
+ else
+ {
+ typeInfo = TypeInfo.of(bean.getTypes()).add(Serializable.class);
+ }
+ return Proxies.<T>createProxy(new ClientProxyMethodHandler(bean, id), typeInfo);
}
catch (InstantiationException e)
{
14 years, 10 months
Weld SVN: r5891 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2010-02-19 08:54:18 -0500 (Fri, 19 Feb 2010)
New Revision: 5891
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/Retriever.java
Log:
Modified test for WELD-447
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java 2010-02-19 10:22:10 UTC (rev 5890)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/EnterpriseBeanDefinitionTest.java 2010-02-19 13:54:18 UTC (rev 5891)
@@ -95,7 +95,7 @@
@SpecAssertion(section = "3.2.2", id = "ba")
public void testEnterpriseBeanClassLocalView()
{
- Bean<Retriever> dogBean = getBeans(Retriever.class).iterator().next();
+ Bean<Retriever> dogBean = getUniqueBean(Retriever.class);
assert dogBean.getTypes().contains(Retriever.class);
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/Retriever.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/Retriever.java 2010-02-19 10:22:10 UTC (rev 5890)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/definition/Retriever.java 2010-02-19 13:54:18 UTC (rev 5891)
@@ -16,15 +16,15 @@
*/
package org.jboss.jsr299.tck.tests.implementation.enterprise.definition;
+import javax.ejb.Stateful;
+
/**
* @author pmuir
*
*/
-// TODO Enable when we support EJB 3.1
-//@Stateful
-//@LocalBean
+@Stateful
public class Retriever
{
14 years, 10 months
Weld SVN: r5890 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2010-02-19 05:22:10 -0500 (Fri, 19 Feb 2010)
New Revision: 5890
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java
Log:
Updated test for lifecycle callback interceptors on a normal scoped bean.
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java 2010-02-19 10:22:10 UTC (rev 5890)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.interceptors.tests.lifecycleCallback;
+
+public abstract class Animal
+{
+ void foo()
+ {
+
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java 2010-02-19 09:59:00 UTC (rev 5889)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java 2010-02-19 10:22:10 UTC (rev 5890)
@@ -23,7 +23,7 @@
@Interceptors(AnimalInterceptor.class)
@RequestScoped
-class Cow
+class Cow extends Animal
{
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java 2010-02-19 09:59:00 UTC (rev 5889)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java 2010-02-19 10:22:10 UTC (rev 5890)
@@ -21,7 +21,7 @@
import javax.interceptor.Interceptors;
@Interceptors(AnimalInterceptor.class)
-class Goat
+class Goat extends Animal
{
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java 2010-02-19 09:59:00 UTC (rev 5889)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java 2010-02-19 10:22:10 UTC (rev 5890)
@@ -23,7 +23,7 @@
@Interceptors(AnimalInterceptor.class)
@ApplicationScoped
-class Hen
+class Hen extends Animal
{
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java 2010-02-19 09:59:00 UTC (rev 5889)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java 2010-02-19 10:22:10 UTC (rev 5890)
@@ -31,16 +31,15 @@
{
@Test
@SpecAssertion(section = "5", id = "a")
- // WELD-436
public void testPostConstructInterceptor()
{
getInstanceByType(Goat.class);
assert Goat.isPostConstructInterceptorCalled();
assert AnimalInterceptor.isPostConstructInterceptorCalled(Goat.class);
- getInstanceByType(Hen.class);
+ getInstanceByType(Hen.class).toString();
assert Hen.isPostConstructInterceptorCalled();
assert AnimalInterceptor.isPostConstructInterceptorCalled(Hen.class);
- getInstanceByType(Cow.class);
+ getInstanceByType(Cow.class).toString();
assert Cow.isPostConstructInterceptorCalled();
assert AnimalInterceptor.isPostConstructInterceptorCalled(Cow.class);
}
@@ -56,17 +55,18 @@
createAndDestroyInstance(Hen.class);
assert Hen.isPreDestroyInterceptorCalled();
assert AnimalInterceptor.isPreDestroyInterceptorCalled(Hen.class);
- createAndDestroyInstance(Hen.class);
- assert Hen.isPreDestroyInterceptorCalled();
- assert AnimalInterceptor.isPreDestroyInterceptorCalled(Hen.class);
+ createAndDestroyInstance(Cow.class);
+ assert Cow.isPreDestroyInterceptorCalled();
+ assert AnimalInterceptor.isPreDestroyInterceptorCalled(Cow.class);
}
@SuppressWarnings("unchecked")
- private <T> void createAndDestroyInstance(Class<T> clazz)
+ private <T extends Animal> void createAndDestroyInstance(Class<T> clazz)
{
- Bean<T> bean = getBeans(clazz).iterator().next();
+ Bean<T> bean = getUniqueBean(clazz);
CreationalContext<T> ctx = getCurrentManager().createCreationalContext(bean);
T instance = (T) getCurrentManager().getReference(bean, clazz, ctx);
+ instance.foo(); // invoke method so that the instance is actually created
// destroy the instance
bean.destroy(instance, ctx);
}
14 years, 10 months
Weld SVN: r5889 - in cdi-tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/tests/context/conversation and 1 other directory.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2010-02-19 04:59:00 -0500 (Fri, 19 Feb 2010)
New Revision: 5889
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/
Log:
CDITCK-109
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/AbstractConversationTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public abstract class AbstractConversationTest extends AbstractJSR299Test
+{
+
+ public static final String CID_REQUEST_PARAMETER_NAME = "cid";
+
+ public static final String CID_HEADER_NAME = "org.jboss.jsr299.tck.cid";
+
+ public static final String LONG_RUNNING_HEADER_NAME = "org.jboss.jsr299.tck.longRunning";
+
+ protected boolean isCloudDestroyed(WebClient client) throws Exception
+ {
+ Page page = client.getPage(getConversationStatusPath("cloudDestroyed"));
+ return page.getWebResponse().getStatusCode() == 200;
+ }
+
+ protected void resetCloud(WebClient client) throws Exception
+ {
+ client.getPage(getConversationStatusPath("resetCloud"));
+ }
+
+ protected void invalidateSession(WebClient client) throws Exception
+ {
+ client.getPage(getConversationStatusPath("invalidateSession"));
+ }
+
+ protected String getConversationStatusPath(String method)
+ {
+ return super.getContextPath() + "conversation-status?method=" + method;
+ }
+
+ protected String getPath(String viewId)
+ {
+ return getContextPath() + viewId;
+ }
+
+ protected String getPath(String viewId, String cid)
+ {
+ return getContextPath() + viewId + "?" + CID_REQUEST_PARAMETER_NAME + "=" + cid;
+ }
+
+ 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(Page page)
+ {
+ return page.getWebResponse().getResponseHeaderValue(AbstractConversationTest.CID_HEADER_NAME);
+ }
+
+ protected Boolean hasRained(Page page)
+ {
+ return Boolean.valueOf(page.getWebResponse().getResponseHeaderValue(Cloud.RAINED_HEADER_NAME));
+ }
+
+ protected Boolean isLongRunning(Page page)
+ {
+ return Boolean.valueOf(page.getWebResponse().getResponseHeaderValue(LONG_RUNNING_HEADER_NAME));
+ }
+
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ConversationScoped
+@Named("builtin")
+public class BuiltInConversation implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Inject
+ private BeanManager manager;
+ @Inject
+ private Conversation conversation;
+
+ public boolean isScopeCorrect()
+ {
+ return getConversationBean().getScope().equals(RequestScoped.class);
+ }
+
+ public boolean isQualifierCorrect()
+ {
+ for (Annotation qualifier : getConversationBean().getQualifiers())
+ {
+ if (qualifier.annotationType().equals(Default.class))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isNameCorrect()
+ {
+ return getConversationBean().getName().equals("javax.enterprise.context.conversation");
+ }
+
+ public boolean isDefaultConversationHasNullId()
+ {
+ return conversation.isTransient() && conversation.getId() == null;
+ }
+
+ private Bean<?> getConversationBean()
+ {
+ Set<Bean<?>> beans = manager.getBeans(Conversation.class);
+ if (beans.size() != 1)
+ {
+ throw new RuntimeException("Multiple beans found for Conversation class.");
+ }
+ return beans.iterator().next();
+ }
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ClientConversationContextTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSpan;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+/**
+ * @author Nicklas Karlsson
+ * @author Dan Allen
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class, Cumulus.class, BuiltInConversation.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination="home.jspx", source="home.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="cumulus.jspx", source="cumulus.jsf"),
+ @Resource(destination="builtin.jspx", source="builtin.jsf"),
+ @Resource(destination="error.jspx", source="error.jsf"),
+ @Resource(destination="storm.jspx", source="storm.jsf"),
+ @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="rain.jspx", source="rain.jsf")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class ClientConversationContextTest extends AbstractConversationTest
+{
+
+ private WebClient client;
+
+
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ client = new WebClient();
+ }
+
+
+ @Test(groups = { "contexts"})
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "hb"),
+ @SpecAssertion(section = "6.7.4", id = "o")
+ })
+ public void testConversationIdSetByContainerIsUnique() throws Exception
+ {
+ HtmlPage storm = client.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c1 = getCid(storm);
+
+ storm = client.getPage(getPath("/storm.jsf"));
+ beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c2 = getCid(storm);
+
+ assert !c1.equals(c2);
+ }
+
+ @Test(groups = { "contexts", "rewrite" })
+ @SpecAssertion(section = "6.7.4", id = "j")
+ // TODO this test doesn't verify that the conversation context itself is destroyed
+ public void testTransientConversationInstancesDestroyedAtRequestEnd() throws Exception
+ {
+ resetCloud(client);
+ HtmlPage page = client.getPage(getPath("/cloud.jsf"));
+ assert !isLongRunning(page);
+ assert isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts"})
+ @SpecAssertion(section = "6.7.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HtmlPage storm = client.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ resetCloud(client);
+
+ client.getPage(getPath("/cloud.jsf", getCid(storm)));
+ assert !isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "p")
+ public void testConversationsDontCrossSessionBoundary1() throws Exception
+ {
+ // Load the page
+ HtmlPage rain = client.getPage(getPath("/rain.jsf"));
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "beginConversationButton");
+ rain = beginConversationButton.click();
+ String cid = getCid(rain);
+
+ // Cause rain
+ HtmlSubmitInput rainButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "rain");
+ rain = rainButton.click();
+
+ // Re-request the page, inside the conversation and check it has rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert hasRained(rain);
+
+ // Invalidate the session, invalidate the conversation-scoped cloud
+ invalidateSession(client);
+
+ // Re-request the page, check it hasn't rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert !hasRained(rain);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "p")
+ public void testConversationsDontCrossSessionBoundary2() throws Exception
+ {
+ // Load the page
+ HtmlPage rain = client.getPage(getPath("/rain.jsf"));
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "beginConversationButton");
+ rain = beginConversationButton.click();
+ String cid = getCid(rain);
+
+ // Cause rain
+ HtmlSubmitInput rainButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "rain");
+ rain = rainButton.click();
+
+ // Re-request the page, inside the conversation and check it has rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert hasRained(rain);
+
+ // Create a new web client and load the page
+ client = new WebClient();
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert !hasRained(rain);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "a")
+ public void testConversationActiveDuringNonFacesRequest() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cloud.jsf"));
+ HtmlSpan span = getFirstMatchingElement(page, HtmlSpan.class, "cloudName");
+ assert span.getTextContent().equals(Cloud.NAME);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "tb")
+ public void testConversationPropagationToNonExistentConversationLeadsToTransientConversation() throws Exception
+ {
+ Page page = client.getPage(getPath("/cloud.jsf", "org.jboss.jsr299"));
+ assert !isLongRunning(page);
+ assert !getCid(page).equals("org.jboss.jsr299");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "f")
+ public void testConversationBeginMakesConversationLongRunning() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "r")
+ public void testBeginAlreadyLongRunningConversationThrowsException() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+
+ // begin a conversation again and check that IllegalStateException is thrown
+ HtmlSubmitInput beginConversationButton2 = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationAndSwallowException");
+ page = beginConversationButton2.click();
+ assert page.getBody().getTextContent().contains("Hello world!");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "g"),
+ @SpecAssertion(section = "6.7.5", id = "k"),
+ @SpecAssertion(section = "6.7.5", id = "o")
+ })
+ public void testConversationEndMakesConversationTransient() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+
+ // end a conversation
+ HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "endConversationButton");
+ page = endConversationButton.click();
+ assert !isLongRunning(page);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "q")
+ public void testEndTransientConversationThrowsException() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // try ending a transient conversation
+ HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "endConversationAndSwallowException");
+ page = endConversationButton.click();
+ assert page.getBody().getTextContent().contains("Hello world!");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "ib"),
+ @SpecAssertion(section = "6.7.5", id = "iaa")
+ })
+ public void testBeanWithRequestScope() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct scope: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "id")
+ public void testBeanWithDefaultQualifier() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct qualifier: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "ie")
+ public void testBeanWithNameJavaxEnterpriseContextConversation() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct name: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "l"),
+ @SpecAssertion(section = "6.7.4", id = "e")
+ })
+ public void testTransientConversationHasNullId() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Default conversation has null id: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "ha"),
+ @SpecAssertion(section = "6.7.5", id = "j")
+ })
+ public void testConversationIdMayBeSetByApplication() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationIdentifiedByCustomIdentifier");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ assert getCid(page).equals("humilis");
+ assert page.getBody().getTextContent().contains("Cumulus humilis");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "hb"),
+ @SpecAssertion(section = "6.7.5", id = "j")
+ })
+ public void testConversationIdMayBeSetByContainer() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ assert getCid(page) != null;
+ assert page.getBody().getTextContent().contains("Cumulus congestus");
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "m"),
+ @SpecAssertion(section = "6.7.5", id = "n")
+ })
+ public void testSetConversationTimeoutOverride() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation and set a custom timeout
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationAndSetTimeout");
+ page = beginConversationButton.click();
+ assert page.getBody().getTextContent().contains("Cumulonimbus");
+ }
+
+ @Test
+ @SpecAssertion(section = "6.7.5", id = "m")
+ public void testConversationHasDefaultTimeout() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert page.getBody().getTextContent().contains("Stratocumulus");
+ }
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Cloud.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Named;
+
+@Named @Default
+@ConversationScoped
+public class Cloud implements Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5765109971012677278L;
+
+ 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 void rain()
+ {
+ rained = true;
+ System.out.println("rain!");
+ }
+
+ public boolean isRained()
+ {
+ return rained;
+ }
+
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/CloudController.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public @Named class CloudController
+{
+ @Inject Conversation conversation;
+
+ public String getBeginConversation()
+ {
+ conversation.begin();
+ return "long-running conversation begun";
+ }
+
+}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyLiteral;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationBeginTest extends AbstractJSR299Test
-{
-
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- if (!conversation.isTransient())
- {
- conversation.end();
- }
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.4", id = "f")
- public void testConversationBeginMakesConversationLongRunning()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- conversation.begin();
- assert !conversation.isTransient();
- }
-
- @Test(groups = { "contexts" }, expectedExceptions = IllegalStateException.class)
- @SpecAssertion(section = "6.7.5", id = "r")
- public void testBeginAlreadyLongRunningConversationThrowsException()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- conversation.begin();
- conversation.begin();
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.Conversation;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Default;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyLiteral;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationContextTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.4", id = "e")
- public void testDefaultConversationIsTransient()
- {
- assert getInstanceByType(Conversation.class, new AnyLiteral()).isTransient();
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "iaa")
- public void testBeanWithTypeConversation()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).size() == 1;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "ib")
- public void testBeanWithRequestScope()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).iterator().next().getScope().equals(RequestScoped.class);
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "id")
- public void testBeanWithBindingCurrent()
- {
- boolean found = false;
- for (Annotation binding : getBeans(Conversation.class, new AnyLiteral()).iterator().next().getQualifiers())
- {
- if (binding.annotationType().equals(Default.class))
- {
- found = true;
- }
- }
- assert found;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "l")
- public void testTransientConversationHasNullId()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- assert conversation.getId() == null;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "ie")
- public void testBeanWithNameJavaxEnterpriseContextConversation()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).iterator().next().getName().equals("javax.enterprise.context.conversation");
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationEndTest extends AbstractJSR299Test
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- Conversation conversation = getInstanceByType(Conversation.class);
- if (!conversation.isTransient())
- {
- conversation.end();
- }
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "g"),
- @SpecAssertion(section = "6.7.5", id = "k"),
- @SpecAssertion(section = "6.7.5", id = "o")
- })
- public void testConversationEndMakesConversationTransient()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.isTransient();
- conversation.begin();
- assert !conversation.isTransient();
- conversation.end();
- assert conversation.isTransient();
- }
-
- @Test(groups = { "contexts" }, expectedExceptions = IllegalStateException.class)
- @SpecAssertion(section = "6.7.5", id = "q")
- public void testEndTransientConversationThrowsException()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.isTransient();
- conversation.end();
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationIdSetByApplicationTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "ha"),
- @SpecAssertion(section = "6.7.5", id = "j")
- })
- public void testConversationIdMayBeSetByApplication()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- conversation.begin("foo");
- assert conversation.getId().equals("foo");
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- *
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationIdSetByContainerTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "hb"),
- @SpecAssertion(section = "6.7.5", id = "j")
- })
- public void testConversationBeginMakesConversationLongRunning()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- conversation.begin();
- assert conversation.getId() != null;
- }
-
-}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+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.OldSPIBridge;
+
+public class ConversationStatusServlet extends HttpServlet
+{
+
+ private static final long serialVersionUID = 2984756941080790899L;
+
+ @Inject
+ private BeanManager beanManager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ String method = req.getParameter("method");
+ if ("cid".equals(method))
+ {
+ Conversation conversation = OldSPIBridge.getInstanceByType(beanManager, Conversation.class);
+ serializeToResponse(conversation.getId(), resp);
+ }
+ else if ("cloudDestroyed".equals(method))
+ {
+ if (Cloud.isDestroyed())
+ {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ }
+ else
+ {
+ resp.setStatus(208);
+ }
+ }
+ 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();
+ }
+
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationTestPhaseListener.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+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.api.JSR299Configuration;
+import org.jboss.jsr299.tck.impl.OldSPIBridge;
+import org.jboss.testharness.impl.ConfigurationFactory;
+
+public class ConversationTestPhaseListener implements PhaseListener
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1197355854770726526L;
+
+ 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)
+ {
+ JSR299Configuration configuration = ConfigurationFactory.get(JSR299Configuration.class);
+ if (event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+ {
+ try
+ {
+ configuration.getManagers().getManager().getContext(ConversationScoped.class);
+ activeBeforeApplyRequestValues = true;
+ }
+ catch (ContextNotActiveException e)
+ {
+ activeBeforeApplyRequestValues = false;
+ }
+ }
+ if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+ {
+ BeanManager beanManager = configuration.getManagers().getManager();
+ Conversation conversation = OldSPIBridge.getInstanceByType(beanManager, Conversation.class);
+ HttpServletResponse response = (HttpServletResponse) event.getFacesContext().getExternalContext().getResponse();
+ response.addHeader(AbstractConversationTest.CID_HEADER_NAME, conversation.getId() == null ? " null" : conversation.getId());
+ response.addHeader(AbstractConversationTest.LONG_RUNNING_HEADER_NAME, String.valueOf(!conversation.isTransient()));
+ response.addHeader(Cloud.RAINED_HEADER_NAME, new Boolean(OldSPIBridge.getInstanceByType(beanManager, Cloud.class).isRained()).toString());
+ response.addHeader(ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME, new Boolean(activeBeforeApplyRequestValues).toString());
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+
+}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java 2010-02-19 09:55:53 UTC (rev 5888)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Dan Allen
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationTimeoutTest extends AbstractJSR299Test
-{
- @Test
- @SpecAssertion(section = "6.7.5", id = "m")
- public void testConversationHasDefaultTimeout()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.getTimeout() > 0;
- }
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "6.7.5", id = "m"),
- @SpecAssertion(section = "6.7.5", id = "n")
- })
- public void testSetConversationTimeoutOverride()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- long oldValue = conversation.getTimeout();
- conversation.setTimeout(1500);
- assert conversation.getTimeout() == 1500;
- conversation.setTimeout(oldValue);
- }
-}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ConversationScoped
+@Named
+public class Cumulus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private static final int timeout = 15000;
+ private static final String customCid = "humilis";
+
+ @Inject
+ private Conversation conversation;
+
+ public void beginConversation()
+ {
+ conversation.begin();
+ }
+
+ public void beginConversationIdentifiedByCustomIdentifier()
+ {
+ conversation.begin(customCid);
+ }
+
+ public String beginConversationAndSwallowException()
+ {
+ try
+ {
+ conversation.begin();
+ return "error";
+ }
+ catch (IllegalStateException e)
+ {
+ return "home";
+ }
+ }
+
+ public void beginConversationAndSetTimeout()
+ {
+ conversation.begin();
+ conversation.setTimeout(timeout);
+ }
+
+ public void endConversation()
+ {
+ conversation.end();
+ }
+
+ public String endConversationAndSwallowException()
+ {
+ try
+ {
+ conversation.end();
+ return "error";
+ }
+ catch (IllegalStateException e)
+ {
+ return "home";
+ }
+ }
+
+ public boolean isConversationIdentifiedByCustomIdentifier()
+ {
+ return !conversation.isTransient() && conversation.getId().equals(customCid);
+ }
+
+ public boolean isConversationIdentifierNull()
+ {
+ return conversation.getId() == null;
+ }
+
+ public boolean isConversationTimeoutSetProperly()
+ {
+ return conversation.getTimeout() == timeout;
+ }
+
+ public boolean isConversationHasDefaultTimeout()
+ {
+ return conversation.getTimeout() > 0;
+ }
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/InvalidatingSessionDestroysConversationTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+
+/**
+ * @author Nicklas Karlsson
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @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")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class InvalidatingSessionDestroysConversationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "qa")
+ // TODO this test doesn't precisely probe the boundaries of the service() method
+ public void testInvalidatingSessionDestroysConversation() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ resetCloud(webClient);
+ webClient.getPage(getPath("/clouds.jsf"));
+ assert !isCloudDestroyed(webClient);
+ invalidateSession(webClient);
+ assert isCloudDestroyed(webClient);
+ }
+
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/LongRunningConversationPropagatedByFacesContextTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+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
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @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")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class LongRunningConversationPropagatedByFacesContextTest extends AbstractConversationTest
+{
+
+ private static final String STORM_STRENGTH = "12";
+ private static final String REDIRECT_STORM_STRENGTH = "15";
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "l"),
+ @SpecAssertion(section = "2.4.1", id="ba")
+ })
+
+ 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 = "6.7.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
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ManualCidPropagationTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+/**
+ * @author Nicklas Karlsson
+ * @author Dan Allen
+ *
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="storm.jspx", source="storm.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class ManualCidPropagationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "n")
+ public void testManualCidPropagation() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ HtmlPage storm = webClient.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c1 = getCid(storm);
+
+ HtmlPage cloud = webClient.getPage(getPath("/cloud.jsf", c1));
+
+ String c2 = getCid(cloud);
+
+ assert isLongRunning(cloud);
+ assert c1.equals(c2);
+ }
+
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java (from rev 5874, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/Storm.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@ConversationScoped
+public class Storm implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1513633490356967202L;
+
+ @Inject 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;
+ }
+
+}
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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:panelGrid>
+ <h:outputText value="Correct scope: #{builtin.scopeCorrect}"/>
+ <h:outputText value="Correct name: #{builtin.nameCorrect}"/>
+ <h:outputText value="Correct qualifier: #{builtin.qualifierCorrect}"/>
+ <h:outputText value="Default conversation has null id: #{builtin.defaultConversationHasNullId}"/>
+ </h:panelGrid>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/cloud.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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}" id="cloudName" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/clouds.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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>
+
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,52 @@
+<?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:panelGrid columns="1">
+ <h:outputText value="Cumulus humilis"
+ rendered="#{cumulus.conversationIdentifiedByCustomIdentifier}" />
+ <h:outputText value="Cumulus congestus"
+ rendered="#{not cumulus.conversationIdentifierNull}" />
+ <h:outputText value="Cumulonimbus"
+ rendered="#{cumulus.conversationTimeoutSetProperly}" />
+ <h:outputText value="Stratocumulus"
+ rendered="#{cumulus.conversationHasDefaultTimeout}" />
+ <h:commandButton action="#{cumulus.beginConversation}"
+ value="Begin conversation" id="beginConversationButton" />
+ <h:commandButton
+ action="#{cumulus.beginConversationIdentifiedByCustomIdentifier}"
+ value="Begin conversation identified by custom identifier"
+ id="beginConversationIdentifiedByCustomIdentifier" />
+ <h:commandButton
+ action="#{cumulus.beginConversationAndSwallowException}"
+ value="Begin conversation and swallow exception"
+ id="beginConversationAndSwallowException" />
+ <h:commandButton
+ action="#{cumulus.beginConversationAndSetTimeout}"
+ value="Begin conversation and set timeout"
+ id="beginConversationAndSetTimeout" />
+ <h:commandButton action="#{cumulus.endConversation}"
+ value="End conversation" id="endConversationButton" />
+ <h:commandButton
+ action="#{cumulus.endConversationAndSwallowException}"
+ value="End conversation and swallow exception"
+ id="endConversationAndSwallowException" />
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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>
+ <h1>Expected exception was not thrown!</h1>
+ </body>
+ </html>
+</jsp:root>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/faces-config.xml)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,42 @@
+<?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.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>
+
+ <navigation-rule>
+ <from-view-id>/cumulus.jspx</from-view-id>
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/home.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>error</from-outcome>
+ <to-view-id>/error.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/home.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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>
+ <h1>Hello world!</h1>
+ </body>
+ </html>
+</jsp:root>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/lightening.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/rain.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,25 @@
+<?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:commandButton action="#{storm.beginConversation}" value="Thunder" id="beginConversationButton"/>
+ <h:commandButton action="#{cloud.rain}" value="Rain" id="rain"/>
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/storm.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/thunder.jsf)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf 2010-02-19 09:59:00 UTC (rev 5889)
@@ -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>
+
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml (from rev 5874, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/web.xml)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml 2010-02-19 09:59:00 UTC (rev 5889)
@@ -0,0 +1,46 @@
+<?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>
+
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
14 years, 10 months
Weld SVN: r5888 - in cdi-tck/branches/1.0/impl/src/main: resources/org/jboss/jsr299/tck/tests/context/conversation and 1 other directory.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2010-02-19 04:55:53 -0500 (Fri, 19 Feb 2010)
New Revision: 5888
Added:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml
Removed:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/client/
Log:
CDITCK-109
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/AbstractConversationTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public abstract class AbstractConversationTest extends AbstractJSR299Test
+{
+
+ public static final String CID_REQUEST_PARAMETER_NAME = "cid";
+
+ public static final String CID_HEADER_NAME = "org.jboss.jsr299.tck.cid";
+
+ public static final String LONG_RUNNING_HEADER_NAME = "org.jboss.jsr299.tck.longRunning";
+
+ protected boolean isCloudDestroyed(WebClient client) throws Exception
+ {
+ Page page = client.getPage(getConversationStatusPath("cloudDestroyed"));
+ return page.getWebResponse().getStatusCode() == 200;
+ }
+
+ protected void resetCloud(WebClient client) throws Exception
+ {
+ client.getPage(getConversationStatusPath("resetCloud"));
+ }
+
+ protected void invalidateSession(WebClient client) throws Exception
+ {
+ client.getPage(getConversationStatusPath("invalidateSession"));
+ }
+
+ protected String getConversationStatusPath(String method)
+ {
+ return super.getContextPath() + "conversation-status?method=" + method;
+ }
+
+ protected String getPath(String viewId)
+ {
+ return getContextPath() + viewId;
+ }
+
+ protected String getPath(String viewId, String cid)
+ {
+ return getContextPath() + viewId + "?" + CID_REQUEST_PARAMETER_NAME + "=" + cid;
+ }
+
+ 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(Page page)
+ {
+ return page.getWebResponse().getResponseHeaderValue(AbstractConversationTest.CID_HEADER_NAME);
+ }
+
+ protected Boolean hasRained(Page page)
+ {
+ return Boolean.valueOf(page.getWebResponse().getResponseHeaderValue(Cloud.RAINED_HEADER_NAME));
+ }
+
+ protected Boolean isLongRunning(Page page)
+ {
+ return Boolean.valueOf(page.getWebResponse().getResponseHeaderValue(LONG_RUNNING_HEADER_NAME));
+ }
+
+
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ConversationScoped
+@Named("builtin")
+public class BuiltInConversation implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Inject
+ private BeanManager manager;
+ @Inject
+ private Conversation conversation;
+
+ public boolean isScopeCorrect()
+ {
+ return getConversationBean().getScope().equals(RequestScoped.class);
+ }
+
+ public boolean isQualifierCorrect()
+ {
+ for (Annotation qualifier : getConversationBean().getQualifiers())
+ {
+ if (qualifier.annotationType().equals(Default.class))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isNameCorrect()
+ {
+ return getConversationBean().getName().equals("javax.enterprise.context.conversation");
+ }
+
+ public boolean isDefaultConversationHasNullId()
+ {
+ return conversation.isTransient() && conversation.getId() == null;
+ }
+
+ private Bean<?> getConversationBean()
+ {
+ Set<Bean<?>> beans = manager.getBeans(Conversation.class);
+ if (beans.size() != 1)
+ {
+ throw new RuntimeException("Multiple beans found for Conversation class.");
+ }
+ return beans.iterator().next();
+ }
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ClientConversationContextTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSpan;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+/**
+ * @author Nicklas Karlsson
+ * @author Dan Allen
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class, Cumulus.class, BuiltInConversation.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination="home.jspx", source="home.jsf"),
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="cumulus.jspx", source="cumulus.jsf"),
+ @Resource(destination="builtin.jspx", source="builtin.jsf"),
+ @Resource(destination="error.jspx", source="error.jsf"),
+ @Resource(destination="storm.jspx", source="storm.jsf"),
+ @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml"),
+ @Resource(destination="rain.jspx", source="rain.jsf")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class ClientConversationContextTest extends AbstractConversationTest
+{
+
+ private WebClient client;
+
+
+ @Override
+ public void beforeMethod()
+ {
+ super.beforeMethod();
+ client = new WebClient();
+ }
+
+
+ @Test(groups = { "contexts"})
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "hb"),
+ @SpecAssertion(section = "6.7.4", id = "o")
+ })
+ public void testConversationIdSetByContainerIsUnique() throws Exception
+ {
+ HtmlPage storm = client.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c1 = getCid(storm);
+
+ storm = client.getPage(getPath("/storm.jsf"));
+ beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c2 = getCid(storm);
+
+ assert !c1.equals(c2);
+ }
+
+ @Test(groups = { "contexts", "rewrite" })
+ @SpecAssertion(section = "6.7.4", id = "j")
+ // TODO this test doesn't verify that the conversation context itself is destroyed
+ public void testTransientConversationInstancesDestroyedAtRequestEnd() throws Exception
+ {
+ resetCloud(client);
+ HtmlPage page = client.getPage(getPath("/cloud.jsf"));
+ assert !isLongRunning(page);
+ assert isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts"})
+ @SpecAssertion(section = "6.7.4", id = "k")
+ public void testLongRunningConversationInstancesNotDestroyedAtRequestEnd() throws Exception
+ {
+ HtmlPage storm = client.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ resetCloud(client);
+
+ client.getPage(getPath("/cloud.jsf", getCid(storm)));
+ assert !isCloudDestroyed(client);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "p")
+ public void testConversationsDontCrossSessionBoundary1() throws Exception
+ {
+ // Load the page
+ HtmlPage rain = client.getPage(getPath("/rain.jsf"));
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "beginConversationButton");
+ rain = beginConversationButton.click();
+ String cid = getCid(rain);
+
+ // Cause rain
+ HtmlSubmitInput rainButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "rain");
+ rain = rainButton.click();
+
+ // Re-request the page, inside the conversation and check it has rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert hasRained(rain);
+
+ // Invalidate the session, invalidate the conversation-scoped cloud
+ invalidateSession(client);
+
+ // Re-request the page, check it hasn't rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert !hasRained(rain);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "p")
+ public void testConversationsDontCrossSessionBoundary2() throws Exception
+ {
+ // Load the page
+ HtmlPage rain = client.getPage(getPath("/rain.jsf"));
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "beginConversationButton");
+ rain = beginConversationButton.click();
+ String cid = getCid(rain);
+
+ // Cause rain
+ HtmlSubmitInput rainButton = getFirstMatchingElement(rain, HtmlSubmitInput.class, "rain");
+ rain = rainButton.click();
+
+ // Re-request the page, inside the conversation and check it has rained
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert hasRained(rain);
+
+ // Create a new web client and load the page
+ client = new WebClient();
+ rain = client.getPage(getPath("/rain.jsf", cid));
+ assert !hasRained(rain);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "a")
+ public void testConversationActiveDuringNonFacesRequest() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cloud.jsf"));
+ HtmlSpan span = getFirstMatchingElement(page, HtmlSpan.class, "cloudName");
+ assert span.getTextContent().equals(Cloud.NAME);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "tb")
+ public void testConversationPropagationToNonExistentConversationLeadsToTransientConversation() throws Exception
+ {
+ Page page = client.getPage(getPath("/cloud.jsf", "org.jboss.jsr299"));
+ assert !isLongRunning(page);
+ assert !getCid(page).equals("org.jboss.jsr299");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "f")
+ public void testConversationBeginMakesConversationLongRunning() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "r")
+ public void testBeginAlreadyLongRunningConversationThrowsException() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+
+ // begin a conversation again and check that IllegalStateException is thrown
+ HtmlSubmitInput beginConversationButton2 = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationAndSwallowException");
+ page = beginConversationButton2.click();
+ assert page.getBody().getTextContent().contains("Hello world!");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "g"),
+ @SpecAssertion(section = "6.7.5", id = "k"),
+ @SpecAssertion(section = "6.7.5", id = "o")
+ })
+ public void testConversationEndMakesConversationTransient() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+
+ // end a conversation
+ HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "endConversationButton");
+ page = endConversationButton.click();
+ assert !isLongRunning(page);
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "q")
+ public void testEndTransientConversationThrowsException() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // try ending a transient conversation
+ HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "endConversationAndSwallowException");
+ page = endConversationButton.click();
+ assert page.getBody().getTextContent().contains("Hello world!");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "ib"),
+ @SpecAssertion(section = "6.7.5", id = "iaa")
+ })
+ public void testBeanWithRequestScope() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct scope: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "id")
+ public void testBeanWithDefaultQualifier() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct qualifier: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.5", id = "ie")
+ public void testBeanWithNameJavaxEnterpriseContextConversation() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Correct name: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "l"),
+ @SpecAssertion(section = "6.7.4", id = "e")
+ })
+ public void testTransientConversationHasNullId() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/builtin.jsf"));
+ assert page.getBody().getTextContent().contains("Default conversation has null id: true");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "ha"),
+ @SpecAssertion(section = "6.7.5", id = "j")
+ })
+ public void testConversationIdMayBeSetByApplication() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationIdentifiedByCustomIdentifier");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ assert getCid(page).equals("humilis");
+ assert page.getBody().getTextContent().contains("Cumulus humilis");
+ }
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "hb"),
+ @SpecAssertion(section = "6.7.5", id = "j")
+ })
+ public void testConversationIdMayBeSetByContainer() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert isLongRunning(page);
+ assert getCid(page) != null;
+ assert page.getBody().getTextContent().contains("Cumulus congestus");
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.5", id = "m"),
+ @SpecAssertion(section = "6.7.5", id = "n")
+ })
+ public void testSetConversationTimeoutOverride() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation and set a custom timeout
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationAndSetTimeout");
+ page = beginConversationButton.click();
+ assert page.getBody().getTextContent().contains("Cumulonimbus");
+ }
+
+ @Test
+ @SpecAssertion(section = "6.7.5", id = "m")
+ public void testConversationHasDefaultTimeout() throws Exception
+ {
+ HtmlPage page = client.getPage(getPath("/cumulus.jsf"));
+ assert !isLongRunning(page);
+
+ // begin a conversation
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "beginConversationButton");
+ page = beginConversationButton.click();
+ assert page.getBody().getTextContent().contains("Stratocumulus");
+ }
+}
\ No newline at end of file
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cloud.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Named;
+
+@Named @Default
+@ConversationScoped
+public class Cloud implements Serializable
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5765109971012677278L;
+
+ 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 void rain()
+ {
+ rained = true;
+ System.out.println("rain!");
+ }
+
+ public boolean isRained()
+ {
+ return rained;
+ }
+
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/CloudController.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public @Named class CloudController
+{
+ @Inject Conversation conversation;
+
+ public String getBeginConversation()
+ {
+ conversation.begin();
+ return "long-running conversation begun";
+ }
+
+}
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationBeginTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyLiteral;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationBeginTest extends AbstractJSR299Test
-{
-
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- if (!conversation.isTransient())
- {
- conversation.end();
- }
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.4", id = "f")
- public void testConversationBeginMakesConversationLongRunning()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- conversation.begin();
- assert !conversation.isTransient();
- }
-
- @Test(groups = { "contexts" }, expectedExceptions = IllegalStateException.class)
- @SpecAssertion(section = "6.7.5", id = "r")
- public void testBeginAlreadyLongRunningConversationThrowsException()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- conversation.begin();
- conversation.begin();
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationContextTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.Conversation;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Default;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.literals.AnyLiteral;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationContextTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.4", id = "e")
- public void testDefaultConversationIsTransient()
- {
- assert getInstanceByType(Conversation.class, new AnyLiteral()).isTransient();
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "iaa")
- public void testBeanWithTypeConversation()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).size() == 1;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "ib")
- public void testBeanWithRequestScope()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).iterator().next().getScope().equals(RequestScoped.class);
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "id")
- public void testBeanWithBindingCurrent()
- {
- boolean found = false;
- for (Annotation binding : getBeans(Conversation.class, new AnyLiteral()).iterator().next().getQualifiers())
- {
- if (binding.annotationType().equals(Default.class))
- {
- found = true;
- }
- }
- assert found;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "l")
- public void testTransientConversationHasNullId()
- {
- Conversation conversation = getInstanceByType(Conversation.class, new AnyLiteral());
- assert conversation.isTransient();
- assert conversation.getId() == null;
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertion(section = "6.7.5", id = "ie")
- public void testBeanWithNameJavaxEnterpriseContextConversation()
- {
- assert getBeans(Conversation.class, new AnyLiteral()).iterator().next().getName().equals("javax.enterprise.context.conversation");
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationEndTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationEndTest extends AbstractJSR299Test
-{
- @Override
- public void beforeMethod()
- {
- super.beforeMethod();
- Conversation conversation = getInstanceByType(Conversation.class);
- if (!conversation.isTransient())
- {
- conversation.end();
- }
- }
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "g"),
- @SpecAssertion(section = "6.7.5", id = "k"),
- @SpecAssertion(section = "6.7.5", id = "o")
- })
- public void testConversationEndMakesConversationTransient()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.isTransient();
- conversation.begin();
- assert !conversation.isTransient();
- conversation.end();
- assert conversation.isTransient();
- }
-
- @Test(groups = { "contexts" }, expectedExceptions = IllegalStateException.class)
- @SpecAssertion(section = "6.7.5", id = "q")
- public void testEndTransientConversationThrowsException()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.isTransient();
- conversation.end();
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByApplicationTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationIdSetByApplicationTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "ha"),
- @SpecAssertion(section = "6.7.5", id = "j")
- })
- public void testConversationIdMayBeSetByApplication()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- conversation.begin("foo");
- assert conversation.getId().equals("foo");
- }
-
-}
\ No newline at end of file
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationIdSetByContainerTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Nicklas Karlsson
- *
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationIdSetByContainerTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "contexts" })
- @SpecAssertions({
- @SpecAssertion(section = "6.7.4", id = "hb"),
- @SpecAssertion(section = "6.7.5", id = "j")
- })
- public void testConversationBeginMakesConversationLongRunning()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- conversation.begin();
- assert conversation.getId() != null;
- }
-
-}
\ No newline at end of file
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationStatusServlet.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+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.OldSPIBridge;
+
+public class ConversationStatusServlet extends HttpServlet
+{
+
+ private static final long serialVersionUID = 2984756941080790899L;
+
+ @Inject
+ private BeanManager beanManager;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ String method = req.getParameter("method");
+ if ("cid".equals(method))
+ {
+ Conversation conversation = OldSPIBridge.getInstanceByType(beanManager, Conversation.class);
+ serializeToResponse(conversation.getId(), resp);
+ }
+ else if ("cloudDestroyed".equals(method))
+ {
+ if (Cloud.isDestroyed())
+ {
+ resp.setStatus(HttpServletResponse.SC_OK);
+ }
+ else
+ {
+ resp.setStatus(208);
+ }
+ }
+ 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();
+ }
+
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTestPhaseListener.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+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.api.JSR299Configuration;
+import org.jboss.jsr299.tck.impl.OldSPIBridge;
+import org.jboss.testharness.impl.ConfigurationFactory;
+
+public class ConversationTestPhaseListener implements PhaseListener
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1197355854770726526L;
+
+ 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)
+ {
+ JSR299Configuration configuration = ConfigurationFactory.get(JSR299Configuration.class);
+ if (event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES))
+ {
+ try
+ {
+ configuration.getManagers().getManager().getContext(ConversationScoped.class);
+ activeBeforeApplyRequestValues = true;
+ }
+ catch (ContextNotActiveException e)
+ {
+ activeBeforeApplyRequestValues = false;
+ }
+ }
+ if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE))
+ {
+ BeanManager beanManager = configuration.getManagers().getManager();
+ Conversation conversation = OldSPIBridge.getInstanceByType(beanManager, Conversation.class);
+ HttpServletResponse response = (HttpServletResponse) event.getFacesContext().getExternalContext().getResponse();
+ response.addHeader(AbstractConversationTest.CID_HEADER_NAME, conversation.getId() == null ? " null" : conversation.getId());
+ response.addHeader(AbstractConversationTest.LONG_RUNNING_HEADER_NAME, String.valueOf(!conversation.isTransient()));
+ response.addHeader(Cloud.RAINED_HEADER_NAME, new Boolean(OldSPIBridge.getInstanceByType(beanManager, Cloud.class).isRained()).toString());
+ response.addHeader(ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME, new Boolean(activeBeforeApplyRequestValues).toString());
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+
+}
Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java 2010-02-19 06:36:14 UTC (rev 5887)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ConversationTimeoutTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
-
-import javax.enterprise.context.Conversation;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.testng.annotations.Test;
-
-/**
- * @author Dan Allen
- */
-@Artifact
-@SpecVersion(spec="cdi", version="20091101")
-public class ConversationTimeoutTest extends AbstractJSR299Test
-{
- @Test
- @SpecAssertion(section = "6.7.5", id = "m")
- public void testConversationHasDefaultTimeout()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- assert conversation.getTimeout() > 0;
- }
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "6.7.5", id = "m"),
- @SpecAssertion(section = "6.7.5", id = "n")
- })
- public void testSetConversationTimeoutOverride()
- {
- Conversation conversation = getInstanceByType(Conversation.class);
- long oldValue = conversation.getTimeout();
- conversation.setTimeout(1500);
- assert conversation.getTimeout() == 1500;
- conversation.setTimeout(oldValue);
- }
-}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Cumulus.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@ConversationScoped
+@Named
+public class Cumulus implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private static final int timeout = 15000;
+ private static final String customCid = "humilis";
+
+ @Inject
+ private Conversation conversation;
+
+ public void beginConversation()
+ {
+ conversation.begin();
+ }
+
+ public void beginConversationIdentifiedByCustomIdentifier()
+ {
+ conversation.begin(customCid);
+ }
+
+ public String beginConversationAndSwallowException()
+ {
+ try
+ {
+ conversation.begin();
+ return "error";
+ }
+ catch (IllegalStateException e)
+ {
+ return "home";
+ }
+ }
+
+ public void beginConversationAndSetTimeout()
+ {
+ conversation.begin();
+ conversation.setTimeout(timeout);
+ }
+
+ public void endConversation()
+ {
+ conversation.end();
+ }
+
+ public String endConversationAndSwallowException()
+ {
+ try
+ {
+ conversation.end();
+ return "error";
+ }
+ catch (IllegalStateException e)
+ {
+ return "home";
+ }
+ }
+
+ public boolean isConversationIdentifiedByCustomIdentifier()
+ {
+ return !conversation.isTransient() && conversation.getId().equals(customCid);
+ }
+
+ public boolean isConversationIdentifierNull()
+ {
+ return conversation.getId() == null;
+ }
+
+ public boolean isConversationTimeoutSetProperly()
+ {
+ return conversation.getTimeout() == timeout;
+ }
+
+ public boolean isConversationHasDefaultTimeout()
+ {
+ return conversation.getTimeout() > 0;
+ }
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/InvalidatingSessionDestroysConversationTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+
+/**
+ * @author Nicklas Karlsson
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @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")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class InvalidatingSessionDestroysConversationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "qa")
+ // TODO this test doesn't precisely probe the boundaries of the service() method
+ public void testInvalidatingSessionDestroysConversation() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ resetCloud(webClient);
+ webClient.getPage(getPath("/clouds.jsf"));
+ assert !isCloudDestroyed(webClient);
+ invalidateSession(webClient);
+ assert isCloudDestroyed(webClient);
+ }
+
+}
\ No newline at end of file
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/LongRunningConversationPropagatedByFacesContextTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+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
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @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")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class LongRunningConversationPropagatedByFacesContextTest extends AbstractConversationTest
+{
+
+ private static final String STORM_STRENGTH = "12";
+ private static final String REDIRECT_STORM_STRENGTH = "15";
+
+ @Test(groups = { "contexts" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7.4", id = "l"),
+ @SpecAssertion(section = "2.4.1", id="ba")
+ })
+
+ 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 = "6.7.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
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/ManualCidPropagationTest.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WebXml;
+import org.testng.annotations.Test;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+
+/**
+ * @author Nicklas Karlsson
+ * @author Dan Allen
+ *
+ */
+@Artifact(addCurrentPackage=false)
+(a)Classes({Storm.class, ConversationTestPhaseListener.class, ConversationStatusServlet.class, Cloud.class, CloudController.class})
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination="cloud.jspx", source="cloud.jsf"),
+ @Resource(destination="storm.jspx", source="storm.jsf"),
+ @Resource(destination="clouds.jspx", source="clouds.jsf"),
+ @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml")
+})
+@WebXml("web.xml")
+@SpecVersion(spec="cdi", version="20091101")
+public class ManualCidPropagationTest extends AbstractConversationTest
+{
+
+ @Test(groups = { "contexts" })
+ @SpecAssertion(section = "6.7.4", id = "n")
+ public void testManualCidPropagation() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ HtmlPage storm = webClient.getPage(getPath("/storm.jsf"));
+ HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "beginConversationButton");
+ storm = beginConversationButton.click();
+
+ String c1 = getCid(storm);
+
+ HtmlPage cloud = webClient.getPage(getPath("/cloud.jsf", c1));
+
+ String c2 = getCid(cloud);
+
+ assert isLongRunning(cloud);
+ assert c1.equals(c2);
+ }
+
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/Storm.java 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.jsr299.tck.tests.context.conversation;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@ConversationScoped
+public class Storm implements Serializable
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1513633490356967202L;
+
+ @Inject 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;
+ }
+
+}
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/builtin.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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:panelGrid>
+ <h:outputText value="Correct scope: #{builtin.scopeCorrect}"/>
+ <h:outputText value="Correct name: #{builtin.nameCorrect}"/>
+ <h:outputText value="Correct qualifier: #{builtin.qualifierCorrect}"/>
+ <h:outputText value="Default conversation has null id: #{builtin.defaultConversationHasNullId}"/>
+ </h:panelGrid>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cloud.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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}" id="cloudName" />
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/clouds.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/cumulus.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,52 @@
+<?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:panelGrid columns="1">
+ <h:outputText value="Cumulus humilis"
+ rendered="#{cumulus.conversationIdentifiedByCustomIdentifier}" />
+ <h:outputText value="Cumulus congestus"
+ rendered="#{not cumulus.conversationIdentifierNull}" />
+ <h:outputText value="Cumulonimbus"
+ rendered="#{cumulus.conversationTimeoutSetProperly}" />
+ <h:outputText value="Stratocumulus"
+ rendered="#{cumulus.conversationHasDefaultTimeout}" />
+ <h:commandButton action="#{cumulus.beginConversation}"
+ value="Begin conversation" id="beginConversationButton" />
+ <h:commandButton
+ action="#{cumulus.beginConversationIdentifiedByCustomIdentifier}"
+ value="Begin conversation identified by custom identifier"
+ id="beginConversationIdentifiedByCustomIdentifier" />
+ <h:commandButton
+ action="#{cumulus.beginConversationAndSwallowException}"
+ value="Begin conversation and swallow exception"
+ id="beginConversationAndSwallowException" />
+ <h:commandButton
+ action="#{cumulus.beginConversationAndSetTimeout}"
+ value="Begin conversation and set timeout"
+ id="beginConversationAndSetTimeout" />
+ <h:commandButton action="#{cumulus.endConversation}"
+ value="End conversation" id="endConversationButton" />
+ <h:commandButton
+ action="#{cumulus.endConversationAndSwallowException}"
+ value="End conversation and swallow exception"
+ id="endConversationAndSwallowException" />
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/error.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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>
+ <h1>Expected exception was not thrown!</h1>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/faces-config.xml 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,42 @@
+<?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.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>
+
+ <navigation-rule>
+ <from-view-id>/cumulus.jspx</from-view-id>
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/home.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>error</from-outcome>
+ <to-view-id>/error.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/home.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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>
+ <h1>Hello world!</h1>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/lightening.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/rain.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,25 @@
+<?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:commandButton action="#{storm.beginConversation}" value="Thunder" id="beginConversationButton"/>
+ <h:commandButton action="#{cloud.rain}" value="Rain" id="rain"/>
+ </h:form>
+ </f:view>
+ </body>
+ </html>
+</jsp:root>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/storm.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/thunder.jsf 2010-02-19 09:55:53 UTC (rev 5888)
@@ -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>
+
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/conversation/web.xml 2010-02-19 09:55:53 UTC (rev 5888)
@@ -0,0 +1,46 @@
+<?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>
+
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
14 years, 10 months