Cargo

HomePage | RecentChanges | Preferences

Revision 31 not available (showing current revision instead)
Difference (from prior major revision) (no other diffs)

Changed: 1,270c1
* http://cargo.codehaus.org/

* Articles
** http://www-128.ibm.com/developerworks/java/library/j-cq09266.html

* /PluginError : 20060404 Cargo Maven 2 Plugin error

:Setting the hostname and port

configuration.setProperty(GeneralPropertySet.HOSTNAME, hostname);
configuration.setProperty(ServletPropertySet.PORT, port);

A generic TestSetup? class




* /CargoTestSetup

Strongly Typed Java API





Deployable war = new WAR(System.getProperty("cargo.war"));

configuration = new Tomcat5xStandaloneLocalConfiguration(
new File("target/tomcat5x"));

configuration.setProperty("cargo.servlet.port", System.getProperty("cargo.servlet.port"));
configuration.addDeployable(war);

container = new Tomcat5xInstalledLocalContainer(configuration);
container.setHome(new File(System.getProperty("cargo.tomcat5x.home")));

container.start();

container.stop();


Generic Java API





Deployable war = new DefaultDeployableFactory().createDeployable(
"tomcat5x", System.getProperty("cargo.war"), DeployableType.WAR);

ConfigurationFactory configurationFactory = new DefaultConfigurationFactory();

LocalConfiguration configuration =
(LocalConfiguration) configurationFactory.createConfiguration(
"tomcat5x", ConfigurationType.STANDALONE);

configuration.setProperty("cargo.servlet.port", System.getProperty("cargo.servlet.port"));
configuration.addDeployable(war);

container = (InstalledLocalContainer)
new DefaultContainerFactory().createContainer(
"tomcat5x", ContainerType.INSTALLED, configuration);

container.setHome(new File(System.getProperty("cargo.tomcat5x.home")));

container.start();

container.stop();

A Simple Integration Test




: Goal: Show that the webapp can be deployed and started by visiting the home page.

: Some combination of these may be needed:
* Cargo Maven 2 Plugin: http://cargo.codehaus.org/Maven2+plugin
* http://blogs.codehaus.org/people/vmassol/archives/000893_using_cargo_for_functional_testing.html
* http://www.nabble.com/Re:-RE:-EJB-Unit-tests-with-Maven-2-p2890139.html
* http://maven.apache.org/guides/introduction/introduction-to-profiles.html
* http://mail-archives.apache.org/mod_mbox/maven-users/200405.mbox/%3c027601c43eaa$a7b64800$2502a8c0@vma%3e
* http://www.nabble.com/Re:-How-to-bind-execution-of-integration-tests-to-integration-test-phase-t1260154.html
* http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Better: Move the integration tests to a separate module. This works:


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>2.4-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>myproject-it</artifactId>
<packaging>pom</packaging>
<name>My Project - Integration Tests</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>1.8</version>
<exclusions>
<exclusion>
<groupId>javax.xml</groupId>
<artifactId>jsr173</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-uberjar</artifactId>
<version>0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-ant</artifactId>
<version>0.8</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compiler-it</id>
<phase>pre-integration-test</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>contextName</name>
<value>${pom.build.finalName}</value>
</property>
<!-- configure the path to the war file in the sibling module -->
<property>
<name>cargo.war</name>
<value>${basedir}/../webapp/target/${pom.build.finalName}.war</value>
</property>
<!-- cargo.tomcat5x.home MUST be defined in settings.xml -->
<property>
<name>cargo.tomcat5x.home</name>
<value>${cargo.tomcat5x.home}</value>
</property>
<property>
<name>cargo.resin3x.home</name>
<value>${cargo.resin3x.home}</value>
</property>
<property>
<name>cargo.servlet.port</name>
<value>80</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Other Resources




* Vincent's blog: http://blogs.codehaus.org/people/vmassol/archives/001307_cargo_v07_and_maven2_plugin_v01.html

