feat!: Jakarta & JDK11
This commit is contained in:
parent
2fe3f2a67d
commit
514064debc
11 changed files with 206 additions and 180 deletions
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue