Skip to content

Commit d0429dc

Browse files
vpaviceleftherias
authored andcommitted
Fix Spring Boot based Hazelcast samples
This commit removes unused Hazelcast client dependencies and test support from Spring Boot based Hazelcast samples. Closes: gh-1903
1 parent 4e884cd commit d0429dc

File tree

6 files changed

+33
-75
lines changed

6 files changed

+33
-75
lines changed
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
apply plugin: 'io.spring.convention.spring-sample-boot'
22

33
dependencies {
4-
compile project(':spring-session-hazelcast')
5-
compile "org.springframework.boot:spring-boot-starter-web"
6-
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
7-
compile "org.springframework.boot:spring-boot-starter-security"
8-
compile "com.hazelcast:hazelcast-client"
9-
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
10-
compile "org.webjars:bootstrap"
11-
compile "org.webjars:html5shiv"
12-
compile "org.webjars:webjars-locator-core"
4+
compile project(':spring-session-hazelcast')
5+
compile "org.springframework.boot:spring-boot-starter-web"
6+
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
7+
compile "org.springframework.boot:spring-boot-starter-security"
8+
compile "com.hazelcast:hazelcast"
9+
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
10+
compile "org.webjars:bootstrap"
11+
compile "org.webjars:html5shiv"
12+
compile "org.webjars:webjars-locator-core"
1313

14-
testCompile "org.springframework.boot:spring-boot-starter-test"
15-
testCompile "org.junit.jupiter:junit-jupiter-api"
16-
testRuntime "org.junit.jupiter:junit-jupiter-engine"
17-
integrationTestCompile seleniumDependencies
18-
integrationTestCompile "org.testcontainers:testcontainers"
14+
testCompile "org.springframework.boot:spring-boot-starter-test"
15+
testCompile "org.junit.jupiter:junit-jupiter-api"
16+
testRuntime "org.junit.jupiter:junit-jupiter-engine"
17+
integrationTestCompile seleniumDependencies
1918
}

spring-session-samples/spring-session-sample-boot-hazelcast/src/integration-test/java/sample/BootTests.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,32 +19,24 @@
1919
import org.junit.jupiter.api.AfterEach;
2020
import org.junit.jupiter.api.BeforeEach;
2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.extension.ExtendWith;
2322
import org.openqa.selenium.WebDriver;
24-
import org.testcontainers.containers.GenericContainer;
2523
import sample.pages.HomePage;
2624
import sample.pages.LoginPage;
2725

2826
import org.springframework.beans.factory.annotation.Autowired;
2927
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
3028
import org.springframework.boot.test.context.SpringBootTest;
3129
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
32-
import org.springframework.boot.test.context.TestConfiguration;
33-
import org.springframework.context.annotation.Bean;
34-
import org.springframework.test.context.junit.jupiter.SpringExtension;
3530
import org.springframework.test.web.servlet.MockMvc;
3631
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;
3732

3833
/**
3934
* @author Ellie Bahadori
4035
*/
41-
@ExtendWith(SpringExtension.class)
4236
@AutoConfigureMockMvc
4337
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
4438
class BootTests {
4539

46-
private static final String DOCKER_IMAGE = "hazelcast/hazelcast:latest";
47-
4840
@Autowired
4941
private MockMvc mockMvc;
5042

@@ -83,16 +75,4 @@ void logout() {
8375
login.assertAt();
8476
}
8577

86-
@TestConfiguration
87-
static class Config {
88-
89-
@Bean
90-
GenericContainer hazelcastContainer() {
91-
GenericContainer hazelcastContainer = new GenericContainer(DOCKER_IMAGE).withExposedPorts(5701);
92-
hazelcastContainer.start();
93-
return hazelcastContainer;
94-
}
95-
96-
}
97-
9878
}

