Weld SVN: r5223 - in java-se/trunk/src: test/java/org/jboss/weld/environment/se/test and 1 other directory.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2009-12-08 07:12:29 -0500 (Tue, 08 Dec 2009)
New Revision: 5223
Modified:
java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/InterceptorsTest.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java
java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
Log:
WELDX-57: Removed proprietary shutdown event, replaced with standard BeforeShutdown. Also added shutdown() to Weld, and set Weld.class up as a managed bean for use when observing the ContainerInitialized event.
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java 2009-12-08 07:00:33 UTC (rev 5222)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldSEBeanRegistrant.java 2009-12-08 12:12:29 UTC (rev 5223)
@@ -35,6 +35,7 @@
event.addAnnotatedType(beanManager.createAnnotatedType(ShutdownManager.class));
event.addAnnotatedType(beanManager.createAnnotatedType(ParametersFactory.class));
event.addAnnotatedType(beanManager.createAnnotatedType(InstanceManager.class));
+ event.addAnnotatedType(beanManager.createAnnotatedType(Weld.class));
}
}
Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java 2009-12-08 07:00:33 UTC (rev 5222)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/DecoratorsTest.java 2009-12-08 12:12:29 UTC (rev 5223)
@@ -17,11 +17,10 @@
package org.jboss.weld.environment.se.test;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
+import org.jboss.weld.environment.se.ShutdownManager;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
-import org.jboss.weld.environment.se.events.Shutdown;
import org.jboss.weld.environment.se.test.decorators.CarDoor;
import org.jboss.weld.environment.se.test.decorators.Door;
import org.jboss.weld.environment.se.test.decorators.CarDoorAlarm;
@@ -37,59 +36,52 @@
public class DecoratorsTest
{
- /**
- * Test that decorators work as expected in SE.
- */
- @Test
- public void testDecorators()
- {
+ /**
+ * Test that decorators work as expected in SE.
+ */
+ @Test
+ public void testDecorators()
+ {
- WeldContainer weld = new Weld().initialize();
- BeanManager manager = weld.getBeanManager();
-
- CarDoor carDoor = WeldManagerUtils.getInstanceByType(manager, CarDoor.class);
- Assert.assertNotNull(carDoor);
+ WeldContainer weld = new Weld().initialize();
+ BeanManager manager = weld.getBeanManager();
- // the car door is alarmed
- CarDoorAlarm.alarmActivated = false;
- Assert.assertFalse(CarDoorAlarm.alarmActivated);
- testDoor(carDoor);
- Assert.assertTrue(CarDoorAlarm.alarmActivated);
+ CarDoor carDoor = WeldManagerUtils.getInstanceByType(manager, CarDoor.class);
+ Assert.assertNotNull(carDoor);
- HouseDoor houseDoor = WeldManagerUtils.getInstanceByType(manager, HouseDoor.class);
- Assert.assertNotNull(carDoor);
+ // the car door is alarmed
+ CarDoorAlarm.alarmActivated = false;
+ Assert.assertFalse(CarDoorAlarm.alarmActivated);
+ testDoor(carDoor);
+ Assert.assertTrue(CarDoorAlarm.alarmActivated);
- // the house door is not alarmed
- CarDoorAlarm.alarmActivated = false;
- Assert.assertFalse(CarDoorAlarm.alarmActivated);
- testDoor(houseDoor);
- Assert.assertFalse(CarDoorAlarm.alarmActivated);
+ HouseDoor houseDoor = WeldManagerUtils.getInstanceByType(manager, HouseDoor.class);
+ Assert.assertNotNull(carDoor);
- shutdownManager(manager);
- }
+ // the house door is not alarmed
+ CarDoorAlarm.alarmActivated = false;
+ Assert.assertFalse(CarDoorAlarm.alarmActivated);
+ testDoor(houseDoor);
+ Assert.assertFalse(CarDoorAlarm.alarmActivated);
- private void testDoor(Door door)
- {
- Assert.assertTrue(door.open());
- Assert.assertTrue(door.isOpen());
- Assert.assertFalse(door.close());
- Assert.assertFalse(door.isOpen());
- Assert.assertTrue(door.lock());
- Assert.assertTrue(door.isLocked());
- Assert.assertFalse(door.open());
- Assert.assertFalse(door.isOpen());
- }
+ shutdownManager(weld);
+ }
- private void shutdownManager(BeanManager manager)
- {
- manager.fireEvent(manager, new ShutdownAnnotation());
- }
+ private void testDoor(Door door)
+ {
+ Assert.assertTrue(door.open());
+ Assert.assertTrue(door.isOpen());
+ Assert.assertFalse(door.close());
+ Assert.assertFalse(door.isOpen());
+ Assert.assertTrue(door.lock());
+ Assert.assertTrue(door.isLocked());
+ Assert.assertFalse(door.open());
+ Assert.assertFalse(door.isOpen());
+ }
- private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
- {
-
- public ShutdownAnnotation()
- {
- }
- }
+ private void shutdownManager(WeldContainer weld)
+ {
+ ShutdownManager shutdownManager = weld.instance().select(ShutdownManager.class).get();
+ shutdownManager.shutdown();
+ }
}
Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/InterceptorsTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/InterceptorsTest.java 2009-12-08 07:00:33 UTC (rev 5222)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/InterceptorsTest.java 2009-12-08 12:12:29 UTC (rev 5223)
@@ -17,11 +17,10 @@
package org.jboss.weld.environment.se.test;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
+import org.jboss.weld.environment.se.ShutdownManager;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
-import org.jboss.weld.environment.se.events.Shutdown;
import org.jboss.weld.environment.se.test.beans.InterceptorTestBean;
import org.jboss.weld.environment.se.test.interceptors.AggregatingInterceptor;
import org.jboss.weld.environment.se.test.interceptors.RecordingInterceptor;
@@ -36,42 +35,35 @@
public class InterceptorsTest
{
- /**
- * Test that interceptors work as expected in SE.
- */
- @Test
- public void testInterceptors()
- {
- WeldContainer weld = new Weld().initialize();
- BeanManager manager = weld.getBeanManager();
+ /**
+ * Test that interceptors work as expected in SE.
+ */
+ @Test
+ public void testInterceptors()
+ {
+ WeldContainer weld = new Weld().initialize();
+ BeanManager manager = weld.getBeanManager();
- InterceptorTestBean intTestBean = WeldManagerUtils.getInstanceByType(manager, InterceptorTestBean.class);
- Assert.assertNotNull(intTestBean);
+ InterceptorTestBean intTestBean = WeldManagerUtils.getInstanceByType(manager, InterceptorTestBean.class);
+ Assert.assertNotNull(intTestBean);
- intTestBean.doSomethingRecorded();
- System.out.println(RecordingInterceptor.methodsRecorded);
- System.out.println(AggregatingInterceptor.methodsCalled);
- Assert.assertTrue(RecordingInterceptor.methodsRecorded.contains("doSomethingRecorded"));
+ intTestBean.doSomethingRecorded();
+ System.out.println(RecordingInterceptor.methodsRecorded);
+ System.out.println(AggregatingInterceptor.methodsCalled);
+ Assert.assertTrue(RecordingInterceptor.methodsRecorded.contains("doSomethingRecorded"));
- intTestBean.doSomethingRecordedAndAggregated();
- System.out.println(RecordingInterceptor.methodsRecorded);
- System.out.println(AggregatingInterceptor.methodsCalled);
+ intTestBean.doSomethingRecordedAndAggregated();
+ System.out.println(RecordingInterceptor.methodsRecorded);
+ System.out.println(AggregatingInterceptor.methodsCalled);
- Assert.assertEquals(1, AggregatingInterceptor.methodsCalled);
+ Assert.assertEquals(1, AggregatingInterceptor.methodsCalled);
- shutdownManager(manager);
- }
+ shutdownManager(weld);
+ }
- private void shutdownManager(BeanManager manager)
- {
- manager.fireEvent(manager, new ShutdownAnnotation());
- }
-
- private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
- {
-
- public ShutdownAnnotation()
- {
- }
- }
+ private void shutdownManager(WeldContainer weld)
+ {
+ ShutdownManager shutdownManager = weld.instance().select(ShutdownManager.class).get();
+ shutdownManager.shutdown();
+ }
}
Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java 2009-12-08 07:00:33 UTC (rev 5222)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/StartMainTest.java 2009-12-08 12:12:29 UTC (rev 5223)
@@ -17,11 +17,10 @@
package org.jboss.weld.environment.se.test;
import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
+import org.jboss.weld.environment.se.ShutdownManager;
import org.jboss.weld.environment.se.StartMain;
import org.jboss.weld.environment.se.WeldContainer;
-import org.jboss.weld.environment.se.events.Shutdown;
import org.jboss.weld.environment.se.test.beans.CustomEvent;
import org.jboss.weld.environment.se.test.beans.InitObserverTestBean;
import org.jboss.weld.environment.se.test.beans.MainTestBean;
@@ -67,7 +66,7 @@
Assert.assertNotNull(paramsBean.getParameters().get(2));
Assert.assertEquals(ARGS[2], paramsBean.getParameters().get(2));
- shutdownManager(manager);
+ shutdownManager(weld);
}
/**
@@ -87,7 +86,7 @@
Assert.assertNotNull(paramsBean);
Assert.assertNotNull(paramsBean.getParameters());
- shutdownManager(manager);
+ shutdownManager(weld);
}
@Test
@@ -107,17 +106,10 @@
Assert.assertTrue(InitObserverTestBean.isInitObserved());
}
- private void shutdownManager(BeanManager manager)
+ private void shutdownManager(WeldContainer weld)
{
- manager.fireEvent(manager, new ShutdownAnnotation());
+ ShutdownManager shutdownManager = weld.instance().select(ShutdownManager.class).get();
+ shutdownManager.shutdown();
}
- private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
- {
-
- public ShutdownAnnotation()
- {
- }
- }
-
}
Modified: java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java
===================================================================
--- java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java 2009-12-08 07:00:33 UTC (rev 5222)
+++ java-se/trunk/src/test/java/org/jboss/weld/environment/se/test/WeldMainTest.java 2009-12-08 12:12:29 UTC (rev 5223)
@@ -16,12 +16,9 @@
*/
package org.jboss.weld.environment.se.test;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
-
+import org.jboss.weld.environment.se.ShutdownManager;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
-import org.jboss.weld.environment.se.events.Shutdown;
import org.jboss.weld.environment.se.test.beans.CustomEvent;
import org.jboss.weld.environment.se.test.beans.InitObserverTestBean;
import org.jboss.weld.environment.se.test.beans.MainTestBean;
@@ -53,7 +50,7 @@
Assert.assertNotNull(paramsBean);
Assert.assertNotNull(paramsBean.getParameters());
- shutdownManager(weld.getBeanManager());
+ shutdownManager(weld);
}
/**
@@ -76,16 +73,9 @@
Assert.assertFalse(InitObserverTestBean.isInitObserved());
}
- private void shutdownManager(BeanManager manager)
+ private void shutdownManager(WeldContainer weld)
{
- manager.fireEvent(manager, new ShutdownAnnotation());
+ ShutdownManager shutdownManager = weld.instance().select(ShutdownManager.class).get();
+ shutdownManager.shutdown();
}
-
- private static class ShutdownAnnotation extends AnnotationLiteral<Shutdown>
- {
-
- public ShutdownAnnotation()
- {
- }
- }
}
15 years, 2 months
Weld SVN: r5222 - in core/trunk/tests/src/test: java/org/jboss/weld/tests/decorators/generic and 2 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-12-08 02:00:33 -0500 (Tue, 08 Dec 2009)
New Revision: 5222
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml
Log:
Add test for generic decorators. Currently fails.
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated<T>
+{
+ T decoratedEcho(T parameter);
+}
\ No newline at end of file
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java (from rev 5221, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class GenericBean<T> implements Decorated<T>, NotDecorated<T>
+{
+ static boolean decoratedInvoked;
+ static boolean notDecoratedInvoked;
+
+ public T notDecoratedEcho(T parameter)
+ {
+ notDecoratedInvoked = true;
+ return parameter;
+ }
+
+ public T decoratedEcho(T parameter)
+ {
+ decoratedInvoked = true;
+ return parameter;
+ }
+}
\ No newline at end of file
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface NotDecorated<T>
+{
+ T notDecoratedEcho(T parameter);
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java (from rev 5221, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Decorator
+public class PartialDecorator<T> implements Decorated<T>
+{
+
+ @Inject @Delegate GenericBean<T> delegate;
+
+ static boolean decoratedInvoked;
+
+ static boolean notDecoratedInvoked;
+
+ public T decoratedEcho(T parameter)
+ {
+ decoratedInvoked = true;
+ return delegate.decoratedEcho(parameter);
+ }
+
+ /**
+ * Should not be invoked
+ */
+ public T notDecoratedEcho(T parameter)
+ {
+ notDecoratedInvoked = true;
+ return delegate.notDecoratedEcho(parameter);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java (from rev 5221, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+@BeansXml("beans.xml")
+public class PartialDecoratorTest extends AbstractWeldTest
+{
+
+ @Test(groups = "broken")
+ public void testDecoratorDoesNotDecorateOutsideDecoratedTypes()
+ {
+ TestBean testBean = getCurrentManager().getInstanceByType(TestBean.class);
+ testBean.invoke();
+
+ assert PartialDecorator.decoratedInvoked;
+ assert !PartialDecorator.notDecoratedInvoked;
+ assert GenericBean.decoratedInvoked;
+ assert GenericBean.notDecoratedInvoked;
+ }
+}
\ No newline at end of file
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.generic;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean
+{
+ @Inject @Dependent GenericBean<String> genericBean;
+
+ public void invoke()
+ {
+ genericBean.decoratedEcho("hello");
+ genericBean.notDecoratedEcho("hello");
+ }
+}
Copied: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml (from rev 5221, core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/beans.xml)
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml (rev 0)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml 2009-12-08 07:00:33 UTC (rev 5222)
@@ -0,0 +1,5 @@
+<beans>
+ <decorators>
+ <decorator>org.jboss.weld.tests.decorators.generic.PartialDecorator</decorator>
+ </decorators>
+</beans>
\ No newline at end of file
15 years, 2 months
Weld SVN: r5221 - in core/trunk/tests/src/test: java/org/jboss/weld/tests/decorators/decoratedTypes and 2 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-12-07 23:45:15 -0500 (Mon, 07 Dec 2009)
New Revision: 5221
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/beans.xml
Log:
Add broken test for WELD-333.
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/Decorated.java 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated
+{
+ void decoratedMethod();
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/NotDecorated.java 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface NotDecorated
+{
+ void notDecoratedMethod();
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecorator.java 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.decoratedTypes;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Decorator
+public class PartialDecorator implements Decorated
+{
+
+ @Inject @Delegate TestBean delegate;
+
+ static boolean decoratedInvoked;
+
+ static boolean notDecoratedInvoked;
+
+ public void decoratedMethod()
+ {
+ decoratedInvoked = true;
+ delegate.decoratedMethod();
+ }
+
+ /**
+ * Should not be invoked
+ */
+ public void notDecoratedMethod()
+ {
+ notDecoratedInvoked = true;
+ delegate.decoratedMethod();
+ }
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.decoratedTypes;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+@BeansXml("beans.xml")
+public class PartialDecoratorTest extends AbstractWeldTest
+{
+
+ @Test(groups = "broken")
+ public void testDecoratorDoesNotDecorateOutsideDecoratedTypes()
+ {
+ TestBean testBean = getCurrentManager().getInstanceByType(TestBean.class);
+ testBean.decoratedMethod();
+ testBean.notDecoratedMethod();
+
+ assert PartialDecorator.decoratedInvoked;
+ assert !PartialDecorator.notDecoratedInvoked;
+ assert TestBean.decoratedInvoked;
+ assert TestBean.notDecoratedInvoked;
+ }
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/TestBean.java 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.tests.decorators.decoratedTypes;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean implements Decorated, NotDecorated
+{
+ static boolean decoratedInvoked;
+ static boolean notDecoratedInvoked;
+
+ public void decoratedMethod()
+ {
+ decoratedInvoked = true;
+ }
+
+ public void notDecoratedMethod()
+ {
+ notDecoratedInvoked = true;
+ }
+}
Added: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/beans.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/beans.xml (rev 0)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/decoratedTypes/beans.xml 2009-12-08 04:45:15 UTC (rev 5221)
@@ -0,0 +1,5 @@
+<beans>
+ <decorators>
+ <decorator>org.jboss.weld.tests.decorators.decoratedTypes.PartialDecorator</decorator>
+ </decorators>
+</beans>
\ No newline at end of file
15 years, 2 months
Weld SVN: r5220 - in core/trunk/impl/src/main: java/org/jboss/weld/logging/messages and 1 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-12-07 21:39:38 -0500 (Mon, 07 Dec 2009)
New Revision: 5220
Added:
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ValidatorMessage.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/validator_en.properties
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java
core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java
core/trunk/impl/src/main/java/org/jboss/weld/Validator.java
Log:
Final exception message conversions to localized messages
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-07 09:40:04 UTC (rev 5219)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InconsistentSpecializationException.java 2009-12-08 02:39:38 UTC (rev 5220)
@@ -16,6 +16,9 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
/**
*
* @author Pete Muir
@@ -25,6 +28,14 @@
private static final long serialVersionUID = 4359656880524913555L;
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> InconsistentSpecializationException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
public InconsistentSpecializationException()
{
super();
@@ -42,7 +53,7 @@
public InconsistentSpecializationException(Throwable throwable)
{
- super(throwable);
+ super(throwable.getLocalizedMessage(), throwable);
}
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-07 09:40:04 UTC (rev 5219)
+++ core/trunk/impl/src/main/java/org/jboss/weld/NullableDependencyException.java 2009-12-08 02:39:38 UTC (rev 5220)
@@ -16,6 +16,9 @@
*/
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
* be null
@@ -27,6 +30,14 @@
private static final long serialVersionUID = 6877485218767005761L;
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> NullableDependencyException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
public NullableDependencyException()
{
super();
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-07 09:40:04 UTC (rev 5219)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnserializableDependencyException.java 2009-12-08 02:39:38 UTC (rev 5220)
@@ -16,7 +16,10 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
/**
* Thrown if a simple bean is dependent scoped and injected into a stateful
* session bean, into a non-transient field, bean constructor parameter or
@@ -30,6 +33,14 @@
private static final long serialVersionUID = -6287506607413810688L;
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> UnserializableDependencyException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
public UnserializableDependencyException()
{
super();
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-07 09:40:04 UTC (rev 5219)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Validator.java 2009-12-08 02:39:38 UTC (rev 5220)
@@ -16,6 +16,32 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.messages.ValidatorMessage.ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED;
+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.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;
+import static org.jboss.weld.logging.messages.ValidatorMessage.DISPOSAL_METHODS_WITHOUT_PRODUCER;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_INTO_NON_DEPENDENT_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_HAS_WILDCARD;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INJECTION_POINT_WITH_TYPE_VARIABLE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED;
+import static org.jboss.weld.logging.messages.ValidatorMessage.INTERCEPTOR_SPECIFIED_TWICE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NEW_WITH_QUALIFIERS;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN;
+import static org.jboss.weld.logging.messages.ValidatorMessage.NOT_PROXYABLE;
+import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR;
+import static org.jboss.weld.logging.messages.ValidatorMessage.PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR;
+
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.TypeVariable;
@@ -27,15 +53,12 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.Map;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
-import javax.enterprise.inject.UnproxyableResolutionException;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
@@ -45,17 +68,16 @@
import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.AbstractProducerBean;
-import org.jboss.weld.bean.DecoratorImpl;
import org.jboss.weld.bean.DisposalMethod;
import org.jboss.weld.bean.NewManagedBean;
import org.jboss.weld.bean.NewSessionBean;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.bootstrap.api.Service;
-import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.resolution.ResolvableWeldClass;
+import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.reflection.Reflections;
@@ -82,7 +104,7 @@
boolean normalScoped = beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
if (normalScoped && !Beans.isBeanProxyable(bean))
{
- throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");
+ throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
}
}
@@ -105,7 +127,7 @@
{
if (specializedBeans.contains(abstractBean.getSpecializedBean()))
{
- throw new InconsistentSpecializationException("Two beans cannot specialize the same bean: " + bean);
+ throw new InconsistentSpecializationException(BEAN_SPECIALIZED_TOO_MANY_TIMES, bean);
}
specializedBeans.add(abstractBean.getSpecializedBean());
}
@@ -142,8 +164,7 @@
{
if (!Reflections.isSerializable(interceptorClass))
{
- throw new DeploymentException("The bean " + this + " declared a passivating scope, " +
- "but has a non-serializable interceptor class: " + interceptorClass.getName());
+ throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, this, interceptorClass.getName());
}
InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) beanManager.createInjectionTarget(beanManager.createAnnotatedType(interceptorClass));
for (InjectionPoint injectionPoint: injectionTarget.getInjectionPoints())
@@ -168,8 +189,7 @@
{
if (!Reflections.isSerializable(serializableContextual.get().getBeanClass()))
{
- throw new DeploymentException("The bean " + this + " declared a passivating scope " +
- "but has a non-serializable interceptor: " + serializableContextual.get());
+ throw new DeploymentException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR, this, serializableContextual.get());
}
for (InjectionPoint injectionPoint: serializableContextual.get().getInjectionPoints())
{
@@ -187,7 +207,7 @@
{
if (!Reflections.isSerializable(decorator.getBeanClass()))
{
- throw new UnserializableDependencyException("The bean " + classBean + " declares a passivating scope but has non-serializable decorator: " + decorator);
+ throw new UnserializableDependencyException(PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR, classBean, decorator);
}
for (InjectionPoint ij : decorator.getInjectionPoints())
{
@@ -208,19 +228,19 @@
{
if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getQualifiers().size() > 1)
{
- throw new DefinitionException("The injection point " + ij + " is annotated with @New which cannot be combined with other binding types");
+ throw new DefinitionException(NEW_WITH_QUALIFIERS, ij);
}
if (ij.getType().equals(InjectionPoint.class) && ij.getBean() == null)
{
- throw new DefinitionException("Cannot inject an Injection point into a class which isn't a bean " + ij);
+ throw new DefinitionException(INJECTION_INTO_NON_BEAN, ij);
}
if (ij.getType().equals(InjectionPoint.class) && !Dependent.class.equals(ij.getBean().getScope()))
{
- throw new DefinitionException("Cannot inject an InjectionPoint into a non @Dependent scoped bean " + ij);
+ throw new DefinitionException(INJECTION_INTO_NON_DEPENDENT_BEAN, ij);
}
if (ij.getType() instanceof TypeVariable<?>)
{
- throw new DefinitionException("Cannot declare an injection point with a type variable " + ij);
+ throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, ij);
}
checkFacadeInjectionPoint(ij, Instance.class);
checkFacadeInjectionPoint(ij, Event.class);
@@ -229,20 +249,20 @@
Set<?> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getInjectableBeans(ij));
if (resolvedBeans.isEmpty())
{
- throw new DeploymentException("Injection point has unstatisfied dependencies. Injection point: " + ij.toString() + "; Qualifiers: " + Arrays.toString(bindings));
+ throw new DeploymentException(INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES, ij, Arrays.toString(bindings));
}
if (resolvedBeans.size() > 1)
{
- throw new DeploymentException("Injection point has ambiguous dependencies. Injection point: " + ij.toString() + "; Qualifiers: " + Arrays.toString(bindings) +"; Possible dependencies: " + resolvedBeans);
+ throw new DeploymentException(INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES, ij, Arrays.toString(bindings) +"; Possible dependencies: " + resolvedBeans);
}
Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
if (beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(ij.getType()))
{
- throw new UnproxyableResolutionException("The injection point " + ij + " has non-proxyable dependencies");
+ throw new UnproxyableResolutionException(INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES, ij);
}
if (Reflections.isPrimitive(annotatedItem.getJavaClass()) && resolvedBean.isNullable())
{
- throw new NullableDependencyException("The injection point " + ij + " has nullable dependencies");
+ throw new NullableDependencyException(INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES, ij);
}
if (ij.getBean() != null && Beans.isPassivatingScope(ij.getBean(), beanManager) && (!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
{
@@ -256,9 +276,9 @@
{
if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean instanceof AbstractProducerBean<?, ?,?>)
{
- throw new IllegalProductException("The bean " + ij.getBean() + " declares a passivating scope but the producer returned a non-serializable bean for injection: " + resolvedBean);
+ throw new IllegalProductException(NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN, ij.getBean(), resolvedBean);
}
- throw new UnserializableDependencyException("The bean " + ij.getBean() + " declares a passivating scope but has non-serializable dependency: " + resolvedBean);
+ throw new UnserializableDependencyException(INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY, ij.getBean(), resolvedBean);
}
}
@@ -339,12 +359,11 @@
if (beanManager.getEnabledInterceptorClasses().indexOf(enabledInterceptorClass)
< beanManager.getEnabledInterceptorClasses().lastIndexOf(enabledInterceptorClass))
{
- throw new DeploymentException("Enabled interceptor class" + enabledInterceptorClass + " specified twice");
+ throw new DeploymentException(INTERCEPTOR_SPECIFIED_TWICE, enabledInterceptorClass + " specified twice");
}
if (!interceptorBeanClasses.contains(enabledInterceptorClass))
{
- throw new DeploymentException("Enabled interceptor class " + enabledInterceptorClass
- + " is neither annotated with @Interceptor, nor registered through a portable extension");
+ throw new DeploymentException(INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED, enabledInterceptorClass);
}
}
}
@@ -361,11 +380,11 @@
{
if (beanManager.getEnabledDecoratorClasses().indexOf(clazz) < beanManager.getEnabledDecoratorClasses().lastIndexOf(clazz))
{
- throw new DeploymentException("Enabled decorator class" + clazz + " specified twice");
+ throw new DeploymentException(DECORATOR_SPECIFIED_TWICE, clazz);
}
if (!decoratorBeanClasses.contains(clazz))
{
- throw new DeploymentException("Enabled decorator class " + clazz + " is not the bean class of at least one decorator bean (detected decorator beans " + decoratorBeanClasses + ")");
+ throw new DeploymentException(DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR, clazz, decoratorBeanClasses);
}
}
}
@@ -378,11 +397,11 @@
{
if (!stereotype.isAnnotationPresent(Alternative.class))
{
- throw new DeploymentException("Enabled alternative sterotype " + stereotype + " is not annotated @Alternative");
+ throw new DeploymentException(ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED, stereotype);
}
if (seenAlternatives.contains(stereotype))
{
- throw new DeploymentException("Cannot enable the same alternative sterotype " + stereotype + " in beans.xml");
+ throw new DeploymentException(ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES, stereotype);
}
seenAlternatives.add(stereotype);
}
@@ -390,11 +409,11 @@
{
if (!clazz.isAnnotationPresent(Alternative.class))
{
- throw new DeploymentException("Enabled alternative bean class " + clazz + " is not annotated @Alternative");
+ throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED, clazz);
}
if (seenAlternatives.contains(clazz))
{
- throw new DeploymentException("Cannot enable the same alternative bean class " + clazz + " in beans.xml");
+ throw new DeploymentException(ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES, clazz);
}
seenAlternatives.add(clazz);
}
@@ -405,7 +424,7 @@
Set<DisposalMethod<?, ?>> beans = environment.getUnresolvedDisposalBeans();
if (!beans.isEmpty())
{
- throw new DefinitionException("The following Disposal methods were declared but did not resolved to a producer method " + beans);
+ throw new DefinitionException(DISPOSAL_METHODS_WITHOUT_PRODUCER, beans);
}
}
@@ -418,16 +437,16 @@
ParameterizedType parameterizedType = (ParameterizedType) injectionPoint.getType();
if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable<?>)
{
- throw new DefinitionException("An injection point of type " + type + " cannot have a type variable type parameter " + injectionPoint);
+ throw new DefinitionException(INJECTION_POINT_WITH_TYPE_VARIABLE, injectionPoint);
}
if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
{
- throw new DefinitionException("An injection point of type " + type + " cannot have a wildcard type parameter " + injectionPoint);
+ throw new DefinitionException(INJECTION_POINT_HAS_WILDCARD, type, injectionPoint);
}
}
else
{
- throw new DefinitionException("An injection point of type " + type + " must have a type parameter " + injectionPoint);
+ throw new DefinitionException(INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER, type, injectionPoint);
}
}
Added: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ValidatorMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ValidatorMessage.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ValidatorMessage.java 2009-12-08 02:39:38 UTC (rev 5220)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.logging.messages;
+
+import org.jboss.weld.logging.MessageId;
+
+import ch.qos.cal10n.BaseName;
+import ch.qos.cal10n.Locale;
+import ch.qos.cal10n.LocaleData;
+
+@BaseName("org.jboss.weld.messages.validator")
+@LocaleData({
+ @Locale("en")
+})
+/**
+ * Log messages for validation related classes.
+ *
+ * Message IDs: 001400 - 001499
+ *
+ * @author David Allen
+ *
+ */
+public enum ValidatorMessage
+{
+ @MessageId("001400") NOT_PROXYABLE,
+ @MessageId("001401") BEAN_SPECIALIZED_TOO_MANY_TIMES,
+ @MessageId("001402") PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR,
+ @MessageId("001403") PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR,
+ @MessageId("001404") NEW_WITH_QUALIFIERS,
+ @MessageId("001405") INJECTION_INTO_NON_BEAN,
+ @MessageId("001406") INJECTION_INTO_NON_DEPENDENT_BEAN,
+ @MessageId("001407") INJECTION_POINT_WITH_TYPE_VARIABLE,
+ @MessageId("001408") INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES,
+ @MessageId("001409") INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES,
+ @MessageId("001410") INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES,
+ @MessageId("001411") INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES,
+ @MessageId("001412") NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN,
+ @MessageId("001413") INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY,
+ @MessageId("001414") AMBIGUOUS_EL_NAME,
+ @MessageId("001415") BEAN_NAME_IS_PREFIX,
+ @MessageId("001416") INTERCEPTOR_SPECIFIED_TWICE,
+ @MessageId("001417") INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED,
+ @MessageId("001418") DECORATOR_SPECIFIED_TWICE,
+ @MessageId("001419") DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR,
+ @MessageId("001420") ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED,
+ @MessageId("001421") ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES,
+ @MessageId("001422") ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED,
+ @MessageId("001423") ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES,
+ @MessageId("001424") DISPOSAL_METHODS_WITHOUT_PRODUCER,
+ @MessageId("001425") INJECTION_POINT_HAS_WILDCARD,
+ @MessageId("001426") INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER;
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/ValidatorMessage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/resources/org/jboss/weld/messages/validator_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/validator_en.properties (rev 0)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/validator_en.properties 2009-12-08 02:39:38 UTC (rev 5220)
@@ -0,0 +1,25 @@
+NOT_PROXYABLE=Normal scoped bean {0} is not proxyable
+BEAN_SPECIALIZED_TOO_MANY_TIMES=Two beans cannot specialize the same bean {0}
+PASSIVATING_BEAN_WITH_NONSERIALIZABLE_INTERCEPTOR=The bean {0} declared a passivating scope but has a non-serializable interceptor {1}
+PASSIVATING_BEAN_WITH_NONSERIALIZABLE_DECORATOR=The bean {0} declared a passivating scope but has non-serializable decorator {1}
+NEW_WITH_QUALIFIERS=The injection point {0} is annotated with @New which cannot be combined with other qualifiers
+INJECTION_INTO_NON_BEAN=Cannot inject {0} in a class which isn't a bean
+INJECTION_INTO_NON_DEPENDENT_BEAN=Cannot inject {0} in a non @Dependent scoped bean
+INJECTION_POINT_WITH_TYPE_VARIABLE=Cannot declare an injection point with a type variable\: {0}
+INJECTION_POINT_HAS_UNSATISFIED_DEPENDENCIES=Injection point has unsatisfied dependencies. Injection point\: {0}; Qualifiers\: {1}
+INJECTION_POINT_HAS_AMBIGUOUS_DEPENDENCIES=Injection point has ambiguous dependencies. Injection point\: {0}; Qualifiers\: {1}
+INJECTION_POINT_HAS_NON_PROXYABLE_DEPENDENCIES=The injection point {0} has non-proxyable dependencies
+INJECTION_POINT_HAS_NULLABLE_DEPENDENCIES=Injection point {0} has nullable dependencies
+NON_SERIALIZABLE_BEAN_INJECTED_INTO_PASSIVATING_BEAN=The bean {0} declares passivating scope but the producer returned a non-serializable bean for injection\: {1}
+INJECTION_POINT_HAS_NON_SERIALIZABLE_DEPENDENCY=The bean {0} declares passivating scope but has non-serializable dependency {1}
+INTERCEPTOR_SPECIFIED_TWICE=Enabled interceptor class {0} specified twice
+INTERCEPTOR_NOT_ANNOTATED_OR_REGISTERED=Enabled interceptor class {0} is neither annotated @Interceptor nor registered through a portable extension
+DECORATOR_SPECIFIED_TWICE=Enabled decorator class {0} specified twice
+DECORATOR_CLASS_NOT_BEAN_CLASS_OF_DECORATOR=Enabled decorator class {0} is not the bean class of at least one decorator bean (detected decorator beans {1})
+ALTERNATIVE_STEREOTYPE_NOT_ANNOTATED=Enabled alternative stereotype {0} is not annotated @Alternative
+ALTERNATIVE_STEREOTYPE_SPECIFIED_MULTIPLE_TIMES=Cannot enable the same alternative stereotype {0} in beans.xml
+ALTERNATIVE_BEAN_CLASS_NOT_ANNOTATED=Enabled alternative bean class {0} is not annotated @Alternative
+ALTERNATIVE_BEAN_CLASS_SPECIFIED_MULTIPLE_TIMES=Cannot enable the same alternative bean class {0} in beans.xml
+DISPOSAL_METHODS_WITHOUT_PRODUCER=The following disposal methods were declared but did not resolve to a producer method\: {0}
+INJECTION_POINT_HAS_WILDCARD=An injection point of type {0} cannot have a wildcard type parameter\: {0}
+INJECTION_POINT_MUST_HAVE_TYPE_PARAMETER=An injection point of type {0} must have a type parameter\: {1}
Property changes on: core/trunk/impl/src/main/resources/org/jboss/weld/messages/validator_en.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 2 months
Weld SVN: r5219 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2009-12-07 04:40:04 -0500 (Mon, 07 Dec 2009)
New Revision: 5219
Modified:
doc/trunk/reference/en-US/environments.xml
Log:
WELDX-51: documentation
Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml 2009-12-07 09:39:29 UTC (rev 5218)
+++ doc/trunk/reference/en-US/environments.xml 2009-12-07 09:40:04 UTC (rev 5219)
@@ -285,10 +285,7 @@
<para>
Weld provides an extension which will boot a CDI bean manager in Java SE, automatically registering all
- simple beans found on the classpath. Application developers need not write any bootstrapping code. The entry
- point for application code is a simple bean which observes the special
- <literal>ContainerInitialized</literal> event provided by this extension. The command line parameters can be
- injected using either of the following:
+ simple beans found on the classpath. The command line parameters can be injected using either of the following:
</para>
<programlisting role="JAVA"><![CDATA[@Inject @Parameters List<String> params;]]></programlisting>
@@ -298,7 +295,17 @@
<para>
The second form is useful for compatibility with existing classes.
</para>
-
+
+ <note>
+ <para>
+ The command line parameters do not become available for injection until the
+ <literal>ContainerInitialized</literal> event is fired. If you need access to the parameters during
+ initialization you can do so via the
+ <literal>public static String[] getParameters()</literal> method in
+ <literal>StartMain</literal>.
+ </para>
+ </note>
+
<para>
Here's an example of a simple CDI SE application:
</para>
@@ -311,35 +318,105 @@
}
}]]></programlisting>
- <para>
- CDI SE applications can be bootstrapped by running the <literal>StartMain</literal> class like so:
- </para>
+ </section>
- <programlisting role="JAVA"><![CDATA[java org.jboss.weld.environments.se.StartMain <args>]]></programlisting>
+ <section>
+
+ <title>Bootstrapping CDI SE</title>
- <para>
- If you need to do any custom initialization of the CDI bean manager, for example registering custom contexts
- or initializing resources for your beans you can do so in response to the
- <literal>AfterBeanDiscovery</literal> or <literal>AfterDeploymentValidation</literal> events. The following
- example registers a custom context:
- </para>
-
- <programlisting role="JAVA"><![CDATA[public class PerformSetup {
- public void setup(@Observes AfterBeanDiscovery event) {
- event.addContext( ThreadContext.INSTANCE );
- }
+ <para>
+ CDI SE applications can be bootstrapped in the following ways.
+ </para>
+
+ <section>
+
+ <title>The ContainerInitialized Event</title>
+
+ <para>
+ Thanks to the power of CDI's typesafe event model, application developers
+ need not write any bootstrapping code. The Weld SE module comes
+ with a built-in main method which will bootstrap CDI for you and
+ then fire a <literal>ContainerInitialized</literal> event. The entry
+ point for your application code would therefore be a simple bean which observes
+ the <literal>ContainerInitialized</literal> event, as in the previous example.</para>
+
+ <para>In this case your application can be started by calling the provided
+ main method like so:</para>
+
+ <programlisting role="JAVA"><![CDATA[java org.jboss.weld.environments.se.StartMain <args>]]></programlisting>
+
+ </section>
+
+ <section>
+
+ <title>Programatic Bootstrap API</title>
+
+ <para>For added flexibility, CDI SE also comes with a bootstrap API
+ which can be called from within your application in order to initialize
+ CDI and obtain references to your application's beans and events. The
+ API consists of two classes: <literal>Weld</literal> and
+ <literal>WeldContainer</literal>.</para>
+
+ <programlisting role="JAVA"><![CDATA[public class Weld
+{
+
+ /** Boots Weld and creates and returns a WeldContainer instance, through which
+ * beans and events can be accesed. */
+ public WeldContainer initialize() {...}
+
+ /** Convenience method for shutting down the container. */
+ public void shutdown() {...}
+
}]]></programlisting>
- <note>
- <para>
- The command line parameters do not become available for injection until the
- <literal>ContainerInitialized</literal> event is fired. If you need access to the parameters during
- initialization you can do so via the <literal>public static String[] getParameters()</literal> method in
- <literal>StartMain</literal>.
+ <programlisting role="JAVA"><![CDATA[public class WeldContainer
+{
+
+ /** Provides access to all beans within the application. */
+ public Instance<Object> instance() {...}
+
+ /** Provides access to all events within the application. */
+ public Event<Object> event() {...}
+
+ /** Provides direct access to the BeanManager. */
+ public BeanManager getBeanManager() {...}
+
+}]]></programlisting>
+
+ <para>Here's an example application main method which uses this API
+ to initialize a bean of type <literal>MyApplicationBean</literal>.</para>
+
+ <programlisting role="JAVA"><![CDATA[public static void main(String[] args) {
+ WeldContainer weld = new Weld().initialize();
+ weld.instance().select(MyApplicationBean.class).get();
+ weld.shutdown();
+}]]></programlisting>
+
+ <para>Alternatively the application could be started by firing a custom
+ event which would then be observed by another simple bean. The following
+ example fires <literal>MyEvent</literal> on startup.</para>
+
+ <programlisting role="JAVA"><![CDATA[public static void main(String[] args) {
+ WeldContainer weld = new Weld().initialize();
+ weld.event().select(MyEvent.class).fire( new MyEvent() );
+ weld.shutdown();
+}]]></programlisting>
+
+ </section>
+
+ </section>
+
+ <section>
+
+ <title>Setting the Classpath</title>
+
+ <para>Weld SE comes packaged as a 'shaded' jar which includes the CDI API,
+ Weld Core and all dependant classes bundled into a single jar. Therefore the
+ only Weld jar you need on the classpath, in addition to your application's
+ classes and dependant jars, is the Weld SE jar.
</para>
- </note>
- </section>
+ </section>
</section>
15 years, 2 months
Weld SVN: r5218 - java-se/trunk/src/main/java/org/jboss/weld/environment/se.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2009-12-07 04:39:29 -0500 (Mon, 07 Dec 2009)
New Revision: 5218
Modified:
java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldContainer.java
Log:
Minor javadoc improvements
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java 2009-12-07 04:49:44 UTC (rev 5217)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/Weld.java 2009-12-07 09:39:29 UTC (rev 5218)
@@ -86,7 +86,7 @@
}
/**
- * Convenience method for shutting down the container.
+ * Shuts down Weld.
*/
public void shutdown()
{
Modified: java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldContainer.java
===================================================================
--- java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldContainer.java 2009-12-07 04:49:44 UTC (rev 5217)
+++ java-se/trunk/src/main/java/org/jboss/weld/environment/se/WeldContainer.java 2009-12-07 09:39:29 UTC (rev 5218)
@@ -67,6 +67,9 @@
return instanceManager.getEvents();
}
+ /**
+ * Provides direct access to the BeanManager.
+ */
public BeanManager getBeanManager()
{
return beanManager;
15 years, 2 months
Weld SVN: r5217 - core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2009-12-06 23:49:44 -0500 (Sun, 06 Dec 2009)
New Revision: 5217
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
Log:
WELD-315 implemented BeforeBeanDiscovery.addStereotype
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-12-06 00:39:10 UTC (rev 5216)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-12-07 04:49:44 UTC (rev 5217)
@@ -23,7 +23,6 @@
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
@@ -31,6 +30,7 @@
import org.jboss.weld.literal.InterceptorBindingTypeLiteral;
import org.jboss.weld.literal.NormalScopeLiteral;
import org.jboss.weld.literal.ScopeLiteral;
+import org.jboss.weld.literal.StereotypeLiteral;
public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements BeforeBeanDiscovery
{
@@ -69,7 +69,11 @@
public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef)
{
- throw new InvalidOperationException();
+ getTypeStore().add(stereotype, new StereotypeLiteral());
+ for(Annotation a : stereotypeDef)
+ {
+ getTypeStore().add(stereotype, a);
+ }
}
public void addAnnotatedType(AnnotatedType<?> type)
15 years, 2 months
Weld SVN: r5216 - in extensions/trunk/core/src: test/java/org/jboss/weld/test/extensions/util and 1 other directory.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2009-12-05 19:39:10 -0500 (Sat, 05 Dec 2009)
New Revision: 5216
Added:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/NullMemberException.java
Modified:
extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/AnnotationInvocationHandler.java
extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/AnnotationInstanceProviderTest.java
extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/IntMemberAnnotation.java
Log:
WELDX-56 Support for default values in AnnotationInstanceProvider
Modified: extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/AnnotationInvocationHandler.java
===================================================================
--- extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/AnnotationInvocationHandler.java 2009-12-05 21:25:26 UTC (rev 5215)
+++ extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/AnnotationInvocationHandler.java 2009-12-06 00:39:10 UTC (rev 5216)
@@ -8,6 +8,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -25,7 +26,13 @@
* Numeric types do not have to match exactly, as they are converted using
* java.lang.Number's xxxValue methods.
*
+ * If am member does not have a corresponding entry in the value map then the
+ * annotations default value will be used.
*
+ * If the annotation member does not have a default value then a NullMemberException
+ * will be thrown
+ *
+ *
* @author Stuart Douglas
*
*/
@@ -58,11 +65,27 @@
private final Method[] members;
- AnnotationInvocationHandler(Map<String, Object> valueMap, Class<? extends Annotation> annotationType)
+ AnnotationInvocationHandler(Map<String, Object> values, Class<? extends Annotation> annotationType)
{
- this.valueMap = valueMap;
+ this.valueMap = new HashMap<String, Object>();
+ valueMap.putAll(values);
this.annotationType = annotationType;
this.members = annotationType.getDeclaredMethods();
+ for (Method m : members)
+ {
+ Object value = valueMap.get(m.getName());
+ if (value == null)
+ {
+ value = m.getDefaultValue();
+ if (value == null)
+ {
+ throw new NullMemberException(annotationType, m, "Error creating annotation @" + annotationType.getName() + " member " + m.getName() + " was null and does not provide a default value");
+ } else
+ {
+ valueMap.put(m.getName(), value);
+ }
+ }
+ }
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
@@ -95,39 +118,36 @@
private Object performTypeCoercion(Object val, Class<?> type)
{
- if (val != null)
+ if (Integer.class.isAssignableFrom(type) || type == int.class)
{
- if (Integer.class.isAssignableFrom(type) || type == int.class)
+ return ((Number) val).intValue();
+ }
+ else if (Long.class.isAssignableFrom(type) || type == long.class)
+ {
+ return ((Number) val).longValue();
+ }
+ else if (Short.class.isAssignableFrom(type) || type == short.class)
+ {
+ return ((Number) val).shortValue();
+ }
+ else if (Byte.class.isAssignableFrom(type) || type == byte.class)
+ {
+ return ((Number) val).byteValue();
+ }
+ else if (Double.class.isAssignableFrom(type) || type == double.class)
+ {
+ return ((Number) val).doubleValue();
+ }
+ else if (Float.class.isAssignableFrom(type) || type == float.class)
+ {
+ return ((Number) val).floatValue();
+ }
+ else if (Character.class.isAssignableFrom(type) || type == char.class)
+ {
+ if (String.class.isAssignableFrom(val.getClass()))
{
- return ((Number) val).intValue();
+ return val.toString().charAt(0);
}
- else if (Long.class.isAssignableFrom(type) || type == long.class)
- {
- return ((Number) val).longValue();
- }
- else if (Short.class.isAssignableFrom(type) || type == short.class)
- {
- return ((Number) val).shortValue();
- }
- else if (Byte.class.isAssignableFrom(type) || type == byte.class)
- {
- return ((Number) val).byteValue();
- }
- else if (Double.class.isAssignableFrom(type) || type == double.class)
- {
- return ((Number) val).doubleValue();
- }
- else if (Float.class.isAssignableFrom(type) || type == float.class)
- {
- return ((Number) val).floatValue();
- }
- else if (Character.class.isAssignableFrom(type) || type == char.class)
- {
- if (String.class.isAssignableFrom(val.getClass()))
- {
- return val.toString().charAt(0);
- }
- }
}
return val;
}
Added: extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/NullMemberException.java
===================================================================
--- extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/NullMemberException.java (rev 0)
+++ extensions/trunk/core/src/main/java/org/jboss/weld/extensions/util/NullMemberException.java 2009-12-06 00:39:10 UTC (rev 5216)
@@ -0,0 +1,33 @@
+package org.jboss.weld.extensions.util;
+
+import java.lang.reflect.Method;
+
+/**
+ * Exception thrown when a annotation is created with a null value
+ * for one of the members.
+ * @author Stuart Douglas
+ *
+ */
+public class NullMemberException extends RuntimeException
+{
+ Class annotationType;
+ Method method;
+
+ public NullMemberException(Class annotationType, Method method, String message)
+ {
+ super(message);
+ this.annotationType = annotationType;
+ this.method = method;
+ }
+
+ public Class getAnnotationType()
+ {
+ return annotationType;
+ }
+
+ public Method getMethod()
+ {
+ return method;
+ }
+
+}
Modified: extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/AnnotationInstanceProviderTest.java
===================================================================
--- extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/AnnotationInstanceProviderTest.java 2009-12-05 21:25:26 UTC (rev 5215)
+++ extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/AnnotationInstanceProviderTest.java 2009-12-06 00:39:10 UTC (rev 5216)
@@ -5,6 +5,7 @@
import java.util.Map;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
+import org.jboss.weld.extensions.util.NullMemberException;
import org.testng.annotations.Test;
/**
@@ -87,4 +88,34 @@
MultipleMembers realAn = AnnotatedClass.class.getAnnotation(MultipleMembers.class);
assert an.equals(realAn) : "Equality between declared annotation failed";
}
+
+ /**
+ * Test that an exception is thrown when a member is null
+ */
+ @Test(expectedExceptions = NullMemberException.class)
+ public void testNullMemberException()
+ {
+ AnnotationInstanceProvider provider = new AnnotationInstanceProvider();
+ Map<String, Object> values = new HashMap<String, Object>();
+ values.put("value", Long.valueOf(1));
+ values.put("someMember", null);
+ IntMemberAnnotation an = provider.get(IntMemberAnnotation.class, values);
+
+ }
+
+ /**
+ * Test that an Annotation will use the default values if a member with default
+ * values is null
+ */
+ @Test
+ public void testDefaultValue()
+ {
+ AnnotationInstanceProvider provider = new AnnotationInstanceProvider();
+ Map<String, Object> values = new HashMap<String, Object>();
+ values.put("someMember", Integer.valueOf(0));
+ IntMemberAnnotation an = provider.get(IntMemberAnnotation.class, values);
+ assert an != null : "Annotation was null";
+ assert an.value() == 1 : "Annotation member was not equal to default value";
+ }
+
}
Modified: extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/IntMemberAnnotation.java
===================================================================
--- extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/IntMemberAnnotation.java 2009-12-05 21:25:26 UTC (rev 5215)
+++ extensions/trunk/core/src/test/java/org/jboss/weld/test/extensions/util/IntMemberAnnotation.java 2009-12-06 00:39:10 UTC (rev 5216)
@@ -6,7 +6,7 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface IntMemberAnnotation
{
- int value();
+ int value() default 1;
int someMember();
}
15 years, 2 months
Weld SVN: r5215 - in core/trunk/impl/src/main: java/org/jboss/weld/context and 2 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-12-05 16:25:26 -0500 (Sat, 05 Dec 2009)
New Revision: 5215
Added:
core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.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/context/ContextNotActiveException.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/Container.java
core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanManagerMessage.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/beanmanager_en.properties
Log:
Conversion of BeanManager exceptions to localized messages
Added: core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.AmbiguousResolutionException}.
+ *
+ * @author David Allen
+ */
+public class AmbiguousResolutionException extends javax.enterprise.inject.AmbiguousResolutionException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public AmbiguousResolutionException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
+ public <E extends Enum<?>> AmbiguousResolutionException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/AmbiguousResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-12-04 14:52:43 UTC (rev 5214)
+++ core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -16,6 +16,25 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.AMBIGUOUS_BEANS_FOR_DEPENDENCY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.CONTEXT_NOT_ACTIVE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_ACTIVE_CONTEXTS;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_INTERCEPTOR_BINDING;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.DUPLICATE_QUALIFIERS;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_BINDINGS_EMPTY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INVALID_QUALIFIER;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NON_NORMAL_SCOPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_INTERCEPTOR_BINDING_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_PROXYABLE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NOT_STEREOTYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NO_DECORATOR_TYPES;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.SPECIFIED_TYPE_NOT_BEAN_TYPE;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.TOO_MANY_ACTIVITIES;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNPROXYABLE_RESOLUTION;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_ELEMENT;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_TYPE;
+
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
@@ -38,14 +57,9 @@
import javax.el.ELResolver;
import javax.el.ExpressionFactory;
-import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.InjectionException;
-import javax.enterprise.inject.UnproxyableResolutionException;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
@@ -67,6 +81,7 @@
import org.jboss.weld.bean.proxy.ClientProxyProvider;
import org.jboss.weld.bootstrap.api.ServiceRegistry;
import org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget;
+import org.jboss.weld.context.ContextNotActiveException;
import org.jboss.weld.context.CreationalContextImpl;
import org.jboss.weld.context.WeldCreationalContext;
import org.jboss.weld.ejb.EjbDescriptors;
@@ -677,12 +692,12 @@
{
if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
{
- throw new IllegalArgumentException("Not a binding type " + annotation);
+ throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
}
}
if (bindingAnnotations.size() < bindings.size())
{
- throw new IllegalArgumentException("Duplicate binding types: " + bindings);
+ throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, bindings);
}
}
@@ -756,7 +771,7 @@
{
if (!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
{
- throw new IllegalArgumentException("Not a binding type " + annotation);
+ throw new ForbiddenArgumentException(INVALID_QUALIFIER, annotation);
}
}
// for (Type type : element.getActualTypeArguments())
@@ -772,7 +787,7 @@
// }
if (bindings != null && bindings.length > element.getMetaAnnotations(Qualifier.class).size())
{
- throw new IllegalArgumentException("Duplicate bindings (" + Arrays.asList(bindings) + ") type passed " + element.toString());
+ throw new ForbiddenArgumentException(DUPLICATE_QUALIFIERS, Arrays.asList(bindings));
}
return beanResolver.resolve(ResolvableFactory.of(element));
}
@@ -925,11 +940,11 @@
}
if (activeContexts.isEmpty())
{
- throw new ContextNotActiveException("No active contexts for scope type " + scopeType.getName());
+ throw new ContextNotActiveException(CONTEXT_NOT_ACTIVE, scopeType.getName());
}
if (activeContexts.size() > 1)
{
- throw new IllegalStateException("More than one context active for scope type " + scopeType.getName());
+ throw new ForbiddenStateException(DUPLICATE_ACTIVE_CONTEXTS, scopeType.getName());
}
return activeContexts.iterator().next();
@@ -979,7 +994,7 @@
{
if (!Reflections.isAssignableFrom(bean.getTypes(), beanType))
{
- throw new IllegalArgumentException("The given beanType is not a type " + beanType +" of the bean " + bean );
+ throw new ForbiddenArgumentException(SPECIFIED_TYPE_NOT_BEAN_TYPE, beanType, bean );
}
return getReference(bean, creationalContext, false);
}
@@ -1005,7 +1020,7 @@
}
if (getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScope()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
{
- throw new UnproxyableResolutionException("Attempting to inject an unproxyable normal scoped bean " + resolvedBean + " into " + injectionPoint);
+ throw new UnproxyableResolutionException(UNPROXYABLE_RESOLUTION, resolvedBean, injectionPoint);
}
// TODO Can we move this logic to getReference?
if (creationalContext instanceof WeldCreationalContext<?>)
@@ -1057,7 +1072,7 @@
Bean<?> bean = resolve(beans);
if (bean == null)
{
- throw new UnsatisfiedResolutionException("Unable to resolve any beans. Class: " + beanType + "; Qualifiers: " + Arrays.toString(bindings));
+ throw new UnsatisfiedResolutionException(UNRESOLVABLE_TYPE, beanType, Arrays.toString(bindings));
}
Object reference = getReference(bean, beanType, createCreationalContext(bean));
@@ -1072,13 +1087,13 @@
Bean<T> bean = (Bean<T>) resolve(getBeans(element, bindings));
if (bean == null)
{
- throw new UnsatisfiedResolutionException(element + "Unable to resolve any Managed Beans");
+ throw new UnsatisfiedResolutionException(UNRESOLVABLE_ELEMENT, element);
}
boolean normalScoped = getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isNormal();
if (normalScoped && !Beans.isBeanProxyable(bean))
{
- throw new UnproxyableResolutionException("Normal scoped bean " + bean + " is not proxyable");
+ throw new UnproxyableResolutionException(NOT_PROXYABLE, bean);
}
return bean;
}
@@ -1116,7 +1131,7 @@
{
if (types.isEmpty())
{
- throw new IllegalArgumentException("No decorator types were specified in the set");
+ throw new ForbiddenArgumentException(NO_DECORATOR_TYPES);
}
checkBindingTypes(bindings);
}
@@ -1135,14 +1150,14 @@
public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings)
{
if (interceptorBindings.length == 0)
- throw new IllegalArgumentException("Interceptor bindings list cannot be empty");
+ throw new ForbiddenArgumentException(INTERCEPTOR_BINDINGS_EMPTY);
Set<Class<?>> uniqueInterceptorBindings = new HashSet<Class<?>>();
for (Annotation interceptorBinding: interceptorBindings)
{
if (uniqueInterceptorBindings.contains(interceptorBinding.annotationType()))
- throw new IllegalArgumentException("Duplicate interceptor binding type: " + interceptorBinding.annotationType());
+ throw new ForbiddenArgumentException(DUPLICATE_INTERCEPTOR_BINDING, interceptorBinding.annotationType());
if (!isInterceptorBinding(interceptorBinding.annotationType()))
- throw new IllegalArgumentException("Trying to resolve interceptors with non-binding type: " + interceptorBinding.annotationType());
+ throw new ForbiddenArgumentException(INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE, interceptorBinding.annotationType());
uniqueInterceptorBindings.add(interceptorBinding.annotationType());
}
return new ArrayList<Interceptor<?>>(interceptorResolver.resolve(ResolvableFactory.of(type,interceptorBindings)));
@@ -1207,7 +1222,7 @@
{
if (!getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isNormal())
{
- throw new IllegalArgumentException("Scope must be a normal scope type " + scopeType);
+ throw new ForbiddenArgumentException(NON_NORMAL_SCOPE, scopeType);
}
currentActivities.add(new CurrentActivity(getContext(scopeType), this));
return this;
@@ -1231,7 +1246,7 @@
{
return activeCurrentActivities.get(0).getManager();
}
- throw new IllegalStateException("More than one current activity for an active context " + currentActivities);
+ throw new ForbiddenStateException(TOO_MANY_ACTIVITIES, currentActivities);
}
public ServiceRegistry getServices()
@@ -1391,7 +1406,7 @@
}
catch (DeploymentException e)
{
- throw new InjectionException(e.getMessage(), e.getCause());
+ throw new InjectionException(e.getLocalizedMessage(), e.getCause());
}
}
@@ -1403,7 +1418,7 @@
}
else
{
- throw new IllegalArgumentException("Not a interception binding :" + bindingType);
+ throw new ForbiddenArgumentException(NOT_INTERCEPTOR_BINDING_TYPE, bindingType);
}
}
@@ -1420,7 +1435,7 @@
}
else
{
- throw new IllegalArgumentException("Not a stereotype " + stereotype);
+ throw new ForbiddenArgumentException(NOT_STEREOTYPE, stereotype);
}
}
@@ -1489,7 +1504,7 @@
}
else
{
- throw new AmbiguousResolutionException("Cannot resolve an ambiguous dependency between " + beans);
+ throw new AmbiguousResolutionException(AMBIGUOUS_BEANS_FOR_DEPENDENCY, beans);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/Container.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/Container.java 2009-12-04 14:52:43 UTC (rev 5214)
+++ core/trunk/impl/src/main/java/org/jboss/weld/Container.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -16,6 +16,8 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.NULL_BEAN_MANAGER_ID;
+
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@@ -196,7 +198,7 @@
String id = manager.getId();
if (manager.getId() == null)
{
- throw new IllegalArgumentException("Bean manager must not be null " + manager.toString());
+ throw new ForbiddenArgumentException(NULL_BEAN_MANAGER_ID, manager);
}
managers.put(id, manager);
return id;
Added: core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.InjectionException}.
+ *
+ * @author David Allen
+ */
+public class InjectionException extends javax.enterprise.inject.InjectionException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public InjectionException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
+ public InjectionException(String message, Throwable throwable)
+ {
+ super(message, throwable);
+ }
+
+ public <E extends Enum<?>> InjectionException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/InjectionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java 2009-12-04 14:52:43 UTC (rev 5214)
+++ core/trunk/impl/src/main/java/org/jboss/weld/SimpleInjectionTarget.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -16,6 +16,11 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_POST_CONSTRUCT;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.ERROR_INVOKING_PRE_DESTROY;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.INJECTION_ON_NON_CONTEXTUAL;
+import static org.jboss.weld.logging.messages.BeanManagerMessage.MISSING_BEAN_CONSTRUCTOR_FOUND;
+
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -84,7 +89,7 @@
{
if (ip.getType().equals(InjectionPoint.class))
{
- throw new DefinitionException("Cannot inject an InjectionPoint on a non-contextual type. Type: " + type + "; InjectionPoint: " + ip);
+ throw new DefinitionException(INJECTION_ON_NON_CONTEXTUAL, type, ip);
}
}
}
@@ -98,8 +103,7 @@
// try again so the correct DefinitionException is thrown
Beans.getBeanConstructor(null, type);
// should not be reached
- throw new IllegalStateException(
- "We were not previously able to find the bean constructor, but now are?");
+ throw new ForbiddenStateException(MISSING_BEAN_CONSTRUCTOR_FOUND);
}
return constructor.newInstance(beanManager, ctx);
}
@@ -130,7 +134,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Error invoking postConstruct() " + postConstruct, e);
+ throw new WeldException(ERROR_INVOKING_POST_CONSTRUCT, e, postConstruct);
}
}
@@ -145,7 +149,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Error invoking preDestroy() " + preDestroy, e);
+ throw new WeldException(ERROR_INVOKING_PRE_DESTROY, e, preDestroy);
}
}
Added: core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.UnproxyableResolutionException}.
+ *
+ * @author David Allen
+ */
+public class UnproxyableResolutionException extends javax.enterprise.inject.UnproxyableResolutionException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public UnproxyableResolutionException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
+ public <E extends Enum<?>> UnproxyableResolutionException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/UnproxyableResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * Provides message localization service for the
+ * {@link javax.enterprise.inject.UnsatisfiedResolutionException}.
+ *
+ * @author David Allen
+ *
+ */
+public class UnsatisfiedResolutionException extends javax.enterprise.inject.UnsatisfiedResolutionException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public UnsatisfiedResolutionException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
+ public <E extends Enum<?>> UnsatisfiedResolutionException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/UnsatisfiedResolutionException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.weld.context;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * A localized message version of the {@link javax.enterprise.context.ContextNotActiveException}.
+ *
+ * @author David Allen
+ *
+ */
+public class ContextNotActiveException extends javax.enterprise.context.ContextNotActiveException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public ContextNotActiveException(Throwable throwable)
+ {
+ super(throwable.getLocalizedMessage(), throwable);
+ }
+
+ public <E extends Enum<?>> ContextNotActiveException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/context/ContextNotActiveException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanManagerMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanManagerMessage.java 2009-12-04 14:52:43 UTC (rev 5214)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanManagerMessage.java 2009-12-05 21:25:26 UTC (rev 5215)
@@ -37,5 +37,28 @@
*/
public enum BeanManagerMessage
{
- @MessageId("001300") CANNOT_LOCATE_BEAN_MANAGER
+ @MessageId("001300") CANNOT_LOCATE_BEAN_MANAGER,
+ @MessageId("001301") INVALID_QUALIFIER,
+ @MessageId("001302") DUPLICATE_QUALIFIERS,
+ @MessageId("001303") CONTEXT_NOT_ACTIVE,
+ @MessageId("001304") DUPLICATE_ACTIVE_CONTEXTS,
+ @MessageId("001305") SPECIFIED_TYPE_NOT_BEAN_TYPE,
+ @MessageId("001306") UNPROXYABLE_RESOLUTION,
+ @MessageId("001307") UNRESOLVABLE_TYPE,
+ @MessageId("001308") UNRESOLVABLE_ELEMENT,
+ @MessageId("001309") NOT_PROXYABLE,
+ @MessageId("001310") NO_DECORATOR_TYPES,
+ @MessageId("001311") INTERCEPTOR_BINDINGS_EMPTY,
+ @MessageId("001312") DUPLICATE_INTERCEPTOR_BINDING,
+ @MessageId("001313") INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE,
+ @MessageId("001314") NON_NORMAL_SCOPE,
+ @MessageId("001315") TOO_MANY_ACTIVITIES,
+ @MessageId("001316") NOT_INTERCEPTOR_BINDING_TYPE,
+ @MessageId("001317") NOT_STEREOTYPE,
+ @MessageId("001318") AMBIGUOUS_BEANS_FOR_DEPENDENCY,
+ @MessageId("001319") NULL_BEAN_MANAGER_ID,
+ @MessageId("001320") INJECTION_ON_NON_CONTEXTUAL,
+ @MessageId("001321") MISSING_BEAN_CONSTRUCTOR_FOUND,
+ @MessageId("001322") ERROR_INVOKING_POST_CONSTRUCT,
+ @MessageId("001323") ERROR_INVOKING_PRE_DESTROY;
}
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/beanmanager_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/beanmanager_en.properties 2009-12-04 14:52:43 UTC (rev 5214)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/beanmanager_en.properties 2009-12-05 21:25:26 UTC (rev 5215)
@@ -1 +1,24 @@
CANNOT_LOCATE_BEAN_MANAGER=Unable to locate BeanManager
+INVALID_QUALIFIER=Annotation {0} is not a qualifier
+DUPLICATE_QUALIFIERS=Duplicate qualifiers\: {0}
+CONTEXT_NOT_ACTIVE=No active contexts for scope type {0}
+DUPLICATE_ACTIVE_CONTEXTS=More than one context active for scope type {0}
+SPECIFIED_TYPE_NOT_BEAN_TYPE=The given type {0} is not a type of the bean {1}
+UNPROXYABLE_RESOLUTION=Attempting to inject an unproxyable normal scoped bean {0} into {1}
+UNRESOLVABLE_TYPE=Unable to resolve any beans of type {0} with qualifiers {1}
+UNRESOLVABLE_ELEMENT=Unable to resolve managed beans for {0}
+NOT_PROXYABLE=Normal scoped bean {0} is not proxyable
+NO_DECORATOR_TYPES=No decorator types were specified in the set
+INTERCEPTOR_BINDINGS_EMPTY=Interceptor bindings list cannot be empty
+DUPLICATE_INTERCEPTOR_BINDING=Duplicate interceptor binding type {0} found
+INTERCEPTOR_RESOLUTION_WITH_NONBINDING_TYPE=Trying to resolve interceptors with non-binding type {0}
+NON_NORMAL_SCOPE={0} is expected to be a normal scope type
+TOO_MANY_ACTIVITIES=More than one current activity for an active context\: {0}
+NOT_INTERCEPTOR_BINDING_TYPE={0} is not an interceptor binding type
+NOT_STEREOTYPE={0} is not a stereotype
+AMBIGUOUS_BEANS_FOR_DEPENDENCY=Cannot resolve an ambiguous dependency between {0}
+NULL_BEAN_MANAGER_ID=Bean manager ID must not be null
+INJECTION_ON_NON_CONTEXTUAL=Cannot inject into a non-contextual type\: {0}
+MISSING_BEAN_CONSTRUCTOR_FOUND=Bean constructor was not found before but appears to be found now
+ERROR_INVOKING_POST_CONSTRUCT=Error invoking post construct method {0}
+ERROR_INVOKING_PRE_DESTROY=Error invoking pre-destroy method {0}
15 years, 2 months
Weld SVN: r5214 - cdi-tck/branches/1.0/impl/src/main/resources.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-12-04 09:52:43 -0500 (Fri, 04 Dec 2009)
New Revision: 5214
Added:
cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current-ee.xml
cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current.xml
Log:
Add current excludes for 299 and for 299 in EE
Added: cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current-ee.xml
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current-ee.xml (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current-ee.xml 2009-12-04 14:52:43 UTC (rev 5214)
@@ -0,0 +1,323 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<suite name="JSR-299 TCK with Java EE excludes" verbose="0">
+ <test name="JSR-299 TCK">
+ <method-selectors>
+ <method-selector>
+ <selector-class name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector"/>
+ </method-selector>
+ </method-selectors>
+ <groups>
+ <run>
+ <!-- Don't require licensees to pass tests which are known not working. Confirmed correct -->
+ <exclude name="broken"/>
+ <!-- Don't require licensees to pass tests which the RI can't pass. Confirmed correct -->
+ <exclude name="ri-broken"/>
+ </run>
+ </groups>
+ <packages>
+ <!--
+ - To run a single package, specify its name here,
+ - uncomment the exclude classes for it below (if any)
+ - and comment the exclude classes for all other
+ - packages to avoid accidental inclusions.
+ -->
+ <package name="org.jboss.jsr299.tck.tests.*"/>
+ </packages>
+ <!-- Excludes list -->
+ <classes>
+ <!--
+ - Definition: CDITCK-57. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.definition.bean.custom.CustomBeanImplementationTest">
+ <methods>
+ <exclude name="testGetStereotypesCalled"/>
+ <exclude name="testIsNullableCalled"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.context.passivating.PassivatingContextTest">
+ <methods>
+ <exclude name="testInjectionOfDependentPrimitiveProductIntoNormalBean"/>
+ <exclude name="testInjectionOfDependentSerializableProductIntoNormalBean"/>
+ <exclude name="testNonSerializableProducerFieldDeclaredPassivatingThrowsIllegalProductException"/>
+ <exclude name="testPassivatingScopeProducerMethodReturnsUnserializableObjectNotOk"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-60. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.context.application.ejb.ApplicationContextSharedTest">
+ <methods>
+ <exclude name="testApplicationContextShared"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.context.application.ejb.EJBApplicationContextTest">
+ <methods>
+ <exclude name="testApplicationScopeActiveDuringCallToEjbTimeoutMethod"/>
+ <exclude name="testApplicationScopeActiveDuringWebServiceInvocation"/>
+ </methods>
+ </class>
+ <!--
+ - Context: WELD-293. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.context.request.ejb.EJBRequestContextTest">
+ <methods>
+ <exclude name="testRequestScopeActiveDuringCallToEjbTimeoutMethod"/>
+ <exclude name="testRequestScopeDestroyedAfterCallToEjbTimeoutMethod"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.remove.EnterpriseBeanRemoveMethodTest">
+ <methods>
+ <exclude name="testApplicationMayCallAnyRemoveMethodOnDependentScopedSessionEnterpriseBeans"/>
+ <exclude name="testApplicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: CDITCK-61. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.installedLibrary.WarInstalledLibraryTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.installedLibrary.EarInstalledLibraryTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: WELD-306. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.addDefinitionError.AddDefinitionErrorTest">
+ <methods>
+ <exclude name="testObserverDefinitionErrorTreatedAsDefinitionError"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.addDeploymentProblem.AddDeploymentProblemTest">
+ <methods>
+ <exclude name="testObserverDeploymentProblemTreatedAsDeploymentError"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.exceptionInAfterBeanDiscoveryObserver.AfterBeanDiscoveryObserverExecutionFailureTest">
+ <methods>
+ <exclude name="testObserverFailureTreatedAsDefinitionError"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.exceptionInAfterBeanValidationObserver.AfterDeploymentValidationObserverExecutionFailureTest">
+ <methods>
+ <exclude name="testObserverFailureTreatedAsDeploymentError"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: WELD-307. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.passivatingScope.AddingPassivatingScopeTest">
+ <methods>
+ <exclude name="testAddingScopeType"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: CDITCK-56. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.bundledLibrary.LibraryInEarTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.failsDuringBeanDiscovery.DeploymentFailureTest">
+ <methods>
+ <exclude name="testDeploymentFailsBeforeNotifyingObserversAfterBeanDiscovery"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-56. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.simple.definition.SimpleBeanDefinitionTest">
+ <methods>
+ <exclude name="testAbstractClassDeclaredInJavaNotDiscovered"/>
+ <exclude name="testDependentScopedBeanCanHavePublicField"/>
+ <exclude name="testEmptyConstructorUsed"/>
+ <exclude name="testInitializerAnnotatedConstructor"/>
+ <exclude name="testInitializerAnnotatedConstructorUsedOverEmptyConstuctor"/>
+ <exclude name="testInterfaceNotDiscoveredAsSimpleBean"/>
+ <exclude name="testSimpleBeanOnlyIfConstructorIsInitializer"/>
+ <exclude name="testSimpleBeanOnlyIfConstructorParameterless"/>
+ <exclude name="testStaticInnerClassDeclaredInJavaAllowed"/>
+ <exclude name="testNonStaticInnerClassDeclaredInJavaNotDiscovered"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.remove.EnterpriseBeanRemoveMethodTest">
+ <methods>
+ <exclude name="testApplicationMayCallAnyRemoveMethodOnDependentScopedSessionEnterpriseBeans"/>
+ <exclude name="testApplicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.EnterpriseBeanLifecycleTest">
+ <methods>
+ <exclude name="testCreateSFSB"/>
+ <exclude name="testCreateSLSB"/>
+ <exclude name="testDestroyRemovesSFSB"/>
+ <exclude name="testRemovedEjbIgnored"/>
+ <exclude name="testSerializeSFSB"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-79. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise.EnterpriseProducerMethodDefinitionTest">
+ <methods>
+ <exclude name="testNonStaticProducerMethodInheritedBySpecializingSubclass"/>
+ <exclude name="testNonStaticProducerMethodNotInherited"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-80. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext.PersistenceContextDesctructionTest">
+ <methods>
+ <exclude name="testDestructionOfPersistenceContext"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-70.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessAnnotatedTypeEventFiredForFilter"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForJsfManagedBean"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForServlet"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForServletListener"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForTagHandler"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForTagLibraryListener"/>
+ <exclude name="testProcessInjectionTargetEventFiredForJsfManagedBean"/>
+ <exclude name="testProcessInjectionTargetEventFiredForServletListener"/>
+ <exclude name="testProcessInjectionTargetEventFiredForTagLibraryListener"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-76.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.InjectionIntoWebServiceEndPointTest">
+ <methods>
+ <exclude name="testInjectionIntoWebServiceEndpoint"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-77.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessInjectionTargetEventFiredForFilter"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: WELD-317.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.enterprise.SessionBeanInjectionOrderingTest">
+ <methods>
+ <exclude name="testInitializerCalledAfterFieldInjectionOfSuperclass"/>
+ <exclude name="testPostConstructCalledAfterInitializerOfSuperclass"/>
+ </methods>
+ </class>
+ <!--
+ - Inheritance: CDITCK-67/WELD-304. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.EnterpriseBeanSpecializationTest">
+ <methods>
+ <exclude name="testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean"/>
+ <exclude name="testSpecializingBeanHasNameOfSpecializedBean"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise.EnterpriseBeanSpecializationIntegrationTest">
+ <methods>
+ <exclude name="testSpecializedBeanNotInstantiated"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-74. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.event.observer.enterprise.EnterpriseEventInheritenceTest">
+ <methods>
+ <exclude name="testNonStaticObserverMethodNotIndirectlyInherited"/>
+ <exclude name="testNonStaticObserverMethodNotInherited"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-68. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.extensions.observer.broken.definitionError.ProcessObserverMethodErrorTest">
+ <methods>
+ <exclude name="testAddDefinitionError"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.extensions.observer.broken.exception.ProcessObserverMethodExceptionTest">
+ <methods>
+ <exclude name="testExceptionIsDefinitionError"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-75. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.event.observer.transactional.TransactionalObserversTest">
+ <methods>
+ <exclude name="testAfterTransactionCompletionObserver"/>
+ <exclude name="testAfterTransactionFailureObserver"/>
+ <exclude name="testAfterTransactionSuccessObserver"/>
+ <exclude name="testAfterTransactionCompletionObserver"/>
+ <exclude name="testObserverCanSetRollbackOnlyOnTransaction"/>
+ <exclude name="testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress"/>
+ </methods>
+ </class>
+ <!--
+ - Extensions: CDITCK-78. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.extensions.container.event.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessInjectionTargetFiredForSessionBean"/>
+ <exclude name="testProcessManagedBeanFired"/>
+ <exclude name="testGetSessionBeanType"/>
+ <exclude name="testProcessAnnotatedTypeFiredForSessionBean"/>
+ <exclude name="testProcessSessionBeanFiredForStatelessSessionBean"/>
+ <exclude name="testTypeOfProcessInjectionTargetParameter"/>
+ <exclude name="testProcessInjectionTargetFiredForSessionBeanInterceptor"/>
+ <exclude name="testProcessSessionBeanFiredForStatefulSessionBean"/>
+ <exclude name="testGetEJBName"/>
+ <exclude name="testProcessInjectionTargetFiredForManagedBean"/>
+ <exclude name="testProcessAnnotatedTypeFiredForSessionBeanInterceptor"/>
+ </methods>
+ </class>
+ <!--
+ - Test waived until 1.0.1 release of TCK.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.newBean.NewEnterpriseBeanICTest">
+ <methods>
+ <exclude name="testNewBeanHasSameConstructor"/>
+ </methods>
+ </class>
+ <!--
+ - Test waived until 1.0.1 release of TCK.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.definition.EnterpriseBeanDefinitionTest">
+ <methods>
+ <exclude name="testConstructorAnnotatedInjectCalled"/>
+ </methods>
+ </class>
+ <!--
+ - Test waived until 1.0.1 release of TCK.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.InjectionIntoNonContextualComponentTest">
+ <methods>
+ <exclude name="testInjectionIntoJSFManagedBean"/>
+ </methods>
+ </class>
+ </classes>
+ </test>
+</suite>
Property changes on: cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current-ee.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current.xml
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current.xml (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current.xml 2009-12-04 14:52:43 UTC (rev 5214)
@@ -0,0 +1,234 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<suite name="JSR-299 TCK with confirmed test challenges excluded" verbose="0">
+ <test name="JSR-299 TCK">
+ <method-selectors>
+ <method-selector>
+ <selector-class name="org.jboss.testharness.impl.testng.DisableIntegrationTestsMethodSelector"/>
+ </method-selector>
+ </method-selectors>
+ <groups>
+ <run>
+ <!-- Don't require licensees to pass tests which are known not working. Confirmed correct -->
+ <exclude name="broken"/>
+ </run>
+ </groups>
+ <packages>
+ <!--
+ - To run a single package, specify its name here,
+ - uncomment the exclude classes for it below (if any)
+ - and comment the exclude classes for all other
+ - packages to avoid accidental inclusions.
+ -->
+ <package name="org.jboss.jsr299.tck.tests.*"/>
+ </packages>
+ <!-- Excludes list -->
+ <classes>
+ <!--
+ - Definition: CDITCK-57. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.definition.bean.custom.CustomBeanImplementationTest">
+ <methods>
+ <exclude name="testGetStereotypesCalled"/>
+ <exclude name="testIsNullableCalled"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.context.passivating.PassivatingContextTest">
+ <methods>
+ <exclude name="testInjectionOfDependentPrimitiveProductIntoNormalBean"/>
+ <exclude name="testInjectionOfDependentSerializableProductIntoNormalBean"/>
+ <exclude name="testNonSerializableProducerFieldDeclaredPassivatingThrowsIllegalProductException"/>
+ <exclude name="testPassivatingScopeProducerMethodReturnsUnserializableObjectNotOk"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-60. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.context.application.ejb.ApplicationContextSharedTest">
+ <methods>
+ <exclude name="testApplicationContextShared"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.context.application.ejb.EJBApplicationContextTest">
+ <methods>
+ <exclude name="testApplicationScopeActiveDuringCallToEjbTimeoutMethod"/>
+ <exclude name="testApplicationScopeActiveDuringWebServiceInvocation"/>
+ </methods>
+ </class>
+ <!--
+ - Context: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.remove.EnterpriseBeanRemoveMethodTest">
+ <methods>
+ <exclude name="testApplicationMayCallAnyRemoveMethodOnDependentScopedSessionEnterpriseBeans"/>
+ <exclude name="testApplicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: CDITCK-61. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.installedLibrary.WarInstalledLibraryTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.installedLibrary.EarInstalledLibraryTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <!--
+ - Deployment: CDITCK-56. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.deployment.packaging.bundledLibrary.LibraryInEarTest">
+ <methods>
+ <exclude name="test"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.deployment.lifecycle.broken.failsDuringBeanDiscovery.DeploymentFailureTest">
+ <methods>
+ <exclude name="testDeploymentFailsBeforeNotifyingObserversAfterBeanDiscovery"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-56. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.simple.definition.SimpleBeanDefinitionTest">
+ <methods>
+ <exclude name="testAbstractClassDeclaredInJavaNotDiscovered"/>
+ <exclude name="testDependentScopedBeanCanHavePublicField"/>
+ <exclude name="testEmptyConstructorUsed"/>
+ <exclude name="testInitializerAnnotatedConstructor"/>
+ <exclude name="testInitializerAnnotatedConstructorUsedOverEmptyConstuctor"/>
+ <exclude name="testInterfaceNotDiscoveredAsSimpleBean"/>
+ <exclude name="testSimpleBeanOnlyIfConstructorIsInitializer"/>
+ <exclude name="testSimpleBeanOnlyIfConstructorParameterless"/>
+ <exclude name="testStaticInnerClassDeclaredInJavaAllowed"/>
+ <exclude name="testNonStaticInnerClassDeclaredInJavaNotDiscovered"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-59. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.remove.EnterpriseBeanRemoveMethodTest">
+ <methods>
+ <exclude name="testApplicationMayCallAnyRemoveMethodOnDependentScopedSessionEnterpriseBeans"/>
+ <exclude name="testApplicationMayCallRemoveMethodOnDependentScopedSessionEnterpriseBeansButNoParametersArePassed"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.EnterpriseBeanLifecycleTest">
+ <methods>
+ <exclude name="testCreateSFSB"/>
+ <exclude name="testCreateSLSB"/>
+ <exclude name="testDestroyRemovesSFSB"/>
+ <exclude name="testRemovedEjbIgnored"/>
+ <exclude name="testSerializeSFSB"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-79. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.producer.method.definition.enterprise.EnterpriseProducerMethodDefinitionTest">
+ <methods>
+ <exclude name="testNonStaticProducerMethodInheritedBySpecializingSubclass"/>
+ <exclude name="testNonStaticProducerMethodNotInherited"/>
+ </methods>
+ </class>
+ <!--
+ - Implementation: CDITCK-80. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext.PersistenceContextDesctructionTest">
+ <methods>
+ <exclude name="testDestructionOfPersistenceContext"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-70.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessAnnotatedTypeEventFiredForFilter"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForJsfManagedBean"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForServlet"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForServletListener"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForTagHandler"/>
+ <exclude name="testProcessAnnotatedTypeEventFiredForTagLibraryListener"/>
+ <exclude name="testProcessInjectionTargetEventFiredForJsfManagedBean"/>
+ <exclude name="testProcessInjectionTargetEventFiredForServletListener"/>
+ <exclude name="testProcessInjectionTargetEventFiredForTagLibraryListener"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-76.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ws.InjectionIntoWebServiceEndPointTest">
+ <methods>
+ <exclude name="testInjectionIntoWebServiceEndpoint"/>
+ </methods>
+ </class>
+ <!--
+ - Lookup: CDITCK-77.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.lookup.injection.non.contextual.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessInjectionTargetEventFiredForFilter"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-74. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.event.observer.enterprise.EnterpriseEventInheritenceTest">
+ <methods>
+ <exclude name="testNonStaticObserverMethodNotIndirectlyInherited"/>
+ <exclude name="testNonStaticObserverMethodNotInherited"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-68. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.extensions.observer.broken.definitionError.ProcessObserverMethodErrorTest">
+ <methods>
+ <exclude name="testAddDefinitionError"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.extensions.observer.broken.exception.ProcessObserverMethodExceptionTest">
+ <methods>
+ <exclude name="testExceptionIsDefinitionError"/>
+ </methods>
+ </class>
+ <!--
+ - Event: CDITCK-75. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.event.observer.transactional.TransactionalObserversTest">
+ <methods>
+ <exclude name="testAfterTransactionCompletionObserver"/>
+ <exclude name="testAfterTransactionFailureObserver"/>
+ <exclude name="testAfterTransactionSuccessObserver"/>
+ <exclude name="testAfterTransactionCompletionObserver"/>
+ <exclude name="testObserverCanSetRollbackOnlyOnTransaction"/>
+ <exclude name="testTransactionalObserverNotifiedImmediatelyWhenNoTransactionInProgress"/>
+ </methods>
+ </class>
+ <!--
+ - Extensions: CDITCK-78. Confirmed.
+ -->
+ <class name="org.jboss.jsr299.tck.tests.extensions.container.event.ContainerEventTest">
+ <methods>
+ <exclude name="testProcessInjectionTargetFiredForSessionBean"/>
+ <exclude name="testProcessManagedBeanFired"/>
+ <exclude name="testGetSessionBeanType"/>
+ <exclude name="testProcessAnnotatedTypeFiredForSessionBean"/>
+ <exclude name="testProcessSessionBeanFiredForStatelessSessionBean"/>
+ <exclude name="testTypeOfProcessInjectionTargetParameter"/>
+ <exclude name="testProcessInjectionTargetFiredForSessionBeanInterceptor"/>
+ <exclude name="testProcessSessionBeanFiredForStatefulSessionBean"/>
+ <exclude name="testGetEJBName"/>
+ <exclude name="testProcessInjectionTargetFiredForManagedBean"/>
+ <exclude name="testProcessAnnotatedTypeFiredForSessionBeanInterceptor"/>
+ </methods>
+ </class>
+ </classes>
+ </test>
+</suite>
Property changes on: cdi-tck/branches/1.0/impl/src/main/resources/tck-tests-current.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 2 months