I want my integration test to hit the tomcat load at http: // localhost: 8080 / messaging , but the load (load-maven2-plugin: 1.0.5) prefers to deploy my messaging project as / messaging -0.0.7- SNAPSHOT, as shown in the tomcat admin console and in the target \ tomcat6x \ webapps directory.
So, I tried to add these lines to the load configuration, assuming that it will take the artifact by default:
<deployer> <deployables> <deployable> <properties> <context>/messaging</context> </properties> </deployable> </deployables> </deployer>
but this is not so. It doesnโt even try, since I do not see the messaging or messages-0.0.7-SNAPSHOT in the target \ tomcat6x \ webapps directory.
The same thing happens when I configure it like this:
<configuration> <type>standalone</type> <wait>false</wait> <properties> <cargo.servlet.port>8080</cargo.servlet.port> <cargo.logging>high</cargo.logging> </properties> <deployer> <deployables> <deployable> <groupId>com.company.platform</groupId> <artifactId>messaging</artifactId> <type>war</type> <properties> <context>/messaging</context> </properties> </deployable> </deployables> </deployer> </configuration>
Here is the complete plugin configuration:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <executions> <execution> <id>start</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <configuration> <type>standalone</type> <wait>false</wait> <properties> <cargo.servlet.port>8080</cargo.servlet.port> <cargo.logging>high</cargo.logging> </properties> <deployer> <deployables> <deployable> <properties> <context>/messaging</context> </properties> </deployable> </deployables> </deployer> </configuration>
My integration test is as follows:
import junit.framework.TestCase; import java.io.InputStream; import java.net.URL; import java.net.HttpURLConnection; import java.sql.Time; public class WebappTest extends TestCase { public void testCallIndexPage() throws Exception { URL url = new URL("http://localhost:8080/messaging/"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); assertEquals(200, connection.getResponseCode()); InputStream is = connection.getInputStream(); System.out.println(connection.getContent().getClass()); } }
What is the best way to continue? Knowing that it will be successfully implemented as hxxp: // localhost: 8080 / messaging-0.0.7-SNAPSHOT, I could change the test, but what would be a quick way to pull out the artifact version?
Ideally, I would like the load to unfold it correctly, but it is not clear how.