Skip to content

Commit 4209b41

Browse files
committed
Merge branch 'master' into feature/cli
2 parents fc96662 + 6485b2b commit 4209b41

7 files changed

Lines changed: 75 additions & 102 deletions

File tree

gbfs-validator-java-api/pom.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.entur.gbfs</groupId>
77
<artifactId>gbfs-validator-java-parent</artifactId>
8-
<version>2.0.56-SNAPSHOT</version>
8+
<version>2.0.57-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>gbfs-validator-java-api</artifactId>
@@ -40,15 +40,15 @@
4040
<junit.version>6.0.0</junit.version>
4141
<mockito.version>5.11.0</mockito.version>
4242
<junit-platform.version>6.0.0</junit-platform.version>
43-
<openapi-generator-maven-plugin>6.0.0</openapi-generator-maven-plugin>
43+
<openapi-generator-maven-plugin>7.16.0</openapi-generator-maven-plugin>
4444
</properties>
4545

4646
<dependencyManagement>
4747
<dependencies>
4848
<dependency>
4949
<groupId>org.springframework.boot</groupId>
5050
<artifactId>spring-boot-dependencies</artifactId>
51-
<version>3.4.3</version>
51+
<version>3.5.6</version>
5252
<type>pom</type>
5353
<scope>import</scope>
5454
</dependency>
@@ -74,7 +74,7 @@
7474
<dependency>
7575
<groupId>io.swagger.core.v3</groupId>
7676
<artifactId>swagger-annotations</artifactId>
77-
<version>2.2.28</version>
77+
<version>2.2.38</version>
7878
</dependency>
7979

8080
<dependency>
@@ -100,7 +100,7 @@
100100
<dependency>
101101
<groupId>com.fasterxml.jackson.core</groupId>
102102
<artifactId>jackson-annotations</artifactId>
103-
<version>2.16.1</version>
103+
<version>2.20</version>
104104
</dependency>
105105

106106
<dependency>
@@ -113,25 +113,25 @@
113113
<dependency>
114114
<groupId>org.springdoc</groupId>
115115
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
116-
<version>2.6.0</version>
116+
<version>2.8.13</version>
117117
</dependency>
118118

119119
<dependency>
120120
<groupId>org.openapitools</groupId>
121121
<artifactId>jackson-databind-nullable</artifactId>
122-
<version>0.2.6</version>
122+
<version>0.2.7</version>
123123
</dependency>
124124

125125
<dependency>
126126
<groupId>org.entur.gbfs</groupId>
127127
<artifactId>gbfs-validator-java-loader</artifactId>
128-
<version>2.0.56-SNAPSHOT</version>
128+
<version>2.0.57-SNAPSHOT</version>
129129
</dependency>
130130

