spring-security/samples/xml/cas/cassample/spring-security-samples-xml-cassample.gradle

127 lines
4.4 KiB
Groovy
Raw Normal View History

apply plugin: 'io.spring.convention.spring-sample'
2010-03-28 23:54:41 +01:00
apply plugin: 'war'
apply plugin: 'jetty'
def excludeModules = ['spring-security-acl', 'jsr250-api', 'spring-jdbc', 'spring-tx']
def keystore = "$rootDir/samples/certificates/server.jks"
def password = 'password'
configurations {
2015-03-23 11:14:26 -05:00
casServer
excludeModules.each {name ->
runtime.exclude module: name
}
2015-03-23 11:14:26 -05:00
runtime.exclude group: 'org.aspectj'
}
2012-08-31 15:49:28 -05:00
sourceSets {
2015-03-23 11:14:26 -05:00
test.resources.exclude 'GebConfig.groovy'
integrationTest.groovy.srcDir file('src/integration-test/groovy')
}
2015-01-22 12:34:52 -06:00
eclipse.classpath.plusConfigurations += [configurations.integrationTestRuntime]
dependencies {
compile project(':spring-security-cas')
compile project(':spring-security-core')
compile 'org.jasig.cas.client:cas-client-core'
providedCompile 'javax.servlet:javax.servlet-api'
runtime project(':spring-security-config')
runtime project(':spring-security-web')
runtime 'ch.qos.logback:logback-classic'
runtime 'net.sf.ehcache:ehcache'
runtime 'org.slf4j:jcl-over-slf4j'
runtime 'org.springframework:spring-context-support'
integrationTestCompile project(':spring-security-cas')
integrationTestCompile gebDependencies
integrationTestCompile seleniumDependencies
integrationTestCompile spockDependencies
integrationTestCompile 'org.codehaus.groovy:groovy'
integrationTestCompile 'org.eclipse.jetty:jetty-server'
integrationTestCompile 'org.eclipse.jetty:jetty-servlet'
integrationTestCompile 'org.slf4j:jcl-over-slf4j'
}
[project.tasks.jettyRun, project.tasks.jettyRunWar]*.configure {
contextPath = '/cas-sample'
2015-03-23 11:14:26 -05:00
def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance()
httpConnector.port = 8080
httpConnector.confidentialPort = 8443
def httpsConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance()
httpsConnector.port = 8443
httpsConnector.keystore = httpsConnector.truststore = keystore
httpsConnector.keyPassword = httpsConnector.trustPassword = password
connectors = [httpConnector, httpsConnector]
doFirst() {
System.setProperty('cas.server.host', casServer().httpsHost)
System.setProperty('cas.service.host', jettyRunWar.httpsHost)
}
}
task cas (dependsOn: [jettyRunWar]) {
jettyRunWar.dependsOn(':spring-security-samples-xml-casserver:casServer')
}
task casServer(dependsOn: ':spring-security-samples-xml-casserver:casServer') {
}
integrationTest.dependsOn cas
integrationTest.doFirst {
2015-03-23 11:14:26 -05:00
def casServiceHost = jettyRunWar.httpsHost
systemProperties['cas.server.host'] = casServer().httpsHost
systemProperties['cas.service.host'] = casServiceHost
systemProperties['geb.build.baseUrl'] = 'https://'+casServiceHost+'/cas-sample/'
systemProperties['geb.build.reportsDir'] = 'build/geb-reports'
systemProperties['jar.path'] = jar.archivePath
systemProperties['javax.net.ssl.trustStore'] = keystore
systemProperties['javax.net.ssl.trustStorePassword'] = password
}
gradle.taskGraph.whenReady {graph ->
2015-03-23 11:14:26 -05:00
def casServer = casServer()
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {->
def sslSocketConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector')
delegate.connectors.find { it in sslSocketConnClass }
}
[casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
"localhost:"+delegate.httpsConnector.port
}
jettyRunWar.metaClass.getHttpConnector {->
def channelConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector')
delegate.connectors.find { it in channelConnClass }
}
if (graph.hasTask(cas)) {
casServer.daemon = true
}
if(graph.hasTask(integrationTest)) {
tasks.getByPath(':spring-security-samples-xml-casserver:casServerOverlay').logLevel = 'ERROR'
2015-03-23 11:14:26 -05:00
jettyRunWar {
additionalRuntimeJars += file('src/integration-test/resources')
2015-03-23 11:14:26 -05:00
daemon = true
}
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector,casServer.httpsConnector]*.metaClass*.reservePort { taskToCloseSocket ->
def serverSocket = new ServerSocket(0)
delegate.metaClass.serverSocket = serverSocket
delegate.port = serverSocket.localPort
taskToCloseSocket.doFirst {
serverSocket.close()
}
}
[jettyRunWar.httpConnector,jettyRunWar.httpsConnector]*.reservePort(jettyRunWar)
jettyRunWar.httpConnector.confidentialPort = jettyRunWar.httpsConnector.port
casServer.httpsConnector.reservePort(casServer)
}
}
def casServer() {
tasks.getByPath(':spring-security-samples-xml-casserver:casServer')
2013-08-01 14:14:18 -05:00
}