Skip to content

Commit

Permalink
HHH-16097 Move all tests from documentation into hibernate-core
Browse files Browse the repository at this point in the history
  • Loading branch information
dreab8 authored and mbladel committed Mar 20, 2023
1 parent 15873c1 commit eafd223
Show file tree
Hide file tree
Showing 406 changed files with 1,975 additions and 2,116 deletions.
46 changes: 3 additions & 43 deletions documentation/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ plugins {
*/


apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/module.gradle' )
apply from: rootProject.file( 'gradle/releasable.gradle' )

apply plugin: 'org.hibernate.matrix-test'
apply plugin: 'org.hibernate.orm.build.reports'

tasks.build.dependsOn 'buildDocs'
Expand All @@ -38,46 +37,16 @@ dependencies {
reportAggregation project(':hibernate-ant')
reportAggregation project(':hibernate-enhance-maven-plugin')
reportAggregation project(':hibernate-jpamodelgen')

implementation project( ':hibernate-core' )

annotationProcessor project( ':hibernate-jpamodelgen' )

testImplementation project(':hibernate-testing')
testImplementation project(':hibernate-envers')
testImplementation project(':hibernate-spatial')
testImplementation project(':hibernate-jcache')
testImplementation project( path: ':hibernate-core', configuration: 'tests' )

testImplementation 'org.apache.commons:commons-lang3:3.4'
testImplementation 'org.osgi:org.osgi.core:4.3.1'

testImplementation testLibs.mockito
testImplementation testLibs.mockitoInline

testImplementation jakartaLibs.jaxbApi
testImplementation jakartaLibs.jaxb
testImplementation jakartaLibs.jsonb
testImplementation libs.jacksonXml

testRuntimeOnly testLibs.wildFlyTxnClient
testRuntimeOnly(libs.ehcache3) {
capabilities {
requireCapability 'org.ehcache.modules:ehcache-xml-jakarta'
}
}
// Needed for JSON tests
testRuntimeOnly libs.jackson
}


if ( project.ormVersion.isSnapshot ) {
// only run the ci build tasks for SNAPSHOT versions
task ciBuild( dependsOn: [clean, test] )
task ciBuild( dependsOn: [clean] )
tasks.release.enabled false
}
else {
tasks.release.dependsOn clean, test
tasks.release.dependsOn clean
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -303,12 +272,3 @@ tasks.withType(AsciidoctorTask).all {
backends 'html5'
}
}

// resources inherently exclude sources
sourceSets.test.resources {
setSrcDirs( ['src/test/java','src/test/resources'] )
}


checkstyleMain.exclude '**/org/hibernate/userguide/model/*'

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
:sourcedir: ../../../../test/java/org/hibernate/userguide/mapping
:root-project-dir: ../../../../../..
:core-project-dir: {root-project-dir}/hibernate-core
:sourcedir: {core-project-dir}/src/test/java/org/hibernate/orm/test/mapping
:extrasdir: extras
:originalextrasdir: ../chapters/domain/extras

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[[batch]]
== Batching
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:core-project-dir: {root-project-dir}/hibernate-core
:example-dir-doc-batch: {documentation-project-dir}/src/test/java/org/hibernate/userguide/batch
:example-dir-doc-batch: {core-project-dir}/src/test/java/org/hibernate/orm/test/batch
:example-dir-bulkid: {core-project-dir}/src/test/java/org/hibernate/orm/test/bulkid
:extrasdir: extras

Expand Down Expand Up @@ -49,7 +48,7 @@ Since version 5.2, Hibernate allows overriding the global JDBC batch size given
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-session-jdbc-batch-size-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-session-jdbc-batch-size-example]
----
====

Expand All @@ -63,7 +62,7 @@ The following example shows an anti-pattern for batch inserts.
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-session-batch-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-session-batch-example]
----
====

Expand Down Expand Up @@ -91,7 +90,7 @@ When you make new objects persistent, employ methods `flush()` and `clear()` to
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-session-batch-insert-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-session-batch-insert-example]
----
====

Expand All @@ -106,7 +105,7 @@ In addition, use method `scroll()` to take advantage of server-side cursors for
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-session-scroll-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-session-scroll-example]
----
====

Expand Down Expand Up @@ -152,7 +151,7 @@ IMPORTANT: Due to the lack of a first-level cache, stateless sessions are vulner
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-stateless-session-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-stateless-session-example]
----
====

