Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit d90bac3

Browse files
committed
Updated to Grails 3.3.2
1 parent b432bd4 commit d90bac3

File tree

10 files changed

+108
-56
lines changed

10 files changed

+108
-56
lines changed

build.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ buildscript {
44
ext {
55
grailsVersion = project.grailsVersion
66
gormVersion = project.gormVersion
7+
elasticsearchVersion = project.elasticsearchVersion
8+
elasticsearchAttachmentsVersion = project.elasticsearchAttachmentsVersion
79
}
810
repositories {
911
mavenLocal()
@@ -35,7 +37,8 @@ apply plugin: 'maven-publish'
3537

3638
ext {
3739
gradleWrapperVersion = project.gradleWrapperVersion
38-
elasticsearchVersion = '5.4.1'
40+
elasticsearchVersion = project.elasticsearchVersion
41+
elasticsearchAttachmentsVersion = project.elasticsearchAttachmentsVersion
3942
}
4043

4144
sourceCompatibility = 1.7
@@ -100,7 +103,7 @@ dependencies {
100103

101104
testCompile "org.grails:grails-gorm-testing-support"
102105
testCompile "org.grails:grails-plugin-testing"
103-
testCompile "org.grails:grails-test-mixins:3.3.0"
106+
testCompile "org.grails:grails-web-testing-support"
104107

105108
testCompile 'com.vividsolutions:jts:1.13'
106109
testCompile 'com.googlecode.json-simple:json-simple:1.1.1'
@@ -151,6 +154,13 @@ task cleanDataDir(type: Delete) {
151154
delete fileTree(dir: 'data')
152155
}
153156

157+
bootRun {
158+
jvmArgs('-Dspring.output.ansi.enabled=always')
159+
addResources = true
160+
}
161+
// enable if you wish to package this plugin as a standalone application
162+
bootRepackage.enabled = false
163+
154164
apply from: "gradle/documentation.gradle"
155165

156166
apply from: "gradle/publish.gradle"

gradle.properties

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
grailsVersion=3.3.1
2-
gormVersion=6.1.7.RELEASE
3-
gradleWrapperVersion=3.0
1+
grailsVersion=3.3.2
2+
gormVersion=6.1.8.RELEASE
3+
gradleWrapperVersion=3.5
4+
elasticsearchVersion=5.4.1
5+
elasticsearchAttachmentsVersion=5.4.1

gradle/documentation.gradle

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,34 @@ task asciidoc(type: AsciidoctorTask, description: 'Generates single-page HTML an
5151
backends 'html5', 'pdf'
5252
}
5353

54-
task docs(dependsOn: [asciidoc]) << {
55-
File dir = new File(buildDir, 'docs/docs')
56-
['pdf'].each { String ext ->
57-
File f = new File(dir, 'index.' + ext)
58-
if (f.exists()) {
59-
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
54+
task docs(dependsOn: [asciidoc]) {
55+
doLast {
56+
File dir = new File(buildDir, 'docs/docs')
57+
['pdf'].each { String ext ->
58+
File f = new File(dir, 'index.' + ext)
59+
if (f.exists()) {
60+
f.renameTo new File(dir, project.name + '-' + project.version + '.' + ext)
61+
}
6062
}
61-
}
6263

63-
File quickRefDir = new File(buildDir, 'docs/docs/ref')
64-
['pdf'].each { String ext ->
65-
File f = new File(quickRefDir, 'index.' + ext)
66-
if (f.exists()) {
67-
f.renameTo new File(quickRefDir, project.name + '-' + project.version + '-' + 'quickReference' + '.' + ext)
64+
File quickRefDir = new File(buildDir, 'docs/docs/ref')
65+
['pdf'].each { String ext ->
66+
File f = new File(quickRefDir, 'index.' + ext)
67+
if (f.exists()) {
68+
f.renameTo new File(quickRefDir, project.name + '-' + project.version + '-' + 'quickReference' + '.' + ext)
69+
}
6870
}
69-
}
7071

71-
File ghpages = new File(buildDir, 'docs/index.html')
72-
if (ghpages.exists()) {
73-
ghpages.delete()
74-
}
75-
ghpages << file('src/docs/index.tmpl').text.replaceAll('@VERSION@', project.version)
72+
File ghpages = new File(buildDir, 'docs/index.html')
73+
if (ghpages.exists()) {
74+
ghpages.delete()
75+
}
76+
ghpages << file('src/docs/index.tmpl').text.replaceAll('@VERSION@', project.version)
7677

77-
copy {
78-
from 'src/docs'
79-
into new File(buildDir, 'docs').path
80-
include '**/*.png'
78+
copy {
79+
from 'src/docs'
80+
into new File(buildDir, 'docs').path
81+
include '**/*.png'
82+
}
8183
}
8284
}

gradle/wrapper/gradle-wrapper.jar

-820 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri May 13 09:39:16 CEST 2016
1+
#Fri Nov 27 23:09:32 CET 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip

gradlew.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ echo location of your Java installation.
4646
goto fail
4747

4848
:init
49-
@rem Get command-line arguments, handling Windows variants
49+
@rem Get command-line arguments, handling Windowz variants
5050

5151
if not "%OS%" == "Windows_NT" goto win9xME_args
5252
if "%@eval[2+2]" == "4" goto 4NT_args

grails-app/conf/application.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,34 @@ grails:
33
profile: web-plugin
44
codegen:
55
defaultPackage: grails.plugins.elasticsearch
6-
databinding.dateFormats: ["yyyy-MM-dd'T'HH:mm:ss.SSSZ"]
6+
spring:
7+
transactionManagement:
8+
proxies: false
9+
gorm:
10+
reactor:
11+
# Whether to translate GORM events into Reactor events
12+
# Disabled by default for performance reasons
13+
events: false
14+
databinding:
15+
dateFormats: ["yyyy-MM-dd'T'HH:mm:ss.SSSZ"]
716
info:
817
app:
918
name: '@info.app.name@'
1019
version: '@info.app.version@'
1120
grailsVersion: '@info.app.grailsVersion@'
1221
spring:
22+
main:
23+
banner-mode: "off"
1324
groovy:
1425
template:
1526
check-template-location: false
27+
28+
# Spring Actuator Endpoints are Disabled by Default
29+
endpoints:
30+
enabled: false
31+
jmx:
32+
enabled: true
33+
1634
---
1735
grails:
1836
mime:

grails-app/init/grails/plugins/elasticsearch/Application.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package grails.plugins.elasticsearch
22

33
import grails.boot.GrailsApp
44
import grails.boot.config.GrailsAutoConfiguration
5+
import grails.plugins.metadata.PluginSource
56

7+
@PluginSource
68
class Application extends GrailsAutoConfiguration {
79
static void main(String[] args) {
810
GrailsApp.run(Application, args)

src/test/groovy/grails/plugins/elasticsearch/ElasticSearchAdminServiceSpec.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package grails.plugins.elasticsearch
22

3-
import grails.test.mixin.TestFor
3+
import grails.testing.services.ServiceUnitTest
44
import spock.lang.Specification
55
import spock.lang.Unroll
66

77
/**
88
* Created by @marcos-carceles on 15/01/15.
99
*/
10-
@TestFor(ElasticSearchAdminService)
11-
class ElasticSearchAdminServiceSpec extends Specification {
10+
class ElasticSearchAdminServiceSpec extends Specification implements ServiceUnitTest<ElasticSearchAdminService> {
1211

1312
@Unroll
1413
void "identifies the next index version correctly"() {
Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
package grails.plugins.elasticsearch.mapping
22

3-
import grails.core.GrailsApplication
43
import grails.core.GrailsDomainClass
54
import grails.plugins.elasticsearch.util.IndexNamingUtils
6-
import grails.test.mixin.Mock
7-
import org.grails.core.DefaultGrailsDomainClass
5+
import grails.testing.gorm.DataTest
6+
import grails.testing.spring.AutowiredTest
7+
import org.grails.datastore.gorm.config.GrailsDomainClassMappingContext
88
import spock.lang.Specification
99
import test.Photo
1010
import test.upperCase.UpperCase
1111

12-
@Mock([Photo, UpperCase])
13-
class SearchableClassMappingSpec extends Specification {
12+
class SearchableClassMappingSpec extends Specification implements DataTest, AutowiredTest {
13+
14+
Closure doWithSpring() {{ ->
15+
mappingContext GrailsDomainClassMappingContext
16+
domainReflectionService DomainReflectionService
17+
}}
18+
19+
DomainReflectionService domainReflectionService
20+
21+
void setupSpec() {
22+
mockDomains(Photo, UpperCase)
23+
}
1424

1525
def "indexing and querying index are calculated based on the index name"() {
1626
given:
17-
def domainClass = Mock(DomainEntity)
27+
def domainClass = Mock(GrailsDomainClass)
1828
domainClass.getPackageName() >> packageName
1929

2030
when:
21-
SearchableClassMapping scm = new SearchableClassMapping(null, domainClass, [])
31+
SearchableClassMapping scm = new SearchableClassMapping(grailsApplication, new DomainEntity(domainReflectionService, domainClass, null), [])
2232

2333
then:
24-
scm.indexName == packageName
34+
scm.indexName == domainClass.packageName
2535
scm.queryingIndex == IndexNamingUtils.queryingIndexFor(packageName)
2636
scm.indexingIndex == IndexNamingUtils.indexingIndexFor(packageName)
2737
scm.queryingIndex != scm.indexingIndex
@@ -33,29 +43,38 @@ class SearchableClassMappingSpec extends Specification {
3343
}
3444

3545
void testGetIndexName() throws Exception {
36-
GrailsDomainClass dc = new DefaultGrailsDomainClass(Photo.class)
37-
dc.grailsApplication = [:] as GrailsApplication
38-
SearchableClassMapping mapping = new SearchableClassMapping(dc, null)
39-
assert 'test' == mapping.getIndexName()
46+
when:
47+
def domainClass = Mock(GrailsDomainClass)
48+
domainClass.getPackageName() >> "test"
49+
SearchableClassMapping mapping = new SearchableClassMapping(grailsApplication, new DomainEntity(domainReflectionService, domainClass, null), null)
50+
51+
then:
52+
'test' == mapping.getIndexName()
4053
}
4154

4255
void testManuallyConfiguredIndexName() throws Exception {
43-
GrailsDomainClass dc = new DefaultGrailsDomainClass(Photo.class)
44-
dc.grailsApplication = [:] as GrailsApplication
45-
config.elasticSearch.index.name = 'index-name'
46-
SearchableClassMapping mapping = new SearchableClassMapping(dc, null)
47-
assert 'index-name' == mapping.getIndexName()
56+
57+
when:
58+
DomainEntity dc = domainReflectionService.getAbstractDomainEntity(Photo.class)
59+
grailsApplication.config.elasticSearch.index.name = 'index-name'
60+
SearchableClassMapping mapping = new SearchableClassMapping(grailsApplication, dc, null)
61+
62+
then:
63+
'index-name' == mapping.getIndexName()
4864
}
4965

5066
void testIndexNameIsLowercaseWhenPackageNameIsLowercase() throws Exception {
51-
GrailsDomainClass dc = new DefaultGrailsDomainClass(UpperCase.class)
52-
dc.grailsApplication = [:] as GrailsApplication
53-
SearchableClassMapping mapping = new SearchableClassMapping(dc, null)
67+
when:
68+
def domainClass = Mock(GrailsDomainClass)
69+
domainClass.getPackageName() >> "test.upperCase"
70+
SearchableClassMapping mapping = new SearchableClassMapping(grailsApplication, new DomainEntity(domainReflectionService, domainClass, null), null)
5471
String indexName = mapping.getIndexName()
55-
assert 'test.uppercase' == indexName
72+
73+
then:
74+
'test.uppercase' == indexName
5675
}
5776

5877
void cleanup() {
59-
config.elasticSearch.index.name = null
78+
grailsApplication.config.elasticSearch.index.name = null
6079
}
6180
}

0 commit comments

Comments
 (0)