Skip to content

Commit

Permalink
HV-824 Switching to Wildfly for integration testing
Browse files Browse the repository at this point in the history
Using now same approach as in TCK to update the wildfly HV version to latest SNAPSHOT
  • Loading branch information
hferentschik committed Nov 30, 2013
1 parent 94994e4 commit 60db87f
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 121 deletions.
99 changes: 45 additions & 54 deletions integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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">
<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>
Expand All @@ -25,13 +27,13 @@
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>hibernate-validator-integrationtest-as</artifactId>
<artifactId>hibernate-validator-integrationtest-wildfly</artifactId>

<name>Hibernate Validator AS Integration Tests</name>
<name>Hibernate Validator Wildfly Integration Tests</name>
<description>Hibernate Validator integration tests.</description>

<properties>
<jbossTargetDir>${basedir}/target/jboss-as-${jbossas.version}</jbossTargetDir>
<wildflyTargetDir>${basedir}/target/wildfly-${wildfly.version}</wildflyTargetDir>
</properties>

<dependencies>
Expand Down Expand Up @@ -83,9 +85,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>test</scope>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
Expand All @@ -98,8 +100,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>${wildfly.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -147,35 +150,52 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${jbossas.version}</version>
<type>zip</type>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<type>tar.gz</type>
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy</id>
<phase>pre-integration-test</phase>
<id>copy-hv-snapshot</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/wildfly-${wildfly.version}/modules/system/layers/base/org/hibernate/validator/main
</outputDirectory>
<stripVersion>false</stripVersion>
<artifactItems>
<artifactItem>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-hv-cdi-snapshot</id>
<phase>process-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/wildfly-${wildfly.version}/modules/system/layers/base/org/hibernate/validator/cdi/main
</outputDirectory>
<stripVersion>false</stripVersion>
<artifactItems>
<artifactItem>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${bv.api.version}</version>
<overWrite>true</overWrite>
<destFileName>validation-api-${bv.api.version}.jar</destFileName>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
</configuration>
</execution>
</executions>
Expand All @@ -185,42 +205,13 @@
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<id>copy-modules</id>
<id>update-modules</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
println "[INFO] ------------------------------------------------------------------------";
println "[INFO] INTEGRATION BUILD INFO ";
println "[INFO] ------------------------------------------------------------------------";
println "[INFO] These tests will replace the default Bean Validation API module with a ";
println "[INFO] custom on based on Bean Validation 1.1. ";
println "[INFO] ------------------------------------------------------------------------";


def toDir = new File(project.properties['jbossTargetDir'], 'modules/javax/validation')
def fromDir = new File(project.basedir, 'src/as7config/modules/javax/validation')

log.info('Deleting old Bean Validation 1.0 module from ' + fromDir )
ant.delete(dir : toDir)

log.info('Copying Bean Validation 1.1 module from ' + fromDir + ' to ' + toDir)
ant.copy(todir: toDir, filtering: true) {
fileset(dir: fromDir)
filterset() {
filter(token:'BV-API-VERSION', value:project.properties['bv.api.version'])
}
}

def apiDependencyDir = new File(project.basedir, 'target/dependencies')
def apiTargetDir = new File(project.properties['jbossTargetDir'], 'modules/javax/validation/api/main')
log.info('Copying Bean Validation ' + project.properties['bv.api.version'] + ' jar from ' + apiDependencyDir + ' to ' + toDir)
ant.copy( todir: apiTargetDir) {
fileset(dir: apiDependencyDir)
}
</source>
<source>${pom.basedir}/src/script/setupModules.groovy</source>
</configuration>
</execution>
</executions>
Expand Down

This file was deleted.

25 changes: 25 additions & 0 deletions integration/src/script/setupModules.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Needed while running against an AS instance which is not bundled with HV 5
println "[INFO] ------------------------------------------------------------------------";
println "[INFO] UPDATING BEAN VALIDATION RELATED WILDFLY MODULES ";
println "[INFO] ------------------------------------------------------------------------";

def processFileInplace(file, Closure processText) {
def text = file.text
file.write( processText( text ) )
}

hvModuleXml = new File( project.properties['wildflyTargetDir'], 'modules/system/layers/base/org/hibernate/validator/main/module.xml' )
def hvArtifactName = 'hibernate-validator-' + project.version + '.jar';
println "[INFO] Using HV version " + hvArtifactName;
processFileInplace( hvModuleXml ) { text ->
text.replaceAll( /hibernate-validator.*jar/, hvArtifactName )
}

hvCdiModuleXml = new File( project.properties['wildflyTargetDir'], 'modules/system/layers/base/org/hibernate/validator/cdi/main/module.xml' )
def hvCdiArtifactName = 'hibernate-validator-cdi-' + project.version + '.jar';
println "[INFO] Using HV CDI Portable Extension version " + hvCdiArtifactName;
processFileInplace( hvCdiModuleXml ) { text ->
text.replaceAll( /hibernate-validator-cdi.*jar/, hvCdiArtifactName )
}

println "[INFO] ------------------------------------------------------------------------";
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ public static WebArchive createTestArchive() throws Exception {
PingServiceImpl.class,
PingableValidator.class
)
.addAsLibraries( IntegrationTestUtil.bundleHibernateValidatorWithDependencies( false ) )
.addAsLibraries( IntegrationTestUtil.bundleLoggingDependencies() )
.addAsLibraries( IntegrationTestUtil.bundleOptionalDependencies() )
.addAsResource( "log4j.properties" )
.addAsWebInfResource( "jboss-deployment-structure.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ public class QualifiedInjectionUnitIT {
public static WebArchive createTestArchive() throws Exception {
return ShrinkWrap
.create( WebArchive.class, WAR_FILE_NAME )
.addAsLibraries( IntegrationTestUtil.bundleHibernateValidatorWithDependencies( false ) )
.addAsLibraries( IntegrationTestUtil.bundleLoggingDependencies() )
.addAsLibraries( IntegrationTestUtil.bundleOptionalDependencies() )
.addAsResource( "log4j.properties" )
.addAsWebInfResource( "jboss-deployment-structure.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ public static WebArchive createTestArchive() throws Exception {
ParameterNameProviderWithInjection.class,
TraversableResolverWithInjection.class
)
.addAsLibraries( IntegrationTestUtil.bundleHibernateValidatorWithDependencies( false ) )
.addAsLibraries( IntegrationTestUtil.bundleLoggingDependencies() )
.addAsLibraries( IntegrationTestUtil.bundleOptionalDependencies() )
.addAsResource( "log4j.properties" )
.addAsResource( "validation-custom-config.xml", "META-INF/validation.xml" )
.addAsWebInfResource( "jboss-deployment-structure.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hibernate.validator.integration.jbossas7;
package org.hibernate.validator.integration.wildfly;

import java.util.Map;
import javax.persistence.EntityManager;
Expand All @@ -40,7 +40,7 @@
import static org.junit.Assert.assertTrue;

/**
* Tests the integration of Hibernate Validator in JBoss AS 7
* Tests the integration of Hibernate Validator in Wildfly
*
* @author Hardy Ferentschik
*/
Expand Down Expand Up @@ -80,7 +80,7 @@ private static Asset persistenceXml() {
EntityManager em;

@Test
// TODO see HV-546
// TODO see HV-837
public void testValidatorFactoryPassedToPersistenceUnit() throws Exception {
log.debug( "Running testValidatorFactoryPassedToPersistenceUnit..." );
Map<String, Object> properties = em.getEntityManagerFactory().getProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hibernate.validator.integration.jbossas7;
package org.hibernate.validator.integration.wildfly;

import java.util.Map;
import javax.persistence.EntityManager;
Expand All @@ -41,7 +41,7 @@
import static org.junit.Assert.assertTrue;

/**
* Tests the integration of Hibernate Validator in JBoss AS 7
* Tests the integration of Hibernate Validator in Wildfly
*
* @author Hardy Ferentschik
* @todo the test should execute an actual validation. It is not guaranteed that one can access the validator factory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hibernate.validator.integration.jbossas7;
package org.hibernate.validator.integration.wildfly;

import javax.naming.Context;
import javax.naming.InitialContext;
Expand All @@ -37,7 +37,7 @@
import static org.junit.Assert.fail;

/**
* Tests the integration of Hibernate Validator in JBoss AS 7.
* Tests the integration of Hibernate Validator in Wildfly.
*
* @author Hardy Ferentschik
*/
Expand Down Expand Up @@ -69,7 +69,7 @@ public void testDefaultValidatorFactoryLookup() throws Exception {
factory.getValidator().getClass().getSimpleName()
);
}
catch ( NamingException e ) {
catch( NamingException e ) {
fail( "The default validator factory should be bound" );
}
log.debug( "testDefaultValidatorFactoryLookup completed" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hibernate.validator.integration.jbossas7;
package org.hibernate.validator.integration.wildfly;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
Expand Down
6 changes: 3 additions & 3 deletions integration/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<property name="deploymentExportPath">target/</property>
</engine>

<container qualifier="jboss" default="true">
<protocol type="jmx-as7">
<container qualifier="wildfly" default="true">
<protocol type="jmx-wildfly">
<property name="executionType">REMOTE</property>
</protocol>
<configuration>
<property name="jbossHome">${basedir}/target/jboss-as-${jbossas.version}</property>
<property name="jbossHome">${basedir}/target/wildfly-${wildfly.version}</property>
<!--<property name="javaVmArguments">-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y -Xmx512m -XX:MaxPermSize=128m</property>-->
</configuration>
</container>
Expand Down
2 changes: 1 addition & 1 deletion integration/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%d{yyyy-mm-dd hh:mm:ss.S},%6.6r]%-5p[%t]%x(%F:%L) - %m%n

#log4j.logger.org.hibernate.search=TRACE
log4j.logger.org.hibernate.validator=DEBUG
Loading

0 comments on commit 60db87f

Please sign in to comment.