Skip to content

Commit 4dee806

Browse files
committed
Use Antora
Closes gh-1237
2 parents 9ad871a + 3d11824 commit 4dee806

File tree

57 files changed

+2054
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2054
-759
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
!!! For Security Vulnerabilities, please go to https://spring.io/security-policy !!!
3+
-->
4+
**Affects:** \<Spring Framework version>
5+
6+
---
7+
<!--
8+
Thanks for taking the time to create an issue. Please read the following:
9+
10+
- Questions should be asked on Stack Overflow.
11+
- For bugs, specify affected versions and explain what you are trying to do.
12+
- For enhancements, provide context and describe the problem.
13+
14+
Issue or Pull Request? Create only one, not both. GitHub treats them as the same.
15+
If unsure, start with an issue, and if you submit a pull request later, the
16+
issue will be closed as superseded.
17+
-->

.github/actions/dispatch.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REPOSITORY_REF="$1"
2+
TOKEN="$2"
3+
4+
curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${TOKEN}" --request POST --data '{"event_type": "request-build"}' https://api.github.com/repos/${REPOSITORY_REF}/dispatches
5+
echo "Requested Build for $REPOSITORY_REF"

.github/workflows/build-reference.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: reference
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'gh-pages'
7+
8+
env:
9+
GH_TOKEN_DISPATCH: ${{ secrets.GH_TOKEN_DISPATCH }}
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Source
16+
uses: actions/checkout@v2
17+
- name: Generate antora.yml
18+
run: ./gradlew :spring-session-docs:generateAntora
19+
- name: Push generated antora files to the spring-security-docs-generated
20+
uses: JamesIves/[email protected]
21+
with:
22+
branch: "spring-session/main" # The branch the action should deploy to.
23+
folder: "spring-session-docs/build/generateAntora" # The folder the action should deploy.
24+
repository-name: "rwinch/spring-security-docs-generated"
25+
token: ${{ secrets.GH_TOKEN_DISPATCH }}
26+
- name: Dispatch Build Request
27+
run: ${GITHUB_WORKSPACE}/.github/actions/dispatch.sh 'rwinch/spring-reference' "$GH_TOKEN_DISPATCH"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Validate Gradle Wrapper"
2+
on: [push, pull_request]
3+
4+
jobs:
5+
validation:
6+
name: "Validation"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: gradle/wrapper-validation-action@v1

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
snapshotBuild = version.endsWith('SNAPSHOT')
55
milestoneBuild = !(releaseBuild || snapshotBuild)
66

7-
springBootVersion = '2.5.3'
7+
springBootVersion = '2.4.5'
88
}
99

1010
repositories {

gradle/dependency-management.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencyManagement {
22
imports {
3-
mavenBom 'io.projectreactor:reactor-bom:2020.0.10'
3+
mavenBom 'io.projectreactor:reactor-bom:2020.0.7'
44
mavenBom 'org.junit:junit-bom:5.7.2'
55
mavenBom 'org.springframework:spring-framework-bom:5.3.9'
66
mavenBom 'org.springframework.data:spring-data-bom:2021.1.0-M2'

local-antora-playbook.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
site:
2+
title: Spring Session
3+
start_page: session::index.adoc
4+
content:
5+
sources:
6+
- url: ./
7+
branches: HEAD
8+
start_path: spring-session-docs
9+
ui:
10+
bundle:
11+
url: ../../rwinch/antora-ui-spring/build/ui-bundle.zip
12+
snapshot: true

spring-session-docs/antora.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: session
2+
title: Spring Session
3+
version: ~
4+
display_version: 2.6
5+
start_page: ROOT:index.adoc
6+
7+
8+
nav:
9+
- modules/ROOT/nav.adoc
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright 2014-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package docs;
18+
19+
import java.util.Map;
20+
21+
import org.junit.jupiter.api.BeforeEach;
22+
import org.junit.jupiter.api.Test;
23+
import org.mockito.Mock;
24+
import org.mockito.MockitoAnnotations;
25+
26+
import org.springframework.session.FindByIndexNameSessionRepository;
27+
import org.springframework.session.Session;
28+
29+
/**
30+
* @author Rob Winch
31+
*
32+
*/
33+
class FindByIndexNameSessionRepositoryTests {
34+
35+
@Mock
36+
FindByIndexNameSessionRepository<Session> sessionRepository;
37+
38+
@Mock
39+
Session session;
40+
41+
@BeforeEach
42+
void setUp() {
43+
MockitoAnnotations.initMocks(this);
44+
}
45+
46+
@Test
47+
void setUsername() {
48+
// tag::set-username[]
49+
String username = "username";
50+
this.session.setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, username);
51+
// end::set-username[]
52+
}
53+
54+
@Test
55+
@SuppressWarnings("unused")
56+
void findByUsername() {
57+
// tag::findby-username[]
58+
String username = "username";
59+
Map<String, Session> sessionIdToSession = this.sessionRepository.findByPrincipalName(username);
60+
// end::findby-username[]
61+
}
62+
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2014-2019 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package docs;
18+
19+
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.extension.ExtendWith;
21+
22+
import org.springframework.beans.factory.annotation.Autowired;
23+
import org.springframework.data.redis.connection.RedisConnectionFactory;
24+
import org.springframework.session.Session;
25+
import org.springframework.session.web.http.SessionRepositoryFilter;
26+
import org.springframework.test.context.ContextConfiguration;
27+
import org.springframework.test.context.junit.jupiter.SpringExtension;
28+
import org.springframework.test.context.web.WebAppConfiguration;
29+
30+
import static org.assertj.core.api.Assertions.assertThat;
31+
import static org.mockito.Mockito.mock;
32+
33+
/**
34+
* @author Rob Winch
35+
*/
36+
@ExtendWith(SpringExtension.class)
37+
@ContextConfiguration
38+
@WebAppConfiguration
39+
public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests {
40+
41+
@Autowired
42+
SessionRepositoryFilter<? extends Session> filter;
43+
44+
@Test
45+
void redisConnectionFactoryNotUsedSinceNoValidation() {
46+
assertThat(this.filter).isNotNull();
47+
}
48+
49+
static RedisConnectionFactory connectionFactory() {
50+
return mock(RedisConnectionFactory.class);
51+
}
52+
53+
}

0 commit comments

Comments
 (0)