camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-8541) Came main TestSupport class is incompatible with the CDI specification
Date Wed, 25 Mar 2015 06:39:53 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-8541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen updated CAMEL-8541:
-------------------------------
    Priority: Minor  (was: Major)

> Came main TestSupport class is incompatible with the CDI specification
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-8541
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8541
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-test
>    Affects Versions: 2.12.5, 2.14.2
>            Reporter: Alex Savitsky
>            Priority: Minor
>
> JUnit4 test support class (org.apache.camel.test.junit4.TestSupport) contains the following
declaration:
> {noformat}
>     // CHECKSTYLE:OFF
>     @Rule
>     public TestName testName = new TestName();
>     // CHECKSTYLE:ON
> {noformat}
> In addition to being a terrible idea overall, this public field also breaks CDI integration,
as any tests attempted to be bootstrapped in CDI will throw the following error (WELD trace
is shown for an example):
> {noformat}
> org.jboss.weld.exceptions.DefinitionException: WELD-000075: Normal scoped managed bean
implementation class has a public field:  [EnhancedAnnotatedFieldImpl] @Rule public com.netotc.ha.route.TestCDI.testName
> 	at org.jboss.weld.bean.ManagedBean.checkBeanImplementation(ManagedBean.java:227)
> 	at org.jboss.weld.bean.AbstractClassBean.internalInitialize(AbstractClassBean.java:74)
> 	at org.jboss.weld.bean.ManagedBean.internalInitialize(ManagedBean.java:105)
> 	at org.jboss.weld.bean.RIBean.initialize(RIBean.java:66)
> 	at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$5.doWork(ConcurrentBeanDeployer.java:121)
> 	at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$5.doWork(ConcurrentBeanDeployer.java:118)
> 	at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
> 	at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:745)
> {noformat}
> Suggesting to create a getter for this field, making the field private, and moving the
@Rule annotation to the getter.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message