[weld-commits] Weld SVN: r6807 - in extensions/trunk/impl/src/test: java/org/jboss/weld/extensions/test/bean/generic/field and 2 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sat Jul 24 12:27:42 EDT 2010
Author: pete.muir at jboss.org
Date: 2010-07-24 12:27:42 -0400 (Sat, 24 Jul 2010)
New Revision: 6807
Added:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Bar.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Baz.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Corge.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Foo.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Garply.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanProducer.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanTest.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Message.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Qux.java
Removed:
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanProducer.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Message.java
extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Qux.java
extensions/trunk/impl/src/test/resources/META-INF/jboss-test-harness.properties
extensions/trunk/impl/src/test/resources/org/
Log:
move tests, remove old testharness stuff
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,48 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import javax.inject.Inject;
-
-import org.jboss.weld.extensions.bean.generic.Generic;
-
-/**
- * A generic bean for the config annotation Message
- *
- * @author pmuir
- *
- */
-
- at Generic(Message.class)
-public class Bar
-{
- @Inject
- private Message injectedMessage;
-
- // A Message with no @Inject
- private Message message;
-
- public Message getInjectedMessage()
- {
- return injectedMessage;
- }
-
- public Message getMessage()
- {
- return message;
- }
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,58 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import javax.inject.Inject;
-
-import org.jboss.weld.extensions.bean.generic.Generic;
-import org.jboss.weld.extensions.bean.generic.GenericBean;
-
-/**
- * A generic bean for the config annotation Message
- *
- * @author pmuir
- *
- */
-
- at Generic(Message.class)
-public class Baz
-{
-
- @Inject @GenericBean
- private Bar bar;
-
- @Inject
- private Corge corge;
-
- @Inject
- private Message message;
-
- public Bar getBar()
- {
- return bar;
- }
-
- public Corge getCorge()
- {
- return corge;
- }
-
- public Message getMessage()
- {
- return message;
- }
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,33 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-/**
- * A normal bean
- *
- * @author pmuir
- *
- */
-public class Corge
-{
-
- public String getName()
- {
- return "fred";
- }
-
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,43 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * A qualifier
- *
- * @author pmuir
- *
- */
-
- at Retention(RUNTIME)
- at Target({METHOD, FIELD, PARAMETER, TYPE})
- at Qualifier
-public @interface Foo
-{
- int value();
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,40 +0,0 @@
-package org.jboss.weld.extensions.test.bean.generic;
-
-import javax.inject.Inject;
-
-import org.jboss.weld.extensions.bean.generic.Generic;
-import org.jboss.weld.extensions.bean.generic.GenericBean;
-
-/**
- * A generic bean for the config annotation Message that uses initializer
- * injection for generic configuration annotations and generic bean injection
- *
- * @author pmuir
- *
- */
-
- at Generic(Message.class)
-public class Garply
-{
-
- private Message message;
- private Qux qux;
-
- @Inject
- public void init(Message message, @GenericBean Qux qux)
- {
- this.qux = qux;
- this.message = message;
- }
-
- public Message getMessage()
- {
- return message;
- }
-
- public Qux getQux()
- {
- return qux;
- }
-
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanProducer.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanProducer.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanProducer.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,76 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import javax.enterprise.inject.Produces;
-
-/**
- * A producer of generic beans
- * @author pmuir
- *
- */
-public class GenericBeanProducer
-{
- @SuppressWarnings("unused")
- @Foo(1)
- @Produces
- @Message("hello1")
- private Baz baz1;
-
- @SuppressWarnings("unused")
- @Foo(2)
- @Produces
- @Message("hello2")
- private Baz baz2;
-
- @SuppressWarnings("unused")
- @Foo(1)
- @Produces
- @Message("bye1")
- private Bar bar1;
-
- @SuppressWarnings("unused")
- @Foo(2)
- @Produces
- @Message("bye2")
- private Bar bar2;
-
- @SuppressWarnings("unused")
- @Foo(1)
- @Produces
- @Message("adios1")
- private Qux qux1;
-
- @SuppressWarnings("unused")
- @Foo(2)
- @Produces
- @Message("adios2")
- private Qux qux2;
-
- @SuppressWarnings("unused")
- @Foo(1)
- @Produces
- @Message("aurevoir1")
- private Garply garply1;
-
- @SuppressWarnings("unused")
- @Foo(2)
- @Produces
- @Message("aurevoir2")
- private Garply garply2;
-
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,134 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import javax.inject.Inject;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class GenericBeanTest
-{
- @Deployment
- public static Archive<?> deploy()
- {
- return ShrinkWrap.create("test.jar", JavaArchive.class).addPackage(GenericBeanTest.class.getPackage());
- }
-
- @Inject
- @Foo(1)
- private Baz baz1;
-
- @Inject
- @Foo(2)
- private Baz baz2;
-
- @Inject
- @Foo(1)
- private Bar bar1;
-
- @Inject
- @Foo(2)
- private Bar bar2;
-
- @Inject
- @Foo(1)
- private Qux qux1;
-
- @Inject
- @Foo(2)
- private Qux qux2;
-
- @Inject
- @Foo(1)
- private Garply garply1;
-
- @Inject
- @Foo(2)
- private Garply garply2;
-
- @Test
- public void testGeneric()
- {
- // Check that normal bean injection is working correctly!
- assertNotNull(baz2.getCorge());
- assertEquals(baz2.getCorge().getName(), "fred");
-
- // Test that the generic configuration injection wiring is working for bar
- assertNotNull(bar1.getInjectedMessage());
- assertEquals(bar1.getInjectedMessage().value(), "bye1");
- assertNotNull(bar2.getInjectedMessage());
- assertEquals(bar2.getInjectedMessage().value(), "bye2");
-
- // Check that the generic configuration injection wiring is working for baz
- assertNotNull(baz1.getMessage());
- assertEquals(baz1.getMessage().value(), "hello1");
- assertNotNull(baz2.getMessage());
- assertEquals(baz2.getMessage().value(), "hello2");
-
- // Check that the generic configuration injection wiring is working for qux (ctor injection)
- assertNotNull(qux1.getMessage());
- assertEquals(qux1.getMessage().value(), "adios1");
- assertNotNull(qux2.getMessage());
- assertEquals(qux2.getMessage().value(), "adios2");
-
- // Check that the generic configuration injection wiring is working for garply (initializer injection)
- assertNotNull(garply1.getMessage());
- assertEquals(garply1.getMessage().value(), "aurevoir1");
- assertNotNull(garply2.getMessage());
- assertEquals(garply2.getMessage().value(), "aurevoir2");
-
- // Check that generic beans can inject each other
- assertNotNull(baz1.getBar());
- assertNotNull(baz1.getBar().getInjectedMessage());
- assertEquals(baz1.getBar().getInjectedMessage().value(), "hello1");
- assertNotNull(baz2.getBar());
- assertNotNull(baz2.getBar().getInjectedMessage());
- assertEquals(baz2.getBar().getInjectedMessage().value(), "hello2");
-
- // Check for ctor injection
- assertNotNull(qux1.getBar());
- assertNotNull(qux1.getBar().getInjectedMessage());
- assertEquals(qux1.getBar().getInjectedMessage().value(), "adios1");
- assertNotNull(qux2.getBar());
- assertNotNull(qux2.getBar().getInjectedMessage());
- assertEquals(qux2.getBar().getInjectedMessage().value(), "adios2");
-
- // Check for initializer injection
- assertNotNull(garply1.getQux());
- assertNotNull(garply1.getQux().getMessage());
- assertEquals(garply1.getQux().getMessage().value(), "aurevoir1");
- assertNotNull(garply2.getQux());
- assertNotNull(garply2.getQux().getMessage());
- assertEquals(garply2.getQux().getMessage().value(), "aurevoir2");
-
- // Check that this isn't affecting annotations on the generic bean without @Inject
- assertNull(baz1.getBar().getMessage());
- assertNull(baz2.getBar().getMessage());
-
- }
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Message.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Message.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Message.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,43 +0,0 @@
-/*
- * 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.weld.extensions.test.bean.generic;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
-
-/**
- * The annotation used to configure a generic bean
- *
- * @author pmuir
- *
- */
-
- at Retention(RUNTIME)
- at Target({METHOD, FIELD, PARAMETER, TYPE})
- at GenericConfiguration
-public @interface Message
-{
- String value();
-}
Deleted: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Qux.java
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Qux.java 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Qux.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1,40 +0,0 @@
-package org.jboss.weld.extensions.test.bean.generic;
-
-import javax.inject.Inject;
-
-import org.jboss.weld.extensions.bean.generic.Generic;
-import org.jboss.weld.extensions.bean.generic.GenericBean;
-
-/**
- * A generic bean for the config annotation Message that uses ctor injection for
- * generic configuration annotations and generic bean injection
- *
- * @author pmuir
- *
- */
-
- at Generic(Message.class)
-public class Qux
-{
-
- private final Message message;
- private final Bar bar;
-
- @Inject
- public Qux(Message message, @GenericBean Bar bar)
- {
- this.bar = bar;
- this.message = message;
- }
-
- public Message getMessage()
- {
- return message;
- }
-
- public Bar getBar()
- {
- return bar;
- }
-
-}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Bar.java (from rev 6799, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Bar.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Bar.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Bar.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,48 @@
+/*
+ * 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.weld.extensions.test.bean.generic.field;
+
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.bean.generic.Generic;
+
+/**
+ * A generic bean for the config annotation Message
+ *
+ * @author pmuir
+ *
+ */
+
+ at Generic(Message.class)
+public class Bar
+{
+ @Inject
+ private Message injectedMessage;
+
+ // A Message with no @Inject
+ private Message message;
+
+ public Message getInjectedMessage()
+ {
+ return injectedMessage;
+ }
+
+ public Message getMessage()
+ {
+ return message;
+ }
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Baz.java (from rev 6800, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Baz.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Baz.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Baz.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,58 @@
+/*
+ * 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.weld.extensions.test.bean.generic.field;
+
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.bean.generic.Generic;
+import org.jboss.weld.extensions.bean.generic.GenericBean;
+
+/**
+ * A generic bean for the config annotation Message
+ *
+ * @author pmuir
+ *
+ */
+
+ at Generic(Message.class)
+public class Baz
+{
+
+ @Inject @GenericBean
+ private Bar bar;
+
+ @Inject
+ private Corge corge;
+
+ @Inject
+ private Message message;
+
+ public Bar getBar()
+ {
+ return bar;
+ }
+
+ public Corge getCorge()
+ {
+ return corge;
+ }
+
+ public Message getMessage()
+ {
+ return message;
+ }
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Corge.java (from rev 6781, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Corge.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Corge.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Corge.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -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.weld.extensions.test.bean.generic.field;
+
+/**
+ * A normal bean
+ *
+ * @author pmuir
+ *
+ */
+public class Corge
+{
+
+ public String getName()
+ {
+ return "fred";
+ }
+
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Foo.java (from rev 6799, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Foo.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Foo.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Foo.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -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.weld.extensions.test.bean.generic.field;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * A qualifier
+ *
+ * @author pmuir
+ *
+ */
+
+ at Retention(RUNTIME)
+ at Target({METHOD, FIELD, PARAMETER, TYPE})
+ at Qualifier
+public @interface Foo
+{
+ int value();
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Garply.java (from rev 6802, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Garply.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Garply.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Garply.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,40 @@
+package org.jboss.weld.extensions.test.bean.generic.field;
+
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.bean.generic.Generic;
+import org.jboss.weld.extensions.bean.generic.GenericBean;
+
+/**
+ * A generic bean for the config annotation Message that uses initializer
+ * injection for generic configuration annotations and generic bean injection
+ *
+ * @author pmuir
+ *
+ */
+
+ at Generic(Message.class)
+public class Garply
+{
+
+ private Message message;
+ private Qux qux;
+
+ @Inject
+ public void init(Message message, @GenericBean Qux qux)
+ {
+ this.qux = qux;
+ this.message = message;
+ }
+
+ public Message getMessage()
+ {
+ return message;
+ }
+
+ public Qux getQux()
+ {
+ return qux;
+ }
+
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanProducer.java (from rev 6800, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanProducer.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanProducer.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanProducer.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,76 @@
+/*
+ * 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.weld.extensions.test.bean.generic.field;
+
+import javax.enterprise.inject.Produces;
+
+/**
+ * A producer of generic beans
+ * @author pmuir
+ *
+ */
+public class GenericBeanProducer
+{
+ @SuppressWarnings("unused")
+ @Foo(1)
+ @Produces
+ @Message("hello1")
+ private Baz baz1;
+
+ @SuppressWarnings("unused")
+ @Foo(2)
+ @Produces
+ @Message("hello2")
+ private Baz baz2;
+
+ @SuppressWarnings("unused")
+ @Foo(1)
+ @Produces
+ @Message("bye1")
+ private Bar bar1;
+
+ @SuppressWarnings("unused")
+ @Foo(2)
+ @Produces
+ @Message("bye2")
+ private Bar bar2;
+
+ @SuppressWarnings("unused")
+ @Foo(1)
+ @Produces
+ @Message("adios1")
+ private Qux qux1;
+
+ @SuppressWarnings("unused")
+ @Foo(2)
+ @Produces
+ @Message("adios2")
+ private Qux qux2;
+
+ @SuppressWarnings("unused")
+ @Foo(1)
+ @Produces
+ @Message("aurevoir1")
+ private Garply garply1;
+
+ @SuppressWarnings("unused")
+ @Foo(2)
+ @Produces
+ @Message("aurevoir2")
+ private Garply garply2;
+
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanTest.java (from rev 6800, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/GenericBeanTest.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanTest.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/GenericBeanTest.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,134 @@
+/*
+ * 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.weld.extensions.test.bean.generic.field;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class GenericBeanTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addPackage(GenericBeanTest.class.getPackage());
+ }
+
+ @Inject
+ @Foo(1)
+ private Baz baz1;
+
+ @Inject
+ @Foo(2)
+ private Baz baz2;
+
+ @Inject
+ @Foo(1)
+ private Bar bar1;
+
+ @Inject
+ @Foo(2)
+ private Bar bar2;
+
+ @Inject
+ @Foo(1)
+ private Qux qux1;
+
+ @Inject
+ @Foo(2)
+ private Qux qux2;
+
+ @Inject
+ @Foo(1)
+ private Garply garply1;
+
+ @Inject
+ @Foo(2)
+ private Garply garply2;
+
+ @Test
+ public void testGeneric()
+ {
+ // Check that normal bean injection is working correctly!
+ assertNotNull(baz2.getCorge());
+ assertEquals(baz2.getCorge().getName(), "fred");
+
+ // Test that the generic configuration injection wiring is working for bar
+ assertNotNull(bar1.getInjectedMessage());
+ assertEquals(bar1.getInjectedMessage().value(), "bye1");
+ assertNotNull(bar2.getInjectedMessage());
+ assertEquals(bar2.getInjectedMessage().value(), "bye2");
+
+ // Check that the generic configuration injection wiring is working for baz
+ assertNotNull(baz1.getMessage());
+ assertEquals(baz1.getMessage().value(), "hello1");
+ assertNotNull(baz2.getMessage());
+ assertEquals(baz2.getMessage().value(), "hello2");
+
+ // Check that the generic configuration injection wiring is working for qux (ctor injection)
+ assertNotNull(qux1.getMessage());
+ assertEquals(qux1.getMessage().value(), "adios1");
+ assertNotNull(qux2.getMessage());
+ assertEquals(qux2.getMessage().value(), "adios2");
+
+ // Check that the generic configuration injection wiring is working for garply (initializer injection)
+ assertNotNull(garply1.getMessage());
+ assertEquals(garply1.getMessage().value(), "aurevoir1");
+ assertNotNull(garply2.getMessage());
+ assertEquals(garply2.getMessage().value(), "aurevoir2");
+
+ // Check that generic beans can inject each other
+ assertNotNull(baz1.getBar());
+ assertNotNull(baz1.getBar().getInjectedMessage());
+ assertEquals(baz1.getBar().getInjectedMessage().value(), "hello1");
+ assertNotNull(baz2.getBar());
+ assertNotNull(baz2.getBar().getInjectedMessage());
+ assertEquals(baz2.getBar().getInjectedMessage().value(), "hello2");
+
+ // Check for ctor injection
+ assertNotNull(qux1.getBar());
+ assertNotNull(qux1.getBar().getInjectedMessage());
+ assertEquals(qux1.getBar().getInjectedMessage().value(), "adios1");
+ assertNotNull(qux2.getBar());
+ assertNotNull(qux2.getBar().getInjectedMessage());
+ assertEquals(qux2.getBar().getInjectedMessage().value(), "adios2");
+
+ // Check for initializer injection
+ assertNotNull(garply1.getQux());
+ assertNotNull(garply1.getQux().getMessage());
+ assertEquals(garply1.getQux().getMessage().value(), "aurevoir1");
+ assertNotNull(garply2.getQux());
+ assertNotNull(garply2.getQux().getMessage());
+ assertEquals(garply2.getQux().getMessage().value(), "aurevoir2");
+
+ // Check that this isn't affecting annotations on the generic bean without @Inject
+ assertNull(baz1.getBar().getMessage());
+ assertNull(baz2.getBar().getMessage());
+
+ }
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Message.java (from rev 6799, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Message.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Message.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Message.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -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.weld.extensions.test.bean.generic.field;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.weld.extensions.bean.generic.GenericConfiguration;
+
+/**
+ * The annotation used to configure a generic bean
+ *
+ * @author pmuir
+ *
+ */
+
+ at Retention(RUNTIME)
+ at Target({METHOD, FIELD, PARAMETER, TYPE})
+ at GenericConfiguration
+public @interface Message
+{
+ String value();
+}
Copied: extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Qux.java (from rev 6802, extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/Qux.java)
===================================================================
--- extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Qux.java (rev 0)
+++ extensions/trunk/impl/src/test/java/org/jboss/weld/extensions/test/bean/generic/field/Qux.java 2010-07-24 16:27:42 UTC (rev 6807)
@@ -0,0 +1,40 @@
+package org.jboss.weld.extensions.test.bean.generic.field;
+
+import javax.inject.Inject;
+
+import org.jboss.weld.extensions.bean.generic.Generic;
+import org.jboss.weld.extensions.bean.generic.GenericBean;
+
+/**
+ * A generic bean for the config annotation Message that uses ctor injection for
+ * generic configuration annotations and generic bean injection
+ *
+ * @author pmuir
+ *
+ */
+
+ at Generic(Message.class)
+public class Qux
+{
+
+ private final Message message;
+ private final Bar bar;
+
+ @Inject
+ public Qux(Message message, @GenericBean Bar bar)
+ {
+ this.bar = bar;
+ this.message = message;
+ }
+
+ public Message getMessage()
+ {
+ return message;
+ }
+
+ public Bar getBar()
+ {
+ return bar;
+ }
+
+}
Deleted: extensions/trunk/impl/src/test/resources/META-INF/jboss-test-harness.properties
===================================================================
--- extensions/trunk/impl/src/test/resources/META-INF/jboss-test-harness.properties 2010-07-24 16:21:47 UTC (rev 6806)
+++ extensions/trunk/impl/src/test/resources/META-INF/jboss-test-harness.properties 2010-07-24 16:27:42 UTC (rev 6807)
@@ -1 +0,0 @@
-org.jboss.testharness.testPackage=org.jboss.webbeans.test
\ No newline at end of file
More information about the weld-commits
mailing list