-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WELD-2466: Relax unproxyable check in BM.getInjectableReference()
- Loading branch information
Showing
3 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...s/weld/tests/proxy/superclass/unproxyable/GetInjectableReferenceUnproxyableCheckTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package org.jboss.weld.tests.proxy.superclass.unproxyable; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Member; | ||
import java.lang.reflect.Type; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import javax.enterprise.inject.spi.Annotated; | ||
import javax.enterprise.inject.spi.Bean; | ||
import javax.enterprise.inject.spi.BeanManager; | ||
import javax.enterprise.inject.spi.InjectionPoint; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.BeanArchive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.weld.test.util.Utils; | ||
import org.jboss.weld.tests.proxy.superclass.NotSimpleConstructorClass; | ||
import org.jboss.weld.tests.proxy.superclass.SimpleBean; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* | ||
* @author Martin Kouba | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class GetInjectableReferenceUnproxyableCheckTest { | ||
|
||
@Deployment | ||
public static Archive<?> deploy() { | ||
return ShrinkWrap.create(BeanArchive.class, Utils.getDeploymentNameAsHash(GetInjectableReferenceUnproxyableCheckTest.class)) | ||
.addPackage(GetInjectableReferenceUnproxyableCheckTest.class.getPackage()).addClasses(SimpleBean.class, NotSimpleConstructorClass.class); | ||
} | ||
|
||
@Test | ||
public void testClientProxy(BeanManager beanManager) { | ||
SimpleBean simple = (SimpleBean) beanManager.getInjectableReference(new InjectionPoint() { | ||
|
||
@Override | ||
public boolean isTransient() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDelegate() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return SimpleBean.class; | ||
} | ||
|
||
@Override | ||
public Set<Annotation> getQualifiers() { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public Member getMember() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Bean<?> getBean() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Annotated getAnnotated() { | ||
return null; | ||
} | ||
}, beanManager.createCreationalContext(null)); | ||
|
||
assertEquals("nothing", simple.getValue()); | ||
} | ||
|
||
} |