Skip to content

Commit

Permalink
HHH-11019 - Extend DelayedPostInsertIdentifier support to include che…
Browse files Browse the repository at this point in the history
…cks for FlushMode (EXTENDED PC) - support for testing inside WildFly leveraging Arquilian and hibernate-orm-modules
  • Loading branch information
sebersole committed Aug 5, 2016
1 parent 0de0ff0 commit 1378708
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 47 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Expand Up @@ -59,6 +59,11 @@ ext {
baselineJavaVersion = '1.8'

osgiExportVersion = hibernateTargetVersion.replaceAll( '-SNAPSHOT', '.SNAPSHOT' )

final String[] versionComponents = hibernateTargetVersion.split( '\\.' );
hibernateFullVersion = hibernateTargetVersion
hibernateMajorMinorVersion = versionComponents[0] + '.' + versionComponents[1]
hibernateMajorVersion = versionComponents[0]
}

idea {
Expand Down
7 changes: 2 additions & 5 deletions documentation/documentation.gradle
Expand Up @@ -290,9 +290,6 @@ task renderMappingGuide(type: AsciidoctorTask, group: 'Documentation') {
}
}

final String[] versionComponents = version.split( '\\.' );
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];

// User Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {
Expand All @@ -302,7 +299,7 @@ task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {
backends "html5"
separateOutputDirs false
options logDocuments: true
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: rootProject.hibernateMajorMinorVersion
resources {
from('src/main/asciidoc/userguide/') {
include 'images/**'
Expand All @@ -325,7 +322,7 @@ task renderIntegrationGuide(type: AsciidoctorTask, group: 'Documentation') {
backends "html5"
separateOutputDirs false
options logDocuments: true
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: rootProject.hibernateMajorMinorVersion
resources {
from('src/main/asciidoc/integrationguide/') {
include 'images/**'
Expand Down
72 changes: 40 additions & 32 deletions hibernate-orm-modules/hibernate-orm-modules.gradle
Expand Up @@ -16,15 +16,25 @@ buildDir = "target"

ext {
// Exact ORM version, e.g. "5.1.1.Final"
slot = rootProject.hibernateTargetVersion

slot = rootProject.hibernateFullVersion
// Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version
minorSlot = slot.substring( 0, slot.indexOf( ".", slot.indexOf( "." ) + 1) )
majorWildflyVersion = wildflyVersion.substring( 0, wildflyVersion.indexOf( "." ) )
artifactClassifier = "wildfly-${majorWildflyVersion}-dist"
minorSlot = rootProject.hibernateMajorMinorVersion

final String[] wildFlyVersionComponents = wildflyVersion.split( '\\.' );

// e.g. "10" for WildFly 10.x
wildFlyMajorVersion = wildFlyVersionComponents[0];

artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"

modulesXmlDir = "$buildDir/tmp/modules"
moduleXmlStagingDir = file( "$buildDir/tmp/modules" )

wildFlyInstallDir = file( "${rootProject.buildDir}/" )
}

mavenPom {
name = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
}

configurations {
Expand All @@ -48,10 +58,14 @@ dependencies {
testCompile libraries.wildfly_arquillian_container_managed
}

task copyModulesXml(type: Copy) {
// NOTE : we do a separate Copy task for the modules XML files to apply token-replacements

into modulesXmlDir
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tasks related to creating and publishing the module zip

task copyAndExpandModuleXml(type: Copy) {
description 'Performs a copy of the XML files defining the module into a staging directory for the purpose of performing token-replacement'

into moduleXmlStagingDir
expand( slot: slot, minorSlot: minorSlot, version: rootProject.hibernateTargetVersion, wildflyVersion: wildflyVersion )

into( 'org/hibernate/' + slot ) {
Expand Down Expand Up @@ -80,11 +94,11 @@ task copyModulesXml(type: Copy) {
}
}

task createModulesZip(type: Zip, dependsOn: [copyModulesXml]) {
baseName = 'hibernate-orm-modules'
classifier = artifactClassifier
task createModulesZip(type: Zip, dependsOn: [copyAndExpandModuleXml]) {
baseName 'hibernate-orm-modules'
classifier artifactClassifier

from modulesXmlDir
from moduleXmlStagingDir

into( 'org/hibernate/' + slot ) {
from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
Expand All @@ -100,11 +114,6 @@ task createModulesZip(type: Zip, dependsOn: [copyModulesXml]) {
}
}

mavenPom {
name = "Hibernate ORM modules for WildFly ${majorWildflyVersion}"
description = "Hibernate ORM modules for WildFly ${majorWildflyVersion}"
}

publishing {
publications {
mavenZip( MavenPublication ) {
Expand All @@ -118,38 +127,37 @@ publishing {
build.dependsOn createModulesZip


/*************************/
/* Testing */
/*************************/

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tasks related to in-container (Arquillian + WF) testing

if ( JavaVersion.current().isJava9Compatible() ) {
logger.lifecycle( "WARNING - Skipping hibernate-orm-modules tests for Java 9" )
// WildFly has problems booting in Java 9
test.enabled = false
}

test {
systemProperties['jboss.socket.binding.port-offset'] = 137
}
task installWildFly(type: Copy) {
description = 'Downloads the WildFly distribution and installs it into a local directory (if needed)'

// Unzip Wildfly Dist
task extractWildFly(type: Copy) {
from {
configurations.wildflyDist.collect { zipTree(it) }
}
into "$buildDir/"
into wildFlyInstallDir
}

// Unzip Hibernate ORM Modules ZIP into the server's "modules" dir
task extractModules(dependsOn: [extractWildFly, createModulesZip], type: Copy) {
task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWildFly]) {
duplicatesStrategy DuplicatesStrategy.EXCLUDE
from zipTree( createModulesZip.archivePath )
into "$buildDir/wildfly-${wildflyVersion}/modules"
into "${wildFlyInstallDir}/wildfly-${wildflyVersion}/modules"
}

test.dependsOn extractModules
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule])

test.dependsOn prepareWildFlyForTests

processTestResources {
expand( buildDir: buildDir.getName(), wildflyVersion: wildflyVersion )
expand( buildDir: wildFlyInstallDir, wildflyVersion: wildflyVersion )
}


14 changes: 9 additions & 5 deletions hibernate-orm-modules/src/test/resources/arquillian.xml
Expand Up @@ -23,12 +23,16 @@
<container qualifier="container.active-1" mode="suite" default="true">
<configuration>
<property name="jbossHome">${buildDir}/wildfly-${wildflyVersion}</property>
<property name="javaVmArguments">-Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=127.0.0.1 -Djboss.socket.binding.port-offset=137</property>
<property name="javaVmArguments">
-Djava.net.preferIPv4Stack=true
-Djgroups.bind_addr=127.0.0.1
-Djboss.socket.binding.port-offset=137

<!-- Uncomment for Remote debugging Wildfly -->
<!--
<property name="javaVmArguments">-Djava.net.preferIPv4Stack=true -Djgroups.bind_addr=127.0.0.1 -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y</property>
-->
<!-- Uncomment for Remote debugging Wildfly -->
<!--
-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y
-->
</property>
</configuration>
</container>
</group>
Expand Down
6 changes: 1 addition & 5 deletions release/release.gradle
Expand Up @@ -17,10 +17,6 @@ buildDir = "target"
idea.module {
}


final String[] versionComponents = version.split( '\\.' );
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];

final File documentationDir = mkdir( "${project.buildDir}/documentation" );

/**
Expand Down Expand Up @@ -74,7 +70,7 @@ task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documen
task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) {
description = "Uploads documentation to the JBoss doc server"

final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${majorMinorVersion}";
final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${rootProject.hibernateMajorMinorVersion}";

executable 'rsync'
args '-avz', '--links', '--protocol=28', "${documentationDir.absolutePath}/", url
Expand Down

0 comments on commit 1378708

Please sign in to comment.