Skip to content

Commit

Permalink
Merge 2111518 into b2c49e9
Browse files Browse the repository at this point in the history
  • Loading branch information
cjstehno committed Jun 16, 2017
2 parents b2c49e9 + 2111518 commit 850aada
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -22,14 +22,14 @@ Project artifacts are available via the JCenter (Bintray) and Maven Central repo

For Gradle:

testCompile 'com.stehno.ersatz:ersatz:1.2.0'
testCompile 'com.stehno.ersatz:ersatz:1.2.1'

For Maven:

<dependency>
<groupId>com.stehno.ersatz</groupId>
<artifactId>ersatz</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<scope>test</scope>
</dependency>

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = 'com.stehno.ersatz'
version = '1.2.0'
version = '1.2.1'

sourceCompatibility = 8
targetCompatibility = 8
Expand All @@ -28,7 +28,7 @@ configurations {

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.8'
compile 'io.undertow:undertow-core:1.4.6.Final'
compile 'io.undertow:undertow-core:1.3.15.Final' // track with boot/grails supported version

compile 'ch.qos.logback:logback-classic:1.1.7'

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Fri Mar 10 15:17:13 CST 2017
#Fri Jun 16 07:18:29 CDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
6 changes: 3 additions & 3 deletions gradlew
Expand Up @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -155,7 +155,7 @@ if $cygwin ; then
fi

# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
Expand Down
6 changes: 3 additions & 3 deletions src/docs/asciidoc/index.adoc
@@ -1,6 +1,6 @@
= Ersatz Server User Guide
Christopher J. Stehno <chris@stehno.com>
v1.2.0, March 2017
v1.2.1, March 2017
:toc: left
:toclevels: 3

Expand Down Expand Up @@ -31,14 +31,14 @@ The `ersatz` library is available via Bintray (JCenter) and the Maven Central Re

For Gradle:

testCompile 'com.stehno.ersatz:ersatz:1.2.0'
testCompile 'com.stehno.ersatz:ersatz:1.2.1'

For Maven:

<dependency>
<groupId>com.stehno.ersatz</groupId>
<artifactId>ersatz</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<scope>test</scope>
</dependency>

Expand Down
20 changes: 13 additions & 7 deletions src/main/groovy/com/stehno/ersatz/ErsatzServer.groovy
Expand Up @@ -22,7 +22,6 @@ import com.stehno.ersatz.impl.ErsatzRequest
import com.stehno.ersatz.impl.ExpectationsImpl
import com.stehno.ersatz.impl.UndertowClientRequest
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode
import groovy.util.logging.Slf4j
import io.undertow.Undertow
import io.undertow.server.HttpHandler
Expand All @@ -42,6 +41,8 @@ import java.util.function.BiFunction
import java.util.function.Consumer
import java.util.function.Function

import static groovy.transform.TypeCheckingMode.SKIP

/**
* The main entry point for configuring an Ersatz server, which allows configuring of the expectations and management of the server itself. This is
* the class that should be instantiated in unit tests.
Expand Down Expand Up @@ -317,16 +318,21 @@ class ErsatzServer implements ServerConfig {

server.start()

actualHttpPort = (server.listenerInfo[0].address as InetSocketAddress).port

if (httpsEnabled) {
actualHttpsPort = (server.listenerInfo[1].address as InetSocketAddress).port
}
applyPorts()

started = true
}
}

@CompileStatic(SKIP)
private void applyPorts() {
actualHttpPort = server.channels[0].channel.localAddress.holder.port

if (httpsEnabled) {
actualHttpsPort = server.channels[1].tcpServer.channel.localAddress.holder.port
}
}

/**
* Used to stop the HTTP server. The server may be restarted after it has been stopped.
*/
Expand Down Expand Up @@ -392,7 +398,7 @@ class ErsatzServer implements ServerConfig {
exchange.responseSender.send(responseContent)
}

@CompileStatic(TypeCheckingMode.SKIP)
@CompileStatic(SKIP)
private SSLContext sslContext() {
KeyStore keyStore = KeyStore.getInstance('JKS')

Expand Down

0 comments on commit 850aada

Please sign in to comment.