Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 6.17 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to start tomcat before running integration test?
  2. mvn install -Pit
  3.        
  4. <profile>
  5.           <id>it</id>
  6.           <build>
  7.            <plugins>
  8.  
  9.  
  10.         <plugin>
  11.  
  12.             <groupId>org.codehaus.cargo</groupId>
  13.             <artifactId>cargo-maven2-plugin</artifactId>
  14.             <version>1.1.4</version>
  15.             <configuration>
  16.  
  17.                 <wait>false</wait>
  18.                 <container>
  19.                  <containerId>tomcat7x</containerId>
  20.                  <home>${env.CATALINA_HOME}</home>  
  21.                  <timeout>300000</timeout>                  
  22.                 </container>
  23.  
  24.                 <configuration>
  25.                  <type>standalone</type>
  26.                  <home>target/tomcat7x</home>
  27.                  <properties>
  28.                   <cargo.jvmargs>-XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
  29.                 </properties>
  30.                 </configuration>
  31.  
  32.  
  33.  
  34.             </configuration>
  35.                 <executions>
  36.                     <execution>
  37.                     <id>start-container</id>
  38.                     <phase>pre-integration-test</phase>
  39.                         <goals>
  40.                             <goal>start</goal>
  41.                             <goal>deploy</goal>
  42.                         </goals>
  43.                     </execution>
  44.                     <execution>
  45.                     <id>stop-container</id>
  46.                     <phase>post-integration-test</phase>
  47.                         <goals>
  48.                             <goal>stop</goal>
  49.                         </goals>
  50.                     </execution>
  51.                 </executions>
  52.           </plugin>
  53.  
  54.  
  55.  
  56.         <plugin>
  57.             <groupId>org.codehaus.mojo</groupId>
  58.             <artifactId>selenium-maven-plugin</artifactId>
  59.               <executions>
  60.                     <execution>
  61.                     <id>start</id>
  62.                     <phase>pre-integration-test</phase>
  63.                         <goals>
  64.                             <goal>start-server</goal>
  65.                         </goals>
  66.                     <configuration>
  67.                         <background>true</background>
  68.                         <logOutput>true</logOutput>
  69.                     </configuration>
  70.                 </execution>
  71.  
  72.                 <execution>
  73.                 <id>stop</id>
  74.                 <phase>post-integration-test</phase>
  75.                         <goals>
  76.                             <goal>stop-server</goal>
  77.                         </goals>
  78.                 </execution>
  79.             </executions>
  80.     </plugin>
  81.  
  82.  
  83.              <plugin>
  84.  
  85.                 <groupId>org.apache.maven.plugins</groupId>
  86.                 <artifactId>maven-surefire-plugin</artifactId>
  87.                 <version>2.8</version>
  88.  
  89.                 <configuration>
  90.                     <junitArtifactName>
  91.                     org.junit:com.springsource.org.junit
  92.                     </junitArtifactName>
  93.                     <excludes>
  94.  
  95.                         <exclude>**/unit/*Test.java</exclude>
  96.                     </excludes>
  97.                 </configuration>
  98.  
  99.  
  100.                 <executions>
  101.                     <execution>
  102.  
  103.                     <id>integration-tests</id>
  104.                     <phase>integration-test</phase>
  105.                         <goals>
  106.                             <goal>test</goal>
  107.                         </goals>
  108.                     <configuration>
  109.                     <skip>false</skip>
  110.                     <excludes>
  111.                         <exclude>none</exclude>
  112.                     </excludes>
  113.  
  114.                     <includes>
  115.                        <include>**/integration/*Test.java</include>
  116.                     </includes>
  117.                     </configuration>
  118.                     </execution>
  119.             </executions>
  120.  
  121.                 </plugin>
  122.               </plugins>
  123.             </build>
  124.  
  125.             <activation>
  126.               <property>
  127.                 <name>it</name>
  128.               </property>
  129.             </activation>
  130.  
  131.         </profile>
  132.        
  133. [INFO] Scanning for projects...
  134. [INFO] ------------------------------------------------------------------------
  135. [INFO] Building My APP
  136. [INFO]    task-segment: [install]
  137. [INFO] ------------------------------------------------------------------------
  138. [INFO] [jaxws:wsimport {execution: default}]
  139. [debug] execute contextualize
  140. [INFO] [resources:resources {execution: default-resources}]
  141. [INFO] Using 'UTF-8' encoding to copy filtered resources.
  142. [INFO] Copying 7 resources
  143. [INFO] [compiler:compile {execution: default-compile}]
  144. [INFO] Nothing to compile - all classes are up to date
  145. [debug] execute contextualize
  146. [INFO] [resources:testResources {execution: default-testResources}]
  147. [INFO] Using 'UTF-8' encoding to copy filtered resources.
  148. [INFO] Copying 5 resources
  149. [INFO] [compiler:testCompile {execution: default-testCompile}]
  150. [INFO] Nothing to compile - all classes are up to date
  151. [INFO] [surefire:test {execution: default-test}]
  152. [INFO] Surefire report directory: C:WorkspaceMyAPPtargetsurefire-reports
  153.  
  154. -------------------------------------------------------
  155.  T E S T S
  156. -------------------------------------------------------
  157. Running integration.MyTest
  158.        
  159. <plugin>
  160.                 <artifactId>maven-surefire-plugin</artifactId>
  161.                 <executions>
  162.  
  163.                     <execution>
  164.                         <id>default-test</id>                                
  165.                         <configuration>
  166.                             <skipTests>true</skipTests>
  167.                         </configuration>
  168.                     </execution>
  169.  
  170.                     <execution>
  171.                         <id>surefire-it</id>
  172.                         <phase>integration-test</phase>
  173.                         <goals>
  174.                             <goal>test</goal>
  175.                         </goals>
  176.                         <configuration>
  177.                             <includes>
  178.                                 <include>**/integration/*Test.java</include>
  179.                             </includes>
  180.                             <skipTests>false</skipTests>
  181.                         </configuration>
  182.                     </execution>
  183.                 </executions>
  184.                 <configuration>
  185.                     <argLine>-Xms256M -Xmx768M -XX:MaxPermSize=256M</argLine>
  186.                 </configuration>
  187.             </plugin>