feat!: Jakarta & JDK11

This commit is contained in:
Piotr Dec 2024-02-22 22:48:02 +01:00
parent 2fe3f2a67d
commit 514064debc
Signed by: stawros
GPG key ID: F89F27AD8F881A91
11 changed files with 206 additions and 180 deletions

View file

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>http-mock-server</artifactId>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>http-mock-server</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mockserver-api</artifactId>
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@ -18,19 +24,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>

View file

@ -1,10 +1,9 @@
<?xml version="1.0"?>
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings>
<jxb:globalBindings>
<xjc:simple/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
<bindings version="3.0"
xmlns="https://jakarta.ee/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<globalBindings>
<xjc:simple/>
</globalBindings>
</bindings>

View file

@ -1,18 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>http-mock-server</artifactId>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>http-mock-server</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mockserver-client</artifactId>
<build>
<defaultGoal>clean install</defaultGoal>
</build>
<dependencies>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
@ -25,6 +29,7 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
@ -33,9 +38,15 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View file

@ -17,7 +17,7 @@ import eu.ztsh.mockserver.api.response.MockRemoved
import eu.ztsh.mockserver.api.response.MockReport
import eu.ztsh.mockserver.api.response.Mocks
import javax.xml.bind.JAXBContext
import jakarta.xml.bind.JAXBContext
class RemoteMockServer {
private final String address

View file

@ -11,7 +11,7 @@ import eu.ztsh.mockserver.api.response.ExceptionOccured
import eu.ztsh.mockserver.api.response.MockAdded
import eu.ztsh.mockserver.api.response.MockServerResponse
import javax.xml.bind.JAXBContext
import jakarta.xml.bind.JAXBContext
@CompileStatic
@TypeChecked

View file

@ -1,27 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>http-mock-server</artifactId>
<groupId>eu.ztsh.mockserver</groupId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mockserver-tests</artifactId>
<build>
<defaultGoal>clean install</defaultGoal>
</build>
<dependencies>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver</artifactId>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-client</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@ -30,24 +39,20 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>info.solidsoft.spock</groupId>
<artifactId>spock-global-unroll</artifactId>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,15 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>http-mock-server</artifactId>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>http-mock-server</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mockserver</artifactId>
<dependencies>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
@ -22,6 +29,12 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@ -34,19 +47,15 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package assembly:single install</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
@ -61,16 +70,17 @@
<finalName>mockserver-full</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -20,7 +20,7 @@ import eu.ztsh.mockserver.api.response.MockResponseReport
import eu.ztsh.mockserver.api.response.Mocks
import eu.ztsh.mockserver.api.response.Parameter
import javax.xml.bind.JAXBContext
import jakarta.xml.bind.JAXBContext
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet
import java.util.concurrent.Executor
@ -79,22 +79,22 @@ class HttpMockServer {
void listMocks(HttpExchange ex) {
Mocks mockListing = new Mocks(
mocks: listMocks().collect {
new MockReport(
name: it.name,
path: it.path,
port: it.port,
predicate: it.predicateClosureText,
response: it.responseClosureText,
responseHeaders: it.responseHeadersClosureText,
soap: it.soap,
method: it.method,
statusCode: it.statusCode as int,
schema: it.schema,
imports: it.imports.collect { new ImportAlias(alias: it.key, fullClassName: it.value) },
preserveHistory: it.preserveHistory
)
}
mocks: listMocks().collect {
new MockReport(
name: it.name,
path: it.path,
port: it.port,
predicate: it.predicateClosureText,
response: it.responseClosureText,
responseHeaders: it.responseHeadersClosureText,
soap: it.soap,
method: it.method,
statusCode: it.statusCode as int,
schema: it.schema,
imports: it.imports.collect { new ImportAlias(alias: it.key, fullClassName: it.value) },
preserveHistory: it.preserveHistory
)
}
)
createResponse(ex, mockListing, 200)
}
@ -182,12 +182,12 @@ class HttpMockServer {
mock.preserveHistory = co.preserveHistory != false
if (co.https) {
mock.https = new Https(
keystorePath: co.https.keystorePath ?: null,
keystorePassword: co.https.keystorePassword,
keyPassword: co.https.keyPassword,
truststorePath: co.https.truststorePath,
truststorePassword: co.https.truststorePassword,
requireClientAuth: co.https?.requireClientAuth?.asBoolean() ?: false
keystorePath: co.https.keystorePath ?: null,
keystorePassword: co.https.keystorePassword,
keyPassword: co.https.keyPassword,
truststorePath: co.https.truststorePath,
truststorePassword: co.https.truststorePassword,
requireClientAuth: co.https?.requireClientAuth?.asBoolean() ?: false
)
}
mock.maxUses = co.maxUses ?: null
@ -217,7 +217,7 @@ class HttpMockServer {
mockNames.remove(name)
configuration.remove(name)
MockRemoved mockRemoved = new MockRemoved(
mockEvents: createMockEventReports(mockEvents)
mockEvents: createMockEventReports(mockEvents)
)
createResponse(ex, mockRemoved, 200)
}
@ -225,23 +225,23 @@ class HttpMockServer {
private static List<MockEventReport> createMockEventReports(List<MockEvent> mockEvents) {
return mockEvents.collect {
new MockEventReport(
request: new MockRequestReport(
text: it.request.text,
headers: new MockRequestReport.Headers(headers: it.request.headers.collect {
new Parameter(name: it.key, value: it.value)
}),
queryParams: new MockRequestReport.QueryParams(queryParams: it.request.query.collect {
new Parameter(name: it.key, value: it.value)
}),
path: new MockRequestReport.Path(pathParts: it.request.path)
),
response: new MockResponseReport(
statusCode: it.response.statusCode,
text: it.response.text,
headers: new MockResponseReport.Headers(headers: it.response.headers.collect {
new Parameter(name: it.key, value: it.value)
})
)
request: new MockRequestReport(
text: it.request.text,
headers: new MockRequestReport.Headers(headers: it.request.headers.collect {
new Parameter(name: it.key, value: it.value)
}),
queryParams: new MockRequestReport.QueryParams(queryParams: it.request.query.collect {
new Parameter(name: it.key, value: it.value)
}),
path: new MockRequestReport.Path(pathParts: it.request.path)
),
response: new MockResponseReport(
statusCode: it.response.statusCode,
text: it.response.text,
headers: new MockResponseReport.Headers(headers: it.response.headers.collect {
new Parameter(name: it.key, value: it.value)
})
)
)
}
}
@ -254,7 +254,7 @@ class HttpMockServer {
log.trace("Peeking mock $name")
List<MockEvent> mockEvents = childServers.values().collect { it.peekMock(name) }.flatten() as List<MockEvent>
MockPeeked mockPeeked = new MockPeeked(
mockEvents: createMockEventReports(mockEvents)
mockEvents: createMockEventReports(mockEvents)
)
createResponse(ex, mockPeeked, 200)
}

View file

@ -3,7 +3,7 @@ package eu.ztsh.mockserver.server
import com.sun.net.httpserver.HttpExchange
import eu.ztsh.mockserver.api.response.MockAdded
import javax.xml.bind.JAXBContext
import jakarta.xml.bind.JAXBContext
class Util {

View file

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>http-mock-server</artifactId>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>http-mock-server</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mockserver-performance-tests</artifactId>
@ -13,13 +14,12 @@
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>

115
pom.xml
View file

@ -17,26 +17,45 @@
</modules>
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<groovy.version>2.5.7</groovy.version>
<groovy.version>3.0.20</groovy.version>
<httpclient.version>4.5.13</httpclient.version>
<spock-core.version>1.3-groovy-2.5</spock-core.version>
<spock-core.version>2.0-groovy-3.0</spock-core.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
<slf4j-api.version>1.7.30</slf4j-api.version>
<logback.version>1.3.12</logback.version>
<lombok.version>1.16.6</lombok.version>
<lombok.version>1.18.26</lombok.version>
<jakarta-xml-bind.version>4.0.1</jakarta-xml-bind.version>
<autoVersionSubmodules>true</autoVersionSubmodules>
<jmh.version>1.11.2</jmh.version>
<maven-release-plugin.version>2.5.2</maven-release-plugin.version>
<gmavenplus-plugin.version>1.4</gmavenplus-plugin.version>
<spock-global-unroll.version>0.5.1</spock-global-unroll.version>
<jmh.version>1.37</jmh.version>
<gmavenplus-plugin.version>3.0.2</gmavenplus-plugin.version>
<jaxb2-maven-plugin.version>3.1.0</jaxb2-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
@ -52,22 +71,22 @@
<artifactId>groovy-xml</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta-xml-bind.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@ -88,10 +107,12 @@
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>eu.ztsh.mockserver</groupId>
<artifactId>mockserver-api</artifactId>
<version>${project.version}</version>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
@ -105,48 +126,32 @@
<version>${jmh.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.solidsoft.spock</groupId>
<artifactId>spock-global-unroll</artifactId>
<version>${spock-global-unroll.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>${gmavenplus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<autoversionsubmodules>true</autoversionsubmodules>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>${jaxb2-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>${gmavenplus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>