Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
language: java

services:
- redis-server
sudo: required

jdk:
- oraclejdk8
services: docker

os:
- linux
jdk: oraclejdk8

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

install: true

script: ./gradlew clean build --refresh-dependencies --no-daemon
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/boot-findbyusername.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/boot-redis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/boot-websocket.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ server.session.timeout=60
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/grails3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `JedisConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/java-custom-cookie.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/java-redis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/java-rest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/java-security.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/java-users.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
1 change: 1 addition & 0 deletions docs/src/docs/asciidoc/guides/xml-redis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ You can run the sample by obtaining the {download-url}[source code] and invoking
====
For the sample to work, you must http://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
Alternatively, you can update the `LettuceConnectionFactory` to point to a Redis server.
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost. See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
====

----
Expand Down
10 changes: 10 additions & 0 deletions gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ dependencyManagement {
entry 'hazelcast-client'
}

dependencySet(group: 'org.testcontainers', version: '1.4.2') {
entry 'mysql'
entry 'postgresql'
entry 'testcontainers'
}

dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr4'
dependency 'com.h2database:h2:1.4.196'
dependency 'com.maxmind.geoip2:geoip2:2.3.1'
Expand All @@ -22,13 +28,17 @@ dependencyManagement {
dependency 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.2-b02'
dependency 'javax.servlet:javax.servlet-api:3.1.0'
dependency 'junit:junit:4.12'
dependency 'mysql:mysql-connector-java:5.1.43'
dependency 'org.apache.derby:derby:10.13.1.1'
dependency 'org.apache.httpcomponents:httpclient:4.5.3'
dependency 'org.apache.taglibs:taglibs-standard-jstlel:1.2.5'
dependency 'org.assertj:assertj-core:3.8.0'
dependency 'org.hsqldb:hsqldb:2.4.0'
dependency 'org.mariadb.jdbc:mariadb-java-client:2.0.3'
dependency 'org.mockito:mockito-core:2.8.47'
dependency 'org.postgresql:postgresql:42.1.3'
dependency 'org.seleniumhq.selenium:htmlunit-driver:2.27'
dependency 'org.testcontainers:mariadb:1.3.0'
dependency 'org.webjars:bootstrap:2.3.2'
dependency 'org.webjars:html5shiv:3.7.3'
dependency 'org.webjars:jquery:1.9.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
testCompile "org.assertj:assertj-core"

integrationTestCompile seleniumDependencies
integrationTestCompile "org.testcontainers:testcontainers"
}

integrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,43 @@

import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import org.testcontainers.containers.GenericContainer;
import sample.pages.HomePage;
import sample.pages.LoginPage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;

/**
* @author Eddú Meléndez
* @author Rob Winch
* @author Vedran Pavic
*/
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
@SpringBootTest(classes = FindByUsernameApplication.class, webEnvironment = WebEnvironment.MOCK)
@ContextConfiguration(initializers = FindByUsernameTests.Initializer.class)
public class FindByUsernameTests {

private static final String DOCKER_IMAGE = "redis:3.2.9";

@ClassRule
public static GenericContainer redisContainer = new GenericContainer(DOCKER_IMAGE)
.withExposedPorts(6379);

@Autowired
private MockMvc mockMvc;

Expand Down Expand Up @@ -72,4 +86,18 @@ public void login() {
home.terminateButtonDisabled();
}

static class Initializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
public void initialize(
ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues
.of("spring.redis.host=" + redisContainer.getContainerIpAddress(),
"spring.redis.port=" + redisContainer.getFirstMappedPort())
.applyTo(configurableApplicationContext.getEnvironment());
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ dependencies {
testCompile "org.skyscreamer:jsonassert"

integrationTestCompile seleniumDependencies
integrationTestCompile "org.testcontainers:testcontainers"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@

import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import org.testcontainers.containers.GenericContainer;
import sample.pages.HomePage;
import sample.pages.HomePage.Attribute;
import sample.pages.LoginPage;
Expand All @@ -31,6 +33,10 @@
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;
Expand All @@ -39,12 +45,20 @@

/**
* @author Eddú Meléndez
* @author Vedran Pavic
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.MOCK)
@AutoConfigureMockMvc
@ContextConfiguration(initializers = HttpRedisJsonTest.Initializer.class)
public class HttpRedisJsonTest {

private static final String DOCKER_IMAGE = "redis:3.2.9";

@ClassRule
public static GenericContainer redisContainer = new GenericContainer(DOCKER_IMAGE)
.withExposedPorts(6379);

@Autowired
private MockMvc mockMvc;

Expand Down Expand Up @@ -96,4 +110,18 @@ public void createAttribute() {
assertThat(attributes).extracting("attributeValue").contains("Demo Value");
}

static class Initializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
public void initialize(
ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues
.of("spring.redis.host=" + redisContainer.getContainerIpAddress(),
"spring.redis.port=" + redisContainer.getFirstMappedPort())
.applyTo(configurableApplicationContext.getEnvironment());
}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,28 +13,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package sample;

import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.testcontainers.containers.GenericContainer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author jitendra on 8/3/16.
* @author jitendra
* @author Vedran Pavic
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(classes = Application.class)
@ContextConfiguration(initializers = RedisSerializerTest.Initializer.class)
public class RedisSerializerTest {

private static final String DOCKER_IMAGE = "redis:3.2.9";

@ClassRule
public static GenericContainer redisContainer = new GenericContainer(DOCKER_IMAGE)
.withExposedPorts(6379);

@Autowired
RedisTemplate<Object, Object> sessionRedisTemplate;
private RedisTemplate<Object, Object> sessionRedisTemplate;

@Test
public void testRedisTemplate() {
Expand All @@ -43,4 +58,19 @@ public void testRedisTemplate() {
assertThat(this.sessionRedisTemplate.getDefaultSerializer())
.isInstanceOf(GenericJackson2JsonRedisSerializer.class);
}

static class Initializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
public void initialize(
ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues
.of("spring.redis.host=" + redisContainer.getContainerIpAddress(),
"spring.redis.port=" + redisContainer.getFirstMappedPort())
.applyTo(configurableApplicationContext.getEnvironment());
}

}

}
1 change: 1 addition & 0 deletions samples/boot/redis/spring-session-sample-boot-redis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ dependencies {
testCompile "org.springframework.boot:spring-boot-starter-test"

integrationTestCompile seleniumDependencies
integrationTestCompile "org.testcontainers:testcontainers"
}
Loading