Skip to content

Commit

Permalink
Grails 7: testapps fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoehm committed Oct 7, 2024
1 parent 0b43518 commit c69975a
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 223 deletions.
163 changes: 64 additions & 99 deletions testapps/spring-security-cas-test1/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,68 @@
---
grails:
profile: web
codegen:
defaultPackage: spring.security.cas.test
spring:
transactionManagement:
proxies: false
gorm:
reactor:
# Whether to translate GORM events into Reactor events
# Disabled by default for performance reasons
events: false
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
main:
banner-mode: "off"
groovy:
template:
check-template-location: false

# Spring Actuator Endpoints are Disabled by Default
endpoints:
enabled: false
jmx:
enabled: true

---
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none
endpoints:
jmx:
unique-names: true
controllers:
defaultScope: singleton
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlet: html
taglib: none
staticparts: none
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
dataSource:
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
driverClassName: org.h2.Driver
username: sa
password: ''
pooled: true
jmxExport: true
dbCreate: update
hibernate:
cache:
queries: false
use_second_level_cache: false
use_query_cache: false

---
hibernate:
cache:
queries: false
use_query_cache: false
use_second_level_cache: false
format_sql: true
use_sql_comments: true
dataSource:
dbCreate: create-drop
driverClassName: org.h2.Driver
jmxExport: true
password:
pooled: true
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
username: sa
server:
port: 8081

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class User implements Serializable {
}

static mapping = {
table 'TestUser'
password column: '`password`'
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package spring.security.cas.test

import groovy.transform.CompileStatic
import org.springframework.context.annotation.PropertySource
import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
import groovy.transform.CompileStatic

@CompileStatic
@PropertySource('classpath:/local.properties')
class Application extends GrailsAutoConfiguration {
static void main(String[] args) {
GrailsApp.run Application, args
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
package spring.security.cas
package spring.security.cas.test

import com.test.Role
import com.test.User
import com.test.UserRole
import groovy.transform.CompileStatic

@CompileStatic
class BootStrap {

def init = { servletContext ->
Role roleAdmin = new Role('ROLE_ADMIN').save()
Role roleUser = new Role('ROLE_USER').save()
Role roleAdmin
Role roleUser
User user
User admin
Role.withTransaction {
roleAdmin = new Role('ROLE_ADMIN').save()
roleUser = new Role('ROLE_USER').save()
}

User user = new User('user', 'user').save()
User admin = new User('admin', 'admin').save()

UserRole.create user, roleUser
UserRole.create admin, roleUser
UserRole.create admin, roleAdmin, true
User.withTransaction {
user = new User('user', 'user').save()
admin = new User('admin', 'admin').save()
}

UserRole.withTransaction {
UserRole.create user, roleUser
UserRole.create admin, roleUser
UserRole.create admin, roleAdmin, true
}
}

def destroy = {
Expand Down
Loading

0 comments on commit c69975a

Please sign in to comment.