2013-08-20 34 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

    回答