首页 文章

使用货物进行码头部署的JMS配置设置

提问于
浏览
0

我们有一个部署到OAS(Oracle Application Server)的当前Web应用程序 .

我正在尝试使用selenium为此应用程序实现一些功能测试 . 我创建了一个专门用于功能测试的新maven项目,该项目使用货物将应用程序war文件(webapp-site.war)部署到货物(Jetty)提供的默认容器中 . pom.xml附在最后 .

我面临的问题是尝试配置jms属性 . Web应用程序中的当前设置使用来自特定于环境的jms.properties文件的OAS特定值(如下所示):

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

当我使用货物启动jetty时,应用程序战争的部署在查找“RMIInitialContextFactory”并且找不到它时失败 . 这是一个OAS特定的jar,在全局maven存储库中不可用 . 我设法在本地maven仓库中下载并安装此jar,但随后它显示了来自全球maven仓库中不存在的另一个oracle特定jar的缺少类 . 此外,即使我解决了所有这些依赖关系到外部jar,我不确定它将如何与Jetty执行 .

了解如何在特定于码头的货物中配置这些属性并让它可以通过可部署的应用程序战争获取将非常有用 .

附加下面功能测试模块的pom.xml:

<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>

任何帮助都会很棒!!

干杯,拉胡尔

1 回答

  • 0

    我找到了解决问题的方法 .

    我们在项目中使用一些特定于环境的设置 . 我在构建中为功能测试创建了一个新的环境配置文件,并创建了一个新的jms.properties,初始上下文工厂指向jetty提供的工厂 .

    有效 .

    干杯,拉胡尔

相关问题