Weld SVN: r5264 - cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-12-10 04:25:26 -0500 (Thu, 10 Dec 2009)
New Revision: 5264
Modified:
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/web.xml
Log:
CDITCK-76
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/web.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/web.xml 2009-12-10 08:45:39 UTC (rev 5263)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ws/web.xml 2009-12-10 09:25:26 UTC (rev 5264)
@@ -3,12 +3,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Dependency Injection Test</display-name>
-
- <listener>
- <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
- </listener>
+
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
<servlet>
- <servlet-name>TestWebService</servlet-name>
+ <servlet-name>org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.SheepWSEndPoint</servlet-name>
<servlet-class>org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.SheepWSEndPoint</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
@@ -17,7 +17,7 @@
<servlet-class>org.jboss.testharness.impl.runner.servlet.ServletTestRunner</servlet-class>
</servlet>
<servlet-mapping>
- <servlet-name>TestWebService</servlet-name>
+ <servlet-name>org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.SheepWSEndPoint</servlet-name>
<url-pattern>/TestWebService</url-pattern>
</servlet-mapping>
<servlet-mapping>
14 years, 11 months
Weld SVN: r5263 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-12-10 03:45:39 -0500 (Thu, 10 Dec 2009)
New Revision: 5263
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
Log:
minor
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-12-10 08:44:22 UTC (rev 5262)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-12-10 08:45:39 UTC (rev 5263)
@@ -143,7 +143,7 @@
FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class);
BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedField;
+ assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedField<?>;
assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(AnimalStereotype.class);
}
@@ -155,7 +155,7 @@
MethodInjectionPointBean beanWithInjectedBean = getInstanceByType(MethodInjectionPointBean.class);
BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedParameter;
+ assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated() instanceof AnnotatedParameter<?>;
assert annotationSetMatches(beanWithInjectionPoint.getInjectedMetadata().getQualifiers(), Default.class);
}
14 years, 11 months
Weld SVN: r5262 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator and 2 other directories.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-12-10 03:44:22 -0500 (Thu, 10 Dec 2009)
New Revision: 5262
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/AnimalDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Animal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/AnimalDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotInjectedTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/CatDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/CatDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Animal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Cat.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/beans.xml
Log:
CDITCK-83
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Animal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Animal.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Animal.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -2,5 +2,5 @@
interface Animal
{
-
+ String hello();
}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/AnimalDecorator.java (from rev 5251, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/CatDecorator.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/AnimalDecorator.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/AnimalDecorator.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+class AnimalDecorator implements Animal {
+
+ @Inject @Delegate
+ private Animal bean;
+
+ public String hello() {
+ return bean.hello() + " world!";
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/Cat.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -4,7 +4,7 @@
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
-class Cat
+class Cat implements Animal
{
@Inject private InjectionPoint injectionPoint;
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/CatDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/CatDecorator.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/CatDecorator.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,17 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.injectionpoint;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-@Decorator
-class CatDecorator extends Cat
-{
- @Inject @Delegate Cat bean;
-
- @Override
- public String hello()
- {
- return bean.hello() + " world!";
- }
-}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Animal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Animal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Animal.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
+
+interface Animal {
+ String hello();
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/AnimalDecorator.java (from rev 5251, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/CatDecorator.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/AnimalDecorator.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/AnimalDecorator.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -0,0 +1,16 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+class AnimalDecorator implements Animal
+{
+ @Inject @Delegate Animal bean;
+
+ public String hello()
+ {
+ return bean.hello() + " world!";
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Cat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Cat.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/Cat.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,6 +1,6 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
-class Cat
+class Cat implements Animal
{
public String hello() {
return "hello";
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/CatDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/CatDecorator.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/CatDecorator.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,17 +0,0 @@
-package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-@Decorator
-class CatDecorator extends Cat
-{
- @Inject @Delegate Cat bean;
-
- @Override
- public String hello()
- {
- return bean.hello() + " world!";
- }
-}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotInjectedTest.java (from rev 5251, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotInjectedTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotInjectedTest.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -0,0 +1,41 @@
+/*
+ * 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.lookup.typesafe.resolution.decorator;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+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.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@BeansXml("beans.xml")
+@SpecVersion(spec="cdi", version="20091101")
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+public class DecoratorNotInjectedTest extends AbstractJSR299Test
+{
+
+ @Test(groups = { "resolution" })
+ @SpecAssertion(section = "5.1.4", id = "a")
+ public void testDecoratorNotResolved()
+ {
+ assert false;
+ }
+}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,50 +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.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
-
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.testng.annotations.Test;
-
-@Artifact
-@BeansXml("beans.xml")
-@SpecVersion(spec="cdi", version="20091101")
-public class DecoratorNotResolvedTest extends AbstractJSR299Test
-{
-
- @Test(groups = { "resolution", "rewrite" })
- @SpecAssertion(section = "5.1.4", id = "a")
- // TODO PLM should check injection, not resolution
- public void testDecoratorNotResolved()
- {
- Set<Type> types = new HashSet<Type>();
- for (Bean<Cat> bean : getBeans(Cat.class)) {
- types.addAll(bean.getTypes());
- }
- assert !types.contains(CatDecorator.class);
- assert getInstanceByType(Cat.class) != null;
- }
-}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/House.java 2009-12-10 08:44:22 UTC (rev 5262)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator;
+
+import javax.inject.Inject;
+
+class House {
+ @SuppressWarnings("unused")
+ @Inject
+ private AnimalDecorator decorator;
+}
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/injectionpoint/beans.xml 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,6 +1,6 @@
<beans>
<decorators>
<class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.TimestampLogger</class>
- <class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.CatDecorator</class>
+ <class>org.jboss.jsr299.tck.tests.lookup.injectionpoint.AnimalDecorator</class>
</decorators>
</beans>
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/beans.xml 2009-12-10 02:25:51 UTC (rev 5261)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/beans.xml 2009-12-10 08:44:22 UTC (rev 5262)
@@ -1,5 +1,5 @@
<beans>
<decorators>
- <class>org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator.CatDecorator</class>
+ <class>org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.decorator.AnimalDecorator</class>
</decorators>
</beans>
14 years, 11 months
Weld SVN: r5261 - core/trunk/impl/src/main/java/org/jboss/weld.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-12-09 21:25:51 -0500 (Wed, 09 Dec 2009)
New Revision: 5261
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java
core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java
core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java
core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/Validator.java
core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
Log:
Initial refactoring of exception classes
Modified: core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -33,11 +33,24 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public AmbiguousResolutionException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> AmbiguousResolutionException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/CreationException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -35,11 +35,28 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> CreationException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
}
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> CreationException(E key, Throwable throwable, Object... args)
{
super(messageConveyer.getMessage(key, args), throwable);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -16,87 +16,64 @@
*/
package org.jboss.weld;
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-
import java.util.List;
-import ch.qos.cal10n.IMessageConveyor;
-
/**
* Thrown if the definition of a bean is incorrect
*
* @author Pete Muir
*/
-public class DefinitionException extends RuntimeException
+public class DefinitionException extends WeldException
{
private static final long serialVersionUID = 8014646336322875707L;
- // Exception messages
- private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
-
- private String message = null;
-
- public DefinitionException()
- {
- super();
- }
-
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> DefinitionException(E key, Object... args)
{
- super();
- this.message = messageConveyer.getMessage(key, args);
+ super(key, args);
}
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> DefinitionException(E key, Throwable throwable, Object... args)
{
super(throwable);
- this.message = messageConveyer.getMessage(key, args);
}
- public DefinitionException(String message, Throwable throwable)
- {
- super(throwable);
- this.message = message;
- }
-
- public DefinitionException(String message)
- {
- super();
- this.message = message;
- }
-
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public DefinitionException(Throwable throwable)
{
super(throwable);
- this.message = throwable.getLocalizedMessage();
}
-
+
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
public DefinitionException(List<Throwable> errors)
{
- super();
- StringBuilder errorMessage = new StringBuilder();
- boolean firstError = true;
- for (Throwable throwable : errors)
- {
- if (!firstError)
- {
- errorMessage.append('\n');
- }
- errorMessage.append(throwable.getLocalizedMessage());
- }
- message = errorMessage.toString();
+ super(errors);
}
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message;
- }
-
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DeploymentException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -16,87 +16,68 @@
*/
package org.jboss.weld;
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-
import java.util.List;
-import ch.qos.cal10n.IMessageConveyor;
-
/**
* Thrown if an deployment exception occurs.
*
* @author Pete Muir
*/
-public class DeploymentException extends RuntimeException
+public class DeploymentException extends WeldException
{
private static final long serialVersionUID = 8014646336322875707L;
- // Exception messages
- private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
-
- private String message = null;
-
public DeploymentException()
{
super();
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> DeploymentException(E key, Object... args)
{
- super();
- this.message = messageConveyer.getMessage(key, args);
+ super(key, args);
}
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> DeploymentException(E key, Throwable throwable, Object... args)
{
- super(throwable);
- this.message = messageConveyer.getMessage(key, args);
+ super(key, throwable, args);
}
- public DeploymentException(String message, Throwable throwable)
- {
- super(throwable);
- this.message = message;
- }
-
- public DeploymentException(String message)
- {
- super();
- this.message = message;
- }
-
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public DeploymentException(Throwable throwable)
{
super(throwable);
- this.message = throwable.getLocalizedMessage();
}
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
public DeploymentException(List<Throwable> errors)
{
- super();
- StringBuilder errorMessage = new StringBuilder();
- boolean firstError = true;
- for (Throwable throwable : errors)
- {
- if (!firstError)
- {
- errorMessage.append('\n');
- }
- errorMessage.append(throwable.getLocalizedMessage());
- }
- message = errorMessage.toString();
+ super(errors);
}
-
- @Override
- public String getLocalizedMessage()
- {
- return getMessage();
- }
-
- @Override
- public String getMessage()
- {
- return message;
- }
-
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -34,11 +34,24 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public ForbiddenArgumentException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> ForbiddenArgumentException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -33,11 +33,24 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> ForbiddenStateException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
}
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public ForbiddenStateException(Throwable cause)
{
super(cause.getLocalizedMessage(), cause);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/IllegalProductException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -35,6 +35,14 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> IllegalProductException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -16,8 +16,6 @@
*/
package org.jboss.weld;
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-import ch.qos.cal10n.IMessageConveyor;
/**
*
@@ -28,32 +26,27 @@
private static final long serialVersionUID = 4359656880524913555L;
- // Exception messages
- private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
-
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> InconsistentSpecializationException(E key, Object... args)
{
- super(messageConveyer.getMessage(key, args));
+ super(key, args);
}
- public InconsistentSpecializationException()
- {
- super();
- }
-
- public InconsistentSpecializationException(String message, Throwable throwable)
- {
- super(message, throwable);
- }
-
- public InconsistentSpecializationException(String message)
- {
- super(message);
- }
-
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public InconsistentSpecializationException(Throwable throwable)
{
- super(throwable.getLocalizedMessage(), throwable);
+ super(throwable);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -33,16 +33,37 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public InjectionException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
}
+ /**
+ * Creates a new exception with an arbitrary message and the cause of the
+ * exception. It is not recommended to use this constructor since the
+ * message cannot be localized.
+ *
+ * @param message The error message
+ * @param throwable The cause of the exception or wrapped throwable
+ */
public InjectionException(String message, Throwable throwable)
{
super(message, throwable);
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> InjectionException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InvalidObjectException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -35,6 +35,14 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> InvalidObjectException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -35,11 +35,22 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Default constructor mostly for serialization purposes.
+ */
public InvalidOperationException()
{
super();
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> InvalidOperationException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/NullInstanceException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -30,6 +30,14 @@
private static final long serialVersionUID = 1L;
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> NullInstanceException(E key, Object... args)
{
super(key, args);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -16,8 +16,6 @@
*/
package org.jboss.weld;
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-import ch.qos.cal10n.IMessageConveyor;
/**
* Thrown if an injection point of primitive type resolves to a bean which may
@@ -30,29 +28,24 @@
private static final long serialVersionUID = 6877485218767005761L;
- // Exception messages
- private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
-
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> NullableDependencyException(E key, Object... args)
{
- super(messageConveyer.getMessage(key, args));
+ super(key, args);
}
- public NullableDependencyException()
- {
- super();
- }
-
- public NullableDependencyException(String message, Throwable throwable)
- {
- super(message, throwable);
- }
-
- public NullableDependencyException(String message)
- {
- super(message);
- }
-
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public NullableDependencyException(Throwable throwable)
{
super(throwable);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -33,11 +33,24 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public UnproxyableResolutionException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> UnproxyableResolutionException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -34,11 +34,24 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public UnsatisfiedResolutionException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> UnsatisfiedResolutionException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -16,8 +16,6 @@
*/
package org.jboss.weld;
-import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
-import ch.qos.cal10n.IMessageConveyor;
/**
@@ -33,29 +31,24 @@
private static final long serialVersionUID = -6287506607413810688L;
- // Exception messages
- private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
-
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> UnserializableDependencyException(E key, Object... args)
{
- super(messageConveyer.getMessage(key, args));
+ super(key, args);
}
- public UnserializableDependencyException()
- {
- super();
- }
-
- public UnserializableDependencyException(String message, Throwable throwable)
- {
- super(message, throwable);
- }
-
- public UnserializableDependencyException(String message)
- {
- super(message);
- }
-
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public UnserializableDependencyException(Throwable throwable)
{
super(throwable);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/Validator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -20,6 +20,8 @@
import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES;
import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED;
import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.AMBIGUOUS_EL_NAME;
+import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_NAME_IS_PREFIX;
import static org.jboss.weld.logging.messages.ValidatorMessage.BEAN_SPECIALIZED_TOO_MANY_TIMES;
import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR;
import static org.jboss.weld.logging.messages.ValidatorMessage.DECORATOR_SPECIFIED_TWICE;
@@ -338,11 +340,11 @@
Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(namedAccessibleBeans.get(name));
if (resolvedBeans.size() > 1)
{
- throw new DeploymentException("An unresolvable ambiguous EL name exists for " + name + "; found " + resolvedBeans );
+ throw new DeploymentException(AMBIGUOUS_EL_NAME, name, resolvedBeans );
}
if (accessibleNamespaces.contains(name))
{
- throw new DeploymentException("The bean name " + name + " is used as a prefix for another bean");
+ throw new DeploymentException(BEAN_NAME_IS_PREFIX, name);
}
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2009-12-09 22:56:14 UTC (rev 5260)
+++ core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2009-12-10 02:25:51 UTC (rev 5261)
@@ -18,6 +18,9 @@
package org.jboss.weld;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+
+import java.util.List;
+
import ch.qos.cal10n.IMessageConveyor;
/**
@@ -32,19 +35,94 @@
// Exception messages
private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+ private String message = null;
+
+ /**
+ * Default constructor mostly for serialization purposes.
+ */
+ protected WeldException()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new exception with the given cause.
+ *
+ * @param throwable The cause of the exception
+ */
public WeldException(Throwable throwable)
{
super(throwable.getLocalizedMessage(), throwable);
+ this.message = throwable.getLocalizedMessage();
}
+ /**
+ * Creates a new exception with the given localized message key and optional
+ * arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> WeldException(E key, Object... args)
{
super(messageConveyer.getMessage(key, args));
+ this.message = messageConveyer.getMessage(key, args);
}
+ /**
+ * Creates a new exception with the given localized message key, the cause
+ * for this exception and optional arguments for the message.
+ *
+ * @param <E> The enumeration type for the message keys
+ * @param key The localized message to use
+ * @param throwable The cause for this exception
+ * @param args Optional arguments to insert into the message
+ */
public <E extends Enum<?>> WeldException(E key, Throwable throwable, Object... args)
{
super(messageConveyer.getMessage(key, args), throwable);
+ this.message = messageConveyer.getMessage(key, args);
}
+ /**
+ * Creates a new exception based on a list of throwables. The throwables are not
+ * used as the cause, but the message from each throwable is included as the message
+ * for this exception.
+ *
+ * @param errors A list of throwables to use in the message
+ */
+ public WeldException(List<Throwable> errors)
+ {
+ super();
+ StringBuilder errorMessage = new StringBuilder();
+ boolean firstError = true;
+ for (Throwable throwable : errors)
+ {
+ if (!firstError)
+ {
+ errorMessage.append('\n');
+ }
+ errorMessage.append(throwable.getLocalizedMessage());
+ }
+ setMessage(errorMessage.toString());
+ }
+
+ protected void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ @Override
+ public String getLocalizedMessage()
+ {
+ return getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return message;
+ }
+
}
14 years, 11 months
Weld SVN: r5260 - in archetypes/trunk/jsf: jee-minimal/src/main/resources/archetype-resources and 1 other directory.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-12-09 17:56:14 -0500 (Wed, 09 Dec 2009)
New Revision: 5260
Modified:
archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
Log:
note about Hibernate Validator impl
Modified: archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-12-09 21:36:32 UTC (rev 5259)
+++ archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2009-12-09 22:56:14 UTC (rev 5260)
@@ -65,7 +65,7 @@
</dependency>
<!-- Bean Validation Implementation -->
<!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
- <!-- Hibernate Validator is the JSR-303 implementation in JBoss AS -->
+ <!-- Hibernate Validator is only the JSR-303 implementation at the moment, so we can assume it's provided -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
Modified: archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-12-09 21:36:32 UTC (rev 5259)
+++ archetypes/trunk/jsf/jee-minimal/src/main/resources/archetype-resources/pom.xml 2009-12-09 22:56:14 UTC (rev 5260)
@@ -56,7 +56,7 @@
</dependency>
<!-- Bean Validation Implementation -->
<!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
- <!-- Hibernate Validator is the JSR-303 implementation in JBoss AS -->
+ <!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
14 years, 11 months
Weld SVN: r5259 - examples/trunk.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-12-09 16:36:32 -0500 (Wed, 09 Dec 2009)
New Revision: 5259
Modified:
examples/trunk/build.properties
examples/trunk/build.xml
Log:
warn if jboss.home or tomcat.home is not set, respectively (only if attempting to deploy)
use env variables in build.properties
Modified: examples/trunk/build.properties
===================================================================
--- examples/trunk/build.properties 2009-12-09 20:55:15 UTC (rev 5258)
+++ examples/trunk/build.properties 2009-12-09 21:36:32 UTC (rev 5259)
@@ -1,2 +1,2 @@
jboss.home=${env.JBOSS_HOME}
-tomcat.home=/Applications/apache-tomcat-6.0.20
+tomcat.home=${env.CATALINA_HOME}
Modified: examples/trunk/build.xml
===================================================================
--- examples/trunk/build.xml 2009-12-09 20:55:15 UTC (rev 5258)
+++ examples/trunk/build.xml 2009-12-09 21:36:32 UTC (rev 5259)
@@ -38,6 +38,28 @@
<property name="artifact.dir" value="${artifact.target.dir}/${example.name}" />
+ <target name="check.jboss.home">
+ <fail message="Please set the JBOSS_HOME environment variable to a JBoss AS 6 installation. (Alternatively, you can set jboss.home in ${wbexamples.dir}/build.properties">
+ <condition>
+ <or>
+ <length string="${jboss.home}" trim="true" length="0"/>
+ <not><available file="${jboss.home}/bin/run.conf"/></not>
+ </or>
+ </condition>
+ </fail>
+ </target>
+
+ <target name="check.tomcat.home">
+ <fail message="Please set the CATALINA_HOME environment variable to a Tomcat 6 installation. (Alternatively, you can set tomcat.home in ${wbexamples.dir}/build.properties">
+ <condition>
+ <or>
+ <length string="${tomcat.home}" trim="true" length="0"/>
+ <not><available file="${tomcat.home}/webapps" type="dir"/></not>
+ </or>
+ </condition>
+ </fail>
+ </target>
+
<target name="package">
<maven target="install" basedir="${basedir}">
<arg line="-f ${pom.file}" />
@@ -56,26 +78,26 @@
</maven>
</target>
- <target name="explode" depends="package">
+ <target name="explode" depends="check.jboss.home, package">
<mkdir dir="${jboss.home}/server/default/deploy/${example.name}.${type}" />
<copy todir="${jboss.home}/server/default/deploy/${example.name}.${type}">
<fileset dir="${artifact.dir}" />
</copy>
</target>
- <target name="tomcat.explode" depends="tomcat.package">
+ <target name="tomcat.explode" depends="check.tomcat.home, tomcat.package">
<mkdir dir="${tomcat.home}/webapps/${example.name}" />
<copy todir="${tomcat.home}/webapps/${example.name}">
<fileset dir="${artifact.dir}" />
</copy>
</target>
- <target name="deploy" depends="package">
+ <target name="deploy" depends="check.jboss.home, package">
<copy todir="${jboss.home}/server/default/deploy/" file="${artifact.target.dir}/${example.name}.${type}" />
<echo message="The app can be accessed at ${final.url}" />
</target>
- <target name="tomcat.deploy" depends="tomcat.package">
+ <target name="tomcat.deploy" depends="check.tomcat.home, tomcat.package">
<copy todir="${tomcat.home}/webapps/" file="${artifact.target.dir}/${example.name}.${type}" />
<echo message="The app can be accessed at ${final.url}" />
</target>
@@ -97,16 +119,16 @@
<echo message="The app can be accessed at ${jboss.home}" />
</target>
- <target name="undeploy">
+ <target name="undeploy" depends="check.jboss.home">
<delete dir="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
<delete file="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
</target>
- <target name="tomcat.undeploy">
+ <target name="tomcat.undeploy" depends="check.tomcat.home">
<delete file="${tomcat.home}/webapps/${example.name}.war" failonerror="false" />
</target>
- <target name="tomcat.unexplode">
+ <target name="tomcat.unexplode" depends="check.tomcat.home">
<delete dir="${tomcat.home}/webapps/${example.name}" failonerror="false" />
</target>
14 years, 11 months
Weld SVN: r5258 - examples/trunk.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-12-09 15:55:15 -0500 (Wed, 09 Dec 2009)
New Revision: 5258
Modified:
examples/trunk/build.properties
examples/trunk/build.xml
Log:
to get jboss.home, first check local.build.properties, then build.properties
build.properties references the environment variables JBOSS_HOME and CATALINA_HOME by default
Modified: examples/trunk/build.properties
===================================================================
--- examples/trunk/build.properties 2009-12-09 20:21:45 UTC (rev 5257)
+++ examples/trunk/build.properties 2009-12-09 20:55:15 UTC (rev 5258)
@@ -1,2 +1,2 @@
-jboss.home=/Applications/jboss-5.2.0.Beta1
+jboss.home=${env.JBOSS_HOME}
tomcat.home=/Applications/apache-tomcat-6.0.20
Modified: examples/trunk/build.xml
===================================================================
--- examples/trunk/build.xml 2009-12-09 20:21:45 UTC (rev 5257)
+++ examples/trunk/build.xml 2009-12-09 20:55:15 UTC (rev 5258)
@@ -7,16 +7,14 @@
<property name="maven.dir" location="${wbexamples.dir}/lib/maven" />
+ <property environment="env"/><!-- assign OS environment variables to an object visible to ANT -->
+
<!-- preserve local build.properties if they're still being used -->
<property file="${wbexamples.dir}/../jboss-as/local.build.properties" />
<property file="${wbexamples.dir}/local.build.properties" />
- <!-- Use CATALINA_HOME or JBOSS_HOME from OS if no local values are set -->
- <property environment="env"/><!-- assign OS environment variables to an object visible to ANT -->
- <property name="jboss.home" value="${env.JBOSS_HOME}" />
- <property name="tomcat.home" value="${env.CATALINA_HOME}" />
-
<property file="${wbexamples.dir}/../jboss-as/build.properties" />
+ <property file="${wbexamples.dir}/build.properties" />
<property name="final.url" value="http://localhost:8080/${example.name}" />
@@ -135,4 +133,4 @@
</sequential>
</macrodef>
-</project>
\ No newline at end of file
+</project>
14 years, 11 months
Weld SVN: r5257 - examples/trunk.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2009-12-09 15:21:45 -0500 (Wed, 09 Dec 2009)
New Revision: 5257
Modified:
examples/trunk/build.xml
Log:
Reformatted to use 3 spaces instead of tabs
Modified: examples/trunk/build.xml
===================================================================
--- examples/trunk/build.xml 2009-12-09 20:15:11 UTC (rev 5256)
+++ examples/trunk/build.xml 2009-12-09 20:21:45 UTC (rev 5257)
@@ -1,138 +1,138 @@
<project basedir="." name="example.build.script" default="restart">
- <!--
- Running this build requires that you set JBOSS_HOME to run on JBoss 6
- or CATALINA_HOME to run on Tomcat 6 as an environment variable in your OS.
- -->
- <dirname property="wbexamples.dir" file="${ant.file.example.build.script}" />
+ <!--
+ Running this build requires that you set JBOSS_HOME to run on JBoss 6
+ or CATALINA_HOME to run on Tomcat 6 as an environment variable in your OS.
+ -->
+ <dirname property="wbexamples.dir" file="${ant.file.example.build.script}" />
- <property name="maven.dir" location="${wbexamples.dir}/lib/maven" />
+ <property name="maven.dir" location="${wbexamples.dir}/lib/maven" />
- <!-- preserve local build.properties if they're still being used -->
- <property file="${wbexamples.dir}/../jboss-as/local.build.properties" />
- <property file="${wbexamples.dir}/local.build.properties" />
-
- <!-- Use CATALINA_HOME or JBOSS_HOME from OS if no local values are set -->
- <property environment="env"/><!-- assign OS environment variables to an object visible to ANT -->
- <property name="jboss.home" value="${env.JBOSS_HOME}" />
- <property name="tomcat.home" value="${env.CATALINA_HOME}" />
-
- <property file="${wbexamples.dir}/../jboss-as/build.properties" />
+ <!-- preserve local build.properties if they're still being used -->
+ <property file="${wbexamples.dir}/../jboss-as/local.build.properties" />
+ <property file="${wbexamples.dir}/local.build.properties" />
+
+ <!-- Use CATALINA_HOME or JBOSS_HOME from OS if no local values are set -->
+ <property environment="env"/><!-- assign OS environment variables to an object visible to ANT -->
+ <property name="jboss.home" value="${env.JBOSS_HOME}" />
+ <property name="tomcat.home" value="${env.CATALINA_HOME}" />
+
+ <property file="${wbexamples.dir}/../jboss-as/build.properties" />
- <property name="final.url" value="http://localhost:8080/${example.name}" />
+ <property name="final.url" value="http://localhost:8080/${example.name}" />
- <property name="pom.file" value="pom.xml" />
+ <property name="pom.file" value="pom.xml" />
- <property name="type" value="war" />
+ <property name="type" value="war" />
- <condition property="war">
- <equals arg1="${type}" arg2="war" />
- </condition>
- <condition property="ear">
- <equals arg1="${type}" arg2="ear" />
- </condition>
+ <condition property="war">
+ <equals arg1="${type}" arg2="war" />
+ </condition>
+ <condition property="ear">
+ <equals arg1="${type}" arg2="ear" />
+ </condition>
- <condition property="artifact.target.dir" value="${basedir}/target">
- <equals arg1="${type}" arg2="war" />
- </condition>
- <condition property="artifact.target.dir" value="${basedir}/ear/target">
- <equals arg1="${type}" arg2="ear" />
- </condition>
+ <condition property="artifact.target.dir" value="${basedir}/target">
+ <equals arg1="${type}" arg2="war" />
+ </condition>
+ <condition property="artifact.target.dir" value="${basedir}/ear/target">
+ <equals arg1="${type}" arg2="ear" />
+ </condition>
- <property name="artifact.dir" value="${artifact.target.dir}/${example.name}" />
+ <property name="artifact.dir" value="${artifact.target.dir}/${example.name}" />
- <target name="package">
- <maven target="install" basedir="${basedir}">
- <arg line="-f ${pom.file}" />
- </maven>
- </target>
+ <target name="package">
+ <maven target="install" basedir="${basedir}">
+ <arg line="-f ${pom.file}" />
+ </maven>
+ </target>
- <target name="clean">
- <maven target="clean" basedir="${basedir}">
- <arg line="-f ${pom.file}" />
- </maven>
- </target>
+ <target name="clean">
+ <maven target="clean" basedir="${basedir}">
+ <arg line="-f ${pom.file}" />
+ </maven>
+ </target>
- <target name="tomcat.package">
- <maven target="install" basedir="${basedir}">
- <arg line="-f ${pom.file} -Ptomcat" />
- </maven>
- </target>
+ <target name="tomcat.package">
+ <maven target="install" basedir="${basedir}">
+ <arg line="-f ${pom.file} -Ptomcat" />
+ </maven>
+ </target>
- <target name="explode" depends="package">
- <mkdir dir="${jboss.home}/server/default/deploy/${example.name}.${type}" />
- <copy todir="${jboss.home}/server/default/deploy/${example.name}.${type}">
- <fileset dir="${artifact.dir}" />
- </copy>
- </target>
+ <target name="explode" depends="package">
+ <mkdir dir="${jboss.home}/server/default/deploy/${example.name}.${type}" />
+ <copy todir="${jboss.home}/server/default/deploy/${example.name}.${type}">
+ <fileset dir="${artifact.dir}" />
+ </copy>
+ </target>
- <target name="tomcat.explode" depends="tomcat.package">
- <mkdir dir="${tomcat.home}/webapps/${example.name}" />
- <copy todir="${tomcat.home}/webapps/${example.name}">
- <fileset dir="${artifact.dir}" />
- </copy>
- </target>
+ <target name="tomcat.explode" depends="tomcat.package">
+ <mkdir dir="${tomcat.home}/webapps/${example.name}" />
+ <copy todir="${tomcat.home}/webapps/${example.name}">
+ <fileset dir="${artifact.dir}" />
+ </copy>
+ </target>
- <target name="deploy" depends="package">
- <copy todir="${jboss.home}/server/default/deploy/" file="${artifact.target.dir}/${example.name}.${type}" />
- <echo message="The app can be accessed at ${final.url}" />
- </target>
+ <target name="deploy" depends="package">
+ <copy todir="${jboss.home}/server/default/deploy/" file="${artifact.target.dir}/${example.name}.${type}" />
+ <echo message="The app can be accessed at ${final.url}" />
+ </target>
- <target name="tomcat.deploy" depends="tomcat.package">
- <copy todir="${tomcat.home}/webapps/" file="${artifact.target.dir}/${example.name}.${type}" />
- <echo message="The app can be accessed at ${final.url}" />
- </target>
+ <target name="tomcat.deploy" depends="tomcat.package">
+ <copy todir="${tomcat.home}/webapps/" file="${artifact.target.dir}/${example.name}.${type}" />
+ <echo message="The app can be accessed at ${final.url}" />
+ </target>
- <target name="restart.war" depends="explode" if="war">
- <touch file="${jboss.home}/server/default/deploy/${example.name}.war/WEB-INF/web.xml" />
- </target>
+ <target name="restart.war" depends="explode" if="war">
+ <touch file="${jboss.home}/server/default/deploy/${example.name}.war/WEB-INF/web.xml" />
+ </target>
- <target name="tomcat.restart" depends="tomcat.explode" if="war">
- <touch file="${tomcat.home}/webapps/${example.name}/WEB-INF/web.xml" />
- </target>
+ <target name="tomcat.restart" depends="tomcat.explode" if="war">
+ <touch file="${tomcat.home}/webapps/${example.name}/WEB-INF/web.xml" />
+ </target>
- <target name="restart.ear" depends="explode" if="ear">
- <touch file="${jboss.home}/server/default/deploy/${example.name}.ear/META-INF/application.xml" />
- </target>
+ <target name="restart.ear" depends="explode" if="ear">
+ <touch file="${jboss.home}/server/default/deploy/${example.name}.ear/META-INF/application.xml" />
+ </target>
- <target name="restart" depends="restart.war, restart.ear">
- <echo message="The app can be accessed at ${final.url}" />
- <echo message="The app can be accessed at ${jboss.home}" />
- </target>
+ <target name="restart" depends="restart.war, restart.ear">
+ <echo message="The app can be accessed at ${final.url}" />
+ <echo message="The app can be accessed at ${jboss.home}" />
+ </target>
- <target name="undeploy">
- <delete dir="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
- <delete file="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
- </target>
+ <target name="undeploy">
+ <delete dir="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
+ <delete file="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
+ </target>
- <target name="tomcat.undeploy">
- <delete file="${tomcat.home}/webapps/${example.name}.war" failonerror="false" />
- </target>
+ <target name="tomcat.undeploy">
+ <delete file="${tomcat.home}/webapps/${example.name}.war" failonerror="false" />
+ </target>
- <target name="tomcat.unexplode">
- <delete dir="${tomcat.home}/webapps/${example.name}" failonerror="false" />
- </target>
+ <target name="tomcat.unexplode">
+ <delete dir="${tomcat.home}/webapps/${example.name}" failonerror="false" />
+ </target>
- <macrodef name="maven">
- <attribute name="target" />
- <attribute name="basedir" />
- <element name="args" implicit="true" optional="true" />
- <sequential>
- <java classname="org.codehaus.classworlds.Launcher" fork="true" dir="@{basedir}" failonerror="true">
- <classpath>
- <fileset dir="${maven.dir}/boot">
- <include name="*.jar" />
- </fileset>
- <fileset dir="${maven.dir}/bin">
- <include name="*.*" />
- </fileset>
- </classpath>
- <sysproperty key="classworlds.conf" value="${maven.dir}/bin/m2.conf" />
- <sysproperty key="maven.home" value="${maven.dir}" />
- <args />
- <arg line="@{target}" />
- </java>
- </sequential>
- </macrodef>
+ <macrodef name="maven">
+ <attribute name="target" />
+ <attribute name="basedir" />
+ <element name="args" implicit="true" optional="true" />
+ <sequential>
+ <java classname="org.codehaus.classworlds.Launcher" fork="true" dir="@{basedir}" failonerror="true">
+ <classpath>
+ <fileset dir="${maven.dir}/boot">
+ <include name="*.jar" />
+ </fileset>
+ <fileset dir="${maven.dir}/bin">
+ <include name="*.*" />
+ </fileset>
+ </classpath>
+ <sysproperty key="classworlds.conf" value="${maven.dir}/bin/m2.conf" />
+ <sysproperty key="maven.home" value="${maven.dir}" />
+ <args />
+ <arg line="@{target}" />
+ </java>
+ </sequential>
+ </macrodef>
-</project>
+</project>
\ No newline at end of file
14 years, 11 months
Weld SVN: r5256 - examples/trunk.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2009-12-09 15:15:11 -0500 (Wed, 09 Dec 2009)
New Revision: 5256
Modified:
examples/trunk/build.xml
Log:
updated to use JBOSS_HOME or CATALINA_HOME
Modified: examples/trunk/build.xml
===================================================================
--- examples/trunk/build.xml 2009-12-09 18:52:30 UTC (rev 5255)
+++ examples/trunk/build.xml 2009-12-09 20:15:11 UTC (rev 5256)
@@ -1,12 +1,21 @@
<project basedir="." name="example.build.script" default="restart">
-
+ <!--
+ Running this build requires that you set JBOSS_HOME to run on JBoss 6
+ or CATALINA_HOME to run on Tomcat 6 as an environment variable in your OS.
+ -->
<dirname property="wbexamples.dir" file="${ant.file.example.build.script}" />
<property name="maven.dir" location="${wbexamples.dir}/lib/maven" />
+ <!-- preserve local build.properties if they're still being used -->
<property file="${wbexamples.dir}/../jboss-as/local.build.properties" />
- <property file="${wbexamples.dir}/local.build.properties" />
- <property file="${wbexamples.dir}/build.properties" />
+ <property file="${wbexamples.dir}/local.build.properties" />
+
+ <!-- Use CATALINA_HOME or JBOSS_HOME from OS if no local values are set -->
+ <property environment="env"/><!-- assign OS environment variables to an object visible to ANT -->
+ <property name="jboss.home" value="${env.JBOSS_HOME}" />
+ <property name="tomcat.home" value="${env.CATALINA_HOME}" />
+
<property file="${wbexamples.dir}/../jboss-as/build.properties" />
<property name="final.url" value="http://localhost:8080/${example.name}" />
@@ -37,17 +46,17 @@
</maven>
</target>
- <target name="clean">
- <maven target="clean" basedir="${basedir}">
- <arg line="-f ${pom.file}" />
- </maven>
- </target>
+ <target name="clean">
+ <maven target="clean" basedir="${basedir}">
+ <arg line="-f ${pom.file}" />
+ </maven>
+ </target>
- <target name="tomcat.package">
- <maven target="install" basedir="${basedir}">
- <arg line="-f ${pom.file} -Ptomcat" />
- </maven>
- </target>
+ <target name="tomcat.package">
+ <maven target="install" basedir="${basedir}">
+ <arg line="-f ${pom.file} -Ptomcat" />
+ </maven>
+ </target>
<target name="explode" depends="package">
<mkdir dir="${jboss.home}/server/default/deploy/${example.name}.${type}" />
@@ -87,6 +96,7 @@
<target name="restart" depends="restart.war, restart.ear">
<echo message="The app can be accessed at ${final.url}" />
+ <echo message="The app can be accessed at ${jboss.home}" />
</target>
<target name="undeploy">
14 years, 11 months
Weld SVN: r5255 - in core/trunk/tests/src: test/java/org/jboss/weld/tests/scope and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-12-09 13:52:30 -0500 (Wed, 09 Dec 2009)
New Revision: 5255
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java
Modified:
core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
Log:
WELD-311
Modified: core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java 2009-12-09 17:10:51 UTC (rev 5254)
+++ core/trunk/tests/src/main/java/org/jboss/weld/test/AbstractWeldTest.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -180,13 +180,13 @@
@SuppressWarnings("unchecked")
public <T> T createContextualInstance(Class<T> beanType, Annotation... bindings)
{
- return (T) createContextualInstance((Type) beanType, bindings);
+ Bean<?> bean = getBean(beanType, bindings);
+ return (T) getCurrentManager().getReference(bean, beanType, getCurrentManager().createCreationalContext(bean));
}
-
- public Object createContextualInstance(Type beanType, Annotation... bindings)
+
+ public <T> T getReference(Bean<T> bean)
{
- Bean<?> bean = getBean(beanType, bindings);
- return getCurrentManager().getReference(bean, beanType, getCurrentManager().createCreationalContext(bean));
+ return (T) getCurrentManager().getReference(bean, bean.getBeanClass(), getCurrentManager().createCreationalContext(bean));
}
@SuppressWarnings("unchecked")
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java 2009-12-09 17:10:51 UTC (rev 5254)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -1,8 +1,16 @@
package org.jboss.weld.tests.scope;
+import java.lang.annotation.Annotation;
+
import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;
@@ -10,10 +18,46 @@
public class ScopeTest extends AbstractWeldTest
{
+ private static Annotation USELESS_LITERAL = new AnnotationLiteral<Useless>() {};
+ private static Annotation SPECIAL_LITERAL = new AnnotationLiteral<Special>() {};
+
@Test(description="WELD-322")
public void testScopeDeclaredOnSubclassOverridesScopeOnSuperClass()
{
assert getCurrentManager().resolve(getCurrentManager().getBeans(Bar.class)).getScope().equals(Dependent.class);
}
+ @Test(description="WELD-311")
+ public void testScopeOfProducerMethod()
+ {
+ Bean<Temp> specialTempBean = getBean(Temp.class, SPECIAL_LITERAL);
+ Bean<Temp> uselessTempBean = getBean(Temp.class, USELESS_LITERAL);
+ assert specialTempBean.getScope().equals(RequestScoped.class);
+ assert uselessTempBean.getScope().equals(RequestScoped.class);
+ assert getReference(specialTempBean).getNumber() == 10;
+ assert getReference(uselessTempBean).getNumber() == 11;
+
+ TempConsumer tempConsumer = createContextualInstance(TempConsumer.class);
+ tempConsumer.getSpecialTemp().setNumber(101);
+ tempConsumer.getUselessTemp().setNumber(102);
+
+ assert tempConsumer.getSpecialTemp().getNumber() == 101;
+ assert tempConsumer.getUselessTemp().getNumber() == 102;
+ assert getReference(specialTempBean).getNumber() == 101;
+ assert getReference(uselessTempBean).getNumber() == 102;
+
+ newRequest();
+
+ assert tempConsumer.getSpecialTemp().getNumber() == 10;
+ assert tempConsumer.getUselessTemp().getNumber() == 102;
+ assert getReference(specialTempBean).getNumber() == 10;
+ assert getReference(uselessTempBean).getNumber() == 102;
+ }
+
+ private void newRequest()
+ {
+ ContextLifecycle lifecycle = Container.instance().deploymentServices().get(ContextLifecycle.class);
+ lifecycle.endRequest("test", lifecycle.getRequestContext().getBeanStore());
+ lifecycle.beginRequest("test", new HashMapBeanStore());
+ }
}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -0,0 +1,20 @@
+package org.jboss.weld.tests.scope;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -0,0 +1,28 @@
+package org.jboss.weld.tests.scope;
+
+public class Temp
+{
+
+ private int number;
+
+ public Temp(int number)
+ {
+ this.number = number;
+ }
+
+ public Temp()
+ {
+ number = 0;
+ }
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public void setNumber(int number)
+ {
+ this.number = number;
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -0,0 +1,24 @@
+package org.jboss.weld.tests.scope;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class TempConsumer
+{
+
+ @Inject @Special Temp specialTemp;
+ @Inject @Useless Temp uselessTemp;
+
+ public Temp getSpecialTemp()
+ {
+ return specialTemp;
+ }
+
+ public Temp getUselessTemp()
+ {
+ return uselessTemp;
+ }
+
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -0,0 +1,28 @@
+package org.jboss.weld.tests.scope;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class TempProducer implements Serializable
+{
+
+ @Produces
+ @RequestScoped
+ @Special
+ public Temp getTemp()
+ {
+ return new Temp(10);
+ }
+
+ @Produces
+ @RequestScoped
+ @Useless
+ Temp t = new Temp(11);
+
+}
\ No newline at end of file
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java 2009-12-09 18:52:30 UTC (rev 5255)
@@ -0,0 +1,20 @@
+package org.jboss.weld.tests.scope;
+
+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 java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Useless
+{
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
14 years, 11 months