Rahul Nair
Rahul Nair

Reputation: 125

JMS config settings for jetty deployment using cargo

We have a current web application that is deployed to OAS (Oracle Application Server).

I am trying to implement some functional tests using selenium for this application. I created a new maven project specifically for functional testing, which uses cargo to deploy the application war file (webapp-site.war) to the default container provided by cargo (Jetty). pom.xml attached at the end.

The problem I am facing is in trying to configure jms properties. The current setting in the web application uses OAS specific values from an environment specific jms.properties file (shown below):

java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory

java.naming.provider.url=opmn:ormi://localhost:6003:OC4J_DEV/default
java.naming.security.principal=username
java.naming.security.credentials=password

jms.queue.connection.factory.jndi=jms/QueueConnectionFactory

When I start up jetty using cargo, the deployment of the application war fails when it looks for the "RMIInitialContextFactory" and does not find it. This is an OAS specific jar which is not available in the global maven repository. I managed to download and install this jar in the local maven repo, but then it showed a missing class from another oracle specific jar not present in the global maven repo. Also, even I resolved all such dependencies to external jar, I am unsure of how it would perform with Jetty.

It would be really helpful to know how to configure these properties in cargo specific to jetty and have it picked up by the deployable application war.

Attaching the pom.xml of the functional test module below:

<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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>webapp-automation</artifactId>
<packaging>jar</packaging>
<url>http://maven.apache.org</url>

<parent>
    <groupId>com.webapp</groupId>
    <artifactId>webapp</artifactId>
    <version>11.0.5</version>
</parent>


<name>Functional tests for webapp</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <servlet.port>9090</servlet.port>

    <seleniumHost>localhost</seleniumHost>
    <seleniumPort>4444</seleniumPort>
    <selenium.version>2.3</selenium.version>
    <selenium.background>true</selenium.background>
</properties>

<dependencies>
    <dependency>
        <groupId>com.webap</groupId>
        <artifactId>webapp-site</artifactId>
        <type>war</type>
        <version>${project.version.number}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.42.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.5</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <version>${selenium.version}</version>
            </plugin>
            <!-- CARGO is used to deploy the RAPS application for functional testing -->
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.2</version>
                <configuration>
                    <container>
                        <dependencies>
                            <dependency>
                                <groupId>com.oracle</groupId>
                                <artifactId>ojdbc14</artifactId>
                            </dependency>
                        </dependencies>
                    </container>
                    <configuration>
                        <properties>
                            <cargo.servlet.port>${servlet.port}</cargo.servlet.port>
                            <cargo.datasource.datasource.ojdbc14>
                                cargo.datasource.driver=oracle.jdbc.driver.OracleDriver|
                                cargo.datasource.url=jdbc:oracle:thin:@deirbned01.deir.citec.qld.gov.au:1521:RAPSDEV|
                                cargo.datasource.jndi=jdbc/RAPSDS|
                                cargo.datasource.username=RAPS_9|
                                cargo.datasource.password=sm4u
                            </cargo.datasource.datasource.ojdbc14>
                        </properties>
                    </configuration>
                    <deployables>
                        <deployable>
                            <groupId>com.webapp</groupId>
                            <artifactId>webapp-site</artifactId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <!-- Skip the normal tests, we'll run them in the integration-test phase -->
                <skip>true</skip>
            </configuration>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <executions>
                <execution>
                    <id>start-cargo</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-cargo</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>selenium-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>start-selenium</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start-server</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-selenium</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop-server</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <background>${selenium.background}</background>
                <port>${selenium.port}</port>
                <logOutput>true</logOutput>
            </configuration>
        </plugin>
    </plugins>
</build>

Any help would be great !!

Cheers, Rahul

Upvotes: 0

Views: 559

Answers (1)

Rahul Nair
Rahul Nair

Reputation: 125

I found a way of solving the problem.

We use some environment specific settings in the project. I created a new environment profile in the build for functional tests and created a new jms.properties with the initial context factory pointing to the one provided by jetty.

It worked.

Cheers, Rahul

Upvotes: 0

Related Questions