Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using github workflows instead. See https://github.com/grails-plugins/grails-mail/tree/5.0.x/.github for examples

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cache:
- $HOME/.gradle
language: groovy
jdk:
- openjdk7
- openjdk17
before_script:
- rm -rf target
script: ./travis-build.sh
Expand Down
79 changes: 35 additions & 44 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,64 @@ buildscript {
grailsVersion = project.grailsVersion
}
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/restricted" }
maven {
url = 'https://repository.apache.org/content/groups/snapshots'
content {
includeVersionByRegex('org[.]apache[.](grails|groovy).*', '.*', '.*-SNAPSHOT')
}
}
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath platform("org.apache.grails:grails-bom:$grailsVersion")
classpath "org.apache.grails:grails-gradle-plugins"
}
}

plugins {
id "io.spring.dependency-management" version "1.1.0"
}

version "2.1.0-SNAPSHOT"
version "3.0.0-SNAPSHOT"
group "org.grails.plugins"

apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "spring-boot"
apply plugin: "org.grails.grails-plugin"
apply plugin: "org.grails.grails-gsp"
apply plugin: "org.grails.grails-doc"
apply plugin:"org.apache.grails.gradle.grails-plugin"
apply plugin:"org.apache.grails.gradle.grails-gsp"
// Used for publishing to central repository, remove if not needed
apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'
//apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle'

ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}

sourceCompatibility = 1.7
targetCompatibility = 1.7


repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}

dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
maven { url "https://repo.grails.org/grails/restricted" }
maven {
url = 'https://repository.apache.org/content/groups/snapshots'
content {
includeVersionByRegex('org[.]apache[.](grails|groovy).*', '.*', '.*-SNAPSHOT')
}
}
applyMavenExclusions false
mavenLocal()
}

dependencies {
compileOnly platform("org.apache.grails:grails-bom:$grailsVersion")
compileOnly 'org.apache.grails:grails-dependencies-starter-web'

compile 'org.xhtmlrenderer:flying-saucer-pdf-openpdf:9.1.22'
testCompile("org.apache.pdfbox:pdfbox:1.0.0") {
exclude module:'jempbox'
}
testImplementation "org.apache.grails:grails-testing-support-datamapping"
testImplementation "org.spockframework:spock-core"
testImplementation "org.apache.grails:grails-testing-support-web"

provided 'org.springframework.boot:spring-boot-starter-logging'
provided "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-autoconfigure"
provided "org.springframework.boot:spring-boot-starter-tomcat"

provided "org.grails:grails-web-boot"
provided "org.grails:grails-dependencies"
provided 'javax.servlet:javax.servlet-api:3.1.0'

testCompile "org.grails:grails-plugin-testing"
testCompile 'org.grails:grails-datastore-rest-client:4.0.3.RELEASE'
console "org.grails:grails-console"
implementation 'org.xhtmlrenderer:flying-saucer-pdf-openpdf:9.1.22'
testImplementation("org.apache.pdfbox:pdfbox:3.0.5") {
exclude module:'jempbox'
}
}

task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
compileJava.options.release = 17