131131
<dependency>
132132
<groupId>org.entur.gbfs</groupId>
133133
<artifactId>gbfs-validator-java</artifactId>
134-
<version>2.0.56-SNAPSHOT</version>
134+
<version>2.0.57-SNAPSHOT</version>
135135
</dependency>
136136
<dependency>
137137
<groupId>com.google.guava</groupId>
@@ -207,7 +207,7 @@
207207
<plugin>
208208
<groupId>org.springframework.boot</groupId>
209209
<artifactId>spring-boot-maven-plugin</artifactId>
210-
<version>3.4.3</version>
210+
<version>3.5.6</version>
211211
<executions>
212212
<execution>
213213
<goals>
@@ -221,7 +221,7 @@
221221
<plugin>
222222
<groupId>org.apache.maven.plugins</groupId>
223223
<artifactId>maven-compiler-plugin</artifactId>
224-
<version>3.13.0</version>
224+
<version>3.14.1</version>
225225
<configuration>
226226
<source>17</source>
227227
<target>17</target>
@@ -233,7 +233,7 @@
233233
<plugin>
234234
<groupId>org.apache.maven.plugins</groupId>
235235
<artifactId>maven-surefire-plugin</artifactId>
236-
<version>3.5.2</version>
236+
<version>3.5.4</version>
237237
<configuration>
238238
<includes>
239239
<include>**/*Test.java</include>

gbfs-validator-java-api/src/main/java/org/entur/gbfs/validator/api/handler/ValidateApiDelegateHandler.java

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@
3636
import org.entur.gbfs.validation.model.ValidationResult;
3737
import org.entur.gbfs.validation.model.ValidatorError;
3838
import org.entur.gbfs.validator.api.gen.ValidateApiDelegate;
39-
import org.entur.gbfs.validator.api.model.BasicAuth;
40-
import org.entur.gbfs.validator.api.model.BearerTokenAuth;
4139
import org.entur.gbfs.validator.api.model.FileError;
4240
import org.entur.gbfs.validator.api.model.GbfsFile;
43-
import org.entur.gbfs.validator.api.model.OAuthClientCredentialsGrantAuth;
4441
import org.entur.gbfs.validator.api.model.SystemError;
4542
import org.entur.gbfs.validator.api.model.ValidatePostRequest;
4643
import org.entur.gbfs.validator.api.model.ValidatePostRequestAuth;
@@ -113,40 +110,7 @@ public ResponseEntity<org.entur.gbfs.validator.api.model.ValidationResult> valid
113110
validatePostRequest.getFeedUrl()
114111
);
115112
try {
116-
Authentication loaderAuth = null;
117-
ValidatePostRequestAuth apiAuth = validatePostRequest.getAuth();
118-
119-
if (apiAuth != null) {
120-
if (apiAuth instanceof BasicAuth basic) {
121-
if (basic.getUsername() != null && basic.getPassword() != null) {
122-
loaderAuth =
123-
new org.entur.gbfs.validator.loader.auth.BasicAuth(
124-
basic.getUsername(),
125-
basic.getPassword()
126-
);
127-
}
128-
} else if (apiAuth instanceof BearerTokenAuth bearer) {
129-
if (bearer.getToken() != null) {
130-
loaderAuth =
131-
new org.entur.gbfs.validator.loader.auth.BearerTokenAuth(
132-
bearer.getToken()
133-
);
134-
}
135-
} else if (apiAuth instanceof OAuthClientCredentialsGrantAuth oauth) {
136-
if (
137-
oauth.getClientId() != null &&
138-
oauth.getClientSecret() != null &&
139-
oauth.getTokenUrl() != null
140-
) {
141-
loaderAuth =
142-
new org.entur.gbfs.validator.loader.auth.OAuthClientCredentialsGrantAuth(
143-
oauth.getClientId(),
144-
oauth.getClientSecret(),
145-
oauth.getTokenUrl().toString()
146-
);
147-
}
148-
}
149-
}
113+
Authentication loaderAuth = getAuthentication(validatePostRequest);
150114

151115
List<LoadedFile> allLoadedFiles = loader.load(
152116
validatePostRequest.getFeedUrl(),
@@ -210,6 +174,47 @@ public ResponseEntity<org.entur.gbfs.validator.api.model.ValidationResult> valid
210174
}
211175
}
212176

177+
private static Authentication getAuthentication(
178+
ValidatePostRequest validatePostRequest
179+
) {
180+
Authentication loaderAuth = null;
181+
ValidatePostRequestAuth apiAuth = validatePostRequest.getAuth();
182+
183+
if (apiAuth != null) {
184+
String authType = apiAuth.getAuthType();
185+
if ("basicAuth".equals(authType)) {
186+
if (apiAuth.getUsername() != null && apiAuth.getPassword() != null) {
187+
loaderAuth =
188+
new org.entur.gbfs.validator.loader.auth.BasicAuth(
189+
apiAuth.getUsername(),
190+
apiAuth.getPassword()
191+
);
192+
}
193+
} else if ("bearerToken".equals(authType)) {
194+
if (apiAuth.getToken() != null) {
195+
loaderAuth =
196+
new org.entur.gbfs.validator.loader.auth.BearerTokenAuth(
197+
apiAuth.getToken()
198+
);
199+
}
200+
} else if ("oauthClientCredentialsGrant".equals(authType)) {
201+
if (
202+
apiAuth.getClientId() != null &&
203+
apiAuth.getClientSecret() != null &&
204+
apiAuth.getTokenUrl() != null
205+
) {
206+
loaderAuth =
207+
new org.entur.gbfs.validator.loader.auth.OAuthClientCredentialsGrantAuth(
208+
apiAuth.getClientId(),
209+
apiAuth.getClientSecret(),
210+
apiAuth.getTokenUrl()
211+
);
212+
}
213+
}
214+
}
215+
return loaderAuth;
216+
}
217+
213218
private org.entur.gbfs.validator.api.model.ValidationResult mergeValidationResults(
214219
List<org.entur.gbfs.validator.api.model.ValidationResult> results
215220
) {

gbfs-validator-java-api/src/test/java/org/entur/gbfs/validator/api/TestApplication.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

gbfs-validator-java-api/src/test/java/org/entur/gbfs/validator/api/ValidateIntegrationTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
66

77
import com.fasterxml.jackson.databind.ObjectMapper;
8+
import org.entur.gbfs.validator.api.handler.OpenApiGeneratorApplication;
89
import org.entur.gbfs.validator.api.model.*;
910
import org.junit.jupiter.api.Test;
1011
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +14,7 @@
1314
import org.springframework.http.MediaType;
1415
import org.springframework.test.web.servlet.MockMvc;
1516

16-
@SpringBootTest(classes = TestApplication.class)
17+
@SpringBootTest(classes = OpenApiGeneratorApplication.class)
1718
@AutoConfigureMockMvc
1819
public class ValidateIntegrationTest {
1920

@@ -46,8 +47,8 @@ void testValidate_BasicAuth_Success() throws Exception {
4647
ValidatePostRequest request = new ValidatePostRequest();
4748
request.setFeedUrl("http://example.com/gbfs.json");
4849

49-
BasicAuth basicAuth = new BasicAuth();
50-
basicAuth.setAuthType("basic");
50+
ValidatePostRequestAuth basicAuth = new ValidatePostRequestAuth();
51+
basicAuth.setAuthType("basicAuth");
5152
basicAuth.setUsername("user");
5253
basicAuth.setPassword("pass");
5354
request.setAuth(basicAuth);
@@ -69,8 +70,8 @@ void testValidate_BearerTokenAuth_Success() throws Exception {
6970
ValidatePostRequest request = new ValidatePostRequest();
7071
request.setFeedUrl("http://example.com/gbfs.json");
7172

72-
BearerTokenAuth bearerAuth = new BearerTokenAuth();
73-
bearerAuth.setAuthType("bearer");
73+
ValidatePostRequestAuth bearerAuth = new ValidatePostRequestAuth();
74+
bearerAuth.setAuthType("bearerToken");
7475
bearerAuth.setToken("token123");
7576
request.setAuth(bearerAuth);
7677

@@ -91,9 +92,8 @@ void testValidate_OAuthClientCredentials_Success() throws Exception {
9192
ValidatePostRequest request = new ValidatePostRequest();
9293
request.setFeedUrl("http://example.com/gbfs.json");
9394

94-
OAuthClientCredentialsGrantAuth oauthAuth =
95-
new OAuthClientCredentialsGrantAuth();
96-
oauthAuth.setAuthType("oauth");
95+
ValidatePostRequestAuth oauthAuth = new ValidatePostRequestAuth();
96+
oauthAuth.setAuthType("oauthClientCredentialsGrant");
9797
oauthAuth.setTokenUrl("https://auth.example.com/token");
9898
oauthAuth.setClientId("client_id");
9999
oauthAuth.setClientSecret("client_secret");
@@ -116,8 +116,8 @@ void testValidate_AuthFailure() throws Exception {
116116
ValidatePostRequest request = new ValidatePostRequest();
117117
request.setFeedUrl("http://example.com/gbfs.json");
118118

119-
BasicAuth basicAuth = new BasicAuth();
120-
basicAuth.setAuthType("basic");
119+
ValidatePostRequestAuth basicAuth = new ValidatePostRequestAuth();
120+
basicAuth.setAuthType("basicAuth");
121121
basicAuth.setUsername("wrong_user");
122122
basicAuth.setPassword("wrong_password");
123123
request.setAuth(basicAuth);

gbfs-validator-java-loader/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.entur.gbfs</groupId>
88
<artifactId>gbfs-validator-java-parent</artifactId>
9-
<version>2.0.56-SNAPSHOT</version>
9+
<version>2.0.57-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gbfs-validator-java-loader</artifactId>
@@ -20,7 +20,7 @@
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<junit.version>6.0.0</junit.version>
2222
<wiremock.version>3.0.1</wiremock.version>
23-
<mockito.version>5.11.0</mockito.version>
23+
<mockito.version>5.20.0</mockito.version>
2424
</properties>
2525

2626
<dependencies>
@@ -32,12 +32,12 @@
3232
<dependency>
3333
<groupId>commons-io</groupId>
3434
<artifactId>commons-io</artifactId>
35-
<version>2.17.0</version>
35+
<version>2.20.0</version>
3636
</dependency>
3737
<dependency>
3838
<groupId>org.apache.httpcomponents.client5</groupId>
3939
<artifactId>httpclient5</artifactId>
40-
<version>5.3.1</version>
40+
<version>5.5.1</version>
4141
</dependency>
4242

4343
<!-- Test dependencies -->

gbfs-validator-java/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>org.entur.gbfs</groupId>
66
<artifactId>gbfs-validator-java-parent</artifactId>
7-
<version>2.0.56-SNAPSHOT</version>
7+
<version>2.0.57-SNAPSHOT</version>
88
</parent>
99

1010
<artifactId>gbfs-validator-java</artifactId>
11-
<version>2.0.56-SNAPSHOT</version>
11+
<version>2.0.57-SNAPSHOT</version>
1212
<packaging>jar</packaging>
1313

1414
<name>gbfs-validator-java</name>
@@ -54,7 +54,7 @@
5454
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
5555
<maven-exec-plugin.version>1.6.0</maven-exec-plugin.version>
5656
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
57-
<maven-enforcer-plugin.version>3.6.1</maven-enforcer-plugin.version>
57+
<maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>
5858
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
5959
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
6060
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
@@ -108,7 +108,7 @@
108108
<dependency>
109109
<groupId>org.mockito</groupId>
110110
<artifactId>mockito-core</artifactId>
111-
<version>5.12.0</version>
111+
<version>5.20.0</version>
112112
<scope>test</scope>
113113
</dependency>
114114
<dependency>
@@ -120,7 +120,7 @@
120120
<dependency>
121121
<groupId>org.mockito</groupId>
122122
<artifactId>mockito-junit-jupiter</artifactId>
123-
<version>5.12.0</version>
123+
<version>5.20.0</version>
124124
<scope>test</scope>
125125
</dependency>
126126
<dependency>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.entur.gbfs</groupId>
66
<artifactId>gbfs-validator-java-parent</artifactId>
7-
<version>2.0.56-SNAPSHOT</version>
7+
<version>2.0.57-SNAPSHOT</version>
88

99
<packaging>pom</packaging>
1010

@@ -46,7 +46,7 @@
4646
</scm>
4747
<properties>
4848
<jreleaser-maven-plugin.version>1.20.0</jreleaser-maven-plugin.version>
49-
<sonar-maven-plugin.version>5.1.0.4751</sonar-maven-plugin.version>
49+
<sonar-maven-plugin.version>5.2.0.4988</sonar-maven-plugin.version>
5050
<prettier-java.version>2.1.0</prettier-java.version>
5151
<prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
5252
<plugin.prettier.goal>write</plugin.prettier.goal>

0 commit comments

Comments
 (0)