Expand Down Expand Up @@ -208,7 +207,7 @@ You can use sub-queries in the `WHERE` clause, and the sub-queries themselves ca
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-jpql-update-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-jpql-update-example]
----
====

Expand All @@ -217,7 +216,7 @@ include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-jpql-update-exam
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-hql-update-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-hql-update-example]
----
====

Expand All @@ -229,7 +228,7 @@ You can use a versioned update to force Hibernate to reset the version or timest
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-hql-update-version-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-hql-update-version-example]
----
====

Expand All @@ -245,7 +244,7 @@ This feature is only available in HQL since it's not standardized by Jakarta Per
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-jpql-delete-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-jpql-delete-example]
----
====

Expand All @@ -254,7 +253,7 @@ include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-jpql-delete-exam
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-hql-delete-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-hql-delete-example]
----
====

Expand Down Expand Up @@ -312,7 +311,7 @@ in which case the seed value defined by the `org.hibernate.type.descriptor.java.
====
[source, JAVA, indent=0]
----
include::{example-dir-doc-batch}/BatchTest.java[tags=batch-bulk-hql-insert-example]
include::{example-dir-doc-batch}/BatchTests.java[tags=batch-bulk-hql-insert-example]
----
====

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[[bootstrap]]
== Bootstrap
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:core-project-dir: {root-project-dir}/hibernate-core
:example-dir-boot: {documentation-project-dir}/src/test/java/org/hibernate/userguide/bootstrap
:example-dir-boot-spi: {core-project-dir}/src/test/java/org/hibernate/orm/test/bootstrap/spi
:core-test-base: {core-project-dir}/src/test/java/org/hibernate/orm/test
:example-dir-boot: {core-test-base}/bootstrap
:example-dir-boot-spi: {core-test-base}/bootstrap/spi
:extrasdir: extras

The term bootstrapping refers to initializing and starting a software component.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[[caching]]
== Caching
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:example-dir-caching: {documentation-project-dir}/src/test/java/org/hibernate/userguide/caching
:jcache-project-dir: {root-project-dir}/hibernate-jcache
:example-dir-caching: {jcache-project-dir}/src/test/java/org/hibernate/orm/test/caching

At runtime, Hibernate handles moving data into and out of the second-level cache in response to the operations performed by the `Session`, which acts as a transaction-level cache of persistent data.
Once an entity becomes managed, that object is added to the internal cache of the current persistence context (`EntityManager` or `Session`).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[[access]]
=== Access strategies
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:example-dir-access: {documentation-project-dir}/src/test/java/org/hibernate/userguide/mapping/access
:core-project-dir: {root-project-dir}/hibernate-core
:example-dir-access: {core-project-dir}/src/test/java/org/hibernate/orm/test/mapping/access
:extrasdir: extras

As a Jakarta Persistence provider, Hibernate can introspect both the entity attributes (instance fields) or the accessors (instance properties).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[[associations]]
=== Associations
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:example-dir-association: {documentation-project-dir}/src/test/java/org/hibernate/userguide/associations
:core-project-dir: {root-project-dir}/hibernate-core
:example-dir-association: {core-project-dir}/src/test/java/org/hibernate/orm/test/associations
:extrasdir: extras/associations

Associations describe how two or more entities form a relationship based on a database joining semantics.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[[basic]]
=== Basic values
:root-project-dir: ../../../../../../..
:documentation-project-dir: {root-project-dir}/documentation
:documentation-example-base: {documentation-project-dir}/src/test/
:example-dir-model: {documentation-project-dir}/src/main/java/org/hibernate/userguide/model
:example-dir-basic-mapping: {documentation-example-base}/java/org/hibernate/userguide/mapping
:example-dir-resources: {documentation-example-base}/resources/org/hibernate/userguide/
:testing-project-dir: {root-project-dir}/hibernate-testing
:example-dir-model: {testing-project-dir}/src/main/java/org/hibernate/testing/orm/domain/userguide
:core-project-dir: {root-project-dir}/hibernate-core
:core-test-base: {core-project-dir}/src/test
:example-dir-basic-mapping: {core-test-base}/java/org/hibernate/orm/test/mapping
:example-dir-resources: {core-test-base}/resources/org/hibernate/orm/test/
:example-dir-generated: {core-test-base}/java/org/hibernate/orm/test/mapping/generated
:example-dir-converter: {core-test-base}/java/org/hibernate/orm/test/mapping/converted/converter
:extrasdir: extras
Expand Down
Loading

0 comments on commit eafd223

Please sign in to comment.