Weld SVN: r5990 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor and 7 other directories.
by weld-commits@lists.jboss.org
Author: oskutka(a)redhat.com
Date: 2010-03-03 08:10:45 -0500 (Wed, 03 Mar 2010)
New Revision: 5990
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelInterceptorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelInterceptorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelInterceptorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelInterceptorTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FooBinding.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/MissileInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/BusinessMethodBinding.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/InterceptorForLifecycleTargetMethodTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/LifecycleInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/MissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/GuidedMissile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/LockInterceptor.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/beans.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/beans.xml
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/MultipleInterceptorBindingsTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/beans.xml
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Extending test cases for interceptors
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelInterceptorTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelInterceptorTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+@IntegrationTest
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class FinalClassClassLevelInterceptorTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "9.3", id = "ca")
+ public void testFinalClassWithClassLevelInterceptor() throws Exception
+ {
+ assert false;
+/* MissileInterceptor.intercepted = false;
+
+ FinalClassMissileLocal missile = getInstanceByType(FinalClassMissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;*/
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Stateful;
+
+@Stateful
+@FooBinding
+public final class FinalClassClassLevelMissile implements FinalClassClassLevelMissileLocal
+{
+ public void fire() {}
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassClassLevelMissileLocal.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Local;
+
+@Local
+public interface FinalClassClassLevelMissileLocal
+{
+ void fire();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelInterceptorTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelInterceptorTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+@IntegrationTest
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class FinalClassMethodLevelInterceptorTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "9.3", id = "da")
+ public void testFinalClassWithMethodLevelInterceptor() throws Exception
+ {
+ assert false;
+/* MissileInterceptor.intercepted = false;
+
+ FinalClassMethodLevelMissileLocal missile = getInstanceByType(FinalClassMethodLevelMissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;*/
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public final class FinalClassMethodLevelMissile implements FinalClassMethodLevelMissileLocal
+{
+ @FooBinding
+ public void fire() {}
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalClassMethodLevelMissileLocal.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Local;
+
+@Local
+public interface FinalClassMethodLevelMissileLocal
+{
+ void fire();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelInterceptorTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelInterceptorTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+@IntegrationTest
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class FinalMethodClassLevelInterceptorTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "9.3", id = "cb")
+ public void testFinalMethodWithClassLevelInterceptor() throws Exception
+ {
+ assert false;
+/* MissileInterceptor.intercepted = false;
+
+ FinalMethodMissileLocal missile = getInstanceByType(FinalMethodMissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;*/
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Stateful;
+
+@Stateful
+@FooBinding
+public class FinalMethodClassLevelMissile implements FinalMethodClassLevelMissileLocal
+{
+ public void fire() {}
+
+ public final void finalManeuver() {}
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodClassLevelMissileLocal.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Local;
+
+@Local
+public interface FinalMethodClassLevelMissileLocal
+{
+ void fire();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelInterceptorTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelInterceptorTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+@IntegrationTest
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class FinalMethodMethodLevelInterceptorTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "9.3", id = "db")
+ public void testFinalMethodWithMethodLevelInterceptor() throws Exception
+ {
+ assert false;
+/* MissileInterceptor.intercepted = false;
+
+ FinalMethodMethodLevelMissileLocal missile = getInstanceByType(FinalMethodMethodLevelMissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;*/
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class FinalMethodMethodLevelMissile implements FinalMethodMethodLevelMissileLocal
+{
+ @FooBinding
+ public final void fire() {}
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FinalMethodMethodLevelMissileLocal.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import javax.ejb.Local;
+
+@Local
+public interface FinalMethodMethodLevelMissileLocal
+{
+ void fire();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FooBinding.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FooBinding.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/FooBinding.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@Target( { TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+@InterceptorBinding
+@interface FooBinding
+{
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/MissileInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/MissileInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/MissileInterceptor.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @FooBinding
+public class MissileInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ return ctx.proceed();
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/BusinessMethodBinding.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/BusinessMethodBinding.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/BusinessMethodBinding.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+@Target( { TYPE , METHOD })
+@Retention(RUNTIME)
+@Documented
+@InterceptorBinding
+public @interface BusinessMethodBinding
+{
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/InterceptorForLifecycleTargetMethodTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/InterceptorForLifecycleTargetMethodTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/InterceptorForLifecycleTargetMethodTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentFailure;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)ExpectedDeploymentException(DeploymentFailure.class)
+@IntegrationTest
+@BeansXml("beans.xml")
+(a)Packaging(PackagingType.EAR)
+public class InterceptorForLifecycleTargetMethodTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "9.2", id = "d")
+ public void testInterceptorForLifecycleTargetMethod() throws Exception
+ {
+ assert false;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/LifecycleInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/LifecycleInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/LifecycleInterceptor.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @BusinessMethodBinding
+public class LifecycleInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+
+ @PostConstruct
+ public void postConstruct(InvocationContext ctx) {
+ intercepted = true;
+ try
+ {
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static boolean isIntercepted()
+ {
+ return intercepted;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/Missile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/Missile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/Missile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod;
+
+import javax.ejb.Stateful;
+
+@Stateful
+@BusinessMethodBinding
+public class Missile implements MissileLocal
+{
+ public void fire() {}
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/MissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/MissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/MissileLocal.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod;
+
+import javax.ejb.Local;
+
+@Local
+public interface MissileLocal
+{
+ void fire();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/GuidedMissile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/GuidedMissile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/GuidedMissile.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.multipleBindings;
+
+public class GuidedMissile implements Missile
+{
+ @Slow @Deadly
+ public void lockAndFire()
+ {
+ }
+
+ @Fast @Deadly
+ public void fire()
+ {
+ }
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/LockInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/LockInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/LockInterceptor.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.interceptors.definition.multipleBindings;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @Slow @Deadly
+class LockInterceptor
+{
+ public static boolean intercepted = false;
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ return ctx.proceed();
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/MultipleInterceptorBindingsTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/MultipleInterceptorBindingsTest.java 2010-03-02 23:11:32 UTC (rev 5989)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/MultipleInterceptorBindingsTest.java 2010-03-03 13:10:45 UTC (rev 5990)
@@ -32,7 +32,9 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "9.5.1", id = "a"),
- @SpecAssertion(section = "9.5", id = "ca")
+ @SpecAssertion(section = "9.5", id = "ca"),
+ @SpecAssertion(section = "9.2", id = "ab"),
+ @SpecAssertion(section = "9.3", id = "ba")
})
public void testInterceptorAppliedToBeanWithAllBindings()
{
@@ -55,4 +57,20 @@
assert !MissileInterceptor.intercepted;
}
+
+ @Test
+ @SpecAssertion(section = "9.3", id = "bb")
+ public void testMultipleInterceptorsOnMethod()
+ {
+ LockInterceptor.intercepted = false;
+
+ GuidedMissile bullet = getInstanceByType(GuidedMissile.class);
+
+ bullet.fire();
+ assert !LockInterceptor.intercepted;
+
+ bullet.lockAndFire();
+ assert LockInterceptor.intercepted;
+ }
+
}
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/finalClassInterceptor/beans.xml 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.broken.finalClassInterceptor.MissileInterceptor</class>
+ </interceptors>
+</beans>
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorForLifecycleTargetMethod/beans.xml 2010-03-03 13:10:45 UTC (rev 5990)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.broken.interceptorForLifecycleTargetMethod.LifecycleInterceptor</class>
+ </interceptors>
+</beans>
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/beans.xml 2010-03-02 23:11:32 UTC (rev 5989)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/multipleBindings/beans.xml 2010-03-03 13:10:45 UTC (rev 5990)
@@ -1,5 +1,6 @@
<beans>
<interceptors>
<class>org.jboss.jsr299.tck.tests.interceptors.definition.multipleBindings.MissileInterceptor</class>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.multipleBindings.LockInterceptor</class>
</interceptors>
</beans>
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2010-03-02 23:11:32 UTC (rev 5989)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2010-03-03 13:10:45 UTC (rev 5990)
@@ -4579,17 +4579,47 @@
<text>An interceptor binding may be declared by annotating the bean class, or a method of the bean class, with the interceptor binding type.</text>
</assertion>
- <assertion id="b">
+ <group>
<text>A bean class or method of a bean class may declare multiple interceptor bindings.</text>
- </assertion>
+ <assertion id="ba">
+ <text>A bean class may declare multiple interceptor bindings.</text>
+ </assertion>
+ <assertion id="bb">
+ <text>A method of a bean class may declare multiple interceptor bindings.</text>
+ </assertion>
+ </group>
- <assertion id="c">
+ <group>
<text>If the bean class of a managed bean declares or inherits a class level interceptor binding or a stereotype with interceptor bindings, it must not be declared final, or have any non-static, non-private, final methods. If a managed bean has a class-level interceptor binding and is declared final or has a non-static, non-private, final method, the container automatically detects the problem and treats it as a definition error.</text>
- </assertion>
+ <assertion id="ca">
+ <text>If the bean class of a managed bean declares a class level interceptor binding, it must not be declared final.</text>
+ </assertion>
+ <assertion id="cb">
+ <text>If the bean class of a managed bean declares a class level interceptor binding, it must not have any non-static, non-private, final methods.</text>
+ </assertion>
+ <assertion id="cc">
+ <text>If the bean class of a managed bean inherits a class level interceptor binding, it must not be declared final.</text>
+ </assertion>
+ <assertion id="cd">
+ <text>If the bean class of a managed bean inherits a class level interceptor binding, it must not have any non-static, non-private, final methods.</text>
+ </assertion>
+ <assertion id="ce">
+ <text>If the bean class of a managed bean inherits a stereotype with interceptor bindings, it must not be declared final.</text>
+ </assertion>
+ <assertion id="cf">
+ <text>If the bean class of a managed bean inherits a stereotype with interceptor bindings, it must not have any non-static, non-private, final methods.</text>
+ </assertion>
+ </group>
- <assertion id="d">
+ <group>
<text>If a non-static, non-private method of a bean class of a managed bean declares a method level interceptor binding, neither the method nor the bean class may be declared final. If a non-static, non-private, final method of a managed bean has a method level interceptor binding, the container automatically detects the problem and treats it as a definition error.</text>
- </assertion>
+ <assertion id="da">
+ <text>If a non-static, non-private method of a bean class of a managed bean declares a method level interceptor binding, the bean class may not be declared final.</text>
+ </assertion>
+ <assertion id="db">
+ <text>If a non-static, non-private method of a bean class of a managed bean declares a method level interceptor binding, the method may not be declared final.</text>
+ </assertion>
+ </group>
</section>
<section id="9.4" title="Interceptor enablement and ordering">
14 years, 10 months
Weld SVN: r5989 - in extensions/trunk: genericbeans and 21 other directories.
by weld-commits@lists.jboss.org
Author: swd847
Date: 2010-03-02 18:11:32 -0500 (Tue, 02 Mar 2010)
New Revision: 5989
Added:
extensions/trunk/genericbeans/
extensions/trunk/genericbeans/pom.xml
extensions/trunk/genericbeans/src/
extensions/trunk/genericbeans/src/main/
extensions/trunk/genericbeans/src/main/java/
extensions/trunk/genericbeans/src/main/java/org/
extensions/trunk/genericbeans/src/main/java/org/jboss/
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/FieldSetter.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericAnnotation.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectConfiguration.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectGeneric.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectLiteral.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java
extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/SyntheticQualifier.java
extensions/trunk/genericbeans/src/main/resources/
extensions/trunk/genericbeans/src/main/resources/META-INF/
extensions/trunk/genericbeans/src/main/resources/META-INF/services/
extensions/trunk/genericbeans/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
extensions/trunk/genericbeans/src/test/
extensions/trunk/genericbeans/src/test/java/
extensions/trunk/genericbeans/src/test/java/org/
extensions/trunk/genericbeans/src/test/java/org/jboss/
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/AbstractTest.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericBeanTest.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericDep.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericMain.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericProducer.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/InjectedBean.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/SomeQualifier.java
extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/TestAnnotation.java
extensions/trunk/genericbeans/src/test/resources/
extensions/trunk/genericbeans/src/test/resources/META-INF/
extensions/trunk/genericbeans/src/test/resources/META-INF/beans.xml
extensions/trunk/genericbeans/src/test/resources/META-INF/services/
Modified:
extensions/trunk/pom.xml
Log:
Commiting initial generic beans implementation
Added: extensions/trunk/genericbeans/pom.xml
===================================================================
--- extensions/trunk/genericbeans/pom.xml (rev 0)
+++ extensions/trunk/genericbeans/pom.xml 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!--
+ <parent>
+ <artifactId>weld-extensions-parent</artifactId>
+ <groupId>org.jboss.weld</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions-genericbeans</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ <name>Weld Generic Beans</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>1.0.1-Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-se</artifactId>
+ <version>1.0.1-Final</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <type>jar</type>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <workspace>${basedir}</workspace>
+
+ <downloadJavadocs>true</downloadJavadocs>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/weld/extensions/trunk/genericbeans</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/extensions/trunk/genericbeans</developerConnection>
+ <url>http://fisheye.jboss.org/browse/weld/extensions/trunk/genericbeans</url>
+ </scm>
+</project>
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/FieldSetter.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/FieldSetter.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/FieldSetter.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,58 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.reflect.Field;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+/**
+ * Class that is responsible for setting the values of generic producer fields
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+public class FieldSetter
+{
+ final Field field;
+ final SyntheticQualifier qualifier;
+ final BeanManager beanManager;
+
+ public FieldSetter(BeanManager beanManager, Field field, SyntheticQualifier qualifier)
+ {
+ this.field = field;
+ this.qualifier = qualifier;
+ this.beanManager = beanManager;
+ field.setAccessible(true);
+ }
+
+ public void set(Object instance, CreationalContext<?> ctx)
+ {
+ Set<Bean<?>> beans = beanManager.getBeans(field.getType(), qualifier);
+ if (beans.size() == 0)
+ {
+ throw new RuntimeException("Could not resolve bean for Generic Producer field " + field.getDeclaringClass() + "." + field.getName());
+ }
+ if (beans.size() > 1)
+ {
+ throw new RuntimeException("More than 1 bean resolved for Generic Producer field " + field.getDeclaringClass() + "." + field.getName());
+ }
+ Bean bean = beans.iterator().next();
+ Object dep = beanManager.getReference(bean, field.getType(), ctx);
+ try
+ {
+ field.set(instance, dep);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/Generic.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,19 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a generic bean
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE })
+public @interface Generic
+{
+ Class value();
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericAnnotation.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericAnnotation.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericAnnotation.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,20 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Must be applied to any annotation that is used as a value in @Generic, this
+ * may not be needed in the future
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.TYPE })
+public @interface GenericAnnotation
+{
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericBeanInjectionTargetWrapper.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,104 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.jboss.weld.extensions.util.reannotated.ReannotatedField;
+import org.jboss.weld.extensions.util.reannotated.ReannotatedType;
+
+/**
+ * injection target wrapper that injects the configuration for generic beans
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ * @param <T>
+ */
+public class GenericBeanInjectionTargetWrapper<T> implements InjectionTarget<T>
+{
+ InjectionTarget<T> delegate;
+ Annotation annotation;
+ ReannotatedType<T> annotatedType;
+
+ public GenericBeanInjectionTargetWrapper(ReannotatedType<T> annotatedType, InjectionTarget<T> delegate, Annotation annotation)
+ {
+ this.annotation = annotation;
+ this.delegate = delegate;
+ this.annotatedType = annotatedType;
+ }
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
+ for (Field f : getFields(instance.getClass()))
+ {
+
+ if (annotation.annotationType().isAssignableFrom(f.getType()))
+ {
+ ReannotatedField<? super T> reannotatedField = annotatedType.getField(f);
+ if (reannotatedField.isAnnotationPresent(InjectConfiguration.class))
+ {
+ try
+ {
+ f.setAccessible(true);
+ f.set(instance, annotation);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ delegate.inject(instance, ctx);
+ }
+
+ public void postConstruct(T instance)
+ {
+ delegate.postConstruct(instance);
+ }
+
+ public void preDestroy(T instance)
+ {
+ delegate.preDestroy(instance);
+ }
+
+ public void dispose(T instance)
+ {
+ delegate.dispose(instance);
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegate.getInjectionPoints();
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return delegate.produce(ctx);
+ }
+
+ public static Set<Field> getFields(Class clazz)
+ {
+ Set<Field> ret = new HashSet<Field>();
+ return getFields(clazz, ret);
+ }
+
+ private static Set<Field> getFields(Class clazz, Set<Field> ret)
+ {
+ ret.addAll(Arrays.asList(clazz.getDeclaredFields()));
+ Class n = clazz.getSuperclass();
+ if (n != Object.class)
+ {
+ return getFields(n);
+ }
+ return ret;
+ }
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,191 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
+import org.jboss.weld.extensions.util.BeanImpl;
+import org.jboss.weld.extensions.util.reannotated.ReannotatedField;
+import org.jboss.weld.extensions.util.reannotated.ReannotatedParameter;
+import org.jboss.weld.extensions.util.reannotated.ReannotatedType;
+
+public class GenericExtension implements Extension
+{
+
+ AnnotationInstanceProvider annotationProvider = new AnnotationInstanceProvider();
+
+ Map<Class<?>, Set<AnnotatedType<?>>> genericBeans = new HashMap<Class<?>, Set<AnnotatedType<?>>>();
+
+ Map<Class<?>, Map<AnnotatedField<?>, Annotation>> producerFields = new HashMap<Class<?>, Map<AnnotatedField<?>, Annotation>>();
+
+ /**
+ * map of a generic annotation type to all instances of that type found on
+ * beans
+ */
+ Map<Class<?>, Set<Annotation>> concreteGenerics = new HashMap<Class<?>, Set<Annotation>>();
+
+ /**
+ * Map of generic Annotation instance to a SyntheticQualifier
+ */
+ Map<Annotation, SyntheticQualifier> qualifierMap = new HashMap<Annotation, SyntheticQualifier>();
+
+ long count = 0;
+
+ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+ {
+ event.addQualifier(SyntheticQualifier.class);
+ }
+
+ public void processAnnotatedType(@Observes ProcessAnnotatedType<?> event)
+ {
+ AnnotatedType<?> type = event.getAnnotatedType();
+ if (type.isAnnotationPresent(Generic.class))
+ {
+ Generic an = type.getAnnotation(Generic.class);
+ if (!genericBeans.containsKey(an.value()))
+ {
+ genericBeans.put(an.value(), new HashSet<AnnotatedType<?>>());
+ }
+ genericBeans.get(an.value()).add(type);
+ // we will install this bean later
+ event.veto();
+
+ }
+
+ for (Object f : type.getFields())
+ {
+ AnnotatedField<?> field = (AnnotatedField<?>) f;
+ if (field.isAnnotationPresent(Produces.class))
+ {
+ for (Annotation a : field.getAnnotations())
+ {
+ if (a.annotationType().isAnnotationPresent(GenericAnnotation.class))
+ {
+ if (!producerFields.containsKey(type.getJavaClass()))
+ {
+ producerFields.put(type.getJavaClass(), new HashMap<AnnotatedField<?>, Annotation>());
+ }
+ if (!concreteGenerics.containsKey(a.annotationType()))
+ {
+ concreteGenerics.put(a.annotationType(), new HashSet<Annotation>());
+ }
+ producerFields.get(type.getJavaClass()).put(field, a);
+ concreteGenerics.get(a.annotationType()).add(a);
+ }
+ }
+ }
+ }
+ }
+
+ public <T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> event, BeanManager beanManager)
+ {
+ Class javaClass = event.getAnnotatedType().getJavaClass();
+ if (producerFields.containsKey(javaClass))
+ {
+ Map<AnnotatedField<?>, Annotation> producers = producerFields.get(javaClass);
+ List<FieldSetter> setters = new ArrayList<FieldSetter>();
+ for (AnnotatedField<?> a : producers.keySet())
+ {
+ SyntheticQualifier qual = this.getQualifierForGeneric(producers.get(a));
+ FieldSetter f = new FieldSetter(beanManager, a.getJavaMember(), qual);
+ setters.add(f);
+ }
+ ProducerFieldInjectionTarget<T> it = new ProducerFieldInjectionTarget<T>(event.getInjectionTarget(), setters);
+ event.setInjectionTarget(it);
+ }
+ }
+
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+ {
+ for (Entry<Class<?>, Set<AnnotatedType<?>>> i : genericBeans.entrySet())
+ {
+ Set<Annotation> concretes = concreteGenerics.get(i.getKey());
+ if (concretes != null)
+ {
+ for (AnnotatedType<?> at : i.getValue())
+ {
+ for (Annotation conc : concretes)
+ {
+ final SyntheticQualifier newQualifier = getQualifierForGeneric(conc);
+ ReannotatedType<?> rt = new ReannotatedType(at);
+
+ rt.define(newQualifier);
+ for (AnnotatedField<?> f : rt.getFields())
+ {
+ ReannotatedField<?> field = (ReannotatedField<?>) f;
+ if (field.isAnnotationPresent(InjectGeneric.class))
+ {
+ field.define(newQualifier);
+ field.define(new InjectLiteral());
+ }
+ else if (field.isAnnotationPresent(Inject.class))
+ {
+ //if this is a configuration injection point
+ if (conc.annotationType().isAssignableFrom(field.getJavaMember().getType()))
+ {
+ field.undefine(Inject.class);
+ field.define(new AnnotationLiteral<InjectConfiguration>()
+ {
+ });
+ }
+ }
+ }
+ for (AnnotatedMethod<?> m : rt.getMethods())
+ {
+ for (AnnotatedParameter<?> a : m.getParameters())
+ {
+ ReannotatedParameter<?> param = (ReannotatedParameter<?>) a;
+ if (param.isAnnotationPresent(InjectGeneric.class))
+ {
+ param.define(newQualifier);
+ param.define(new InjectLiteral());
+ }
+ }
+ }
+ InjectionTarget<?> it = beanManager.createInjectionTarget(rt);
+
+ it = new GenericBeanInjectionTargetWrapper(rt, it, conc);
+ BeanImpl<?> bean = new BeanImpl(it, rt);
+ event.addBean(bean);
+
+ }
+ }
+ }
+ }
+
+ }
+
+ public SyntheticQualifier getQualifierForGeneric(Annotation a)
+ {
+ if (!qualifierMap.containsKey(a))
+ {
+ SyntheticQualifier qualifier = (SyntheticQualifier) annotationProvider.get(SyntheticQualifier.class, (Map) Collections.singletonMap("value", count++));
+ qualifierMap.put(a, qualifier);
+ }
+ return qualifierMap.get(a);
+ }
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectConfiguration.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectConfiguration.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectConfiguration.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,15 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * synthetic qualifier that is added to Generic beans to signify configuration annotation injection points
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface InjectConfiguration
+{
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectGeneric.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectGeneric.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectGeneric.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,20 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * used to mark where a generic bean should be inejcted in place of the normal
+ * @Inject, this may not be required in the future
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.FIELD, ElementType.PARAMETER })
+public @interface InjectGeneric
+{
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectLiteral.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectLiteral.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/InjectLiteral.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,9 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+{
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/ProducerFieldInjectionTarget.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,62 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * injection target wrapper used for beans that have generic producer fields
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ * @param <T>
+ */
+public class ProducerFieldInjectionTarget<T> implements InjectionTarget<T>
+{
+ final InjectionTarget<T> delegate;
+ final List<FieldSetter> fieldSetters;
+
+ public ProducerFieldInjectionTarget(InjectionTarget<T> delegate, List<FieldSetter> fieldSetters)
+ {
+ this.delegate = delegate;
+ this.fieldSetters = fieldSetters;
+ }
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
+ for (FieldSetter f : fieldSetters)
+ {
+ f.set(instance, ctx);
+ }
+ delegate.inject(instance, ctx);
+ }
+
+ public void postConstruct(T instance)
+ {
+ delegate.postConstruct(instance);
+ }
+
+ public void preDestroy(T instance)
+ {
+ delegate.preDestroy(instance);
+ }
+
+ public void dispose(T instance)
+ {
+ delegate.dispose(instance);
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return delegate.getInjectionPoints();
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return delegate.produce(ctx);
+ }
+
+}
Added: extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/SyntheticQualifier.java
===================================================================
--- extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/SyntheticQualifier.java (rev 0)
+++ extensions/trunk/genericbeans/src/main/java/org/jboss/weld/extensions/genericbeans/SyntheticQualifier.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,21 @@
+package org.jboss.weld.extensions.genericbeans;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+/**
+ * qualifier that is added to Generic beans to that the correct one is injected
+ *
+ * @author Stuart Douglas <stuart(a)baileyroberts.com.au>
+ *
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+// even though this is not in a bean archive this is still needed to make
+// BeanImpl work
+@Qualifier
+public @interface SyntheticQualifier
+{
+ long value();
+}
Added: extensions/trunk/genericbeans/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
===================================================================
--- extensions/trunk/genericbeans/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (rev 0)
+++ extensions/trunk/genericbeans/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1 @@
+org.jboss.weld.extensions.genericbeans.GenericExtension
\ No newline at end of file
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/AbstractTest.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/AbstractTest.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/AbstractTest.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,59 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.environment.se.Weld;
+import org.jboss.weld.environment.se.WeldContainer;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+public class AbstractTest
+{
+
+ protected BeanManager manager;
+
+ Weld weld;
+
+ protected void preBootstrap()
+ {
+ }
+
+ @BeforeClass
+ public void setup()
+ {
+ weld = new Weld();
+ WeldContainer container = weld.initialize();
+ manager = container.getBeanManager();
+ }
+
+ @AfterClass
+ public void teardown()
+ {
+ weld.shutdown();
+ }
+
+ public <T> T getReference(Class<T> clazz, Annotation... bindings)
+ {
+ Set<Bean<?>> beans = manager.getBeans(clazz, bindings);
+ if (beans.isEmpty())
+ {
+ throw new RuntimeException("No bean found with class: " + clazz + " and bindings " + bindings.toString());
+ }
+ else if (beans.size() != 1)
+ {
+ StringBuilder bs = new StringBuilder("[");
+ for (Annotation a : bindings)
+ {
+ bs.append(a.toString() + ",");
+ }
+ bs.append("]");
+ throw new RuntimeException("More than one bean found with class: " + clazz + " and bindings " + bs);
+ }
+ Bean bean = beans.iterator().next();
+ return (T) bean.create(manager.createCreationalContext(bean));
+ }
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericBeanTest.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericBeanTest.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericBeanTest.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,17 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import org.testng.annotations.Test;
+
+public class GenericBeanTest extends AbstractTest
+{
+ @Test
+ public void testGeneric()
+ {
+ InjectedBean bean = getReference(InjectedBean.class);
+ assert bean.main1.getValue().equals("hello1");
+ assert bean.main2.getValue().equals("hello2");
+ assert bean.main1.getNoData() == null;
+ assert bean.main2.getNoData() == null;
+
+ }
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericDep.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericDep.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericDep.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,24 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.genericbeans.Generic;
+
+(a)Generic(TestAnnotation.class)
+public class GenericDep
+{
+ @Inject
+ TestAnnotation data;
+
+ TestAnnotation noData;
+
+ public String getValue()
+ {
+ return data.value();
+ }
+
+ public TestAnnotation getNoData()
+ {
+ return noData;
+ }
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericMain.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericMain.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericMain.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,21 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import org.jboss.weld.extensions.genericbeans.Generic;
+import org.jboss.weld.extensions.genericbeans.InjectGeneric;
+
+(a)Generic(TestAnnotation.class)
+public class GenericMain
+{
+ @InjectGeneric
+ GenericDep dep;
+
+ public String getValue()
+ {
+ return dep.getValue();
+ }
+
+ public TestAnnotation getNoData()
+ {
+ return dep.getNoData();
+ }
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericProducer.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericProducer.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/GenericProducer.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,16 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import javax.enterprise.inject.Produces;
+
+public class GenericProducer
+{
+ @SomeQualifier(1)
+ @Produces
+ @TestAnnotation("hello1")
+ GenericMain main1;
+
+ @SomeQualifier(2)
+ @Produces
+ @TestAnnotation("hello2")
+ GenericMain main2;
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/InjectedBean.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/InjectedBean.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/InjectedBean.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,12 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import javax.inject.Inject;
+
+public class InjectedBean
+{
+ @Inject @SomeQualifier(1)
+ public GenericMain main1;
+
+ @Inject @SomeQualifier(2)
+ public GenericMain main2;
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/SomeQualifier.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/SomeQualifier.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/SomeQualifier.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,13 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Qualifier
+public @interface SomeQualifier
+{
+ int value();
+}
Added: extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/TestAnnotation.java
===================================================================
--- extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/TestAnnotation.java (rev 0)
+++ extensions/trunk/genericbeans/src/test/java/org/jboss/weld/extensions/genericbeans/test/TestAnnotation.java 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,13 @@
+package org.jboss.weld.extensions.genericbeans.test;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.jboss.weld.extensions.genericbeans.GenericAnnotation;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@GenericAnnotation
+public @interface TestAnnotation
+{
+ String value();
+}
Added: extensions/trunk/genericbeans/src/test/resources/META-INF/beans.xml
===================================================================
--- extensions/trunk/genericbeans/src/test/resources/META-INF/beans.xml (rev 0)
+++ extensions/trunk/genericbeans/src/test/resources/META-INF/beans.xml 2010-03-02 23:11:32 UTC (rev 5989)
@@ -0,0 +1,5 @@
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
Modified: extensions/trunk/pom.xml
===================================================================
--- extensions/trunk/pom.xml 2010-03-02 19:40:54 UTC (rev 5988)
+++ extensions/trunk/pom.xml 2010-03-02 23:11:32 UTC (rev 5989)
@@ -8,7 +8,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-parent</artifactId>
- <version>8</version>
+ <version>9</version>
</parent>
<name>Weld Extensions Build Aggregator</name>
@@ -17,6 +17,7 @@
<module>bom</module>
<module>parent</module>
<module>core</module>
+ <module>genericbeans</module>
</modules>
<!-- Minimal metadata -->
14 years, 10 months
Weld SVN: r5988 - examples/trunk/jsf/login/src/main/webapp.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-02 14:40:54 -0500 (Tue, 02 Mar 2010)
New Revision: 5988
Added:
examples/trunk/jsf/login/src/main/webapp/users.xhtml
Modified:
examples/trunk/jsf/login/src/main/webapp/home.xhtml
Log:
start to add persistence to the example
Modified: examples/trunk/jsf/login/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/login/src/main/webapp/home.xhtml 2010-03-02 19:39:11 UTC (rev 5987)
+++ examples/trunk/jsf/login/src/main/webapp/home.xhtml 2010-03-02 19:40:54 UTC (rev 5988)
@@ -12,11 +12,12 @@
<h:outputLabel for="username">Username:</h:outputLabel>
<h:inputText id="username" value="#{credentials.username}"/>
<h:outputLabel for="password">Password:</h:outputLabel>
- <h:inputText id="password" value="#{credentials.password}"/>
+ <h:inputSecret id="password" value="#{credentials.password}"/>
</h:panelGrid>
<h:commandButton id="login" value="Login" action="#{login.login}" rendered="#{!login.loggedIn}"/>
<h:commandButton id="logout" value="Logout" action="#{login.logout}" rendered="#{login.loggedIn}"/>
</h:form>
+ <h:link outcome="/users.xhtml">View users</h:link>
</ui:define>
</ui:composition>
</html>
Added: examples/trunk/jsf/login/src/main/webapp/users.xhtml
===================================================================
--- examples/trunk/jsf/login/src/main/webapp/users.xhtml (rev 0)
+++ examples/trunk/jsf/login/src/main/webapp/users.xhtml 2010-03-02 19:40:54 UTC (rev 5988)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="template.xhtml">
+ <ui:define name="content">
+ <h:messages />
+ <h1>Users</h1>
+ <h:dataTable value="#{users}" var="u">
+ <h:column>
+ <f:facet name="header">
+ Username
+ </f:facet>
+ <h:outputText value="#{u.username}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ Name
+ </f:facet>
+ <h:outputText value="#{u.name}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ Password
+ </f:facet>
+ <h:outputText value="#{u.password}" />
+ </h:column>
+ </h:dataTable>
+ </ui:define>
+</ui:composition>
+</html>
Property changes on: examples/trunk/jsf/login/src/main/webapp/users.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 10 months
Weld SVN: r5987 - in examples/trunk/jsf/login: src/main and 3 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-02 14:39:11 -0500 (Tue, 02 Mar 2010)
New Revision: 5987
Added:
examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Users.java
examples/trunk/jsf/login/src/main/resources/
examples/trunk/jsf/login/src/main/resources/META-INF/
examples/trunk/jsf/login/src/main/resources/META-INF/persistence.xml
examples/trunk/jsf/login/src/main/resources/import.sql
Modified:
examples/trunk/jsf/login/pom.xml
examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Credentials.java
examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Login.java
examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/User.java
Log:
start to add persistence to the example
Modified: examples/trunk/jsf/login/pom.xml
===================================================================
--- examples/trunk/jsf/login/pom.xml 2010-03-02 18:41:14 UTC (rev 5986)
+++ examples/trunk/jsf/login/pom.xml 2010-03-02 19:39:11 UTC (rev 5987)
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -43,12 +44,11 @@
<scope>provided</scope>
</dependency>
- <!--
- <dependency> <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId> <exclusions> <exclusion>
- <groupId>javax.el</groupId> <artifactId>el-api</artifactId>
- </exclusion> </exclusions> </dependency>
- -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
@@ -164,7 +164,7 @@
<connection>scm:svn:http://anonsvn.jboss.org/repos/weld/examples/trunk/jsf/login</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/weld/examples/trunk/jsf/login</developerConnection>
<url>http://fisheye.jboss.org/browse/weld/examples/trunk/jsf/login</url>
- </scm>
+ </scm>
</project>
Modified: examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Credentials.java
===================================================================
--- examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Credentials.java 2010-03-02 18:41:14 UTC (rev 5986)
+++ examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Credentials.java 2010-03-02 19:39:11 UTC (rev 5987)
@@ -1,21 +1,36 @@
package org.jboss.weld.examples.login;
-import java.io.Serializable;
-
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Default;
import javax.inject.Named;
-@RequestScoped @Named @Default
-public class Credentials implements Serializable {
-
- private String username;
- private String password;
-
- public String getUsername() { return username; }
- public void setUsername(String username) { this.username = username; }
-
- public String getPassword() { return password; }
- public void setPassword(String password) { this.password = password; }
-
+@RequestScoped
+@Named
+@Default
+public class Credentials
+{
+
+ private String username;
+ private String password;
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
}
\ No newline at end of file
Modified: examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Login.java
===================================================================
--- examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Login.java 2010-03-02 18:41:14 UTC (rev 5986)
+++ examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Login.java 2010-03-02 19:39:11 UTC (rev 5987)
@@ -1,7 +1,6 @@
package org.jboss.weld.examples.login;
import java.io.Serializable;
-import java.util.Arrays;
import java.util.List;
import javax.enterprise.context.SessionScoped;
@@ -10,46 +9,54 @@
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
-@SessionScoped @Named
-public class Login implements Serializable {
+@SessionScoped
+@Named
+public class Login implements Serializable
+{
- @Inject Credentials credentials;
- //@PersistenceContext EntityManager userDatabase;
+ private static final long serialVersionUID = 7965455427888195913L;
- private User user;
-
- public void login() {
-
- List<User> results = /*userDatabase.createQuery(
- "select u from User u where u.username=:username and u.password=:password")
- .setParameter("username", credentials.getUsername())
- .setParameter("password", credentials.getPassword())
- .getResultList();*/
-
- Arrays.asList( new User(credentials.getUsername(), "Your Name", credentials.getPassword()) );
-
- if ( !results.isEmpty() ) {
- user = results.get(0);
- FacesContext.getCurrentInstance()
- .addMessage(null, new FacesMessage("Welcome, " + user.getName()));
- }
-
- }
-
- public void logout() {
- FacesContext.getCurrentInstance()
- .addMessage(null, new FacesMessage("Goodbye, " + user.getName()));
- user = null;
- }
-
- public boolean isLoggedIn() {
- return user!=null;
- }
-
- @Produces @LoggedIn
- public User getCurrentUser() {
- return user;
- }
+ @Inject
+ private Credentials credentials;
+
+ @PersistenceContext
+ private EntityManager userDatabase;
+ private User currentUser;
+
+ @SuppressWarnings("unchecked")
+ public void login()
+ {
+
+ List<User> results = userDatabase.createQuery("select u from User u where u.username=:username and u.password=:password").setParameter("username", credentials.getUsername()).setParameter("password", credentials.getPassword()).getResultList();
+
+ if (!results.isEmpty())
+ {
+ currentUser = results.get(0);
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Welcome, " + currentUser.getName()));
+ }
+
+ }
+
+ public void logout()
+ {
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Goodbye, " + currentUser.getName()));
+ currentUser = null;
+ }
+
+ public boolean isLoggedIn()
+ {
+ return currentUser != null;
+ }
+
+ @Produces
+ @LoggedIn
+ public User getCurrentUser()
+ {
+ return currentUser;
+ }
+
}
\ No newline at end of file
Modified: examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/User.java
===================================================================
--- examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/User.java 2010-03-02 18:41:14 UTC (rev 5986)
+++ examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/User.java 2010-03-02 19:39:11 UTC (rev 5987)
@@ -1,27 +1,47 @@
package org.jboss.weld.examples.login;
-public class User {
- private String username;
- private String name;
- private String password;
-
- public User(String username, String name, String password) {
- super();
- this.username = username;
- this.name = name;
- this.password = password;
- }
-
- public String getUsername() {
- return username;
- }
-
- public String getName() {
- return name;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class User
+{
+ @Id
+ private String username;
+ private String name;
+ @SuppressWarnings("unused")
+ private String password;
+
+ public User() {}
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
}
Added: examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Users.java
===================================================================
--- examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Users.java (rev 0)
+++ examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Users.java 2010-03-02 19:39:11 UTC (rev 5987)
@@ -0,0 +1,24 @@
+package org.jboss.weld.examples.login;
+
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class Users
+{
+
+ @PersistenceContext
+ private EntityManager userDatabase;
+
+ @SuppressWarnings("unchecked")
+ @Produces @Named @RequestScoped
+ public List<User> getUsers()
+ {
+ return userDatabase.createQuery("select u from User u").getResultList();
+ }
+
+}
Property changes on: examples/trunk/jsf/login/src/main/java/org/jboss/weld/examples/login/Users.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: examples/trunk/jsf/login/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/jsf/login/src/main/resources/META-INF/persistence.xml (rev 0)
+++ examples/trunk/jsf/login/src/main/resources/META-INF/persistence.xml 2010-03-02 19:39:11 UTC (rev 5987)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="loginDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Property changes on: examples/trunk/jsf/login/src/main/resources/META-INF/persistence.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: examples/trunk/jsf/login/src/main/resources/import.sql
===================================================================
--- examples/trunk/jsf/login/src/main/resources/import.sql (rev 0)
+++ examples/trunk/jsf/login/src/main/resources/import.sql 2010-03-02 19:39:11 UTC (rev 5987)
@@ -0,0 +1 @@
+insert into User (username, name, password) values ('demo', 'Demo User', 'demo')
\ No newline at end of file
14 years, 10 months
Weld SVN: r5983 - examples/trunk.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-02 13:36:42 -0500 (Tue, 02 Mar 2010)
New Revision: 5983
Modified:
examples/trunk/build.xml
Log:
fix messages, more reliable touch
Modified: examples/trunk/build.xml
===================================================================
--- examples/trunk/build.xml 2010-03-02 18:33:26 UTC (rev 5982)
+++ examples/trunk/build.xml 2010-03-02 18:36:42 UTC (rev 5983)
@@ -109,6 +109,7 @@
</target>
<target name="restart.war" depends="explode" if="war">
+ <touch file="${jboss.home}/server/default/deploy/${example.name}.war" />
<touch file="${jboss.home}/server/default/deploy/${example.name}.war/WEB-INF/web.xml" />
</target>
@@ -121,8 +122,7 @@
</target>
<target name="restart" depends="restart.war, restart.ear">
- <echo message="The app can be accessed at ${final.url}" />
- <echo message="The app can be accessed at ${jboss.home}" />
+ <echo message="The app was deployed to ${jboss.home}/server/default/deploy/${example.name}.${type} and can be accessed at ${final.url}" />
</target>
<target name="undeploy" depends="check.jboss.home, undeploy.datasource">
14 years, 10 months
Weld SVN: r5982 - in examples/trunk/jsf/pastecode/ear: src/main and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-02 13:33:26 -0500 (Tue, 02 Mar 2010)
New Revision: 5982
Removed:
examples/trunk/jsf/pastecode/ear/src/main/application/
examples/trunk/jsf/pastecode/ear/src/main/resources/
Modified:
examples/trunk/jsf/pastecode/ear/pom.xml
Log:
cleanup
Modified: examples/trunk/jsf/pastecode/ear/pom.xml
===================================================================
--- examples/trunk/jsf/pastecode/ear/pom.xml 2010-03-02 18:32:38 UTC (rev 5981)
+++ examples/trunk/jsf/pastecode/ear/pom.xml 2010-03-02 18:33:26 UTC (rev 5982)
@@ -53,19 +53,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
- <generateApplicationXml>true</generateApplicationXml>
- <applicationXml>${project.build.directory}/application.xml</applicationXml>
<modules>
<webModule>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-war</artifactId>
- <bundleFileName>weld-pastecode.war</bundleFileName>
<contextRoot>/weld-pastecode</contextRoot>
</webModule>
<ejbModule>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-ejb</artifactId>
- <bundleFileName>weld-pastecode.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
14 years, 10 months
Weld SVN: r5981 - examples/trunk/jsf/pastecode/ejb/src/main/resources/META-INF.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-03-02 13:32:38 -0500 (Tue, 02 Mar 2010)
New Revision: 5981
Modified:
examples/trunk/jsf/pastecode/ejb/src/main/resources/META-INF/persistence.xml
Log:
remove uneeded properties
Modified: examples/trunk/jsf/pastecode/ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/jsf/pastecode/ejb/src/main/resources/META-INF/persistence.xml 2010-03-02 18:32:06 UTC (rev 5980)
+++ examples/trunk/jsf/pastecode/ejb/src/main/resources/META-INF/persistence.xml 2010-03-02 18:32:38 UTC (rev 5981)
@@ -8,14 +8,7 @@
<jta-data-source>java:/pastecodeDatasource</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/> <!-- create-drop update-->
- <property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.show_sql" value="false"/>
-
- <property name="hibernate.cache.provider_class"
- value="org.hibernate.cache.HashtableCacheProvider"/>
-
- <property name="jboss.entity.manager.factory.jndi.name"
- value="java:/pastecodeEntityManagerFactory" />
</properties>
</persistence-unit>
</persistence>
14 years, 10 months