我已經創建了一個新的項目,該項目將只與運行集成測試集成測試
- 行家入耳式插件
- Maven的故障保護,插件
- Maven的嵌入與GlassFish插件
當我設置的包裝耳耳文件被創建,GlassFish的運行,但測試被忽略,我收到以下消息
[故障安全:集成測試]沒有測試運行。
和GlassFish取消部署失敗
[嵌入的glassfish:取消部署]
17/08/2012上午10點08分17秒PluginUtil doUndeploy
INFO:部署= com.sun.enterprise。 [email protected]
17/08/2012 10:08:17 AM com.sun.enterprise.loader.ASURLClassLoader $ SentinelInputStream
報告
警告:輸入流已經完成或強制關閉而未明確
已關閉;在以下堆棧跟蹤中報告的流實例化
java.lang.Throwable
at com.sun.enterprise.loader.ASURLClassLoader $ SentinelInputStream。
(ASURLClassLoader.java:1230)
當我設置的包裝到罈子裏 我得到
運行packageName.MyServiceTest
17/08/2012上午10點09分34秒的com.sun .enterprise.v3.server.CommonClassLoaderServiceImpl
findDerbyClient
信息:無法找到javadb客戶端jar文件,derby jdbc驅動程序將不會由
默認提供。
org.omg.CORBA.COMM_FAILURE:FINE:IOP00410001:連接失敗:socketType:
IIOP_CLEAR_TEXT;主機名:localhost;端口:3700 vmcid:OMG次要代碼:1
完成:沒有
在sun.reflect.GeneratedConstructorAccessor27.newInstance(來源不明)
和GlassFish不啓動
我知道它必須做一些事情Maven的生命週期不允許我創建ear文件,啓動glassfish嵌入式服務器並在同一個項目中運行集成測試。
有人可以給我一個解決方案嗎?我試圖創建僅包含EJB和Business實體項目的ear文件,並將其部署到嵌入式glassfish服務器,以使用maven-failsafe插件運行集成測試,而不是部署由父pom.xml創建的ear文件,該文件添加UI和其他項目放入ear文件中。
這裏是我的pom.xml文件
http://maven.apache.org/xsd/maven-4.0.0。。XSD「> 4.0.0
<parent>
<groupId>company.MyProject</groupId>
<artifactId>MyProject</artifactId>
<version>3.8.1-SNAPSHOT</version>
</parent>
<artifactId>MyProject-integration-test</artifactId>
<packaging>jar</packaging>
<name>MyProject Integration Tests</name>
<properties>
<ear-final-name>MyProject-integration-test-${project.version}</ear-final-name>
</properties>
<dependencies>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.concordion</groupId>
<artifactId>concordion</artifactId>
<version>1.4.2</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.concordion</groupId>
<artifactId>concordion-extensions</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MyProject-ejb</artifactId>
<version>${project.version}</version>
<type>ejb</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words-jdk15</artifactId>
<version>${aspose.libraryVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hibernate-entitymanager</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>hibernate-annotations</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>hibernate-commons-annotations</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.1.0.5.0</version>
</dependency>
<dependency>
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org-apache-commons-logging</groupId>
<artifactId>org-apache-commons-logging</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.5</version>
<configuration>
<version>5</version>
<displayName>MyProject</displayName>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<finalName>${ear-final-name}</finalName>
<name>MyProject-integration-test</name>
<modules>
<ejbModule>
<groupId>company.MyProject</groupId>
<artifactId>MyProject-ejb</artifactId>
<bundleFileName>MyProject-ejb.jar</bundleFileName>
</ejbModule>
<jarModule>
<groupId>company.MyProject</groupId>
<artifactId>MyProject-business-entities</artifactId>
<bundleFileName>MyProject-business-entities-3.8.1-SNAPSHOT.jar</bundleFileName>
</jarModule>
<jarModule>
<groupId>company.MyProject</groupId>
<artifactId>MyProject-util</artifactId>
<bundleFileName>MyProject-util-3.8.1-SNAPSHOT.jar</bundleFileName>
</jarModule>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<goalPrefix>embedded-glassfish</goalPrefix>
<autoDelete>true</autoDelete>
<app>${basedir}/target/MyProject-integration-test-${project.version}.ear</app>
<port>8080</port>
<configFile>src/test/resources/glassfish/config/domain.xml</configFile>
</configuration>
<executions>
<execution>
<id>start-glassfish</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>glassfish-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>glassfish-undeploy</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
<execution>
<id>stop-glassfish</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
您是否測試過在命令行上構建ear並將其部署到glassfish中? – khmarbaise 2012-08-20 06:55:30