Skip to content

Commit 6b4102e

Browse files
authored
Merge pull request #126 from entur/feature/api-module
Add api module
2 parents 6a13830 + 5c4f415 commit 6b4102e

File tree

33 files changed

+2401
-88
lines changed

33 files changed

+2401
-88
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ jobs:
2525
${{ runner.os }}-maven-
2626
${{ runner.os }}-
2727
- name: Run maven build
28-
run: mvn verify
29-
28+
run: mvn install

gbfs-validator-java-api/.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ${project.baseDir}/.openapi-generator-ignore
2+
3+
# https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#ignore-file-format
4+
#
5+
# Use this file to prevent files from being overwritten by the generator.
6+
# The patterns follow closely to .gitignore or .dockerignore.
7+
8+
**/OpenApiGeneratorApplicationTests.java

gbfs-validator-java-api/pom.xml

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.entur.gbfs</groupId>
7+
<artifactId>gbfs-validator-java-parent</artifactId>
8+
<version>2.0.49-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>gbfs-validator-java-api</artifactId>
12+
<name>gbfs-validator-java-api</name>
13+
<description>gbfs-validator-java-api</description>
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
27+
<properties>
28+
<java.version>17</java.version>
29+
<maven.compiler.source>17</maven.compiler.source>
30+
<maven.compiler.target>17</maven.compiler.target>
31+
<junit.version>5.10.2</junit.version>
32+
<mockito.version>5.11.0</mockito.version>
33+
<junit-platform.version>1.10.2</junit-platform.version>
34+
<openapi-generator-maven-plugin>6.0.0</openapi-generator-maven-plugin>
35+
</properties>
36+
37+
<dependencyManagement>
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-dependencies</artifactId>
42+
<version>3.4.3</version>
43+
<type>pom</type>
44+
<scope>import</scope>
45+
</dependency>
46+
</dependencies>
47+
</dependencyManagement>
48+
49+
<dependencies>
50+
<dependency>
51+
<groupId>org.springframework.boot</groupId>
52+
<artifactId>spring-boot-starter-web</artifactId>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-starter-security</artifactId>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>org.springframework.boot</groupId>
62+
<artifactId>spring-boot-starter-validation</artifactId>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>io.swagger.core.v3</groupId>
67+
<artifactId>swagger-annotations</artifactId>
68+
<version>2.2.28</version>
69+
</dependency>
70+
71+
<dependency>
72+
<groupId>javax.validation</groupId>
73+
<artifactId>validation-api</artifactId>
74+
<version>2.0.1.Final</version>
75+
</dependency>
76+
77+
<!-- https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api -->
78+
<dependency>
79+
<groupId>jakarta.annotation</groupId>
80+
<artifactId>jakarta.annotation-api</artifactId>
81+
<version>3.0.0</version>
82+
</dependency>
83+
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
84+
<dependency>
85+
<groupId>javax.annotation</groupId>
86+
<artifactId>javax.annotation-api</artifactId>
87+
<version>1.3.2</version>
88+
</dependency>
89+
90+
<!-- Add Jackson annotations dependency -->
91+
<dependency>
92+
<groupId>com.fasterxml.jackson.core</groupId>
93+
<artifactId>jackson-annotations</artifactId>
94+
<version>2.16.1</version>
95+
</dependency>
96+
97+
<dependency>
98+
<groupId>javax.servlet</groupId>
99+
<artifactId>servlet-api</artifactId>
100+
<version>2.5</version>
101+
<scope>provided</scope>
102+
</dependency>
103+
104+
<dependency>
105+
<groupId>org.springdoc</groupId>
106+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
107+
<version>2.6.0</version>
108+
</dependency>
109+
110+
<dependency>
111+
<groupId>org.openapitools</groupId>
112+
<artifactId>jackson-databind-nullable</artifactId>
113+
<version>0.2.6</version>
114+
</dependency>
115+
116+
<dependency>
117+
<groupId>org.entur.gbfs</groupId>
118+
<artifactId>gbfs-validator-java-loader</artifactId>
119+
<version>2.0.49-SNAPSHOT</version>
120+
</dependency>
121+
122+
<dependency>
123+
<groupId>org.entur.gbfs</groupId>
124+
<artifactId>gbfs-validator-java</artifactId>
125+
<version>2.0.49-SNAPSHOT</version>
126+
</dependency>
127+
<dependency>
128+
<groupId>com.google.guava</groupId>
129+
<artifactId>guava</artifactId>
130+
<version>32.1.3-jre</version>
131+
</dependency>
132+
133+
<dependency>
134+
<groupId>org.springframework.boot</groupId>
135+
<artifactId>spring-boot-starter-test</artifactId>
136+
<scope>test</scope>
137+
</dependency>
138+
139+
<!-- JUnit dependencies with aligned versions -->
140+
<dependency>
141+
<groupId>org.junit.jupiter</groupId>
142+
<artifactId>junit-jupiter-api</artifactId>
143+
<scope>test</scope>
144+
</dependency>
145+
146+
<dependency>
147+
<groupId>org.junit.jupiter</groupId>
148+
<artifactId>junit-jupiter-engine</artifactId>
149+
<scope>test</scope>
150+
</dependency>
151+
152+
<dependency>
153+
<groupId>org.junit.platform</groupId>
154+
<artifactId>junit-platform-launcher</artifactId>
155+
<scope>test</scope>
156+
</dependency>
157+
158+
<dependency>
159+
<groupId>org.junit.platform</groupId>
160+
<artifactId>junit-platform-engine</artifactId>
161+
<scope>test</scope>
162+
</dependency>
163+
164+
<dependency>
165+
<groupId>org.junit.platform</groupId>
166+
<artifactId>junit-platform-commons</artifactId>
167+
<scope>test</scope>
168+
</dependency>
169+
170+
<!-- Spring Boot Test dependencies -->
171+
<!-- Version managed by spring-boot-dependencies -->
172+
<!-- JUnit version managed by properties -->
173+
<dependency>
174+
<groupId>org.springframework</groupId>
175+
<artifactId>spring-test</artifactId>
176+
<scope>test</scope>
177+
</dependency>
178+
179+
<!-- Jetty servlet dependency required by Spring Boot Test -->
180+
<dependency>
181+
<groupId>org.eclipse.jetty</groupId>
182+
<artifactId>jetty-servlet</artifactId>
183+
<version>9.4.53.v20231009</version>
184+
<scope>test</scope>
185+
</dependency>
186+
187+
<!-- Jetty util dependency required by Spring Boot Test -->
188+
<dependency>
189+
<groupId>org.eclipse.jetty</groupId>
190+
<artifactId>jetty-util</artifactId>
191+
<version>9.4.53.v20231009</version>
192+
<scope>test</scope>
193+
</dependency>
194+
</dependencies>
195+
196+
<build>
197+
<plugins>
198+
<plugin>
199+
<groupId>org.springframework.boot</groupId>
200+
<artifactId>spring-boot-maven-plugin</artifactId>
201+
<version>3.4.3</version>
202+
<executions>
203+
<execution>
204+
<goals>
205+
<goal>repackage</goal>
206+
<goal>build-info</goal>
207+
</goals>
208+
</execution>
209+
</executions>
210+
</plugin>
211+
212+
<plugin>
213+
<groupId>org.apache.maven.plugins</groupId>
214+
<artifactId>maven-compiler-plugin</artifactId>
215+
<version>3.13.0</version>
216+
<configuration>
217+
<source>17</source>
218+
<target>17</target>
219+
<release>17</release>
220+
</configuration>
221+
</plugin>
222+
223+
<!-- Configure Surefire plugin for JUnit 5 -->
224+
<plugin>
225+
<groupId>org.apache.maven.plugins</groupId>
226+
<artifactId>maven-surefire-plugin</artifactId>
227+
<version>3.5.2</version>
228+
<configuration>
229+
<includes>
230+
<include>**/*Test.java</include>
231+
</includes>
232+
<useModulePath>false</useModulePath>
233+
</configuration>
234+
<dependencies>
235+
<dependency>
236+
<groupId>org.junit.jupiter</groupId>
237+
<artifactId>junit-jupiter-engine</artifactId>
238+
<version>${junit.version}</version>
239+
</dependency>
240+
<dependency>
241+
<groupId>org.junit.platform</groupId>
242+
<artifactId>junit-platform-launcher</artifactId>
243+
<version>${junit-platform.version}</version>
244+
</dependency>
245+
</dependencies>
246+
</plugin>
247+
248+
<plugin>
249+
<groupId>org.openapitools</groupId>
250+
<artifactId>openapi-generator-maven-plugin</artifactId>
251+
<version>${openapi-generator-maven-plugin}</version>
252+
<executions>
253+
<execution>
254+
<goals>
255+
<goal>generate</goal>
256+
</goals>
257+
<configuration>
258+
<inputSpec>${project.basedir}/src/main/resources/public/openapi.yaml</inputSpec>
259+
<generatorName>spring</generatorName>
260+
<output>${project.build.directory}/generated-sources/openapi</output>
261+
<apiPackage>org.entur.gbfs.validator.api.gen</apiPackage>
262+
<modelPackage>org.entur.gbfs.validator.api.model</modelPackage>
263+
<invokerPackage>org.entur.gbfs.validator.api.handler</invokerPackage>
264+
<generateApiTests>false</generateApiTests>
265+
<generateModelTests>false</generateModelTests>
266+
<ignoreFileOverride>${project.basedir}/.openapi-generator-ignore</ignoreFileOverride>
267+
<configOptions>
268+
<delegatePattern>true</delegatePattern>
269+
<interfaceOnly>false</interfaceOnly>
270+
<skipDefaultInterface>false</skipDefaultInterface>
271+
<dateLibrary>java8</dateLibrary>
272+
<useOneOfInterfaces>false</useOneOfInterfaces>
273+
<useOneOfDiscriminatorLookup>true</useOneOfDiscriminatorLookup>
274+
<!-- <useEnumForDiscriminator>true</useEnumForDiscriminator>-->
275+
<!-- <useOneOfInterfaces>true</useOneOfInterfaces>-->
276+
</configOptions>
277+
<typeMappings>
278+
<typeMapping>Double=java.math.BigDecimal</typeMapping>
279+
</typeMappings>
280+
<!-- <library>spring-boot</library>-->
281+
</configuration>
282+
</execution>
283+
</executions>
284+
</plugin>
285+
</plugins>
286+
</build>
287+
288+
</project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
*
3+
* *
4+
* *
5+
* * * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
6+
* * * the European Commission - subsequent versions of the EUPL (the "Licence");
7+
* * * You may not use this work except in compliance with the Licence.
8+
* * * You may obtain a copy of the Licence at:
9+
* * *
10+
* * * https://joinup.ec.europa.eu/software/page/eupl
11+
* * *
12+
* * * Unless required by applicable law or agreed to in writing, software
13+
* * * distributed under the Licence is distributed on an "AS IS" basis,
14+
* * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* * * See the Licence for the specific language governing permissions and
16+
* * * limitations under the Licence.
17+
* *
18+
*
19+
*/
20+
21+
package org.entur.gbfs.validator.api.handler;
22+
23+
import org.entur.gbfs.validator.loader.Loader;
24+
import org.springframework.context.annotation.Bean;
25+
import org.springframework.context.annotation.Configuration;
26+
27+
@Configuration
28+
public class LoaderConfiguration {
29+
30+
@Bean
31+
public Loader loader(LoaderProperties properties) {
32+
return new Loader(
33+
properties.getHttp().getMaxTotalConnections(),
34+
properties.getHttp().getMaxConnectionsPerRoute(),
35+
properties.getHttp().getConnectTimeoutSeconds(),
36+
properties.getHttp().getResponseTimeoutSeconds(),
37+
properties.getThreadPool().getSize(),
38+
properties.getHttp().getHeaders()
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)