Skip to content

Commit

Permalink
Fix thread safety bug in eventing unit tests (#746)
Browse files Browse the repository at this point in the history
A sequencing error in the test service implementation meant that
request message were acknowledged before they had been stored on the
received request queue. This introduced a race condition where tests
could check for received requests before the receiving thread had
processed them.

Also update Maven plugins and test dependencies.

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
  • Loading branch information
bestbeforetoday authored Sep 9, 2024
1 parent 618bb5c commit 1455ece
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: java-doc
path: java/target/site/apidocs/
path: java/target/reports/apidocs/

site:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ clean-generated:
clean-docs:
rm -rf '$(base_dir)/site'
rm -rf '$(node_dir)/apidocs'
rm -rf '$(java_dir)/target/site/apidocs'
rm -rf '$(java_dir)/target/reports/apidocs'

.PHONY: shellcheck
shellcheck:
Expand Down
28 changes: 14 additions & 14 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
<javaVersion>8</javaVersion>
<bouncyCastleVersion>1.78</bouncyCastleVersion>
<skipUnitTests>${skipTests}</skipUnitTests>
<pmdVersion>7.3.0</pmdVersion>
<pmdVersion>7.5.0</pmdVersion>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-bom</artifactId>
<version>7.18.0</version>
<version>7.18.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.2</version>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -83,13 +83,13 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.0</version>
<version>3.26.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.12.0</version>
<version>5.13.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -177,7 +177,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<id>show-profiles</id>
Expand All @@ -190,7 +190,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
Expand All @@ -205,12 +205,12 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
<dependencies>
<dependency>
<groupId>me.fabriciorby</groupId>
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
<version>1.2.1</version>
<version>1.3.0</version>
</dependency>
</dependencies>
<configuration>
Expand Down Expand Up @@ -305,7 +305,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.10.0</version>
<configuration>
<show>public</show>
<doctitle>Hyperledger Fabric Gateway client API for Java</doctitle>
Expand Down Expand Up @@ -349,7 +349,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.23.0</version>
<version>3.25.0</version>
<configuration>
<skip>${skipUnitTests}</skip>
<printFailingErrors>true</printFailingErrors>
Expand Down Expand Up @@ -474,7 +474,7 @@
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.2.0</version>
<version>10.0.4</version>
<configuration>
<skipProvidedScope>true</skipProvidedScope>
<skipTestScope>true</skipTestScope>
Expand Down Expand Up @@ -502,7 +502,7 @@
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand All @@ -520,7 +520,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<version>3.2.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down
26 changes: 0 additions & 26 deletions java/src/site/site.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ private <T> StreamObserver<T> streamObserverFromQueue(
@Override
public void onNext(final T request) {
try {
onNextListener.accept(request);
queue.put(request);
onNextListener.accept(request);
} catch (InterruptedException e) {
onError.accept(e);
}
Expand Down

0 comments on commit 1455ece

Please sign in to comment.