[arquillian-issues] [JBoss JIRA] Commented: (ARQ-254) Allow the use of @Deployment on non-static method

Aslak Knutsen (JIRA) jira-events at lists.jboss.org
Thu Aug 12 13:41:49 EDT 2010


    [ https://jira.jboss.org/browse/ARQ-254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12544672#action_12544672 ] 

Aslak Knutsen commented on ARQ-254:
-----------------------------------

@Deployment is called before there exists a TestClass instance, and to create a TestClass instance just to call @Deployment sounds odd. @Deployment is just a marker for here is the deployment, the concept will be extended for markers for e.g. Deployment for a TestSuite running against the same Deployment.

> Allow the use of @Deployment on non-static method
> -------------------------------------------------
>
>                 Key: ARQ-254
>                 URL: https://jira.jboss.org/browse/ARQ-254
>             Project: Arquillian
>          Issue Type: Feature Request
>            Reporter: Elias Ross
>
> Some tests I have test the deployment as is, some tests add in additional EJBs. (I exclude certain EJBs and MDBs to speed up testing.)
> This is currently what I do:
> @RunWith(org.jboss.arquillian.junit.Arquillian.class)
> public class DeploymentTest {
>     private static List<Class> ejb = new ArrayList<Class>();
>     
>     protected static void addClass(Class c) {
>         ejb.add(c);
>     }
>     @Deployment
>     public static Archive createTestArchive() throws Exception { ... }
> }
> public class XXXTest extends DeploymentTest {
>     static {
>         addClass(FooEJB.class);
>         addClass(BarEJB.class);
>     }
>     @Deployment
>     public static Archive createTestArchive() throws Exception { return DeploymentTest.createTestArchive(); }
> }
> It'd be nice if, in the case of @Deployment on a non-static class, Arquillian could just created a new instance of the class and obtain the deployment that way. So, it'd look like this:
> @RunWith(org.jboss.arquillian.junit.Arquillian.class)
> public class DeploymentTest {
>     private List<Class> ejb = new ArrayList<Class>();
>     
>     protected void addClass(Class c) {
>         ejb.add(c);
>     }
>     @Deployment
>     public Archive createTestArchive() throws Exception { ... }
> }
> public class XXXTest extends DeploymentTest {
>     {
>         addClass(FooEJB.class);
>         addClass(BarEJB.class);
>     }
> }
> Arquillian should be able to simply do:
>   new XXXTest().createTestArchive()
> in this case.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list