Skip to content

Commit

Permalink
Markdown headers (#31)
Browse files Browse the repository at this point in the history
Reformat the output of the functional test to use markdown headers.

Plus delete some dead code, and add links to the docs for the perf and func workflows.
  • Loading branch information
big-andy-coates authored Oct 9, 2023
1 parent 4b7b22d commit 46ea332
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 37 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ implementation is poorly represented due to issues with the code in this repo.

## Feature comparison

To run the comparison: `./gradlew runFunctionalTests`
Run the feature comparison locally with `./gradlew runFunctionalTests`, or view previous runs on [GitHub][functionalTestRuns].

Runs each implementation through the standard [JSON Schema Test Suite][JSON-Schema-Test-Suite].
The suite contains both positive and negative test cases, i.e. JSON that should both pass and fail validation,
Expand Down Expand Up @@ -168,7 +168,7 @@ There are also a couple of notes to call out for different implementations aroun

## Performance comparison

To run the comparison: `./gradlew runBenchmarks`
Run the performance comparison locally with `./gradlew runBenchmarks`, or view previous runs on [GitHub][performanceBenchmarkRuns].

How fast is the implementation at validating JSON? To find out, two different performance suites were run using
the [Java Microbenchmark Harness][jhm]:
Expand Down Expand Up @@ -309,4 +309,6 @@ Note: The author of this repository is not affiliated with any of the implementa
[8]: https://github.com/erosb/json-sKema
[JSON-Schema-Test-Suite]: https://github.com/json-schema-org/JSON-Schema-Test-Suite
[jhm]: https://github.com/openjdk/jmh
[confluent]: https://www.confluent.io/
[confluent]: https://www.confluent.io/
[functionalTestRuns]: https://github.com/creek-service/json-schema-validation-comparison/actions/workflows/run-func-test.yml
[performanceBenchmarkRuns]: https://github.com/creek-service/json-schema-validation-comparison/actions/workflows/run-perf-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ public static void main(final String... args) {
}

private static void outputResults(final Map<SerdeImpl, Result> results) {

System.out.println(new PerDraftSummary(results));

System.out.println();

System.out.println("# Overall comparison");
System.out.println(new Summary(results));
System.out.println();
System.out.println("# Specific Draft & Implementation results");
System.out.println(new PerDraftSummary(results));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public PerDraftSummary(final Map<SerdeImpl, JsonSchemaTestSuite.Result> results)
@Override
public String toString() {
return results.entrySet().stream()
.map(e -> e.getKey() + lineSeparator() + e.getValue())
.map(e -> "## " + e.getKey() + lineSeparator() + e.getValue())
.collect(Collectors.joining(lineSeparator()));
}

Expand Down
28 changes: 0 additions & 28 deletions src/main/java/org/creekservice/kafka/test/perf/util/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class Table {
Expand All @@ -43,10 +40,6 @@ public Table(final List<String> headers) {
this.headers = List.copyOf(requireNonNull(headers, "headers"));
}

public List<String> headers() {
return List.copyOf(headers);
}

public Row addRow() {
final Row row = new Row(headers);
rows.add(row);
Expand Down Expand Up @@ -122,15 +115,6 @@ private static int width(final Object value) {
.orElse(0);
}

public void removeIf(final Predicate<Row> p) {
rows.removeIf(p);
widths.clear();
}

public void sort(final Comparator<? super Row> c) {
rows.sort(c);
}

public void map(final Consumer<Row> c) {
rows.forEach(c);
widths.clear();
Expand All @@ -151,18 +135,6 @@ public void put(final String header, final Object value) {
values.put(header, requireNonNull(value, "value"));
}

public void compute(
final String header, final BiFunction<? super String, ? super Object, ?> updater) {
values.compute(
header,
(h, existing) -> {
if (existing == null) {
validateHeader(h);
}
return requireNonNull(updater.apply(h, existing), "updater returned null");
});
}

public Collection<Object> values() {
return values.values();
}
Expand Down

0 comments on commit 46ea332

Please sign in to comment.