* Support https for Tomcat 5.x: http://jira.codehaus.org/browse/CARGO-283
* Discussion on dev@: http://www.nabble.com/Re%3A-Tomcat-5.x-and-https-with-Cargo-Maven-2-plugin-t1222018.html
* Original user@ thread: http://www.nabble.com/Tomcat-5.x-and-https-with-Cargo-Maven-2-plugin-t1220188.html

* http://java.sun.com/j2se/1.4.2/docs/api/javax/net/ssl/HttpsURLConnection.html
* http://java.sun.com/j2se/1.4.2/docs/api/java/net/URL.html
* http://java.sun.com/developer/technicalArticles/Security/secureinternet2/

* http://javaalmanac.com/egs/javax.net.ssl/TrustAll.html?l=rel

* Support https in HttpUtils: http://jira.codehaus.org/browse/CARGO-284

* Building Cargo: /Building

Adding https support to Tomcat 4.1




The Connector in Tomcat 4.1.31 looks like this:

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector?"
port="8443" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="100" debug="0" scheme="https" secure="true"
useURIValidationHack?="false" disableUploadTimeout?="true">
<Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory?"
clientAuth="false" protocol="TLS" />
</Connector?>

So change the one in Cargo...

<Connector className="org.apache.catalina.connector.http.HttpConnector?"
port="@cargo.servlet.port@" minProcessors="5" maxProcessors="75"
scheme="@cargo.protocol@" secure="@catalina.secure@"
acceptCount="10" debug="@catalina.logging.level@">
@catalina.coyote.factory@
</Connector?>

cargo.protocol and catalina.secure are already taken care of by CARGO-284, just need to add catalina.coyote.factory to... not AbstractTomcatStandalone? (or whatever it's called) but one level down, only for Tomcat 4.x




Some classes could use good toString methods:


[DEBUG] cargo-core-container-geronimo: using locally installed snapshot
[DEBUG] cargo-core-container-orion: using locally installed snapshot
[DEBUG] Configuring mojo 'org.codehaus.cargo:cargo-maven2-plugin:0.3-SNAPSHOT:st
art' -->
[DEBUG] (s) home = c:\svn\irm\current\benweb\webapp\target\tomcat
[DEBUG] (f) properties = {cargo.client.auth=null, cargo.hostname=xxx.example.com, cargo.protocol=https, cargo.secure=true, cargo.servlet.port=443, cargo.s
sl.protocol=null}
[DEBUG] (f) configuration = org.codehaus.cargo.maven2.Configuration@1e7c5cb
[DEBUG] (s) containerId = tomcat5x
[DEBUG] (s) home = c:\java\apache-tomcat-5.5.15
[DEBUG] (s) log = c:\temp\tomcat5x.log
[DEBUG] (s) container = org.codehaus.cargo.maven2.Container@1961581
[DEBUG] (f) localRepository = [local] -> file://C:\\java\\m2-repository
[DEBUG] (f) project = org.apache.maven.project.MavenProject@89b5af79
[DEBUG] (f) repositories = [[Apache Snapshots] -> http://cvs.apache.org/maven-
snapshot-repository/, [irm-repo] -> file://\\irmfs1\files\irm\irmapps\projects\r
epository, [central] -> http://repo1.maven.org/maven2]
[DEBUG] (f) wait = true
[DEBUG] -- end configuration --
[INFO] [cargo:start]
[DEBUG] No container log will be generated. Configure the plugin using the <outp
ut> element under <container> to generate container logs
[INFO] ------------------------------------------------------------------------





Upgrading from Cargo 0.8 to 0.9




The second parameter of createDeployable changed from String to File


Deployable war = new DefaultDeployableFactory().createDeployable(
"tomcat5x",
- System.getProperty("localRepository")+System.getProperty("cargo.war"),
+ new File(System.getProperty("localRepository")+System.getProperty("cargo.war")),
DeployableType.WAR);




HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited December 21, 2019 1:04 pm by 78-93-98-198.dsl.wavetel.us (diff)
Search: