[arquillian-issues] [JBoss JIRA] (ARQ-917) Support the use of @Deployment on a static field

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue May 22 10:25:19 EDT 2012


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

Dan Allen commented on ARQ-917:
-------------------------------

Shoot, I just realized the hole in this idea. It's going to try to build the archive again inside the container, as you mentioned, which is likely going to fail in all but the simplest cases.

...well, at least now we know why it's important that it's a @Deployment method.

I think where we go from here to save typing is to drop the idea of @Deployment fields and instead focus on relocation of the deployment method to another class.

I often see:

{code:java}
@Deployment
public static Archive<?> createDeployment() {
    return Deployments.createDeployment();
}
{code}

I think we can simplify this redundancy by having something like:

{code:java}
@RunWith(Arquillian.class)
@ReadDeploymentFrom(Deployments.class)
public class MyTest {
}
{code}

If there are multiple deployments in that class and you don't want all of them, then they can be selected based on their names:

{code:java}
@RunWith(Arquillian.class)
@ReadDeploymentFrom(value = Deployments.class, named = "deployment1")
public class MyTest {
}
{code}

If you think this is a good idea, I'll file another issue.

I did some refactoring in this pull request that I'd like to preserve. I can update the pull request and take out the field support, if that's cool.

                
> Support the use of @Deployment on a static field
> ------------------------------------------------
>
>                 Key: ARQ-917
>                 URL: https://issues.jboss.org/browse/ARQ-917
>             Project: Arquillian
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: Base Implementation
>    Affects Versions: 1.0.0.Final
>            Reporter: Dan Allen
>            Priority: Minor
>
> To cut down on verbosity and visual clutter for simple use cases, allow the use of a static field to define a @Deployment. If logic is required to build the deployment, a static block can be used. This also caters well when delegating to a static method.
> See examples in this gist: https://gist.github.com/2640101

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list