You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2025/08/06 20:02:37 UTC

(grails-core) 01/01: Add build test for grails-micronaut feature, consolidate tests

This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch addition-micronaut-feature-test
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit d9833fcfd2bb2e9d526754fbc9cb0654f6026156
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Wed Aug 6 16:02:22 2025 -0400

    Add build test for grails-micronaut feature, consolidate tests
---
 .../create/CreateAppGrailsMicronautSpec.groovy     | 69 ++++++++++++++++++++++
 .../org/grails/forge/create/CreateAppSpec.groovy   | 14 -----
 2 files changed, 69 insertions(+), 14 deletions(-)

diff --git a/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppGrailsMicronautSpec.groovy b/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppGrailsMicronautSpec.groovy
new file mode 100644
index 0000000000..cec43f6866
--- /dev/null
+++ b/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppGrailsMicronautSpec.groovy
@@ -0,0 +1,69 @@
+/*
+ *  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 org.grails.forge.create
+
+import io.micronaut.context.ApplicationContext
+import org.grails.forge.application.ApplicationType
+import org.grails.forge.application.OperatingSystem
+import org.grails.forge.utils.CommandSpec
+
+class CreateAppGrailsMicronautSpec extends CommandSpec {
+
+    ApplicationContext beanContext
+
+    void setup() {
+        beanContext = ApplicationContext.run()
+    }
+
+    void cleanup() {
+        beanContext.close()
+        beanContext = null
+    }
+
+    void "test basic create-app build task with grails-micronaut feature"() {
+        given:
+        generateProject(OperatingSystem.MACOS_ARCH64, ['grails-micronaut'], ApplicationType.WEB)
+
+        when:
+        final String output = executeGradle("build").getOutput()
+
+        then:
+        output.contains('BUILD SUCCESSFUL')
+    }
+
+    void "test gradle.properties and build.gradle with micronaut feature"() {
+        given:
+        generateProject(OperatingSystem.MACOS_ARCH64, ['grails-micronaut'], ApplicationType.WEB)
+
+        def gradleProperties = new File(dir, 'gradle.properties')
+        def gradleBuildFile = new File(dir, 'build.gradle')
+
+        expect:
+        gradleProperties.exists()
+        gradleProperties.text.contains('micronautPlatformVersion=4.9.2')
+        gradleBuildFile.exists()
+        gradleBuildFile.text.contains('implementation "org.apache.grails:grails-micronaut"')
+    }
+
+    @Override
+    String getTempDirectoryPrefix() {
+        return "test-app"
+    }
+}
diff --git a/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppSpec.groovy b/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppSpec.groovy
index 94c41d3836..89d3297bf3 100644
--- a/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppSpec.groovy
+++ b/grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppSpec.groovy
@@ -81,20 +81,6 @@ class CreateAppSpec extends CommandSpec {
         '''.stripIndent(8)
     }
 
-    void "test create-app with micronaut feature"() {
-        given:
-        generateProject(OperatingSystem.MACOS_ARCH64, ['grails-micronaut'], ApplicationType.WEB)
-
-        def gradleProperties = new File(dir, 'gradle.properties')
-        def gradleBuildFile = new File(dir, 'build.gradle')
-
-        expect:
-        gradleProperties.exists()
-        gradleProperties.text.contains('micronautPlatformVersion=4.9.2')
-        gradleBuildFile.exists()
-        gradleBuildFile.text.contains('implementation "org.apache.grails:grails-micronaut"')
-    }
-
     void "test create-app web-plugin creates a correct Application.groovy"() {
         given:
         generateProject(OperatingSystem.MACOS_ARCH64, [], ApplicationType.WEB_PLUGIN)