Author: pete.muir(a)jboss.org
Date: 2010-01-25 15:53:50 -0500 (Mon, 25 Jan 2010)
New Revision: 5624
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
Log:
Tests for WELD-381
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,9 @@
+package org.jboss.weld.tests.enterprise;
+
+public interface AbstractDAO<E>
+{
+ public boolean save(E entity);
+
+ public boolean isSaved();
+
+}
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,20 @@
+package org.jboss.weld.tests.enterprise;
+
+
+public abstract class AbstractDAOImpl<E>
+{
+
+ private boolean saved;
+
+ public boolean save(E entity)
+ {
+ this.saved = true;
+ return true;
+ }
+
+ public boolean isSaved()
+ {
+ return saved;
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -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.weld.tests.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface DAO
+{
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-01-25
20:32:26 UTC (rev 5623)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -80,4 +80,10 @@
assert getReference(Scottish.class).getFeed().equals(feed);
}
+ @Test(description = "WELD-381")
+ public void testGenericEJBWorks()
+ {
+ assert
getReference(ResultClient.class).lookupPete().getUsername().equals("pete");
+ }
+
}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,18 @@
+package org.jboss.weld.tests.enterprise;
+
+public class Result
+{
+
+ private final String username;
+
+ public Result(String username)
+ {
+ this.username = username;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,15 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class ResultClient
+{
+
+ @Inject @DAO ResultDAO result;
+
+ public Result lookupPete()
+ {
+ return result.findByUser("pete");
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,11 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface ResultDAO extends AbstractDAO<Result>
+{
+
+ public Result findByUser(String username);
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java 2010-01-25
20:53:50 UTC (rev 5624)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+@DAO
+@Stateless
+public class ResultDAOImpl extends AbstractDAOImpl<Result> implements ResultDAO
+{
+ public Result findByUser(String username)
+ {
+ return new Result(username);
+ }
+}
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native