Author: dallen6
Date: 2009-07-06 05:41:46 -0400 (Mon, 06 Jul 2009)
New Revision: 3010
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/ManagerObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/StringObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/UseBeforeValidationTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
Log:
Fixed some deployment related tests
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-07-06
03:57:18 UTC (rev 3009)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java 2009-07-06
09:41:46 UTC (rev 3010)
@@ -26,28 +26,24 @@
/**
* Tests related to the final deployment phase of the lifecycle.
*
- * Spec version: 20090519 (sort of)
+ * Spec version: 20090519
*
- * PLM: THis test is a total mess and needs rewriting for 20090519 :-)
- *
* @author David Allen
*/
@Artifact
public class DeploymentTest extends AbstractJSR299Test
{
@Test
- @SpecAssertion(id="unknown", section="unknown")
-// @SpecAssertions({
-// @SpecAssertion(section = "11.5.2", id = "a"),
-// @SpecAssertion(section = "11.5.3", id = "a"),
-// @SpecAssertion(section = "11.5.3", id = "d")
-// })
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.2", id = "a"),
+ @SpecAssertion(section = "11.5.3", id = "a")
+ })
public void testDeployedManagerEvent()
{
assert ManagerObserver.isManagerDeployed();
+
+ // Make sure the manager does accept requests now
getCurrentManager().fireEvent("event");
- // QUESTION what is this testing?
- assert !getCurrentManager().resolveObserverMethods(new
InitializedBinding()).isEmpty();
}
@Test
Copied:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/ManagerObserver.java
(from rev 3009,
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/ManagerObserver.java)
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/ManagerObserver.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/ManagerObserver.java 2009-07-06
09:41:46 UTC (rev 3010)
@@ -0,0 +1,46 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.useBeforeValidationFails;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Current;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeanManager;
+
+class ManagerObserver
+{
+ private static boolean managerInitialized = false;
+ private static boolean managerDeployed = false;
+
+ public void managerInitialized(@Observes AfterBeanDiscovery event, @Current
BeanManager beanManager)
+ {
+ managerInitialized = true;
+ beanManager.fireEvent("An event that should not be fired");
+ }
+
+ public void managerDeployed(@Observes AfterDeploymentValidation event, @Current
BeanManager beanManager)
+ {
+ managerDeployed = true;
+ }
+
+ public static boolean isManagerInitialized()
+ {
+ return managerInitialized;
+ }
+
+ public static void setManagerInitialized(boolean managerInitialized)
+ {
+ ManagerObserver.managerInitialized = managerInitialized;
+ }
+
+ public static boolean isManagerDeployed()
+ {
+ return managerDeployed;
+ }
+
+ public static void setManagerDeployed(boolean managerDeployed)
+ {
+ ManagerObserver.managerDeployed = managerDeployed;
+ }
+}
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/StringObserver.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/StringObserver.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/StringObserver.java 2009-07-06
09:41:46 UTC (rev 3010)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.useBeforeValidationFails;
+
+import javax.enterprise.event.Observes;
+
+class StringObserver
+{
+ public static boolean eventReceived = false;
+
+ public void observeStringEvent(@Observes String event)
+ {
+ eventReceived = true;
+ }
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/StringObserver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/UseBeforeValidationTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/UseBeforeValidationTest.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/UseBeforeValidationTest.java 2009-07-06
09:41:46 UTC (rev 3010)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.deployment.lifecycle.broken.useBeforeValidationFails;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.testng.annotations.Test;
+
+/**
+ * Tests that the container will not allow requests to be processed until after
+ * all observers of the AfterDeploymentValidation event have completed.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+public class UseBeforeValidationTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ //Still not clear how the container should now allow this, but the RI is clearly not
implementing this assertion
+ @SpecAssertions({
+ @SpecAssertion(section = "11.5.3", id = "d")
+ })
+ public void testRequestBeforeValidationCompletes()
+ {
+ assert ManagerObserver.isManagerDeployed();
+ assert !StringObserver.eventReceived;
+ }
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/useBeforeValidationFails/UseBeforeValidationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain