Moved cas server and cas sample into common parent folder (samples/cas)
This commit is contained in:
121
samples/cas/sample/cassample.gradle
Normal file
121
samples/cas/sample/cassample.gradle
Normal file
@@ -0,0 +1,121 @@
|
||||
// CAS sample build file
|
||||
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'jetty'
|
||||
apply plugin: 'groovy'
|
||||
|
||||
def excludeModules = ['spring-security-acl', 'jsr250-api', 'spring-jdbc', 'spring-tx']
|
||||
def jettyVersion = '7.1.6.v20100715'
|
||||
def keystore = "$rootDir/samples/certificates/server.jks"
|
||||
def password = 'password'
|
||||
|
||||
configurations {
|
||||
casServer
|
||||
excludeModules.each {name ->
|
||||
runtime.exclude module: name
|
||||
}
|
||||
|
||||
runtime.exclude group: 'org.aspectj'
|
||||
|
||||
integrationTestCompile.extendsFrom groovy
|
||||
}
|
||||
|
||||
sourceSets.integrationTest {
|
||||
groovy.srcDir file('src/integration-test/groovy')
|
||||
}
|
||||
|
||||
eclipseClasspath {
|
||||
plusConfigurations += configurations.integrationTestRuntime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
groovy 'org.codehaus.groovy:groovy:1.7.7'
|
||||
|
||||
providedCompile 'javax.servlet:servlet-api:2.5@jar'
|
||||
|
||||
compile project(':spring-security-core'),
|
||||
project(':spring-security-cas'),
|
||||
"org.jasig.cas.client:cas-client-core:3.1.12"
|
||||
|
||||
runtime project(':spring-security-web'),
|
||||
project(':spring-security-config'),
|
||||
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
|
||||
"ch.qos.logback:logback-classic:$logbackVersion"
|
||||
|
||||
integrationTestCompile project(':spring-security-cas'),
|
||||
'org.seleniumhq.selenium:selenium-htmlunit-driver:2.0a7',
|
||||
'org.spockframework:spock-core:0.4-groovy-1.7',
|
||||
'org.codehaus.geb:geb-spock:0.5.1',
|
||||
'commons-httpclient:commons-httpclient:3.1',
|
||||
"org.eclipse.jetty:jetty-server:$jettyVersion",
|
||||
"org.eclipse.jetty:jetty-servlet:$jettyVersion"
|
||||
}
|
||||
|
||||
[jettyRun, jettyRunWar]*.configure {
|
||||
contextPath = "/cas-sample"
|
||||
def httpConnector = new org.mortbay.jetty.nio.SelectChannelConnector();
|
||||
httpConnector.port = 8080
|
||||
httpConnector.confidentialPort = 8443
|
||||
def httpsConnector = new org.mortbay.jetty.security.SslSocketConnector();
|
||||
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,':spring-security-samples-casserver:casServer']) {
|
||||
}
|
||||
|
||||
task casServer(dependsOn: ':spring-security-samples-casserver:casServer') {
|
||||
}
|
||||
|
||||
integrationTest.dependsOn cas
|
||||
integrationTest.doFirst {
|
||||
systemProperties['cas.server.host'] = casServer().httpsHost
|
||||
systemProperties['cas.service.host'] = jettyRunWar.httpsHost
|
||||
systemProperties['jar.path'] = jar.archivePath
|
||||
systemProperties['javax.net.ssl.trustStore'] = keystore
|
||||
systemProperties['javax.net.ssl.trustStorePassword'] = password
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {graph ->
|
||||
def casServer = casServer()
|
||||
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {->
|
||||
delegate.connectors.find { it instanceof org.mortbay.jetty.security.SslSocketConnector }
|
||||
}
|
||||
[casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
|
||||
"localhost:"+delegate.httpsConnector.port
|
||||
}
|
||||
jettyRunWar.metaClass.getHttpConnector {->
|
||||
delegate.connectors.find { it instanceof org.mortbay.jetty.nio.SelectChannelConnector }
|
||||
}
|
||||
if (graph.hasTask(cas)) {
|
||||
jettyRunWar.dependsOn(casServer)
|
||||
casServer.daemon = true
|
||||
}
|
||||
if(graph.hasTask(integrationTest)) {
|
||||
tasks.getByPath(':spring-security-samples-casserver:casServerOverlay').logLevel = 'ERROR'
|
||||
jettyRunWar.additionalRuntimeJars += file("src/integration-test/resources")
|
||||
|
||||
jettyRunWar.daemon = true
|
||||
jettyRunWar.httpConnector.port = availablePort()
|
||||
jettyRunWar.httpsConnector.port = jettyRunWar.httpConnector.confidentialPort = availablePort()
|
||||
casServer.httpsConnector.port = availablePort()
|
||||
}
|
||||
}
|
||||
|
||||
def casServer() {
|
||||
tasks.getByPath(':spring-security-samples-casserver:casServer')
|
||||
}
|
||||
|
||||
def availablePort() {
|
||||
ServerSocket server = new ServerSocket(0)
|
||||
int port = server.localPort
|
||||
server.close()
|
||||
port
|
||||
}
|
||||
Reference in New Issue
Block a user