jar {
exclude "RenderingController**"
Expand All @@ -83,3 +70,7 @@ jar {
exclude "gsp_*"
exclude "gsp/*"
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
grailsVersion=3.0.9
gradleWrapperVersion=2.6
grailsVersion=7.0.0-RC2
gradleWrapperVersion=8.14.3
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Feb 04 17:05:29 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip
2 changes: 1 addition & 1 deletion grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
grails:
profile: web-plugin
profile: plugin
codegen:
defaultPackage: grails.plugins.rendering
spring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package grails.plugins.rendering

import grails.util.GrailsUtil

import javax.servlet.http.HttpServletResponse
import jakarta.servlet.http.HttpServletResponse

import org.w3c.dom.Document

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/

package grails.plugins.rendering

import org.apache.commons.codec.binary.Base64

/**
* @todo need tests for this.
*/
Expand All @@ -39,7 +36,7 @@ class RenderingTagLib {
out << '<img src="data:'
out << mimeType
out << ';base64,'
out << new String(new Base64().encode(bytes), "UTF-8")
out << new String(Base64.encoder.encode(bytes), 'UTF-8')
out << '" '
attrs.each { k,v -> out << "$k=\"${v ? v.encodeAsHTML() : ''}\" " }
out << ' />'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,18 @@
*/
package grails.plugins.rendering



import java.util.concurrent.TimeUnit

import grails.testing.mixin.integration.Integration
import spock.lang.Specification
import spock.util.concurrent.BlockingVariable
import spock.lang.*
import grails.test.mixin.integration.IntegrationTestMixin
import grails.test.mixin.*

@TestMixin(IntegrationTestMixin)
@Integration
class BackgroundRenderingSpec extends Specification {



def backgroundRenderingService

def "background render"() {
given:
def renderError = new BlockingVariable(10, TimeUnit.SECONDS)
def renderError = new BlockingVariable(10)
when:
backgroundRenderingService.fireEvent(renderError)
then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@
*/
package grails.plugins.rendering

import spock.lang.*
import grails.plugins.rest.client.RestBuilder

import org.springframework.http.HttpMethod
import org.springframework.web.client.RestTemplate
import spock.lang.Specification

class ControllerRelativeTemplateSpec extends Specification {

def accessingControllerRelativeTemplateWorks() {
when:
def rest = new RestBuilder()
def resp = rest.get("http://localhost:8080/rendering/relative")
RestTemplate restTemplate = new RestTemplate()
def resp = restTemplate.exchange(
"http://localhost:8080/rendering/relative",
HttpMethod.GET,
null,
String
)
then:
resp.status == 200
resp.statusCode.value() == 200
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
*/
package grails.plugins.rendering


import grails.testing.mixin.integration.Integration
import grails.util.Holders

import spock.lang.Ignore
import spock.lang.Specification
import spock.lang.Unroll

import spock.lang.*
import grails.test.mixin.integration.IntegrationTestMixin
import grails.test.mixin.*

@TestMixin(IntegrationTestMixin)
@Integration
class RenderingGrailsPluginSpec extends Specification {

def grailsApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ package grails.plugins.rendering

import grails.plugins.rendering.document.UnknownTemplateException
import grails.plugins.rendering.document.XmlParseException


import grails.testing.mixin.integration.Integration
import org.springframework.mock.web.MockHttpServletResponse
import spock.lang.Ignore
import spock.lang.Specification

import spock.lang.*
import grails.test.mixin.integration.IntegrationTestMixin
import grails.test.mixin.*

@TestMixin(IntegrationTestMixin)
@Integration
abstract class RenderingServiceSpec extends Specification {

def grailsApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@
*/
package grails.plugins.rendering.document

import grails.testing.mixin.integration.Integration
import spock.lang.Specification

/**
* The xhtmlDocumentService is exercised in the rendering
* service tests. This is here for testing future functionality.
*/
import spock.lang.*
import grails.test.mixin.integration.IntegrationTestMixin
import grails.test.mixin.*

@TestMixin(IntegrationTestMixin)
@Integration
class XhtmlDocumentServiceSpec extends Specification {

def xhtmlDocumentService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package grails.plugins.rendering.datauri

import org.apache.commons.codec.binary.Base64

class DataUri {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making @CompileStatic


// Default values sourced from http://en.wikipedia.org/wiki/Data_URI_scheme
Expand Down Expand Up @@ -68,7 +66,7 @@ class DataUri {

byte[] getBytes() {
if (base64) {
new Base64().decode(data.getBytes("ASCII"))
Base64.decoder.decode(data.getBytes('ASCII'))
} else {
URLDecoder.decode(data, "ISO-8859-1").getBytes("ISO-8859-1")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,18 @@
package grails.plugins.rendering

import grails.plugins.rendering.datauri.DataUri
import grails.testing.web.taglib.TagLibUnitTest
import spock.lang.Shared

import org.apache.commons.codec.binary.Base64
import spock.lang.Specification

import grails.test.mixin.web.GroovyPageUnitTestMixin
import spock.lang.*
import grails.test.mixin.integration.IntegrationTestMixin
import grails.test.mixin.*

@TestMixin(GroovyPageUnitTestMixin)
class RenderingTagLibSpec extends Specification {
class RenderingTagLibSpec extends Specification implements TagLibUnitTest<RenderingTagLib> {

@Shared bytes = [1,2,3] as byte[]
@Shared encoded = new String(new Base64().encode(bytes), "UTF-8")
@Shared encoded = new String(Base64.encoder.encode(bytes), 'UTF-8')

@Shared String template

def setup() {
mockTagLib(RenderingTagLib)
}

protected getOutputMimeType() {
getDataUri().mimeType
}
Expand All @@ -62,7 +54,7 @@ class RenderingTagLibSpec extends Specification {
def "inline image tag"() {
given:
params.mimeType = 'abc/123'
template = '<rendering:inlineImage mimeType="${mimeType}" bytes="${bytes}" />'
template = '<rendering:inlineImage mimeType="${mimeType}" bytes="${bytes}" />'

expect:
outputMimeType == "abc/123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package grails.plugins.rendering.datauri

import org.apache.commons.codec.binary.Base64
import spock.lang.*

import spock.lang.Specification

class DataUriSpec extends Specification {

def "encoding base64 round trip"() {
given:
def bytes = getRedDotBytes()
def base64 = new String(new Base64().encode(bytes), "UTF-8")
def base64 = new String(Base64.encoder.encode(bytes), 'UTF-8')

when:
def dataUri = new DataUri("data:base64,$base64")
Expand Down