spring-session-samples/spring-session-sample-boot-hazelcast/src/main/java/sample/config/SessionConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
3434
public class SessionConfig {
3535

3636
@Bean
37-
public Config clientConfig() {
37+
public Config hazelcastConfig() {
3838
Config config = new Config();
3939
NetworkConfig networkConfig = config.getNetworkConfig();
4040
networkConfig.setPort(0);
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
apply plugin: 'io.spring.convention.spring-sample-boot'
22

33
dependencies {
4-
compile project(':spring-session-hazelcast')
5-
compile project(':hazelcast4')
6-
compile "org.springframework.boot:spring-boot-starter-web"
7-
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
8-
compile "org.springframework.boot:spring-boot-starter-security"
9-
compile "com.hazelcast:hazelcast:4.2.2"
10-
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
11-
compile "org.webjars:bootstrap"
12-
compile "org.webjars:html5shiv"
13-
compile "org.webjars:webjars-locator-core"
4+
compile project(':spring-session-hazelcast')
5+
compile project(':hazelcast4')
6+
compile "org.springframework.boot:spring-boot-starter-web"
7+
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
8+
compile "org.springframework.boot:spring-boot-starter-security"
9+
compile "com.hazelcast:hazelcast:4.2.2"
10+
compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
11+
compile "org.webjars:bootstrap"
12+
compile "org.webjars:html5shiv"
13+
compile "org.webjars:webjars-locator-core"
1414

15-
testCompile "org.springframework.boot:spring-boot-starter-test"
16-
testCompile "org.junit.jupiter:junit-jupiter-api"
17-
testRuntime "org.junit.jupiter:junit-jupiter-engine"
18-
integrationTestCompile seleniumDependencies
19-
integrationTestCompile "org.testcontainers:testcontainers"
15+
testCompile "org.springframework.boot:spring-boot-starter-test"
16+
testCompile "org.junit.jupiter:junit-jupiter-api"
17+
testRuntime "org.junit.jupiter:junit-jupiter-engine"
18+
integrationTestCompile seleniumDependencies
2019
}

spring-session-samples/spring-session-sample-boot-hazelcast4/src/integration-test/java/sample/BootTests.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,29 +19,21 @@
1919
import org.junit.jupiter.api.AfterEach;
2020
import org.junit.jupiter.api.BeforeEach;
2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.extension.ExtendWith;
2322
import org.openqa.selenium.WebDriver;
24-
import org.testcontainers.containers.GenericContainer;
2523
import sample.pages.HomePage;
2624
import sample.pages.LoginPage;
2725

2826
import org.springframework.beans.factory.annotation.Autowired;
2927
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
3028
import org.springframework.boot.test.context.SpringBootTest;
3129
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
32-
import org.springframework.boot.test.context.TestConfiguration;
33-
import org.springframework.context.annotation.Bean;
34-
import org.springframework.test.context.junit.jupiter.SpringExtension;
3530
import org.springframework.test.web.servlet.MockMvc;
3631
import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriverBuilder;
3732

38-
@ExtendWith(SpringExtension.class)
3933
@AutoConfigureMockMvc
4034
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
4135
class BootTests {
4236

43-
private static final String DOCKER_IMAGE = "hazelcast/hazelcast:latest";
44-
4537
@Autowired
4638
private MockMvc mockMvc;
4739

@@ -80,16 +72,4 @@ void logout() {
8072
login.assertAt();
8173
}
8274

83-
@TestConfiguration
84-
static class Config {
85-
86-
@Bean
87-
GenericContainer hazelcastContainer() {
88-
GenericContainer hazelcastContainer = new GenericContainer(DOCKER_IMAGE).withExposedPorts(5701);
89-
hazelcastContainer.start();
90-
return hazelcastContainer;
91-
}
92-
93-
}
94-
9575
}

spring-session-samples/spring-session-sample-boot-hazelcast4/src/main/java/sample/config/SessionConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
public class SessionConfig {
3636

3737
@Bean
38-
public Config clientConfig() {
38+
public Config hazelcastConfig() {
3939
Config config = new Config();
4040
NetworkConfig networkConfig = config.getNetworkConfig();
4141
networkConfig.setPort(0);

0 commit comments

Comments
 (0)