Skip to content

Commit

Permalink
Merge pull request #44 from holomekc/feature/new-version
Browse files Browse the repository at this point in the history
3.3.1.0
  • Loading branch information
holomekc authored Nov 27, 2023
2 parents 95ded22 + 84e2d81 commit aafd3a4
Show file tree
Hide file tree
Showing 694 changed files with 16,904 additions and 26,629 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up node using nvm
uses: dcodeIO/setup-node-nvm@v5
with:
node-version: 16.16.0
node-version: 20.10.0

# - name: Cache SonarCloud packages
# uses: actions/cache@v1
Expand Down
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ Merges to this repository can be performed by the WireMock maintainer ([Tom Akeh
and by _co-maintainers_ assigned by him.
This is a [community role](https://github.com/wiremock/community/blob/main/governance/README.md)
designed for WireMock itself and other key repositories,
specifically to facilitate review and changes while WireMock 3 is in beta
and receives a lot of incremental patches.
specifically to improve velocity of reviews and changes.

- The maintainers are responsible to verify the pull request readiness
in accordance with contributing guidelines (e.g. code quality, test automation, documentation, etc.).
Expand All @@ -126,19 +125,18 @@ and receives a lot of incremental patches.
unless there are negative reviews and unaddressed comments by other contributors
- After the approval, it is generally recommended to give at least 24 hours for reviews before merging

Beyond WireMock 3.x Beta releases, the scope of responsibilities for co-maintainers
is yet to be determined based on the experiences with this role for the Beta versions.

### What can be merged by co-maintainers

While WireMock 3.x is in Beta, co-maintainers can merge the following pull requests:
For WireMock 3.x and beyond, co-maintainers can merge the following pull requests:

- Minor features and improvements that do not impact the WireMock architecture
- Refactorings, including the major ones, e.g. Guava replacement
- Test Automation
- Non-production repository changes: documentation (including Javadoc), GitHub Actions, bots and automation
- Dependency updates for shaded dependencies, patch/minor versions for projects following the Semantic Versioning notation

For the WireMock 2.x branch, a decision of BDFL is is needed for any patch.

### What CANNOT be merged by co-maintainers without BDFL’s approval

The following changes need a review by Tom Akehurst before being merged.
Expand All @@ -150,4 +148,4 @@ The following changes need a review by Tom Akehurst before being merged.
Examples: New REST API end-points, major features like GraphQL fetching
- Inclusion of new libraries, even if shaded
- Major version Dependency updates, e.g. Jetty 11 => 12
- Changes in the deliverable artefacts, e.g. new modules
- Changes in the deliverable artefacts, e.g. new modules
6 changes: 5 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
- Update to wiremock 3.2.0
## New Feature

- Update to wiremock 3.3.1
- Update nearly all ui dependencies
- Thx to Bootstrap 5.3.x we have a DarkMode now. LightMode is completely light now.
50 changes: 29 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ plugins {
id 'idea'
id 'eclipse'
id 'project-report'
id 'com.diffplug.spotless' version '6.21.0'
id 'com.diffplug.spotless' version '6.22.0'
id 'com.github.johnrengelman.shadow' version '8.1.0'
id "org.sonarqube" version "4.3.1.3277"
id "org.sonarqube" version "4.4.1.3373"
id 'jacoco'
}

group = 'org.wiremock'

project.ext {
versions = [
handlebars : '4.3.1',
jetty : '11.0.16',
guava : '32.1.2-jre',
jackson : '2.15.2',
xmlUnit : '2.9.1',
jsonUnit : '2.38.0',
junitJupiter : '5.10.0'
handlebars : '4.3.1',
jetty : '11.0.18',
guava : '32.1.3-jre',
jackson : '2.15.3',
xmlUnit : '2.9.1',
jsonUnit : '2.38.0',
junitJupiter: '5.10.0'
]
}

Expand Down Expand Up @@ -78,7 +78,7 @@ dependencies {
api "com.jayway.jsonpath:json-path:2.8.0", {
exclude group: 'org.ow2.asm', module: 'asm'
}
api "org.ow2.asm:asm:9.5"
api "org.ow2.asm:asm:9.6"

implementation "org.slf4j:slf4j-api:1.7.36"
standaloneOnly "org.slf4j:slf4j-nop:1.7.36"
Expand All @@ -99,10 +99,10 @@ dependencies {
exclude group: 'org.mozilla', module: 'rhino'
}

api 'commons-fileupload:commons-fileupload:1.5', {
api 'commons-fileupload:commons-fileupload:1.5', {
exclude group: 'commons-io', module: 'commons-io'
}
api "commons-io:commons-io:2.13.0"
api "commons-io:commons-io:2.15.0"

api 'com.networknt:json-schema-validator:1.0.87'

Expand All @@ -116,14 +116,14 @@ dependencies {

testImplementation "org.hamcrest:hamcrest-core:2.2"
testImplementation "org.hamcrest:hamcrest-library:2.2"
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.5.0'
testImplementation 'org.mockito:mockito-core:5.6.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.6.0'
testImplementation "net.javacrumbs.json-unit:json-unit:$versions.jsonUnit"
testImplementation "org.skyscreamer:jsonassert:1.2.3"
testImplementation 'com.toomuchcoding.jsonassert:jsonassert:0.6.2'
testImplementation 'org.awaitility:awaitility:4.2.0'
testImplementation "com.googlecode.jarjar:jarjar:1.3"
testImplementation "commons-io:commons-io:2.13.0"
testImplementation "commons-io:commons-io:2.15.0"
testImplementation 'org.scala-lang:scala-library:2.13.12'
testImplementation 'com.tngtech.archunit:archunit-junit5:0.23.1'

Expand All @@ -133,13 +133,13 @@ dependencies {
testRuntimeOnly "ch.qos.logback:logback-classic:1.4.0"
testRuntimeOnly files('src/test/resources/classpath file source/classpathfiles.zip', 'src/test/resources/classpath-filesource.jar')

testImplementation ('net.jockx:littleproxy:1.1.3') {
testImplementation('net.jockx:littleproxy:1.1.3') {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'org.apache.commons', module: 'commons-lang3'
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'io.netty', module: 'netty-all'
}
testImplementation "io.netty:netty-all:4.1.98.Final"
testImplementation "io.netty:netty-all:4.1.99.Final"

testImplementation files('test-extension/test-extension.jar')

Expand Down Expand Up @@ -184,7 +184,7 @@ allprojects {
ext {
runningOnCI = System.getenv('CI') == 'true'

repoUser = this.hasProperty('sonatypeUser') ? sonatypeUser : 'default'
repoUser = this.hasProperty('sonatypeUser') ? sonatypeUser : 'default'
repoPassword = this.hasProperty('sonatypePassword') ? sonatypePassword : 'default'

pomInfo = {
Expand Down Expand Up @@ -215,7 +215,7 @@ allprojects {
mavenCentral()
}

version = '3.2.0.0'
version = '3.3.1.0'


sourceCompatibility = 11
Expand Down Expand Up @@ -447,11 +447,19 @@ task generateWebapp(type: Exec) {
}
}

task finalizeWebapp(type: Copy) {
mustRunAfter generateWebapp
// Because of: https://github.com/angular/angular-cli/issues/26304
// we need to copy some things around.
from 'webapp/wiremock/dist/browser'
into 'src/main/resources/assets/webapp'
}

jar.dependsOn generateWebapp
processResources.dependsOn generateWebapp

task deleteGeneratedWebapp(type: Delete) {
delete "src/main/resources/assets/webapp"
delete 'src/main/resources/assets/webapp'
}

clean.dependsOn deleteGeneratedWebapp
Expand Down Expand Up @@ -557,7 +565,7 @@ tasks.withType(JavaCompile) {

eclipse.classpath.file {
whenMerged {
entries.find{ it.path ==~ '.*JRE_CONTAINER.*' }.each {
entries.find { it.path ==~ '.*JRE_CONTAINER.*' }.each {
it.entryAttributes['module'] = true
it.entryAttributes['add-exports'] = 'java.base/sun.security.x509=ALL-UNNAMED'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public WireMockServer(Options options) {
HttpServerFactory httpServerFactory =
wireMockApp.getExtensions().ofType(HttpServerFactory.class).values().stream()
.findFirst()
.orElse(options.httpServerFactory());
.orElseGet(options::httpServerFactory);

httpServer =
httpServerFactory.buildHttpServer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AdminRoutes {
private final Stores stores;

public static AdminRoutes forClient() {
return new AdminRoutes(Collections.<AdminApiExtension>emptyList(), null);
return new AdminRoutes(Collections.emptyList(), null);
}

public static AdminRoutes forServer(Iterable<AdminApiExtension> apiExtensions, Stores stores) {
Expand Down Expand Up @@ -131,7 +131,7 @@ public AdminTask taskFor(final RequestMethod method, final String path) {
.filter(entry -> entry.getKey().matches(method, path))
.map(Entry::getValue)
.findFirst()
.orElse(new NotFoundAdminTask());
.orElseGet(NotFoundAdminTask::new);
}

public RequestSpec requestSpecForTask(final Class<? extends AdminTask> taskClass) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2022 Thomas Akehurst
* Copyright (C) 2016-2023 Thomas Akehurst
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,11 +15,11 @@
*/
package com.github.tomakehurst.wiremock.admin;

import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.github.tomakehurst.wiremock.common.Errors;
import com.github.tomakehurst.wiremock.common.InvalidInputException;
import com.github.tomakehurst.wiremock.http.QueryParameter;
import java.text.ParseException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException;
import java.util.Date;

public class Conversions {
Expand All @@ -30,8 +30,10 @@ public static Integer toInt(QueryParameter parameter) {

public static Date toDate(QueryParameter parameter) {
try {
return parameter.isPresent() ? new ISO8601DateFormat().parse(parameter.firstValue()) : null;
} catch (ParseException e) {
return parameter.isPresent()
? Date.from(ZonedDateTime.parse(parameter.firstValue()).toInstant())
: null;
} catch (DateTimeParseException e) {
throw new InvalidInputException(
Errors.validation(
parameter.key(), parameter.firstValue() + " is not a valid ISO8601 date"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public List<TextFile> listFilesRecursively() {
}

private void recursivelyAddFilesToList(File root, List<File> fileList) {
File[] files = Optional.ofNullable(root.listFiles()).orElse(new File[0]);
File[] files = Optional.ofNullable(root.listFiles()).orElseGet(() -> new File[0]);
for (File file : files) {
if (file.isDirectory()) {
recursivelyAddFilesToList(file, fileList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private URI getUriFor(ZipEntry jarEntry) {
}

private void recursivelyAddFilesToList(File root, List<File> fileList) {
File[] files = Optional.ofNullable(root.listFiles()).orElse(new File[0]);
File[] files = Optional.ofNullable(root.listFiles()).orElseGet(() -> new File[0]);
for (File file : files) {
if (file.isDirectory()) {
recursivelyAddFilesToList(file, fileList);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Thomas Akehurst
* Copyright (C) 2021-2023 Thomas Akehurst
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,7 +47,7 @@ public enum DateTimeTruncation {
}

public ZonedDateTime truncate(ZonedDateTime input) {
return fn.apply(input);
return input != null ? fn.apply(input) : null;
}

public Date truncate(Date input) {
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/com/github/tomakehurst/wiremock/common/Dates.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2022 Thomas Akehurst
* Copyright (C) 2016-2023 Thomas Akehurst
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,22 +17,23 @@

import static com.github.tomakehurst.wiremock.common.Exceptions.throwUnchecked;

import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.ParseException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;

public class Dates {

public static Date parse(String dateString) {
try {
return new ISO8601DateFormat().parse(dateString);
} catch (ParseException e) {
return Date.from(ZonedDateTime.parse(dateString).toInstant());
} catch (DateTimeParseException e) {
return throwUnchecked(e, Date.class);
}
}

public static String format(Date date) {
return ISO8601Utils.format(date);
return DateTimeFormatter.ISO_ZONED_DATE_TIME.format(date.toInstant().atZone(ZoneId.of("Z")));
}
}
Loading

0 comments on commit aafd3a4

Please sign in to comment.