[weld-commits] Weld SVN: r5709 - in java-se/trunk/src: test/java/org/jboss/weld/environment/se/test and 2 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Tue Feb 2 07:33:49 EST 2010


Author: peteroyle
Date: 2010-02-02 07:33:48 -0500 (Tue, 02 Feb 2010)
New Revision: 5709

Added:
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/AbstractDoor.java
Modified:
   java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java
   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/ThreadContextTest.java
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoor.java
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoorAlarm.java
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/Door.java
   java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/HouseDoor.java
   java-se/trunk/src/test/resources/META-INF/beans.xml
Log:
WELD-19: Re-enabing ThreadLocal and Delegate tests now that WELD-291 is fixed.

Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -43,8 +43,7 @@
       event.addAnnotatedType(manager.createAnnotatedType(ParametersFactory.class));
       event.addAnnotatedType(manager.createAnnotatedType(InstanceManager.class));
       event.addAnnotatedType(manager.createAnnotatedType(Weld.class));
-      // TODO: enable this when WELD-291 is fixed:
-//      event.addAnnotatedType(manager.createAnnotatedType(RunnableDecorator.class));
+      event.addAnnotatedType(manager.createAnnotatedType(RunnableDecorator.class));
    }
 
    public void registerWeldSEContexts(@Observes AfterBeanDiscovery event)

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -22,7 +22,7 @@
 import org.jboss.weld.environment.se.Weld;
 import org.jboss.weld.environment.se.WeldContainer;
 import org.jboss.weld.environment.se.test.decorators.CarDoor;
-import org.jboss.weld.environment.se.test.decorators.Door;
+import org.jboss.weld.environment.se.test.decorators.AbstractDoor;
 import org.jboss.weld.environment.se.test.decorators.CarDoorAlarm;
 import org.jboss.weld.environment.se.test.decorators.HouseDoor;
 import org.jboss.weld.environment.se.util.WeldManagerUtils;
@@ -39,8 +39,7 @@
    /**
     * Test that decorators work as expected in SE.
     */
-   // TODO: enable when WELD-291 is fixed:
-//   @Test
+   @Test
    public void testDecorators()
    {
 
@@ -68,7 +67,7 @@
       shutdownManager(weld);
    }
 
-   private void testDoor(Door door)
+   private void testDoor(AbstractDoor door)
    {
       Assert.assertTrue(door.open());
       Assert.assertTrue(door.isOpen());

Modified: 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	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/EventsTest.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -36,7 +36,6 @@
       Foo.reset();
       WeldContainer weld = new Weld().initialize();
       weld.event().select(ContainerInitialized.class).fire(new ContainerInitialized());
-      assert Foo.isObservedContainerInitialized();
       assert !Foo.isObservedEventTest();
       shutdownManager(weld);
    }

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/ThreadContextTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/ThreadContextTest.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/ThreadContextTest.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -38,8 +38,7 @@
    public static final int NUM_THREADS = 10;
    public static final int NUM_LOOPS = 10;
 
-   // TODO: enable this when WELD-291 is fixed:
-   //   @Test
+   @Test
    public void testThreadContext()
    {
       WeldContainer weld = new Weld().initialize();

Copied: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/AbstractDoor.java (from rev 5686, java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/Door.java)
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/AbstractDoor.java	                        (rev 0)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/AbstractDoor.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -0,0 +1,73 @@
+/**
+ * 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.decorators;
+
+/**
+ * Represents door with a lock.
+ * @author Peter Royle
+ */
+public abstract class AbstractDoor implements Door
+{
+
+    private boolean isOpen = false;
+    private boolean isLocked = false;
+
+    /**
+     * Open and close the door. Can't open a locked door.
+     */
+    public boolean open()
+    {
+        if (!isLocked)
+        {
+            isOpen = true;
+        }
+        return isOpen;
+    }
+
+    public boolean close()
+    {
+        isOpen = false;
+        return isOpen;
+    }
+
+    public boolean isOpen()
+    {
+        return isOpen;
+    }
+
+    /**
+     * Lock and unlock the door. Can't lock an open door.
+     */
+    public boolean lock()
+    {
+        if (!isOpen)
+        {
+            isLocked = true;
+        }
+        return isLocked;
+    }
+
+    public void unlock()
+    {
+        isLocked = false;
+    }
+
+    public boolean isLocked()
+    {
+        return isLocked;
+    }
+}

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoor.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoor.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoor.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -21,7 +21,7 @@
  *
  * @author Peter Royle
  */
-public class CarDoor extends Door {
+public class CarDoor extends AbstractDoor {
 
     private boolean isWindowOpen = false;
 

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoorAlarm.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoorAlarm.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/CarDoorAlarm.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -26,11 +26,10 @@
  * @author Peter Royle
  */
 @Decorator
-public class CarDoorAlarm
+public abstract class CarDoorAlarm implements Door
 {
 
-    @Inject @Delegate
-    CarDoor door;
+    @Inject @Delegate CarDoor door;
     public static boolean alarmActivated = false;
 
     public boolean open()

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/Door.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/Door.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/Door.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -14,60 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.jboss.weld.environment.se.test.decorators;
 
 /**
- * Represents door with a lock.
+ *
  * @author Peter Royle
  */
-public abstract class Door
-{
+public interface Door {
 
-    private boolean isOpen = false;
-    private boolean isLocked = false;
+   boolean close();
 
-    /**
-     * Open and close the door. Can't open a locked door.
-     */
-    public boolean open()
-    {
-        if (!isLocked)
-        {
-            isOpen = true;
-        }
-        return isOpen;
-    }
+   boolean isLocked();
 
-    public boolean close()
-    {
-        isOpen = false;
-        return isOpen;
-    }
+   boolean isOpen();
 
-    public boolean isOpen()
-    {
-        return isOpen;
-    }
+   /**
+    * Lock and unlock the door. Can't lock an open door.
+    */
+   boolean lock();
 
-    /**
-     * Lock and unlock the door. Can't lock an open door.
-     */
-    public boolean lock()
-    {
-        if (!isOpen)
-        {
-            isLocked = true;
-        }
-        return isLocked;
-    }
+   /**
+    * Open and close the door. Can't open a locked door.
+    */
+   boolean open();
 
-    public void unlock()
-    {
-        isLocked = false;
-    }
+   void unlock();
 
-    public boolean isLocked()
-    {
-        return isLocked;
-    }
 }

Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/HouseDoor.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/HouseDoor.java	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/decorators/HouseDoor.java	2010-02-02 12:33:48 UTC (rev 5709)
@@ -21,6 +21,6 @@
  *
  * @author Peter Royle
  */
-public class HouseDoor extends Door {
+public class HouseDoor extends AbstractDoor {
 
 }

Modified: java-se/trunk/src/test/resources/META-INF/beans.xml
===================================================================
--- java-se/trunk/src/test/resources/META-INF/beans.xml	2010-02-02 11:19:58 UTC (rev 5708)
+++ java-se/trunk/src/test/resources/META-INF/beans.xml	2010-02-02 12:33:48 UTC (rev 5709)
@@ -23,8 +23,6 @@
    </interceptors>
    <decorators>
       <class>org.jboss.weld.environment.se.test.decorators.CarDoorAlarm</class>
-      <!-- TODO: enable this when WELD-291 is fixed:
       <class>org.jboss.weld.environment.se.threading.RunnableDecorator</class>
-      -->
    </decorators>
 </beans>



More information about the weld-commits mailing list