Skip to content

Commit

Permalink
prepare 1.5.3 release (#70)
Browse files Browse the repository at this point in the history
* prepare 1.5.3 release
  • Loading branch information
charlesdaniels authored Aug 6, 2024
1 parent 87fde54 commit 8266142
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: 47e8e950-a454-4ebb-9f78-86fda7dfa0c2
management:
docChecksum: a34bd1c885aa42eb3175940494581f67
docVersion: 0.2.0
speakeasyVersion: 1.352.2
generationVersion: 2.385.2
releaseVersion: 1.5.2
configChecksum: 8fa1830a31c492ff0715e1868931d248
speakeasyVersion: 1.354.0
generationVersion: 2.386.2
releaseVersion: 1.5.3
configChecksum: 64798e8dfb7f95ceef7c914140804cea
repoURL: https://github.com/StyraInc/opa-java.git
published: true
features:
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
java:
version: 1.5.2
version: 1.5.3
additionalDependencies:
- testImplementation:org.junit.jupiter:junit-jupiter-api:5.8.2
- runtimeOnly:org.junit.jupiter:junit-jupiter-engine:5.8.2
Expand Down
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
speakeasyVersion: 1.352.2
speakeasyVersion: 1.354.0
sources:
openapi:
sourceNamespace: openapi
sourceRevisionDigest: sha256:0386accf30f12bb3bb50144694f3ab35ee68b21a3ed88c12e18a2b88dd15a3e0
sourceBlobDigest: sha256:bf9fe4dd822245aa01ce8a97b40ca6b70149d77015e0e26540a3ce94e5fc2700
sourceRevisionDigest: sha256:cdedb966379a4fcac12704efa03907a7529e5fe7d9497ce97571efe8bb06194d
sourceBlobDigest: sha256:0a582b34b60d45468d7211a21ded7a26384d8a6a8d07c7277bd34e3b37b3674a
tags:
- latest
targets:
opa:
source: openapi
sourceNamespace: openapi
sourceRevisionDigest: sha256:0386accf30f12bb3bb50144694f3ab35ee68b21a3ed88c12e18a2b88dd15a3e0
sourceBlobDigest: sha256:bf9fe4dd822245aa01ce8a97b40ca6b70149d77015e0e26540a3ce94e5fc2700
sourceRevisionDigest: sha256:cdedb966379a4fcac12704efa03907a7529e5fe7d9497ce97571efe8bb06194d
sourceBlobDigest: sha256:0a582b34b60d45468d7211a21ded7a26384d8a6a8d07c7277bd34e3b37b3674a
outLocation: /Users/cad/f/src/opa-java
workflow:
workflowVersion: 1.0.0
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# OPA Java SDK Changelog

## v1.5.3

* Marked jackson-databind as an `api` dependency in addition to jackson-core.
* Fixed a bug where `OPALatencyMeasuringHTTPClient` would report results in ns rather than ms.

## v1.5.2

* Fixed a bug where instantiating `OPALatencyMeasuringHTTPClient` with the default constructor could result in a null pointer exception while formatting messages.
Expand Down
10 changes: 10 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,13 @@ Based on:
- [java v1.5.2] .
### Releases
- [Maven Central v1.5.2] https://central.sonatype.com/artifact/com.styra.opa/openapi/1.5.2 - .

## 2024-08-06 16:35:00
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.354.0 (2.361.10) https://github.com/speakeasy-api/speakeasy
### Generated
- [java v1.5.3] .
### Releases
- [Maven Central v1.5.3] https://central.sonatype.com/artifact/com.styra.opa/openapi/1.5.3 - .
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.styra'
artifactId = 'opa'
version = '1.5.2'
version = '1.5.3'

from components.java

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/styra/opa/openapi/SDKConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public Optional<SecuritySource> securitySource() {
public int serverIdx = 0;
public String language = "java";
public String openapiDocVersion = "0.2.0";
public String sdkVersion = "1.5.2";
public String genVersion = "2.385.2";
public String userAgent = "speakeasy-sdk/java 1.5.2 2.385.2 0.2.0 com.styra.opa.openapi";
public String sdkVersion = "1.5.3";
public String genVersion = "2.386.2";
public String userAgent = "speakeasy-sdk/java 1.5.3 2.386.2 0.2.0 com.styra.opa.openapi";

private com.styra.opa.openapi.utils.Hooks _hooks = createHooks();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
*/
public class OPALatencyMeasuringHTTPClient extends OPAHTTPClient {

// Checkstyle wants this to not be a hard-coded magic number. You never
// know, maybe the length of a second will change one day?
private static final double MS_PER_NS = 0.000001;

private static Logger logger = Logger.getLogger(OPALatencyMeasuringHTTPClient.class.getName());

private String latencyMeasurementFormatString = "path=''{1}'' latency={0,number,#}ms";
Expand Down Expand Up @@ -80,9 +84,10 @@ public HttpResponse<InputStream> send(HttpRequest request)
HttpResponse<InputStream> response = super.send(request);
long endTime = System.nanoTime();

long sendLatency = endTime - startTime;
// convert ns -> ms
double sendLatency = (((double) endTime) - ((double) startTime)) * MS_PER_NS;

Object[] logArgs = {sendLatency, path};
Object[] logArgs = {(long) sendLatency, path};

logger.log(latencyMeasurementLogLevel, fmt.format(logArgs));

Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/styra/opa/OPATest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class OPATest {
private int testIntegerA = 8;
private int testIntegerB = 16;
private double testDoubleA = 3.14159;
private long msInZeroSeconds; // implicit initialization to 0
private long msInOneSeconds = 1000;

private String address;
private String altAddress;
Expand Down Expand Up @@ -299,6 +301,12 @@ public void testLatencyMeasurement() {
for (String msg : logs) {
System.out.printf("DEBUG: log line: %s\n", msg);
assertTrue(msg.matches("^INFO LATENCY MEASUREMENT #[0-9]+#/v1/data/policy/echo#$"));

// Sanity check that the measurement value is > 0 and < 1s. Even in
// CI, it shouldn't take over 1s to do a simple localhost request.
String latency = msg.replaceFirst("\\D*(\\d*).*", "$1");
assertTrue(Integer.parseInt(latency) > msInZeroSeconds);
assertTrue(Integer.parseInt(latency) < msInOneSeconds);
}
}

Expand Down

0 comments on commit 8266142

Please sign in to comment.