Skip to content

Commit

Permalink
Deps update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Kopylec committed Sep 21, 2016
1 parent 073a102 commit ddae934
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
*.iml
gradle.properties
.gradle
build
release
build
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '1.3.5.RELEASE', optional
compile group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '1.3.5.RELEASE', optional

testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.3.5.RELEASE'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.3.5.RELEASE'
testCompile group: 'org.spockframework', name: 'spock-spring', version: '1.0-groovy-2.4'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '1.58'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '1.4.0.RELEASE'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.4.0.RELEASE'
testCompile group: 'org.spockframework', name: 'spock-spring', version: '1.1-groovy-2.4-rc-2'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.1.12'
}

configurations {
Expand Down
12 changes: 12 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
while getopts v: opts; do
case ${opts} in
v) VERSION=${OPTARG} ;;
esac
done

if [ -z "$VERSION" ]; then
echo "Set release version using -v option"
exit 1
else
./gradlew clean test release -Prelease.forceVersion=$VERSION && ./gradlew uploadArchives -PsignArtifacts
fi
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule
import org.junit.Rule
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext
import org.springframework.boot.test.SpringApplicationContextLoader
import org.springframework.boot.test.WebIntegrationTest
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.ResponseEntity
import org.springframework.test.context.ContextConfiguration
import org.springframework.util.LinkedMultiValueMap
import org.springframework.web.client.RestTemplate
import spock.lang.Shared
import spock.lang.Specification

@WebIntegrationTest(randomPort = true)
@ContextConfiguration(loader = SpringApplicationContextLoader, classes = TestApplication)
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT

@SpringBootTest(webEnvironment = RANDOM_PORT, classes = TestApplication)
abstract class BasicSpec extends Specification {

@Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.mkopylec.recaptcha.stubs

import com.fasterxml.jackson.databind.ObjectMapper
import com.github.tomakehurst.wiremock.client.ValueMatchingStrategy
import com.github.tomakehurst.wiremock.matching.StringValuePattern

import static com.github.mkopylec.recaptcha.Strings.INVALID_CAPTCHA_RESPONSE
import static com.github.mkopylec.recaptcha.Strings.INVALID_SECRET
Expand Down Expand Up @@ -54,7 +54,7 @@ class RecaptchaValidationStubs {
));
}

private static ValueMatchingStrategy nullableContaining(String param, String value) {
private static StringValuePattern nullableContaining(String param, String value) {
value != null ? containing("$param=$value") : containing('')
}
}
31 changes: 31 additions & 0 deletions src/test/java/com/github/mkopylec/recaptcha/TestApplication.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package com.github.mkopylec.recaptcha;

import org.apache.catalina.Context;
import org.apache.tomcat.util.http.LegacyCookieProcessor;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatContextCustomizer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;

import static org.springframework.boot.SpringApplication.run;

Expand All @@ -10,4 +17,28 @@ public class TestApplication {
public static void main(String[] args) {
run(TestApplication.class, args);
}

@Bean
public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() {
return new TomcatEmbeddedServletContainerFactory();
}

@Bean
public EmbeddedServletContainerCustomizer customizer() {
return new EmbeddedServletContainerCustomizer() {

@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {

@Override
public void customize(Context context) {
context.setCookieProcessor(new LegacyCookieProcessor());
}
};
tomcat.addContextCustomizers(contextCustomizer);
}
};
}
}

0 comments on commit ddae934

Please sign in to comment.