[weld-commits] Weld SVN: r5690 - in java-se/trunk/src/test/java/org/jboss/weld/environment/se/test: events and 1 other directory.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Mon Feb 1 07:07:58 EST 2010
Author: pete.muir at jboss.org
Date: 2010-02-01 07:07:58 -0500 (Mon, 01 Feb 2010)
New Revision: 5690
Added:
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Bar.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier1.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier2.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Foo.java
Log:
Test for forum reported bug
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java 2010-02-01 12:07:58 UTC (rev 5690)
@@ -0,0 +1,46 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, 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.weld.environment.se.test;
+
+import org.jboss.weld.environment.se.ShutdownManager;
+import org.jboss.weld.environment.se.Weld;
+import org.jboss.weld.environment.se.WeldContainer;
+import org.jboss.weld.environment.se.test.events.Foo;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Peter Royle
+ */
+public class EventsTest
+{
+
+ @Test(description="forum post check")
+ public void testEventQualifiersCorrect()
+ {
+ Foo.reset();
+ WeldContainer weld = new Weld().initialize();
+ assert !Foo.isObservedEventTest();
+ shutdownManager(weld);
+ }
+
+ private void shutdownManager(WeldContainer weld)
+ {
+ ShutdownManager shutdownManager = weld.instance().select(ShutdownManager.class).get();
+ shutdownManager.shutdown();
+ }
+}
Property changes on: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Bar.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Bar.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Bar.java 2010-02-01 12:07:58 UTC (rev 5690)
@@ -0,0 +1,6 @@
+package org.jboss.weld.environment.se.test.events;
+
+public class Bar
+{
+
+}
Property changes on: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Bar.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier1.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier1.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier1.java 2010-02-01 12:07:58 UTC (rev 5690)
@@ -0,0 +1,37 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, 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.weld.environment.se.test.events;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Peter Royle
+ */
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target({ PARAMETER, METHOD, FIELD, TYPE })
+public @interface EventQualifier1 {}
Property changes on: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier2.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier2.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier2.java 2010-02-01 12:07:58 UTC (rev 5690)
@@ -0,0 +1,37 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, 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.weld.environment.se.test.events;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Peter Royle
+ */
+ at Qualifier
+ at Retention(RUNTIME)
+ at Target({ PARAMETER, METHOD, FIELD, TYPE })
+public @interface EventQualifier2 {}
Property changes on: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/EventQualifier2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Foo.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Foo.java (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Foo.java 2010-02-01 12:07:58 UTC (rev 5690)
@@ -0,0 +1,39 @@
+package org.jboss.weld.environment.se.test.events;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.jboss.weld.environment.se.ShutdownManager;
+import org.jboss.weld.environment.se.events.ContainerInitialized;
+
+public class Foo
+{
+
+ private static boolean observedEventTest;
+
+ public static void reset()
+ {
+ observedEventTest = false;
+ }
+
+ public static boolean isObservedEventTest()
+ {
+ return observedEventTest;
+ }
+
+ @Inject
+ @EventQualifier1
+ private Event<Bar> eventTest;
+
+ public void start(@Observes ContainerInitialized event, ShutdownManager shutdownManager)
+ {
+ eventTest.fire(new Bar());
+ }
+
+ public void observeEventTest(@Observes @EventQualifier2 Bar eventTest)
+ {
+ this.observedEventTest = true;
+ }
+
+}
Property changes on: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/events/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
More information about the weld-commits
mailing list