Skip to content

Commit 19a5d47

Browse files
Java 17 support (#129)
Use Java 17 Update from javax.servlet (v4) to jakarta.servlet (v6) Update spring boot to v6 Bump dependencies
1 parent b616cb5 commit 19a5d47

30 files changed

+106
-143
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
docker:
99
# specify the version you desire here
10-
- image: cimg/openjdk:8.0
10+
- image: cimg/openjdk:17.0.8
1111

1212
working_directory: ~/repo
1313

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,16 @@ It also shows the key that can be used to set its value in a Properties file.
128128
Finally, it also contains the environmental variable that can be used instead of the key in the Java Properties file:
129129

130130
Setting | Default values, when they exist | Properties file key | Environment variable |
131-
--- | --- | --- | --- |
132-
API Secret | | `api_secret` | `CASTLE_API_SECRET` |
133-
Allowlisted Headers | | `allow_list` | `CASTLE_SDK_ALLOWLIST_HEADERS` |
134-
Denylisted Headers | `Cookie` | `deny_list` | `CASTLE_SDK_DENYLIST_HEADERS` |
135-
Timeout | `500` | `timeout` | `CASTLE_SDK_TIMEOUT` |
131+
--- | --- |---------------------| --- |
132+
API Secret | | `api_secret` | `CASTLE_API_SECRET` |
133+
Allowlisted Headers | | `allow_list` | `CASTLE_SDK_ALLOWLIST_HEADERS` |
134+
Denylisted Headers | `Cookie` | `deny_list` | `CASTLE_SDK_DENYLIST_HEADERS` |
135+
Timeout | `500` | `timeout` | `CASTLE_SDK_TIMEOUT` |
136136
Authenticate Failover Strategy | `ALLOW` | `failover_strategy` | `CASTLE_SDK_AUTHENTICATE_FAILOVER_STRATEGY` |
137-
Backend Provider | `OKHTTP` | `backend_provide` | `CASTLE_SDK_BACKEND_PROVIDER` |
138-
Base URL | `https://api.castle.io/` | `base_url` | `CASTLE_SDK_BASE_URL` |
139-
Log HTTP | false | `log_http` | `CASTLE_SDK_LOG_HTTP` |
140-
IP Headers | | `ip_headers` | `CASTLE_SDK_IP_HEADERS` |
137+
Backend Provider | `OKHTTP` | `backend_provider` | `CASTLE_SDK_BACKEND_PROVIDER` |
138+
Base URL | `https://api.castle.io/` | `base_url` | `CASTLE_SDK_BASE_URL` |
139+
Log HTTP | false | `log_http` | `CASTLE_SDK_LOG_HTTP` |
140+
IP Headers | | `ip_headers` | `CASTLE_SDK_IP_HEADERS` |
141141

142142
By default, the SDK will look in the classpath for the Java Properties file named `castle_sdk.properties`.
143143
An alternative file can be chosen by setting the `CASTLE_PROPERTIES_FILE` environment variable to a different value.

pom.xml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545

4646
<properties>
4747
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
48-
<jdkVersion>1.8</jdkVersion>
49-
<targetJdk>1.8</targetJdk>
50-
<jacoco.version>0.8.3</jacoco.version>
48+
<jdkVersion>17</jdkVersion>
49+
<targetJdk>17</targetJdk>
50+
<jacoco.version>0.8.10</jacoco.version>
5151
</properties>
5252

5353
<profiles>
@@ -99,60 +99,71 @@
9999
<dependency>
100100
<groupId>org.threeten</groupId>
101101
<artifactId>threetenbp</artifactId>
102-
<version>1.6.5</version>
102+
<version>1.6.8</version>
103103
</dependency>
104104
<dependency>
105105
<groupId>io.swagger</groupId>
106106
<artifactId>swagger-annotations</artifactId>
107-
<version>1.6.8</version>
107+
<version>1.6.11</version>
108108
</dependency>
109109
<dependency>
110-
<groupId>javax.servlet</groupId>
111-
<artifactId>javax.servlet-api</artifactId>
112-
<version>4.0.1</version>
110+
<groupId>jakarta.servlet</groupId>
111+
<artifactId>jakarta.servlet-api</artifactId>
112+
<version>6.0.0</version>
113113
<scope>provided</scope>
114114
</dependency>
115115
<dependency>
116116
<groupId>com.squareup.okhttp3</groupId>
117117
<artifactId>okhttp</artifactId>
118-
<version>4.10.0</version>
118+
<version>4.11.0</version>
119119
</dependency>
120120
<dependency>
121121
<groupId>com.squareup.okhttp3</groupId>
122122
<artifactId>logging-interceptor</artifactId>
123-
<version>4.10.0</version>
123+
<version>4.11.0</version>
124124
</dependency>
125125
<dependency>
126126
<groupId>org.slf4j</groupId>
127127
<artifactId>slf4j-api</artifactId>
128-
<version>2.0.5</version>
128+
<version>2.0.7</version>
129129
</dependency>
130130
<dependency>
131131
<groupId>ch.qos.logback</groupId>
132132
<artifactId>logback-classic</artifactId>
133-
<version>1.3.7</version>
133+
<version>1.4.11</version>
134134
<scope>test</scope>
135135
</dependency>
136136
<dependency>
137137
<groupId>com.google.guava</groupId>
138138
<artifactId>guava</artifactId>
139-
<version>32.0.0-jre</version>
139+
<version>32.1.2-jre</version>
140140
</dependency>
141141
<dependency>
142142
<groupId>com.google.code.gson</groupId>
143143
<artifactId>gson</artifactId>
144-
<version>2.9.0</version>
144+
<version>2.10.1</version>
145145
</dependency>
146146
<dependency>
147-
<groupId>junit</groupId>
148-
<artifactId>junit</artifactId>
149-
<version>4.13.2</version>
147+
<groupId>org.junit.jupiter</groupId>
148+
<artifactId>junit-jupiter-api</artifactId>
149+
<version>5.6.2</version>
150150
<scope>test</scope>
151151
</dependency>
152+
<dependency>
153+
<groupId>org.junit.vintage</groupId>
154+
<artifactId>junit-vintage-engine</artifactId>
155+
<version>5.6.2</version>
156+
<scope>test</scope>
157+
</dependency>
158+
<dependency>
159+
<groupId>uk.org.webcompere</groupId>
160+
<artifactId>system-stubs-jupiter</artifactId>
161+
<version>2.0.2</version>
162+
</dependency>
152163
<dependency>
153164
<groupId>org.mockito</groupId>
154165
<artifactId>mockito-core</artifactId>
155-
<version>4.11.0</version>
166+
<version>5.4.0</version>
156167
<scope>test</scope>
157168
</dependency>
158169
<dependency>
@@ -164,13 +175,13 @@
164175
<dependency>
165176
<groupId>org.springframework</groupId>
166177
<artifactId>spring-web</artifactId>
167-
<version>5.3.27</version>
178+
<version>6.0.11</version>
168179
<scope>test</scope>
169180
</dependency>
170181
<dependency>
171182
<groupId>org.springframework</groupId>
172183
<artifactId>spring-test</artifactId>
173-
<version>5.3.27</version>
184+
<version>6.0.11</version>
174185
<scope>test</scope>
175186
</dependency>
176187
<dependency>
@@ -188,7 +199,7 @@
188199
<dependency>
189200
<groupId>com.squareup.okhttp3</groupId>
190201
<artifactId>mockwebserver</artifactId>
191-
<version>4.10.0</version>
202+
<version>4.11.0</version>
192203
<scope>test</scope>
193204
</dependency>
194205
</dependencies>
@@ -207,8 +218,8 @@
207218
<artifactId>maven-compiler-plugin</artifactId>
208219
<version>3.8.0</version>
209220
<configuration>
210-
<source>1.8</source>
211-
<target>1.8</target>
221+
<source>17</source>
222+
<target>17</target>
212223
<optimize>true</optimize>
213224
<debug>true</debug>
214225
</configuration>
@@ -246,7 +257,7 @@
246257
<plugin>
247258
<groupId>org.apache.maven.plugins</groupId>
248259
<artifactId>maven-surefire-plugin</artifactId>
249-
<version>3.0.0-M3</version>
260+
<version>3.1.2</version>
250261
<configuration>
251262
<useSystemClassLoader>false</useSystemClassLoader>
252263
</configuration>

src/main/java/io/castle/client/Castle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.slf4j.Logger;
1515
import org.slf4j.LoggerFactory;
1616

17-
import javax.servlet.http.HttpServletRequest;
17+
import jakarta.servlet.http.HttpServletRequest;
1818

1919
/**
2020
* Creates an instance of the Castle SDK

src/main/java/io/castle/client/internal/CastleApiImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import io.castle.client.model.generated.*;
1717

1818
import javax.annotation.Nullable;
19-
import javax.servlet.http.HttpServletRequest;
19+
import jakarta.servlet.http.HttpServletRequest;
2020

2121
public class CastleApiImpl implements CastleApi {
2222

src/main/java/io/castle/client/internal/utils/CastleContextBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import io.castle.client.model.CastleHeader;
88
import io.castle.client.model.CastleHeaders;
99

10-
import javax.servlet.http.Cookie;
11-
import javax.servlet.http.HttpServletRequest;
10+
import jakarta.servlet.http.Cookie;
11+
import jakarta.servlet.http.HttpServletRequest;
1212
import java.util.ArrayList;
1313
import java.util.Enumeration;
1414

src/test/java/io/castle/client/AbstractCastleHttpLayerTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ public void prepare() throws NoSuchFieldException, IllegalAccessException, Castl
4848
.withAuthenticateFailoverStrategy(testAuthenticateFailoverStrategy)
4949
.withTimeout(configuration.getTimeout())
5050
.build();
51-
OkHttpFactory mockedFactory = new OkHttpFactory(mockedApiConfiguration, sdk.getInternalConfiguration().getModel());
5251

53-
//When the utils are used to override the internal backend factory
54-
SdkMockUtil.modifyInternalBackendFactory(sdk, mockedFactory);
52+
sdk = Castle.initialize(mockedApiConfiguration);
5553
}
5654

5755
@After

src/test/java/io/castle/client/CastleAuthenticateHttpTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import com.google.common.collect.ImmutableMap;
1919

20-
import javax.servlet.http.HttpServletRequest;
20+
import jakarta.servlet.http.HttpServletRequest;
2121
import java.util.concurrent.atomic.AtomicReference;
2222

2323
import static okhttp3.mockwebserver.SocketPolicy.NO_RESPONSE;

src/test/java/io/castle/client/CastleDeviceApproveHttpTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.junit.Test;
1010
import org.springframework.mock.web.MockHttpServletRequest;
1111

12-
import javax.servlet.http.HttpServletRequest;
12+
import jakarta.servlet.http.HttpServletRequest;
1313

1414
import static okhttp3.mockwebserver.SocketPolicy.NO_RESPONSE;
1515

src/test/java/io/castle/client/CastleDeviceHttpTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.junit.Test;
1111
import org.springframework.mock.web.MockHttpServletRequest;
1212

13-
import javax.servlet.http.HttpServletRequest;
13+
import jakarta.servlet.http.HttpServletRequest;
1414

1515
import static okhttp3.mockwebserver.SocketPolicy.NO_RESPONSE;
1616

0 commit comments

Comments
 (0)