[weld-commits] Weld SVN: r5451 - cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem and 8 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Wed Jan 13 11:52:04 EST 2010
Author: pete.muir at jboss.org
Date: 2010-01-13 11:52:02 -0500 (Wed, 13 Jan 2010)
New Revision: 5451
Added:
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/javax.enterprise.inject.spi.Extension
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/javax.enterprise.inject.spi.Extension
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/
cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/javax.enterprise.inject.spi.Extension
Removed:
core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/AddDeploymentProblemTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/BeanDiscoveryObserver.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/AfterBeanDiscoveryObserverExecutionFailureTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/BeanDiscoveryObserver.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/AfterDeploymentValidationObserverExecutionFailureTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/BeanDiscoveryObserver.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
Log:
WELD-306
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/AddDefinitionErrorTest.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -29,8 +29,7 @@
@SpecVersion(spec="cdi", version="20091101")
public class AddDefinitionErrorTest extends AbstractJSR299Test
{
- @Test(groups={"jboss-as-broken", "rewrite"})
- // WBRI-312
+ @Test(groups={"rewrite"})
@SpecAssertions({
@SpecAssertion(section = "11.5.2", id = "ca"),
@SpecAssertion(section = "12.2", id = "c")
@@ -39,13 +38,5 @@
{
assert false;
}
-
- // FIXME need to communicate state of container at the time of failure
- // @Override
- // @AfterClass(alwaysRun = true, groups = "scaffold")
- // public void afterClass() throws Exception
- // {
- // super.afterClass();
- // assert BeanDiscoveryObserver.getInvocationCount() == 2 : "All AfterBeanDiscovery observer methods should have been called";
- // }
+
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/AddDeploymentProblemTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/AddDeploymentProblemTest.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/AddDeploymentProblemTest.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -23,6 +23,7 @@
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
import org.testng.annotations.Test;
/**
@@ -34,26 +35,16 @@
* @author Dan Allen
*/
@Artifact
+ at Extension(value="javax.enterprise.inject.spi.Extension")
@ExpectedDeploymentException(DeploymentFailure.class)
@SpecVersion(spec="cdi", version="20091101")
public class AddDeploymentProblemTest extends AbstractJSR299Test
{
- @Test(groups={"rewrite", "jboss-as-broken"})
- // TODO Needs Extension stuff adding
- // WBRI-312
+ @Test(groups={"rewrite"})
@SpecAssertion(section = "11.5.3", id = "b")
public void testObserverDeploymentProblemTreatedAsDeploymentError()
{
assert false;
}
- // FIXME need to communicate state of container at the time of failure
- // @Override
- // @AfterClass(alwaysRun = true, groups = "scaffold")
- // public void afterClass() throws Exception
- // {
- // super.afterClass();
- // assert BeanDiscoveryObserver.getInvocationCount() == 2 : "All AfterDeploymentValidation observer methods should have been called";
- // }
-
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/BeanDiscoveryObserver.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/BeanDiscoveryObserver.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/BeanDiscoveryObserver.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -2,8 +2,9 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.Extension;
-class BeanDiscoveryObserver
+public class BeanDiscoveryObserver implements Extension
{
private static int invocationCount = 0;
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/AfterBeanDiscoveryObserverExecutionFailureTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/AfterBeanDiscoveryObserverExecutionFailureTest.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/AfterBeanDiscoveryObserverExecutionFailureTest.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -6,6 +6,7 @@
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
import org.testng.annotations.Test;
/**
@@ -18,11 +19,10 @@
@Artifact
@ExpectedDeploymentException(DeploymentFailure.class)
@SpecVersion(spec="cdi", version="20091101")
+ at Extension(value="javax.enterprise.inject.spi.Extension")
public class AfterBeanDiscoveryObserverExecutionFailureTest extends AbstractJSR299Test
{
- @Test(groups={"jboss-as-broken", "rewrite"})
- //TODO Needs Extension stuff adding
- // WBRI-312
+ @Test(groups={"rewrite"})
@SpecAssertion(section = "11.5.2", id = "g")
public void testObserverFailureTreatedAsDefinitionError()
{
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/BeanDiscoveryObserver.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/BeanDiscoveryObserver.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/BeanDiscoveryObserver.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -2,8 +2,9 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
-class BeanDiscoveryObserver
+public class BeanDiscoveryObserver implements Extension
{
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event)
{
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/AfterDeploymentValidationObserverExecutionFailureTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/AfterDeploymentValidationObserverExecutionFailureTest.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/AfterDeploymentValidationObserverExecutionFailureTest.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -23,6 +23,7 @@
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
import org.testng.annotations.Test;
/**
@@ -35,14 +36,15 @@
@Artifact
@ExpectedDeploymentException(DeploymentFailure.class)
@SpecVersion(spec="cdi", version="20091101")
+ at Extension(value="javax.enterprise.inject.spi.Extension")
public class AfterDeploymentValidationObserverExecutionFailureTest extends AbstractJSR299Test
{
- @Test(groups={"jboss-as-broken", "rewrite"})
- // TODO Needs Extension stuff adding
- // WBRI-312
+
+ @Test(groups={"rewrite"})
@SpecAssertion(section = "11.5.3", id = "c")
public void testObserverFailureTreatedAsDeploymentError()
{
assert false;
}
+
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/BeanDiscoveryObserver.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/BeanDiscoveryObserver.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/BeanDiscoveryObserver.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -2,8 +2,9 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.Extension;
-class BeanDiscoveryObserver
+public class BeanDiscoveryObserver implements Extension
{
public void afterDeploymentValidation(@Observes AfterDeploymentValidation event)
{
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/javax.enterprise.inject.spi.Extension (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDeploymentProblem/javax.enterprise.inject.spi.Extension 2010-01-13 16:52:02 UTC (rev 5451)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.addDeploymentProblem.BeanDiscoveryObserver
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/javax.enterprise.inject.spi.Extension (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanDiscoveryObserver/javax.enterprise.inject.spi.Extension 2010-01-13 16:52:02 UTC (rev 5451)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.exceptionInAfterBeanDiscoveryObserver.BeanDiscoveryObserver
\ No newline at end of file
Added: cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/javax.enterprise.inject.spi.Extension (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/exceptionInAfterBeanValidationObserver/javax.enterprise.inject.spi.Extension 2010-01-13 16:52:02 UTC (rev 5451)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.exceptionInAfterBeanValidationObserver.BeanDiscoveryObserver
\ No newline at end of file
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -11,6 +11,7 @@
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.exceptions.DeploymentException;
import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
@@ -58,17 +59,28 @@
protected void fire(Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
{
- // Collect all observers to remove dupes
- Set<ObserverMethod<Object>> observers = new HashSet<ObserverMethod<Object>>();
- Type eventType = new ParameterizedTypeImpl(getRawType(), getEmptyTypeArray(), null);
- for (BeanDeployment beanDeployment : beanDeployments.values())
+ try
{
- observers.addAll(beanDeployment.getBeanManager().resolveObserverMethods(eventType));
+ // Collect all observers to remove dupes
+ Set<ObserverMethod<Object>> observers = new HashSet<ObserverMethod<Object>>();
+ Type eventType = new ParameterizedTypeImpl(getRawType(), getEmptyTypeArray(), null);
+ for (BeanDeployment beanDeployment : beanDeployments.values())
+ {
+ observers.addAll(beanDeployment.getBeanManager().resolveObserverMethods(eventType));
+ }
+ for (ObserverMethod<Object> observerMethod : observers)
+ {
+ observerMethod.notify(this);
+ }
}
- for (ObserverMethod<Object> observerMethod : observers)
+ catch (Exception e)
{
- observerMethod.notify(this);
+ getErrors().add(e);
}
+ if (!getErrors().isEmpty())
+ {
+ throw new DeploymentException(getErrors());
+ }
}
protected Type getRawType()
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2010-01-13 13:55:53 UTC (rev 5450)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/collections/ConcurrentCache.java 2010-01-13 16:52:02 UTC (rev 5451)
@@ -1,189 +0,0 @@
-/*
- * 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.weld.util.collections;
-
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-
-import org.jboss.weld.exceptions.ForbiddenStateException;
-
-import com.google.common.collect.ForwardingMap;
-
-/**
- * Represents a thread safe map
- *
- * @author Pete Muir
- */
-public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
-{
-
- // The backing map with the value wrapped in a Future instance
- private ConcurrentHashMap<K, Future<V>> map;
-
- /**
- * Constructor
- */
- public ConcurrentCache()
- {
- map = new ConcurrentHashMap<K, Future<V>>();
- }
-
- /**
- * Gets the Future value from the map
- *
- * @param key The key to look for
- * @return The Future instance of the value
- */
-
- public <T extends V> Future<T> getFuture(K key)
- {
- @SuppressWarnings("unchecked")
- Future<T> future = (Future<T>) super.get(key);
- return future;
- }
-
- /**
- * Gets a value from the map. Blocks until it is available
- *
- * @param key The key to look for
- * @return The value
- */
- public <T extends V> T getValue(K key)
- {
- @SuppressWarnings("unchecked")
- Future<T> value = (Future<T>) map.get(key);
- if (value != null)
- {
- boolean interrupted = false;
- try
- {
- while (true)
- {
- try
- {
- return value.get();
- }
- catch (InterruptedException e)
- {
- interrupted = true;
- }
- catch (ExecutionException e)
- {
- rethrow(e);
- }
- }
- }
- finally
- {
- if (interrupted)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Adds an item to the map if it's not already there
-
- * @param key The key to place the item under
- * @param callable The item, wrapped in a Callable instance
- * @return The item added
- */
- public <E> E putIfAbsent(K key, Callable<E> callable)
- {
- @SuppressWarnings("unchecked")
- Future<E> future = (Future<E>) map.get(key);
- Future<E> value = future;
- if (value == null)
- {
- FutureTask<E> task = new FutureTask<E>(callable);
- value = task;
- @SuppressWarnings("unchecked")
- Future<V> t = (Future<V>) task;
- map.put(key, t);
- task.run();
- }
- boolean interrupted = false;
- try
- {
- while (true)
- {
- try
- {
- return value.get();
- }
- catch (InterruptedException e)
- {
- interrupted = true;
- }
- catch (ExecutionException e)
- {
- rethrow(e);
- }
- }
- }
- finally
- {
- if (interrupted)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * Gets the delegate map
- *
- * @return The backing map
- */
- @Override
- protected Map<K, Future<V>> delegate()
- {
- return map;
- }
-
- /**
- * Examines and re-throws an exception
- *
- * @param e The exception that happened during execution
- */
- protected void rethrow(ExecutionException e)
- {
- if (e.getCause() instanceof RuntimeException)
- {
- throw (RuntimeException) e.getCause();
- }
- else if (e.getCause() instanceof Error)
- {
- throw (Error) e.getCause();
- }
- else
- {
- throw new ForbiddenStateException(e.getCause());
- }
- }
-
-}
\ No newline at end of file
More information about the weld-commits
mailing list