Skip to content

Commit

Permalink
test: All tests working except GORM Inheritance (#589)
Browse files Browse the repository at this point in the history
- Make all tests work with Grails 7 (except for the failures caused by the GORM Inheritance issue)
- Enable tests in ci
  • Loading branch information
matrei authored Oct 1, 2024
1 parent 1fd1813 commit 8b5c20d
Show file tree
Hide file tree
Showing 21 changed files with 971 additions and 432 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: check -Dgeb.env=chromeHeadless -x test -x integrationTest
arguments: check -Dgeb.env=chromeHeadless

build_project:
runs-on: ubuntu-latest
Expand All @@ -48,7 +48,7 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless -x test -x integrationTest
arguments: build -Dgeb.env=chromeHeadless

- name: Publish Snapshot artifacts to Artifactory (repo.grails.org)
if: success()
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ allprojects {

version = rootProject.version
repositories {
mavenLocal() // Used by Groovy Joint workflow github action after building Groovy
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
if (libs.versions.groovy.get().endsWith('-SNAPSHOT')) {
maven {
name = 'JFrog Groovy snapshot repo'
Expand Down
2 changes: 1 addition & 1 deletion examples/functional-tests-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-library'
id 'org.grails.grails-plugin'
//id 'org.grails.plugins.views-json'
id 'org.grails.plugins.views-json'
}

group = 'functional.tests.plugin'
Expand Down
15 changes: 8 additions & 7 deletions examples/functional-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ group = 'functional.tests'

dependencies {


implementation project(':examples-functional-tests-plugin')
implementation project(':views-json')
implementation project(':views-markup')

runtimeOnly project(':views-json-templates')

testImplementation project(':views-json-testing-support')

implementation 'org.grails:grails-core'
implementation 'org.grails:grails-logging'
implementation 'org.grails:grails-web-boot'
Expand All @@ -38,14 +33,20 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-autoconfigure'
implementation 'org.springframework.boot:spring-boot-starter-logging'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation libs.jakarta.servlet.api

compileOnly libs.jakarta.servlet.api // Provided by Tomcat

runtimeOnly project(':views-json-templates')
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
runtimeOnly libs.assetpipeline

testImplementation project(':views-json-testing-support')
testImplementation libs.grails.testing.support.core
testImplementation libs.micronaut.http.client

integrationTestImplementation libs.jackson.databind
integrationTestImplementation libs.micronaut.http.client
integrationTestImplementation libs.micronaut.jackson.databind
}

assets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class BookController extends RestfulController<Book> {
[books: listAllResources(params)]
}


def listExcludesRespond() {
respond([books: listAllResources(params)])
}
Expand All @@ -34,7 +33,7 @@ class BookController extends RestfulController<Book> {
}

def nonStandardTemplate() {
respond([book: new Book(title: 'template found'), custom: new CustomClass(name: "Sally")], view:'/non-standard/template')
respond([book: new Book(title: 'template found'), custom: new CustomClass(name: 'Sally')], view:'/non-standard/template')
}

def showWithParams() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Garage {

String owner

static hasMany = [vehicles: Vehicle]
// GORM Inheritance not working in Groovy 4
//static hasMany = [vehicles: Vehicle]

}
5 changes: 5 additions & 0 deletions examples/functional-tests/grails-app/init/BootStrap.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ class BootStrap {

new Proxy(name: "Sally").save(flush: true, failOnError: true)

// GORM inheritance not working in Groovy 4
// See https://issues.apache.org/jira/browse/GROOVY-5106,
// https://github.com/grails/grails-views/pull/589
/*
new Garage(owner: "Jay Leno")
.addToVehicles(new Bus(maxPassengers: 30, route: "around town"))
.addToVehicles(new Car(maxPassengers: 4, make: "Subaru", model: "WRX", year: 2016))
.save(flush: true, failOnError: true)
*/

new Customer(name: "Nokia")
.addToSites(new Site(name: "Salo"))
Expand Down
Loading

0 comments on commit 8b5c20d

Please sign in to comment.