This is an automated email from the ASF dual-hosted git repository. jdaugherty pushed a commit to branch feature/exploded in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 3d7985f6f94a972ba434fa419d6637abbe27daae Author: James Daugherty <[email protected]> AuthorDate: Wed Sep 17 14:41:40 2025 -0400 test: add functional test app for exploded plugin --- grails-test-examples/exploded/build.gradle | 65 +++++++++ .../exploded/grails-app/conf/application.yml | 124 +++++++++++++++++ .../exploded/grails-app/conf/logback.xml | 40 ++++++ .../grails-app/conf/spring/resources.groovy | 22 +++ .../controllers/exploded/UrlMappings.groovy | 33 +++++ .../grails-app/init/exploded/Application.groovy | 29 ++++ .../grails-app/init/exploded/BootStrap.groovy | 29 ++++ .../exploded/grails-app/views/error.gsp | 50 +++++++ .../exploded/grails-app/views/index.gsp | 147 +++++++++++++++++++++ .../exploded/grails-app/views/layouts/main.gsp | 40 ++++++ .../exploded/grails-app/views/notFound.gsp | 29 ++++ .../groovy/exploded/LoadAfterSpec.groovy | 35 +++++ grails-test-examples/plugins/exploded/build.gradle | 49 +++++++ .../exploded/grails-app/conf/application.yml | 98 ++++++++++++++ .../plugins/exploded/grails-app/conf/logback.xml | 40 ++++++ .../controllers/exploded/LoginController.groovy | 27 ++++ .../controllers/exploded/UrlMappings.groovy | 35 +++++ .../grails-app/init/exploded/Application.groovy | 29 ++++ .../grails-app/init/exploded/BootStrap.groovy | 29 ++++ .../exploded/grails-app/views/layouts/main.gsp | 70 ++++++++++ .../exploded/grails-app/views/login/auth.gsp | 31 +++++ .../groovy/exploded/ExplodedGrailsPlugin.groovy | 36 +++++ settings.gradle | 4 + 23 files changed, 1091 insertions(+) diff --git a/grails-test-examples/exploded/build.gradle b/grails-test-examples/exploded/build.gradle new file mode 100644 index 0000000000..c8fd209124 --- /dev/null +++ b/grails-test-examples/exploded/build.gradle @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +version = '0.1' +group = 'exploded' + +apply plugin: 'org.apache.grails.gradle.grails-web' + +// The grails-gsp Gradle plugin is not needed for running the functional tests. +// It is applied as a smoke test to check that compiling gsp +// for production does not fail during build task. +apply plugin: 'org.apache.grails.gradle.grails-gsp' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.apache.grails:grails-dependencies-starter-web' + implementation 'com.h2database:h2' + if (System.getenv('SITEMESH3_TESTING_ENABLED') == 'true') { + implementation 'org.apache.grails:grails-sitemesh3' + } else { + implementation 'org.apache.grails:grails-layout' + } + + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-cache' + + runtimeOnly 'org.apache.grails:grails-scaffolding' + runtimeOnly 'org.apache.grails:grails-fields' + + testImplementation 'org.apache.grails:grails-testing-support-web' + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + + console 'org.apache.grails:grails-console' + + integrationTestImplementation testFixtures('org.apache.grails:grails-geb') +} + +grails { + plugins { + implementation project(':grails-test-examples-plugins-exploded') + } +} + +apply { + from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle') + from rootProject.layout.projectDirectory.file('gradle/java-config.gradle') + from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle') +} \ No newline at end of file diff --git a/grails-test-examples/exploded/grails-app/conf/application.yml b/grails-test-examples/exploded/grails-app/conf/application.yml new file mode 100755 index 0000000000..0b40eb43ff --- /dev/null +++ b/grails-test-examples/exploded/grails-app/conf/application.yml @@ -0,0 +1,124 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +grails: + profile: web + codegen: + defaultPackage: exploded +info: + app: + name: '@info.app.name@' + version: '@info.app.version@' + grailsVersion: '@info.app.grailsVersion@' +spring: + groovy: + template: + check-template-location: false + +--- +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 + 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 + hibernate: + cache: + queries: false + views: + default: + codec: html + gsp: + encoding: UTF-8 + htmlcodec: xml + codecs: + expression: html + scriptlets: html + taglib: none + staticparts: none + +--- +dataSource: + pooled: true + jmxExport: true + driverClassName: org.h2.Driver + username: sa + password: + +environments: + development: + dataSource: + dbCreate: create-drop + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + test: + dataSource: + dbCreate: update + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + production: + dataSource: + dbCreate: update + url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + properties: + jmxEnabled: true + initialSize: 5 + maxActive: 50 + minIdle: 5 + maxIdle: 25 + maxWait: 10000 + maxAge: 600000 + timeBetweenEvictionRunsMillis: 5000 + minEvictableIdleTimeMillis: 60000 + validationQuery: SELECT 1 + validationQueryTimeout: 3 + validationInterval: 15000 + testOnBorrow: true + testWhileIdle: true + testOnReturn: false + jdbcInterceptors: ConnectionState + defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED diff --git a/grails-test-examples/exploded/grails-app/conf/logback.xml b/grails-test-examples/exploded/grails-app/conf/logback.xml new file mode 100644 index 0000000000..837b20f79e --- /dev/null +++ b/grails-test-examples/exploded/grails-app/conf/logback.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<configuration> + + <conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/> + <conversionRule conversionWord="wex" + class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <charset>UTF-8</charset> + <pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} + %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + </pattern> + </encoder> + </appender> + + <root level="error"> + <appender-ref ref="STDOUT"/> + </root> +</configuration> \ No newline at end of file diff --git a/grails-test-examples/exploded/grails-app/conf/spring/resources.groovy b/grails-test-examples/exploded/grails-app/conf/spring/resources.groovy new file mode 100755 index 0000000000..f2d41482db --- /dev/null +++ b/grails-test-examples/exploded/grails-app/conf/spring/resources.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Place your Spring DSL code here +beans = { +} diff --git a/grails-test-examples/exploded/grails-app/controllers/exploded/UrlMappings.groovy b/grails-test-examples/exploded/grails-app/controllers/exploded/UrlMappings.groovy new file mode 100755 index 0000000000..c1ba2153ce --- /dev/null +++ b/grails-test-examples/exploded/grails-app/controllers/exploded/UrlMappings.groovy @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +class UrlMappings { + + static mappings = { + "/$controller/$action?/$id?(.$format)?" { + + } + + "/"(view: "/index") + "500"(view: '/error') + "404"(view: '/notFound') + } +} diff --git a/grails-test-examples/exploded/grails-app/init/exploded/Application.groovy b/grails-test-examples/exploded/grails-app/init/exploded/Application.groovy new file mode 100755 index 0000000000..d42e32f168 --- /dev/null +++ b/grails-test-examples/exploded/grails-app/init/exploded/Application.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +import grails.boot.GrailsApp +import grails.boot.config.GrailsAutoConfiguration + +class Application extends GrailsAutoConfiguration { + static void main(String[] args) { + GrailsApp.run(Application, args) + } +} diff --git a/grails-test-examples/exploded/grails-app/init/exploded/BootStrap.groovy b/grails-test-examples/exploded/grails-app/init/exploded/BootStrap.groovy new file mode 100755 index 0000000000..ca21e748a2 --- /dev/null +++ b/grails-test-examples/exploded/grails-app/init/exploded/BootStrap.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +class BootStrap { + + def init = { + } + + def destroy = { + } +} diff --git a/grails-test-examples/exploded/grails-app/views/error.gsp b/grails-test-examples/exploded/grails-app/views/error.gsp new file mode 100644 index 0000000000..021477bccf --- /dev/null +++ b/grails-test-examples/exploded/grails-app/views/error.gsp @@ -0,0 +1,50 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html> +<head> + <title><g:if env="development">Grails Runtime Exception</g:if><g:else>Error</g:else></title> + <meta name="layout" content="main"> + <g:if env="development"><asset:stylesheet src="errors.css"/></g:if> +</head> + +<body> +<g:if env="development"> + <g:if test="${Throwable.isInstance(exception)}"> + <g:renderException exception="${exception}"/> + </g:if> + <g:elseif test="${request.getAttribute('jakarta.servlet.error.exception')}"> + <g:renderException exception="${request.getAttribute('jakarta.servlet.error.exception')}"/> + </g:elseif> + <g:else> + <ul class="errors"> + <li>An error has occurred</li> + <li>Exception: ${exception}</li> + <li>Message: ${message}</li> + <li>Path: ${path}</li> + </ul> + </g:else> +</g:if> +<g:else> + <ul class="errors"> + <li>An error has occurred</li> + </ul> +</g:else> +</body> +</html> diff --git a/grails-test-examples/exploded/grails-app/views/index.gsp b/grails-test-examples/exploded/grails-app/views/index.gsp new file mode 100644 index 0000000000..a998cc9b99 --- /dev/null +++ b/grails-test-examples/exploded/grails-app/views/index.gsp @@ -0,0 +1,147 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html> +<head> + <meta name="layout" content="main"/> + <title>Welcome to Grails</title> + <style type="text/css" media="screen"> + #status { + background-color: #eee; + border: .2em solid #fff; + margin: 2em 2em 1em; + padding: 1em; + width: 12em; + float: left; + -moz-box-shadow: 0px 0px 1.25em #ccc; + -webkit-box-shadow: 0px 0px 1.25em #ccc; + box-shadow: 0px 0px 1.25em #ccc; + -moz-border-radius: 0.6em; + -webkit-border-radius: 0.6em; + border-radius: 0.6em; + } + + #status ul { + font-size: 0.9em; + list-style-type: none; + margin-bottom: 0.6em; + padding: 0; + } + + #status li { + line-height: 1.3; + } + + #status h1 { + text-transform: uppercase; + font-size: 1.1em; + margin: 0 0 0.3em; + } + + #page-body { + margin: 2em 1em 1.25em 18em; + } + + h2 { + margin-top: 1em; + margin-bottom: 0.3em; + font-size: 1em; + } + + p { + line-height: 1.5; + margin: 0.25em 0; + } + + #controller-list ul { + list-style-position: inside; + } + + #controller-list li { + line-height: 1.3; + list-style-position: inside; + margin: 0.25em 0; + } + + @media screen and (max-width: 480px) { + #status { + display: none; + } + + #page-body { + margin: 0 1em 1em; + } + + #page-body h1 { + margin-top: 0; + } + } + </style> +</head> + +<body> +<a href="#page-body" class="skip"><g:message code="default.link.skip.label" default="Skip to content…"/></a> + +<div id="status" role="complementary"> + <h1>Application Status</h1> + <ul> + <li>Environment: ${grails.util.Environment.current.name}</li> + <li>App profile: ${grailsApplication.config.grails?.profile}</li> + <li>App version: <g:meta name="info.app.version"/></li> + <li>Grails version: <g:meta name="info.app.grailsVersion"/></li> + <li>Groovy version: ${GroovySystem.getVersion()}</li> + <li>JVM version: ${System.getProperty('java.version')}</li> + <li>Reloading active: ${grails.util.Environment.reloadingAgentEnabled}</li> + </ul> + + <h1>Artefacts</h1> + <ul> + <li>Controllers: ${grailsApplication.controllerClasses.size()}</li> + <li>Domains: ${grailsApplication.domainClasses.size()}</li> + <li>Services: ${grailsApplication.serviceClasses.size()}</li> + <li>Tag Libraries: ${grailsApplication.tagLibClasses.size()}</li> + </ul> + + <h1>Installed Plugins</h1> + <ul> + <g:each var="plugin" in="${applicationContext.getBean('pluginManager').allPlugins}"> + <li>${plugin.name} - ${plugin.version}</li> + </g:each> + </ul> +</div> + +<div id="page-body" role="main"> + <h1>Welcome to Grails</h1> + + <p>Congratulations, you have successfully started your first Grails application! At the moment + this is the default page, feel free to modify it to either redirect to a controller or display whatever + content you may choose. Below is a list of controllers that are currently deployed in this application, + click on each to execute its default action:</p> + + <div id="controller-list" role="navigation"> + <h2>Available Controllers:</h2> + <ul> + <g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName }}"> + <li class="controller"><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li> + </g:each> + </ul> + </div> +</div> +</body> +</html> diff --git a/grails-test-examples/exploded/grails-app/views/layouts/main.gsp b/grails-test-examples/exploded/grails-app/views/layouts/main.gsp new file mode 100644 index 0000000000..e3602f24ea --- /dev/null +++ b/grails-test-examples/exploded/grails-app/views/layouts/main.gsp @@ -0,0 +1,40 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html lang="en" class="no-js"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title><g:layoutTitle default="Grails"/></title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <asset:stylesheet src="application.css"/> + <asset:javascript src="application.js"/> + + <g:layoutHead/> +</head> + +<body> +<div id="grailsLogo" role="banner"><a href="https://grails.apache.org"><asset:image src="grails_logo.png" + alt="Grails"/></a></div> +<g:layoutBody/> +<div class="footer" role="contentinfo"></div> + +<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading…"/></div> +</body> +</html> diff --git a/grails-test-examples/exploded/grails-app/views/notFound.gsp b/grails-test-examples/exploded/grails-app/views/notFound.gsp new file mode 100644 index 0000000000..a18025dd5b --- /dev/null +++ b/grails-test-examples/exploded/grails-app/views/notFound.gsp @@ -0,0 +1,29 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html> +<head> + <title>Page Not Found</title> + <meta name="layout" content="main"> +</head> + +<body> +<p>Page Not Found</p> +</body> +</html> diff --git a/grails-test-examples/exploded/src/integration-test/groovy/exploded/LoadAfterSpec.groovy b/grails-test-examples/exploded/src/integration-test/groovy/exploded/LoadAfterSpec.groovy new file mode 100644 index 0000000000..73e1cea37e --- /dev/null +++ b/grails-test-examples/exploded/src/integration-test/groovy/exploded/LoadAfterSpec.groovy @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +import grails.plugin.geb.ContainerGebSpec +import grails.testing.mixin.integration.Integration + +@Integration +class LoadAfterSpec extends ContainerGebSpec { + + void "Basic test to prove reloading worked"() { + when: + go('/login/auth') + + then: + title == "My Plugin Login Auth" + } +} diff --git a/grails-test-examples/plugins/exploded/build.gradle b/grails-test-examples/plugins/exploded/build.gradle new file mode 100644 index 0000000000..86c67e1324 --- /dev/null +++ b/grails-test-examples/plugins/exploded/build.gradle @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +version = '0.1-SNAPSHOT' +group = 'com.example.grails.plugins' + +apply plugin: 'java-library' +apply plugin: 'org.apache.grails.gradle.grails-plugin' +apply plugin: 'org.apache.grails.gradle.grails-gsp' +apply plugin: 'org.apache.grails.gradle.grails-exploded' + +dependencies { + implementation platform(project(':grails-bom')) + + if (System.getenv('SITEMESH3_TESTING_ENABLED') == 'true') { + api 'org.apache.grails:grails-sitemesh3' + } else { + api 'org.apache.grails:grails-layout' + } + api 'org.apache.grails:grails-dependencies-starter-web' + api 'com.h2database:h2' + api 'jakarta.servlet:jakarta.servlet-api' + + implementation "org.apache.grails:grails-spring-security:$grailsSpringSecurityVersion" + + console 'org.apache.grails:grails-console' +} + +apply { + from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle') + from rootProject.layout.projectDirectory.file('gradle/java-config.gradle') + from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle') +} \ No newline at end of file diff --git a/grails-test-examples/plugins/exploded/grails-app/conf/application.yml b/grails-test-examples/plugins/exploded/grails-app/conf/application.yml new file mode 100755 index 0000000000..efe666466f --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/conf/application.yml @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +grails: + profile: web-plugin + codegen: + defaultPackage: exploded + 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 + +--- +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 diff --git a/grails-test-examples/plugins/exploded/grails-app/conf/logback.xml b/grails-test-examples/plugins/exploded/grails-app/conf/logback.xml new file mode 100644 index 0000000000..837b20f79e --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/conf/logback.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<configuration> + + <conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/> + <conversionRule conversionWord="wex" + class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <charset>UTF-8</charset> + <pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} + %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + </pattern> + </encoder> + </appender> + + <root level="error"> + <appender-ref ref="STDOUT"/> + </root> +</configuration> \ No newline at end of file diff --git a/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/LoginController.groovy b/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/LoginController.groovy new file mode 100644 index 0000000000..7498e66af2 --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/LoginController.groovy @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +class LoginController { + + def auth() { + [pageTitle: "My Plugin Login Auth"] + } +} diff --git a/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/UrlMappings.groovy b/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/UrlMappings.groovy new file mode 100755 index 0000000000..b46435f9bd --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/controllers/exploded/UrlMappings.groovy @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +class UrlMappings { + + static mappings = { + "/$controller/$action?/$id?(.$format)?" { + constraints { + // apply constraints here + } + } + + "/"(view: "/index") + "500"(view: '/error') + "404"(view: '/notFound') + } +} diff --git a/grails-test-examples/plugins/exploded/grails-app/init/exploded/Application.groovy b/grails-test-examples/plugins/exploded/grails-app/init/exploded/Application.groovy new file mode 100755 index 0000000000..d42e32f168 --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/init/exploded/Application.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +import grails.boot.GrailsApp +import grails.boot.config.GrailsAutoConfiguration + +class Application extends GrailsAutoConfiguration { + static void main(String[] args) { + GrailsApp.run(Application, args) + } +} diff --git a/grails-test-examples/plugins/exploded/grails-app/init/exploded/BootStrap.groovy b/grails-test-examples/plugins/exploded/grails-app/init/exploded/BootStrap.groovy new file mode 100755 index 0000000000..ca21e748a2 --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/init/exploded/BootStrap.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +class BootStrap { + + def init = { + } + + def destroy = { + } +} diff --git a/grails-test-examples/plugins/exploded/grails-app/views/layouts/main.gsp b/grails-test-examples/plugins/exploded/grails-app/views/layouts/main.gsp new file mode 100755 index 0000000000..98aabf22b3 --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/views/layouts/main.gsp @@ -0,0 +1,70 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html lang="en" class="no-js"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <meta http-equiv="X-UA-Compatible" content="IE=edge"/> + <title> + <g:layoutTitle default="Grails"/> + </title> + <meta name="viewport" content="width=device-width, initial-scale=1"/> + <asset:link rel="icon" href="favicon.ico" type="image/x-ico"/> + + <asset:stylesheet src="application.css"/> + + <g:layoutHead/> +</head> + +<body> + +<div class="navbar navbar-default navbar-static-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="/#"> + <asset:image src="grails.svg" alt="Grails Logo"/> + </a> + </div> + + <div class="navbar-collapse collapse" aria-expanded="false" style="height: 0.8px;"> + <ul class="nav navbar-nav navbar-right"> + <g:pageProperty name="page.nav"/> + </ul> + </div> + </div> +</div> + +<g:layoutBody/> + +<div class="footer" role="contentinfo"></div> + +<div id="spinner" class="spinner" style="display:none;"> + <g:message code="spinner.alt" default="Loading…"/> +</div> + +<asset:javascript src="application.js"/> + +</body> +</html> diff --git a/grails-test-examples/plugins/exploded/grails-app/views/login/auth.gsp b/grails-test-examples/plugins/exploded/grails-app/views/login/auth.gsp new file mode 100755 index 0000000000..6bf16cfb6d --- /dev/null +++ b/grails-test-examples/plugins/exploded/grails-app/views/login/auth.gsp @@ -0,0 +1,31 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ https://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<!doctype html> +<html> +<head> + <meta name="layout" content="main"/> + <title>${pageTitle}</title> +</head> + +<body> +<div> + <p>My Plugin Login Page</p> +</div> +</body> +</html> diff --git a/grails-test-examples/plugins/exploded/src/main/groovy/exploded/ExplodedGrailsPlugin.groovy b/grails-test-examples/plugins/exploded/src/main/groovy/exploded/ExplodedGrailsPlugin.groovy new file mode 100755 index 0000000000..31615ddc0d --- /dev/null +++ b/grails-test-examples/plugins/exploded/src/main/groovy/exploded/ExplodedGrailsPlugin.groovy @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package exploded + +import grails.plugins.* + +class ExplodedGrailsPlugin extends Plugin { + + def title = "Exploded Plugin" + def author = "Your name" + def authorEmail = "" + def description = '''\ +Brief summary/description of the plugin. +''' + def profiles = ['web'] + + def loadAfter = ['springSecurityCore'] + +} diff --git a/settings.gradle b/settings.gradle index b28de3a38c..bba933114a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -349,6 +349,7 @@ include( 'grails-test-examples-app2', 'grails-test-examples-app3', 'grails-test-examples-external-configuration', + 'grails-test-examples-exploded', 'grails-test-examples-datasources', 'grails-test-examples-namespaces', 'grails-test-examples-geb', @@ -368,6 +369,7 @@ include( 'grails-test-examples-plugins-loadafter', 'grails-test-examples-plugins-issue11005', 'grails-test-examples-issue-11767', + 'grails-test-examples-plugins-exploded', 'grails-test-examples-plugins-issue-11767', 'grails-test-examples-cache', 'grails-test-examples-scaffolding', @@ -379,6 +381,7 @@ project(':grails-test-examples-app1').projectDir = file('grails-test-examples/ap project(':grails-test-examples-app2').projectDir = file('grails-test-examples/app2') project(':grails-test-examples-app3').projectDir = file('grails-test-examples/app3') project(':grails-test-examples-external-configuration').projectDir = file('grails-test-examples/external-configuration') +project(':grails-test-examples-exploded').projectDir = file('grails-test-examples/exploded') project(':grails-test-examples-datasources').projectDir = file('grails-test-examples/datasources') project(':grails-test-examples-geb').projectDir = file('grails-test-examples/geb') project(':grails-test-examples-geb-gebconfig').projectDir = file('grails-test-examples/geb-gebconfig') @@ -398,6 +401,7 @@ project(':grails-test-examples-plugins-loadsecond').projectDir = file('grails-te project(':grails-test-examples-plugins-loadafter').projectDir = file('grails-test-examples/plugins/loadafter') project(':grails-test-examples-plugins-issue11005').projectDir = file('grails-test-examples/plugins/issue11005') project(':grails-test-examples-issue-11767').projectDir = file('grails-test-examples/issue-11767') +project(':grails-test-examples-plugins-exploded').projectDir = file('grails-test-examples/plugins/exploded') project(':grails-test-examples-plugins-issue-11767').projectDir = file('grails-test-examples/plugins/issue-11767') project(':grails-test-examples-cache').projectDir = file('grails-test-examples/cache') project(':grails-test-examples-scaffolding').projectDir = file('grails-test-examples/scaffolding')
