Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for bug whereby socket/connection timeouts became mandatory!
- Loading branch information
Antony Jones
committed
Aug 29, 2011
1 parent
62f0f7d
commit 90338b1
Showing
3 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,50 @@ | |||
import grails.plugin.spock.ControllerSpec | |||
import org.grails.plugins.oauth.OauthService | |||
import grails.plugin.spock.UnitSpec | |||
import spock.lang.Unroll | |||
|
|||
class ConfigurationSpec extends UnitSpec { | |||
|
|||
@Unroll("Socket timeout is correctly read when socket timeout is #socketTimeout and connection timeout is #connectionTimeout") | |||
def "Socket timeout is read correctly"() { | |||
|
|||
given: | |||
mockConfig """ | |||
httpClient { | |||
timeout { | |||
socket = ${socketTimeout} | |||
connection = ${connectionTimeout} | |||
} | |||
} | |||
""" | |||
|
|||
when: | |||
OauthService oauthService = new OauthService() | |||
|
|||
then: | |||
oauthService.connectionTimeout == connectionTimeout | |||
oauthService.socketTimeout == socketTimeout | |||
|
|||
where: | |||
connectionTimeout | socketTimeout | |||
5000 | 5000 | |||
60000 | 60000 | |||
|
|||
} | |||
|
|||
def "Socket timeout is defaulted when no configuration is available"() { | |||
|
|||
given: | |||
mockConfig '' | |||
|
|||
when: | |||
OauthService oauthService = new OauthService() | |||
|
|||
then: | |||
oauthService.connectionTimeout == 60000 | |||
oauthService.socketTimeout == 60000 | |||
|
|||
|
|||
} | |||
|
|||
} |