Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-540

Support @ArquillianResource URL for in-container test cases

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.1.9.Final
    • 1.0.0.CR2
    • None
    • None

      From IRC:

      [2:13pm] ianbrandt: aslak, Should @ArquillianResource injection work for in-container test cases? It works fine when I try it for an as-client test, but when I do the same in-container the org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider.protocolMetadata.get() is null, so no context URL. I verified the container is returning a non-null ProtocolMetaData from deploy(...).
      [2:15pm] aslak: ianbrandt, no it currently doesn't work
      [2:16pm] aslak: ianbrandt, it probably should, but i'm not sure we have the info incontianer without doing a callback to the client..
      [2:16pm] aslak: ianbrandt, but then we don't know which deployment we are when incontianer, so we have a little problem there..
      [2:17pm] ianbrandt: aslak, Ah, okay.
      [2:17pm] aslak: no wait we do
      [2:18pm] aslak: the Protocol is executed within a DeploymentScope/ContainerScope, so when it gets the callback, it has the correct context..
      [2:18pm] aslak: we tho need OperatesOnDeployment support for that tho, cuz you possible want to inject URLs not to your self, but to another deployment on possible another contianer that you should invoke from incontainer
      [2:19pm] aslak: so from incontianer on dep 1, we can do @ArqRes @OperatesOnDep("dep2") URL url;
      [2:23pm] ianbrandt: aslak, Makes sense. It's a little more than I could take on at the moment. I was just augmenting the Tomcat tests to show @ArqRes usage. I'll skip it for shouldBeAbleToInvokeServletInDeployedWebApp, and JIRA+Wiki the limitation.

            [ARQ-540] Support @ArquillianResource URL for in-container test cases

            Aslak Knutsen added a comment - pushed upstream https://github.com/arquillian/arquillian-core/commit/a6aae69ba50e233813416647ed501eda6ad6701f

            There are valid use cases for "mixed tests" (in-container http tests),
            e.g. setup test using EJBs and Persistence Context, then send http request to the server, then user EJBs and Persistence Context again to verify the effects of the http call's operation.
            Thus, we need a way to know the URL in testable=true / non-RunAsClient tests.
            Injection like suggested in this issue would be the most straightforward solution from the user perspective.
            If that's not possible, or too much effort, please consider at least adding the URL to System.getProperties() or similar, so we can get the URL in any legal way.
            (currently there is none that I know of ... https://community.jboss.org/thread/235866 )

            Tom Eicher (Inactive) added a comment - There are valid use cases for "mixed tests" (in-container http tests), e.g. setup test using EJBs and Persistence Context, then send http request to the server, then user EJBs and Persistence Context again to verify the effects of the http call's operation. Thus, we need a way to know the URL in testable=true / non-RunAsClient tests. Injection like suggested in this issue would be the most straightforward solution from the user perspective. If that's not possible, or too much effort, please consider at least adding the URL to System.getProperties() or similar, so we can get the URL in any legal way. (currently there is none that I know of ... https://community.jboss.org/thread/235866 )

            I've noted the as-client test run mode only limitation on the wiki: https://docs.jboss.org/author/display/ARQ/Resource+injection.

            Ian Brandt (Inactive) added a comment - I've noted the as-client test run mode only limitation on the wiki: https://docs.jboss.org/author/display/ARQ/Resource+injection .

              aslak@redhat.com Aslak Knutsen
              ianbrandt Ian Brandt (Inactive)
              Votes:
              8 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: