[webbeans-commits] Webbeans SVN: r2377 - in test-harness/trunk: impl/src/main/java/org/jboss/testharness/impl/packaging/ear and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 19:12:44 -0400 (Thu, 09 Apr 2009)
New Revision: 2377
Added:
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarXml.java
Modified:
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java
Log:
add ejbjarxml
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-04-09 22:30:05 UTC (rev 2376)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-04-09 23:12:44 UTC (rev 2377)
@@ -18,6 +18,7 @@
import org.jboss.testharness.api.Configuration;
import org.jboss.testharness.api.ResourceDescriptor;
import org.jboss.testharness.impl.packaging.ear.EarArtifactDescriptor;
+import org.jboss.testharness.impl.packaging.ear.EjbJarXml;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
import org.jboss.testharness.impl.packaging.jsr299.TCKArtifactDescriptor;
@@ -35,6 +36,7 @@
private final boolean runLocally;
private final boolean addDeclaringPackage;
private final String beansXml;
+ private final String ejbJarXml;
private final PackagingType packagingType;
private final Collection<ResourceDescriptor> resources;
private final Collection<Class<?>> classes;
@@ -78,6 +80,16 @@
this.packagingType = WAR;
}
+ if (declaringClass.isAnnotationPresent(EjbJarXml.class))
+ {
+ this.ejbJarXml = asAbsolutePath(declaringClass.getAnnotation(EjbJarXml.class).value());
+ }
+ else
+ {
+ this.ejbJarXml = null;
+ }
+
+
if (declaringClass.isAnnotationPresent(IntegrationTest.class))
{
this.unit = false;
@@ -151,7 +163,7 @@
public TCKArtifactDescriptor createArtifact()
{
- final TCKArtifactDescriptor artifact = newArtifact(packagingType, declaringClass, beansXml, standalone, addDeclaringPackage);
+ final TCKArtifactDescriptor artifact = newArtifact(packagingType, declaringClass, beansXml, ejbJarXml, standalone, addDeclaringPackage);
artifact.setUnit(unit);
artifact.setRunLocally(runLocally);
artifact.setExpectedDeploymentException(expectedDeploymentException);
@@ -189,16 +201,20 @@
}
}
- private static TCKArtifactDescriptor newArtifact(PackagingType packagingType, Class<?> declaringClass, String beansXml, boolean standalone, boolean addDeclaringPackage)
+ private static TCKArtifactDescriptor newArtifact(PackagingType packagingType, Class<?> declaringClass, String beansXml, String ejbJarXml, boolean standalone, boolean addDeclaringPackage)
{
TCKArtifactDescriptor artifact;
if (!standalone && packagingType.equals(WAR))
{
artifact = new WarArtifactDescriptor(declaringClass, beansXml).initialize();
+ if (ejbJarXml != null)
+ {
+ artifact.getResources().add(new ResourceDescriptorImpl("WEB-INF/ejb-jar.xml", ejbJarXml));
+ }
}
else if (!standalone && packagingType.equals(EAR))
{
- artifact = new EarArtifactDescriptor(declaringClass, beansXml).initialize();
+ artifact = new EarArtifactDescriptor(declaringClass, beansXml, ejbJarXml).initialize();
}
else
{
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java 2009-04-09 22:30:05 UTC (rev 2376)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java 2009-04-09 23:12:44 UTC (rev 2377)
@@ -24,10 +24,10 @@
private final EjbJarArtifactDescriptor ejbJar;
private final WarArtifactDescriptor war;
- public EarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName)
+ public EarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName, String ejbJarXml)
{
super(declaringClass, null);
- this.ejbJar = new EjbJarArtifactDescriptor(declaringClass, beansXmlSourceFileName).initialize();
+ this.ejbJar = new EjbJarArtifactDescriptor(declaringClass, beansXmlSourceFileName, ejbJarXml).initialize();
this.war = new WarArtifactDescriptor(declaringClass, null)
{
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java 2009-04-09 22:30:05 UTC (rev 2376)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java 2009-04-09 23:12:44 UTC (rev 2377)
@@ -13,21 +13,32 @@
public static final String STANDARD_EJB_JAR_XML_FILE_NAME = "org/jboss/testharness/impl/packaging/ear/ejb-jar.xml";
public static final String CUSTOM_EJB_JAR_XML_FILE_NAME = "org/jboss/testharness/impl/packaging/ear/custom-ejb-jar.xml";
- public EjbJarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName)
+ private final String ejbJarXml;
+
+ public EjbJarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName, String ejbJarXml)
{
super(declaringClass, beansXmlSourceFileName);
+ this.ejbJarXml = ejbJarXml;
}
@Override
public EjbJarArtifactDescriptor initialize()
{
super.initialize();
- URL ejbJarXml = loadResource(CUSTOM_EJB_JAR_XML_FILE_NAME);
- if (ejbJarXml == null)
+ if (ejbJarXml != null)
{
- ejbJarXml = loadResource(STANDARD_EJB_JAR_XML_FILE_NAME);
+ getResources().add(new ResourceDescriptorImpl(EJB_JAR_XML_DESTINATION, ejbJarXml));
}
- getResources().add(new ResourceDescriptorImpl(EJB_JAR_XML_DESTINATION, ejbJarXml));
+ else
+ {
+ URL ejbJarXml = loadResource(CUSTOM_EJB_JAR_XML_FILE_NAME);
+ if (ejbJarXml == null)
+ {
+ ejbJarXml = loadResource(STANDARD_EJB_JAR_XML_FILE_NAME);
+ }
+ getResources().add(new ResourceDescriptorImpl(EJB_JAR_XML_DESTINATION, ejbJarXml));
+ }
+
return this;
}
Added: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarXml.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarXml.java (rev 0)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarXml.java 2009-04-09 23:12:44 UTC (rev 2377)
@@ -0,0 +1,33 @@
+package org.jboss.testharness.impl.packaging.ear;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.testharness.impl.packaging.Resource;
+
+/**
+ * Override the default META-INF/ejb-jar.xml
+ *
+ * @see Resource
+ *
+ * @author Pete Muir
+ *
+ */
+@Documented
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface EjbJarXml
+{
+
+ /**
+ * Location of the overriding file, relative to the current location or the
+ * root this classpath
+ *
+ */
+ String value();
+
+}
Property changes on: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarXml.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java 2009-04-09 22:30:05 UTC (rev 2376)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java 2009-04-09 23:12:44 UTC (rev 2377)
@@ -19,7 +19,7 @@
@Test
public void testDefaultEar() throws Exception
{
- EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null).initialize();
+ EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null, null).initialize();
ear.getClasses().add(Cow.class);
File root = ear.getExplodedJar();
assert root.isDirectory();
@@ -117,7 +117,7 @@
@Test
public void testJarProduction() throws Exception
{
- EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null).initialize();
+ EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null, null).initialize();
ear.getClasses().add(Cow.class);
JarInputStream is = new JarInputStream(ear.getJarAsStream());
JarEntry entry;
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2376 - doc/trunk/reference/en-US.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-04-09 18:30:05 -0400 (Thu, 09 Apr 2009)
New Revision: 2376
Modified:
doc/trunk/reference/en-US/environments.xml
Log:
Initial documentation for SE module.
Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml 2009-04-09 22:29:36 UTC (rev 2375)
+++ doc/trunk/reference/en-US/environments.xml 2009-04-09 22:30:05 UTC (rev 2376)
@@ -69,7 +69,7 @@
should place <literal>webbeans-tomcat.jar</literal> in
<literal>WEB-INF/lib</literal>. <literal>webbeans-tomcat.jar</literal>
is an "uber-jar" provided for your convenience. Instead, you could use
- it's component jars:
+ its component jars:
</para>
<itemizedlist>
@@ -117,7 +117,7 @@
<para>
You also need to explicitly specify the Tomcat servlet listener (used to
- boot Web Beans, and control it's interaction with requests) in
+ boot Web Beans, and control its interaction with requests) in
<literal>web.xml</literal>:
</para>
@@ -152,7 +152,7 @@
</resource-env-ref>]]></programlisting>
<para>
- Tomcat doesn't only allows you to bind entries to
+ Tomcat only allows you to bind entries to
<literal>java:comp/env</literal>, so the Manager will be available at
<literal>java:comp/env/app/Manager</literal>
</para>
@@ -171,7 +171,127 @@
<section>
<title>Java SE</title>
- <para>TODO</para>
+ <para>Apart from improved integration of the Enterprise Java stack,
+ Web Beans also provides a state of the art typesafe, stateful dependency
+ injection framework. This is useful in a wide range of application types,
+ enterprise or otherwise. To facilitate this, Web Beans provides a simple
+ means for executing in the Java Standard Edition environment independently
+ of any Enterprise Edition features.
+ </para>
+
+ <para>When executing in the SE environment the following features of Web
+ Beans are available:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>Simple Web Beans (POJOs)</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Typesafe Dependency Injection</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Application and Dependent Contexts</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Binding Types</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Stereotypes</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Decorators</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>(TODO: Interceptors ?)</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>Typesafe Event Model</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <section>
+ <title>Web Beans SE Module</title>
+
+ <para>To make life easy for developers Web Beans provides a special module with a
+ main method which will boot the Web Beans manager,
+ automatically registering all simple Web Beans found on the classpath.
+ This eliminates the need for application developers to write any
+ bootstrapping code. The entry point for a Web Beans SE applications
+ is a simple Web Bean which observes the standard <literal>@Deployed
+ Manager</literal> event. The command line paramters can be
+ injected using either of the following:
+ </para>
+ <programlisting role="JAVA"><![CDATA[@Parameters List<String> params;
+@Parameters String[] paramsArray; // useful for compatability with existing classes]]></programlisting>
+ <para>
+ Here's an example of a simple Web Beans SE application:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[@ApplicationScoped
+public class HelloWorld
+{
+ @Parameters List<String> parameters;
+
+ public void printHello( @Observes @Deployed Manager manager )
+ {
+ System.out.println( "Hello " + parameters.get(0) );
+ }
+}]]></programlisting>
+
+ <para>Web Beans SE applications are started by running the following
+ main method.</para>
+ <programlisting role="JAVA"><![CDATA[java org.jboss.webbeans.environments.se.StartMain <args>]]></programlisting>
+
+ <para>If you need to do any custom initialization of the Web Beans manager,
+ for example registering custom contexts or initializing resources for
+ your beans you can do so in response to the <literal>@Initialized Manager</literal>
+ event. The following example registers a custom context:</para>
+
+ <programlisting role="JAVA"><![CDATA[public class PerformSetup
+{
+
+ public void setup( @Observes @Initialized Manager manager )
+ {
+ manager.addContext( ThreadContext.INSTANCE );
+ }
+}]]></programlisting>
+
+ <para>
+ <note>
+ <para>
+ The command line parameters do not become available for injection
+ until the <literal>@Deployed Manager</literal> event is fired. If you
+ need access to the parameters during initialization you can do so via the
+ <literal>public static String getParameters()</literal> method in
+ <literal>StartMain</literal>.</para>
+ </note>
+ </para>
+
+ </section>
+
+<!--
+ <section>
+ <title>Under the Hood</title>
+ <para>WebBeansBootstrap is capable of booting into a number of ... </para>
+ </section>
+-->
+
</section>
</chapter>
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2375 - in extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se: beans and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-04-09 18:29:36 -0400 (Thu, 09 Apr 2009)
New Revision: 2375
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
Log:
Added ability to access command line parameters before web beans manager is deployed (ie: during initialisation).
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-04-09 22:27:45 UTC (rev 2374)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-04-09 22:29:36 UTC (rev 2375)
@@ -35,7 +35,7 @@
{
hasShutdownBeenCalled = true;
bootstrap.shutdown();
- DependentContext.INSTANCE.setActive(false);
+ DependentContext.instance().setActive(false);
}
else
{
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-04-09 22:27:45 UTC (rev 2374)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-04-09 22:29:36 UTC (rev 2375)
@@ -24,7 +24,6 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.environment.se.beans.ParametersFactory;
import org.jboss.webbeans.environment.se.discovery.SEWebBeanDiscovery;
import org.jboss.webbeans.environment.se.resources.NoNamingContext;
import org.jboss.webbeans.environment.se.util.Reflections;
@@ -47,14 +46,14 @@
private final Bootstrap bootstrap;
private final BeanStore applicationBeanStore;
- public static String[] ARGS;
+ public static String[] PARAMETERS;
private WebBeansManager manager;
public StartMain(String[] commandLineArgs)
{
- ARGS = commandLineArgs;
+ PARAMETERS = commandLineArgs;
try
{
bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME, Bootstrap.class);
@@ -75,13 +74,12 @@
bootstrap.initialize();
this.manager = bootstrap.getManager();
bootstrap.boot();
- DependentContext.INSTANCE.setActive(true);
+ DependentContext.instance().setActive(true);
bootstrap.getManager().getInstanceByType(ShutdownManager.class).setBootstrap(bootstrap);
}
/**
- * The main method called from the command line. This little puppy will get
- * the ball rolling.
+ * The main method called from the command line.
*
* @param args
* the command line arguments
@@ -96,5 +94,10 @@
go();
return manager;
}
-
+
+ public static String[] getParameters() {
+ // TODO(PR): make immutable
+ return PARAMETERS;
+ }
+
}
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-04-09 22:27:45 UTC (rev 2374)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-04-09 22:29:36 UTC (rev 2375)
@@ -87,6 +87,6 @@
* @param manager The Manager which has been initialized.
*/
public void initArgs(@Observes @Initialized Manager manager) {
- this.setArgs( StartMain.ARGS );
+ this.setArgs( StartMain.PARAMETERS );
}
}
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2374 - in ri/trunk/impl: src/main/java/org/jboss/webbeans and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: peteroyle
Date: 2009-04-09 18:27:45 -0400 (Thu, 09 Apr 2009)
New Revision: 2374
Modified:
ri/trunk/impl/
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
Log:
Unserializable Dependency Exception indicates the problematic bean. ConversationEntry and ConversationImpl classes can use Conversation interface rather than ConversationImpl class.
Property changes on: ri/trunk/impl
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
target
cobertura.ser
.settings
test-output
temp-testng-customsuite.xml
ObjectStore
+ cobertura.ser
nb-configuration.xml
test-output
.classpath
.project
target
temp-testng-customsuite.xml
ObjectStore
.settings
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-04-09 22:12:48 UTC (rev 2373)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-04-09 22:27:45 UTC (rev 2374)
@@ -126,7 +126,7 @@
}
if (Beans.isPassivatingBean(bean, manager) && !resolvedBean.isSerializable() && resolvedBean.getScopeType().equals(Dependent.class))
{
- throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scopes but has non-serializable dependencies");
+ throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scopes but has non-serializable dependency: " + resolvedBean);
}
}
if (bean instanceof RIBean && !(bean instanceof NewSimpleBean) && !(bean instanceof NewEnterpriseBean))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-04-09 22:12:48 UTC (rev 2373)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationEntry.java 2009-04-09 22:27:45 UTC (rev 2374)
@@ -20,6 +20,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
+import javax.context.Conversation;
import javax.servlet.http.HttpSession;
import org.jboss.webbeans.context.ConversationContext;
@@ -37,7 +38,7 @@
private static LogProvider log = Logging.getLogProvider(ConversationEntry.class);
// The conversation
- private ConversationImpl conversation;
+ private Conversation conversation;
// The handle to the asynchronous timeout task
private Future<?> terminationHandle;
// The lock for concurrent access prevention
@@ -49,7 +50,7 @@
* @param cid The conversation ID
* @param terminationHandle The timeout termination handle
*/
- protected ConversationEntry(ConversationImpl conversation, Future<?> terminationHandle)
+ protected ConversationEntry(Conversation conversation, Future<?> terminationHandle)
{
// conversation is a proxy so we need to make a "real" instance
this.conversation = new ConversationImpl(conversation);
@@ -65,7 +66,7 @@
* @param terminationHandle The timeout termination handle
* @return A new conversation entry
*/
- public static ConversationEntry of(ConversationImpl conversation, Future<?> terminationHandle)
+ public static ConversationEntry of(Conversation conversation, Future<?> terminationHandle)
{
return new ConversationEntry(conversation, terminationHandle);
}
@@ -166,7 +167,7 @@
log.trace("Conversation " + conversation + " re-scheduled for termination");
}
- public ConversationImpl getConversation()
+ public Conversation getConversation()
{
return conversation;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-04-09 22:12:48 UTC (rev 2373)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/conversation/ConversationImpl.java 2009-04-09 22:27:45 UTC (rev 2374)
@@ -61,7 +61,7 @@
*
* @param conversation The old conversation
*/
- public ConversationImpl(ConversationImpl conversation)
+ public ConversationImpl(Conversation conversation)
{
this.cid = conversation.getId();
this.longRunning = conversation.isLongRunning();
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2373 - test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 18:12:48 -0400 (Thu, 09 Apr 2009)
New Revision: 2373
Modified:
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java
Log:
minor
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java 2009-04-09 21:18:03 UTC (rev 2372)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java 2009-04-09 22:12:48 UTC (rev 2373)
@@ -308,15 +308,15 @@
{
copyClass(clazz, getClassesRoot(root));
}
- for (ResourceDescriptor resourceDescriptorImpl : resources)
+ for (ResourceDescriptor resourceDescriptor : resources)
{
- copyResource(resourceDescriptorImpl, root);
+ copyResource(resourceDescriptor, root);
}
if (isLibrariesSupported())
{
- for (ResourceDescriptor resourceDescriptorImpl : libraries)
+ for (ResourceDescriptor resourceDescriptor : libraries)
{
- copyResource(resourceDescriptorImpl, getLibraryRoot(root));
+ copyResource(resourceDescriptor, getLibraryRoot(root));
}
}
this.explodedJar = root;
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2372 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/dynamic and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-09 17:18:03 -0400 (Thu, 09 Apr 2009)
New Revision: 2372
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/clientProxy/unknown/
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
cleanup a few tests
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java 2009-04-09 20:30:08 UTC (rev 2371)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java 2009-04-09 21:18:03 UTC (rev 2372)
@@ -2,13 +2,8 @@
import static org.jboss.jsr299.tck.tests.lookup.dynamic.PayBy.PaymentMethod.CHEQUE;
-import java.util.Set;
-
-import javax.context.Dependent;
import javax.inject.DuplicateBindingTypeException;
import javax.inject.Instance;
-import javax.inject.Standard;
-import javax.inject.TypeLiteral;
import javax.inject.manager.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -76,25 +71,4 @@
injectionPoint.getPaymentProcessor().get(new NonBinding() );
}
- @Test(groups="broken")
- // TODO Can we test this?
- @SpecAssertions({
- @SpecAssertion(section = "5.8", id = "k"),
- @SpecAssertion(section = "5.8", id = "l"),
- @SpecAssertion(section = "5.8", id = "m"),
- @SpecAssertion(section = "5.8", id = "n"),
- @SpecAssertion(section = "5.8", id = "o")
- })
- public void testImplicitBeanExists()
- {
- Set<Bean<Instance<PaymentProcessor>>> beans = getCurrentManager().resolveByType(new TypeLiteral<Instance<PaymentProcessor>>() {}, new PayByBinding() { public PaymentMethod value() { return CHEQUE; }});
- assert beans.size() == 1;
- Bean<Instance<PaymentProcessor>> instanceBean = beans.iterator().next();
- assert instanceBean != null;
- assert instanceBean.getDeploymentType().equals(Standard.class);
- assert instanceBean.getScopeType().equals(Dependent.class);
- assert instanceBean.getName() == null;
- }
-
-
}
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-04-09 20:30:08 UTC (rev 2371)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-04-09 21:18:03 UTC (rev 2372)
@@ -3097,24 +3097,29 @@
<text>If the type parameter contains a wildcard a |DefinitionException| is thrown by the container at deployment time</text>
</assertion>
- <assertion id="k">
- <text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with exactly the bean type and bindings that appear at the injection point</text>
+ <assertion id="k" testable="false">
+ <text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with exactly the bean type and bindings that appear at the injection point</text>
+ <note>As the bean is implicit, it cannot be resolved</note>
</assertion>
- <assertion id="l">
+ <assertion id="l" testable="false">
<text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with deployment type |@Standard|</text>
+ <note>As the bean is implicit, it cannot be resolved</note>
</assertion>
- <assertion id="m">
+ <assertion id="m" testable="false">
<text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with |@Dependent| scope</text>
+ <note>As the bean is implicit, it cannot be resolved</note>
</assertion>
- <assertion id="n">
+ <assertion id="n" testable="false">
<text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with no bean name</text>
+ <note>As the bean is implicit, it cannot be resolved</note>
</assertion>
- <assertion id="o">
+ <assertion id="o" testable="false">
<text>Whenever the |@Obtains| annotation appears at an injection point, an implicit bean exists with an implementation provided automatically by the container</text>
+ <note>As the bean is implicit, it cannot be resolved</note>
</assertion>
<assertion id="p">
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2371 - ri/trunk/tests.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-09 16:30:08 -0400 (Thu, 09 Apr 2009)
New Revision: 2371
Modified:
ri/trunk/tests/unit-tests.xml
Log:
Added new unit tests to package list
Modified: ri/trunk/tests/unit-tests.xml
===================================================================
--- ri/trunk/tests/unit-tests.xml 2009-04-09 19:17:17 UTC (rev 2370)
+++ ri/trunk/tests/unit-tests.xml 2009-04-09 20:30:08 UTC (rev 2371)
@@ -58,6 +58,7 @@
<package name="org.jboss.webbeans.test.unit.implementation.annotatedItem" />
<package name="org.jboss.webbeans.test.unit.implementation.enterpise" />
<package name="org.jboss.webbeans.test.unit.implementation.enterprise.sbi" />
+ <package name="org.jboss.webbeans.test.unit.implementation.event" />
<package name="org.jboss.webbeans.test.unit.implementation.newsimple" />
<package name="org.jboss.webbeans.test.unit.implementation.producer.field" />
<package name="org.jboss.webbeans.test.unit.implementation.producer.method" />
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2370 - in ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation: event and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-09 15:17:17 -0400 (Thu, 09 Apr 2009)
New Revision: 2370
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/Updated.java
Log:
Unit tests added from WBRI-225.
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java 2009-04-09 19:17:17 UTC (rev 2370)
@@ -0,0 +1,129 @@
+package org.jboss.webbeans.test.unit.implementation.event;
+
+import javax.event.Event;
+import javax.event.Fires;
+import javax.event.Observes;
+import javax.inject.AnnotationLiteral;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+@Artifact
+public class SimpleEventTest extends AbstractWebBeansTest
+{
+ private static boolean called_flag_for_BindingType;
+ private static boolean called_flag_for_NonBindingType;
+
+ private static void initCalledFlag() {
+ called_flag_for_BindingType = false;
+ called_flag_for_NonBindingType = false;
+ }
+
+ @Override
+ @BeforeMethod
+ public void before() throws Exception
+ {
+ initCalledFlag();
+ super.before();
+ }
+
+ @Override
+ @AfterMethod
+ public void after() throws Exception
+ {
+ initCalledFlag();
+ super.after();
+ }
+
+ @Test
+ public void testEventUsingManager()
+ {
+ ManagerImpl manager = getCurrentManager();
+
+ manager.fireEvent("Fired using Manager Interface with AnnotationLiteral.",
+ new AnnotationLiteral<Updated>(){});
+
+ assert called_flag_for_NonBindingType == true;
+ assert called_flag_for_BindingType == true;
+
+ initCalledFlag();
+
+ manager.fireEvent("Fired using Manager Interface.");
+
+ assert called_flag_for_NonBindingType == true;
+ assert called_flag_for_BindingType == false; // not called
+ }
+
+ @Test
+ public void testEventUsingEvent()
+ {
+ ManagerImpl manager = getCurrentManager();
+
+ App app = manager.getInstanceByType(App.class);
+
+ app.fireEventByBindingDeclaredAtInjectionPoint();
+
+ assert called_flag_for_NonBindingType == true;
+ assert called_flag_for_BindingType == true;
+
+ initCalledFlag();
+
+ app.fireEventByAnnotationLiteral();
+
+ assert called_flag_for_NonBindingType == true;
+ assert called_flag_for_BindingType == true;
+
+ initCalledFlag();
+
+ app.fireEventNonBindingType();
+
+ assert called_flag_for_NonBindingType == true;
+ assert called_flag_for_BindingType == false; // not called
+ }
+
+ public static class App
+ {
+ @Fires
+ Event<String> event1;
+
+ @Fires
+ @Updated
+ Event<String> event2;
+
+ @Fires
+ Event<String> event3;
+
+ public void fireEventByAnnotationLiteral()
+ {
+ event1.fire("Fired using Event Interface with AnnotationLiteral.",
+ new AnnotationLiteral<Updated>(){});
+ }
+
+ public void fireEventByBindingDeclaredAtInjectionPoint()
+ {
+ event2.fire("Fired using Event Interface with Binding Declared.");
+ }
+
+ public void fireEventNonBindingType()
+ {
+ event3.fire("Fired using Event Interface with Non-BindingType.");
+ }
+ }
+
+ public static class Receiver
+ {
+ public void receive1(@Observes @Updated String s)
+ {
+ called_flag_for_BindingType = true;
+ }
+
+ public void receive2(@Observes String s)
+ {
+ called_flag_for_NonBindingType = true;
+ }
+ }
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/SimpleEventTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/Updated.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/Updated.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/Updated.java 2009-04-09 19:17:17 UTC (rev 2370)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.unit.implementation.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@BindingType
+@Retention(RUNTIME)
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@interface Updated
+{
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/event/Updated.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2369 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: event/register/fires1 and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-09 14:57:50 -0400 (Thu, 09 Apr 2009)
New Revision: 2369
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyed.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyedLiteral.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluseProducer.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/BlueFacedParrotFinch.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/ImplicitEventBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
Log:
Fixes for implicit event beans and related tests.
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-04-09 18:57:34 UTC (rev 2368)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -252,13 +252,6 @@
assert getCurrentManager().getClass().getDeclaredMethod("resolveObservers", Object.class, Annotation[].class) != null;
}
- @Test(groups = { "events", "stub" })
- @SpecAssertions( { @SpecAssertion(section = "7.4", id = "a") })
- public void testObserverNotificationCallsResolveObservers()
- {
- assert false;
- }
-
@Test(groups = { "events" })
@SpecAssertions( { @SpecAssertion(section = "7.5", id = "a"), @SpecAssertion(section = "7.5.2", id = "a")} )
public void testObserverMethodAutomaticallyRegistered()
@@ -345,15 +338,20 @@
* Manager.getInstanceToInject() to each of the other parameters.
*/
@Test(groups = { "events" })
- @SpecAssertions( { @SpecAssertion(section = "7.5.4", id = "a"), @SpecAssertion(section = "7.5.8", id = "j") })
+ @SpecAssertions( {
+ @SpecAssertion(section = "7.5.4", id = "a"),
+ @SpecAssertion(section = "7.5.8", id = "j")
+ })
public void testObserverMethodReceivesInjectionsOnNonObservesParameters()
{
- Set<Bean<Object>> beans = getCurrentManager().resolveByType(Object.class);
- assert beans != null;
+ getCurrentManager().fireEvent("string event");
}
@Test(groups = { "events" })
- @SpecAssertions( { @SpecAssertion(section = "7.5.5", id = "a"), @SpecAssertion(section = "7.5.5", id = "b")} )
+ @SpecAssertions( {
+ @SpecAssertion(section = "7.5.5", id = "a"),
+ @SpecAssertion(section = "7.5.5", id = "b")
+ } )
public void testConditionalObserver() throws Exception
{
RecluseSpider.notified = false;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/BlueFacedParrotFinch.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/BlueFacedParrotFinch.java 2009-04-09 18:57:34 UTC (rev 2368)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/BlueFacedParrotFinch.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -7,25 +7,41 @@
class BlueFacedParrotFinch
{
@Fires
- private Event<String> simpleEvent;
+ protected Event<Integer> simpleEvent;
+
+ @Fires @Tame
+ protected Event<String> simpleStringEvent;
+
+ public static boolean simpleStringEventObserved = false;
public void methodThatFiresEvent()
{
- simpleEvent.fire("An event");
+ simpleEvent.fire(new Integer(42));
}
public void methodThatRegistersObserver()
{
- simpleEvent.observe(new Observer<String>()
+ simpleEvent.observe(new Observer<Integer>()
{
- public void notify(String event)
+ public void notify(Integer event)
{
}
});
}
- public Event<String> getSimpleEvent()
+ public void methodThatFiresAnotherEvent()
{
- return simpleEvent;
+ simpleStringEvent.fire("the answer to life", new OneEyedLiteral());
}
+
+ public void methodThatRegistersAnotherObserver()
+ {
+ simpleStringEvent.observe(new Observer<String>()
+ {
+ public void notify(String event)
+ {
+ BlueFacedParrotFinch.simpleStringEventObserved = true;
+ }
+ });
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/ImplicitEventBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/ImplicitEventBeanTest.java 2009-04-09 18:57:34 UTC (rev 2368)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/ImplicitEventBeanTest.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -38,7 +38,7 @@
@BeansXml("beans.xml")
public class ImplicitEventBeanTest extends AbstractJSR299Test
{
- @Test(groups = { "events", "ri-broken" })
+ @Test(groups = { "events" })
@SpecAssertions( {
@SpecAssertion(section = "7.6", id = "b"),
@SpecAssertion(section = "7.6", id = "c"),
@@ -58,7 +58,7 @@
BlueFacedParrotFinch bean = getCurrentManager().getInstanceByType(BlueFacedParrotFinch.class);
bean.methodThatRegistersObserver();
- Set<Observer<String>> observers = getCurrentManager().resolveObservers("String type event");
+ Set<Observer<Integer>> observers = getCurrentManager().resolveObservers(new Integer(78));
assert observers.size() == 1;
}
@@ -69,6 +69,20 @@
@Override
protected void execute() throws Exception
{
+ BlueFacedParrotFinch.simpleStringEventObserved = false;
+ BlueFacedParrotFinch bean = getCurrentManager().getInstanceByType(BlueFacedParrotFinch.class);
+ bean.methodThatRegistersAnotherObserver();
+ bean.methodThatFiresAnotherEvent();
+ assert BlueFacedParrotFinch.simpleStringEventObserved;
+ }
+
+ }.run();
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
StarFinch starFinch = getCurrentManager().getInstanceByType(StarFinch.class);
FinchKeeper birdKeeper = getCurrentManager().getInstanceByType(FinchKeeper.class);
BirdCage birdCage = getCurrentManager().getInstanceByType(BirdCage.class);
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyed.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyed.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyed.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.event.register.fires1;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface OneEyed
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyed.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyedLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyedLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyedLiteral.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.event.register.fires1;
+
+import javax.inject.AnnotationLiteral;
+
+public class OneEyedLiteral extends AnnotationLiteral<OneEyed> implements OneEyed
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/fires1/OneEyedLiteral.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java 2009-04-09 18:57:34 UTC (rev 2368)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/register/observer1/ConsumerNotifiedForEventTest.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -1,5 +1,7 @@
package org.jboss.jsr299.tck.tests.event.register.observer1;
+import java.lang.annotation.Annotation;
+
import javax.event.Observer;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -26,20 +28,39 @@
}
@Test(groups = { "events" })
- @SpecAssertions( { @SpecAssertion(section = "7.1", id = "h"), @SpecAssertion(section = "7.3", id = "d"), @SpecAssertion(section = "7.4", id = "b") })
+ @SpecAssertions( {
+ @SpecAssertion(section = "7.1", id = "h"),
+ @SpecAssertion(section = "7.3", id = "d"),
+ @SpecAssertion(section = "7.4", id = "b")
+ })
public void testConsumerNotifiedWhenEventTypeAndAllBindingsMatch()
{
+ Annotation roleBinding = new RoleBinding("Admin");
AnObserver observer1 = new AnObserver();
AnObserver observer2 = new AnObserver();
getCurrentManager().addObserver(observer1, AnEventType.class);
- getCurrentManager().addObserver(observer2, AnEventType.class);
+ getCurrentManager().addObserver(observer2, AnEventType.class, roleBinding);
// Fire an event that will be delivered to the two above observers
AnEventType anEvent = new AnEventType();
- getCurrentManager().fireEvent(anEvent);
+ getCurrentManager().fireEvent(anEvent, roleBinding);
assert observer1.wasNotified;
assert observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Fire an event that will be delivered to only one
+ getCurrentManager().fireEvent(anEvent);
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
+ observer1.wasNotified = false;
+ observer2.wasNotified = false;
+
+ // Also make sure the binding value is considered
+ getCurrentManager().fireEvent(anEvent, new RoleBinding("user"));
+ assert observer1.wasNotified;
+ assert !observer2.wasNotified;
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluse.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
+
+class BrownRecluse extends Spider
+{
+ public BrownRecluse(Integer numberOfEyes)
+ {
+
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluseProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluseProducer.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluseProducer.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
+
+import javax.inject.Produces;
+
+class BrownRecluseProducer
+{
+ @Produces
+ protected BrownRecluse spider = new BrownRecluse(5);
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BrownRecluseProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java 2009-04-09 18:57:34 UTC (rev 2368)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/ProducerFieldLifecycleTest.java 2009-04-09 18:57:50 UTC (rev 2369)
@@ -21,6 +21,23 @@
@Test(groups = { "producerField" })
@SpecAssertions({
+ @SpecAssertion(section = "6.8", id = "b")
+ })
+ public void testProducerFieldNotAnotherBean()
+ {
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ assert getCurrentManager().getInstanceByType(BrownRecluse.class) != null;
+ }
+ };
+ }
+
+ @Test(groups = { "producerField" })
+ @SpecAssertions({
@SpecAssertion(section = "6.8", id = "h"),
@SpecAssertion(section = "3.5", id = "b")
})
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2368 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: event and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-09 14:57:34 -0400 (Thu, 09 Apr 2009)
New Revision: 2368
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
Log:
Fixes for implicit event beans and related tests.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-04-09 18:41:41 UTC (rev 2367)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-04-09 18:57:34 UTC (rev 2368)
@@ -84,8 +84,8 @@
{
throw new DuplicateBindingTypeException(newAnnotation + " is already present in the bindings list for " + this);
}
- result.add(newAnnotation)
-; }
+ result.add(newAnnotation);
+ }
return result.toArray(EMPTY_BINDINGS);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-04-09 18:41:41 UTC (rev 2367)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-04-09 18:57:34 UTC (rev 2368)
@@ -27,6 +27,7 @@
import org.jboss.webbeans.FacadeImpl;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.literal.FiresLiteral;
import org.jboss.webbeans.util.Strings;
/**
@@ -58,6 +59,7 @@
public EventImpl(Type eventType, ManagerImpl manager, Set<Annotation> bindings)
{
super(eventType, manager, bindings);
+ this.bindings.remove(new FiresLiteral());
}
/**
15 years, 8 months