2013-08-20 53 views
0

我想創建類似集成測試的東西 - 我使用groovy發送請求並解析答案。我也想要自動啓動jboss並部署.ear。使用貨物插件,我能夠啓動jboss。通過使用exec插件我試圖執行perl腳本放入耳朵部署文件夾。下一階段 - 執行groovy測試,但是這個階段開始時不需要等待耳朵被部署。是否有可能讓階段等待服務器部署到jboss?我的POM:使用maven的Inegration測試

<executions> 
    <execution> 
     <id>start-tomcat</id> 
     <phase>pre-integration-test</phase> 
     <goals> 
      <goal>run</goal> 
     </goals> 
    </execution> 
    <execution> 
     <id>stop-tomcat</id> 
     <phase>post-integration-test</phase> 
     <goals> 
      <goal>shutdown</goal> 
     </goals> 
    </execution> 
</executions> 
  • 重命名你的單元測試通過萬無一失被跳過,但通過執行:

    <build> 
        <plugins> 
         <plugin> 
          <groupId>org.codehaus.groovy.maven</groupId> 
          <artifactId>gmaven-plugin</artifactId> 
          <executions> 
          <execution> 
           <id>unpack-application-server</id> 
           <phase>pre-integration-test</phase> 
           <goals> 
            <goal>execute</goal> 
           </goals> 
           <configuration> 
            <source>${basedir}/src/main/script/appserver/unzip.groovy</source> 
            <defaults> 
             <installDirectory>${appserver.install.directory}</installDirectory> 
             <zipUrl>${appserver.zip.url}</zipUrl> 
            </defaults> 
           </configuration> 
          </execution> 
    
          <execution> 
           <id>prepare-application-server-configs</id> 
           <phase>pre-integration-test</phase> 
           <goals> 
            <goal>execute</goal> 
           </goals> 
           <configuration> 
            <source>${basedir}/src/main/script/appserver/${suffix}/postUnzipAction.groovy</source> 
           </configuration> 
          </execution> 
          </executions> 
         </plugin> 
         <plugin> 
          <groupId>org.codehaus.cargo</groupId> 
          <artifactId>cargo-maven2-plugin</artifactId> 
    
          <executions> 
          <execution> 
           <id>start-container</id> 
           <phase>pre-integration-test</phase> 
           <goals> 
            <goal>start</goal> 
           </goals> 
          </execution> 
          </executions> 
    
          <configuration> 
          <wait>false</wait> 
          <container> 
           <containerId>${appserver.id}</containerId> 
           <home>${appserver.home}</home> 
           <timeout>6000000</timeout> <!--in ms--> 
          </container> 
    
          <configuration> 
           <properties> 
            <cargo.servlet.port>${servlet.port}</cargo.servlet.port> 
            <cargo.rmi.port>${rmi.port}</cargo.rmi.port> 
            <!-- corresponds to -Djboss.bind.address=0.0.0.0 under jboss --> 
            <cargo.hostname>0.0.0.0</cargo.hostname> 
           </properties> 
          </configuration> 
          </configuration> 
         </plugin> 
    
         <plugin> 
          <groupId>org.codehaus.mojo</groupId> 
          <artifactId>exec-maven-plugin</artifactId> 
          <executions> 
          <execution> 
           <id>deploy-with-script</id> 
           <phase>pre-integration-test</phase> 
           <goals> 
            <goal>exec</goal> 
           </goals> 
           <configuration> 
            <executable>perl</executable> 
            <workingDirectory>.</workingDirectory> 
            <commandlineArgs>${deploy.pl.cmd} -x redeploy</commandlineArgs> 
           </configuration> 
          </execution> 
          </executions> 
         </plugin> 
        </plugins> 
    </build> 
    
  • +0

    你知道你可以使用貨物來部署你的耳朵也? – artbristol

    +0

    @artbristol貨物正在使用中。 – khmarbaise

    +0

    @khmarbaise我知道 - 使用貨物啓動服務器似乎很奇怪,但不能部署耳朵 – artbristol

    回答