Skip to content

Commit f9d5b6d

Browse files
Updates to test chaincode to exploit new microfab
New microfab version provides an up-to-date Gradle version, which the test chaincode can be updated to exploit. This change also updates several dependencies to current versions. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 4939a15 commit f9d5b6d

File tree

11 files changed

+42
-35
lines changed

11 files changed

+42
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/build/
99
build/*
1010
settings-gradle.lockfile
11+
config/
1112

1213
_cfg
1314
repository

build.gradle

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ subprojects {
6363
dependencies {
6464
implementation 'commons-cli:commons-cli:1.9.0'
6565
implementation 'commons-logging:commons-logging:1.3.4'
66-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.0'
67-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.0'
68-
69-
testImplementation 'org.hamcrest:hamcrest-library:3.0'
70-
testImplementation 'org.mockito:mockito-core:5.13.0'
71-
testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.6'
7266

67+
testImplementation platform('org.junit:junit-bom:5.11.3')
68+
testImplementation 'org.junit.jupiter:junit-jupiter'
69+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
7370
testImplementation 'org.assertj:assertj-core:3.26.3'
71+
testImplementation 'org.mockito:mockito-core:5.14.2'
72+
testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.7'
73+
74+
testImplementation 'org.hamcrest:hamcrest-library:3.0'
7475
}
7576

7677
test {

fabric-chaincode-docker/Dockerfile

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM eclipse-temurin:11-jdk as builder
2-
ENV DEBIAN_FRONTEND=noninteractive
1+
ARG JAVA_IMAGE=eclipse-temurin:11-jdk
2+
3+
FROM ${JAVA_IMAGE} as builder
4+
ENV DEBIAN_FRONTEND=noninteractive
35

46
# Build tools
57
RUN apt-get update \
@@ -10,10 +12,11 @@ RUN curl -s "https://get.sdkman.io" | bash
1012

1113
SHELL ["/bin/bash", "-c"]
1214

13-
RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install gradle 8.6
14-
RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install maven 3.9.6
15+
RUN source /root/.sdkman/bin/sdkman-init.sh \
16+
&& sdk install gradle 8.11.1 \
17+
&& sdk install maven 3.9.9
1518

16-
FROM eclipse-temurin:11-jdk as dependencies
19+
FROM ${JAVA_IMAGE} as dependencies
1720

1821
COPY --from=builder /root/.sdkman/candidates/gradle/current /usr/bin/gradle
1922
COPY --from=builder /root/.sdkman/candidates/maven/current /usr/bin/maven
@@ -25,12 +28,10 @@ ENV PATH="/usr/bin/maven/bin:/usr/bin/maven/:/usr/bin/gradle:/usr/bin/gradle/bin
2528
ADD build/distributions/ /root/
2629

2730
#Creating folders structure
28-
RUN mkdir -p /root/chaincode-java/chaincode/src
29-
RUN mkdir -p /root/chaincode-java/chaincode/build/out
31+
RUN mkdir -p /root/chaincode-java/chaincode/src /root/chaincode-java/chaincode/build/out
3032

3133
#Making scripts runnable
32-
RUN chmod +x /root/chaincode-java/start
33-
RUN chmod +x /root/chaincode-java/build.sh
34+
RUN chmod +x /root/chaincode-java/start /root/chaincode-java/build.sh
3435

3536
# Build protos and shim jar and installing them to maven local and gradle cache
3637
WORKDIR /root/chaincode-java/shim-src
@@ -41,19 +42,21 @@ RUN gradle \
4142
-x javadoc \
4243
-x test \
4344
-x pmdMain \
44-
-x pmdTest
45+
-x pmdTest \
46+
-x spotlessCheck
4547

4648
WORKDIR /root/chaincode-java
4749
# Run the Gradle and Maven commands to generate the wrapper variants
4850
# of each tool
4951
#Gradle doesn't run without settings.gradle file, so create one
50-
RUN touch settings.gradle
51-
RUN gradle wrapper
52-
RUN mvn -N io.takari:maven:wrapper
52+
RUN touch settings.gradle \
53+
&& gradle wrapper \
54+
&& ./gradlew --version \
55+
&& mvn -N wrapper:wrapper
5356

5457
# Creating final javaenv image which will include all required
5558
# dependencies to build and compile java chaincode
56-
FROM eclipse-temurin:11-jdk
59+
FROM ${JAVA_IMAGE}
5760

5861
RUN apt-get update \
5962
&& apt-get -y install zip unzip \
@@ -66,6 +69,7 @@ SHELL ["/bin/bash", "-c"]
6669

6770
# Copy setup scripts, and the cached dependencies
6871
COPY --from=dependencies /root/chaincode-java /root/chaincode-java
72+
COPY --from=dependencies /root/.gradle /root/.gradle
6973
COPY --from=dependencies /root/.m2 /root/.m2
7074

7175
WORKDIR /root/chaincode-java
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
repository
22
_cfg
33
*.tar.gz
4+
log.txt

fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '5.2.0'
2+
id 'com.gradleup.shadow' version '8.3.5'
33
id 'java'
44
}
55

@@ -29,9 +29,9 @@ dependencies {
2929
}
3030

3131
shadowJar {
32-
baseName = 'chaincode'
33-
version = null
34-
classifier = null
32+
archiveBaseName = 'chaincode'
33+
archiveVersion = ''
34+
archiveClassifier = ''
3535
mergeServiceFiles()
3636

3737
manifest {

fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '8.1.1'
2+
id 'com.gradleup.shadow' version '8.3.5'
33
id 'java'
44
}
55

66
group 'org.hyperledger.fabric-chaincode-java'
7-
version '1.0-SNAPSHOT'
7+
version ''
88

99
java {
1010
sourceCompatibility = JavaVersion.VERSION_11

fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '8.1.1'
2+
id 'com.gradleup.shadow' version '8.3.5'
33
id 'java'
44
}
55

fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

fabric-chaincode-shim/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ tasks.withType(org.gradle.api.tasks.testing.Test) {
4242

4343
dependencies {
4444
implementation platform('com.google.protobuf:protobuf-bom:3.25.5')
45-
implementation platform('io.grpc:grpc-bom:1.68.0')
45+
implementation platform('io.grpc:grpc-bom:1.68.1')
4646
implementation platform('io.opentelemetry:opentelemetry-bom:1.42.1')
4747

4848
implementation 'org.hyperledger.fabric:fabric-protos:0.3.3'
49-
implementation 'org.bouncycastle:bcpkix-jdk18on:1.78.1'
50-
implementation 'org.bouncycastle:bcprov-jdk18on:1.78.1'
51-
implementation 'io.github.classgraph:classgraph:4.8.176'
49+
implementation 'org.bouncycastle:bcpkix-jdk18on:1.79'
50+
implementation 'org.bouncycastle:bcprov-jdk18on:1.79'
51+
implementation 'io.github.classgraph:classgraph:4.8.179'
5252
implementation 'com.github.everit-org.json-schema:org.everit.json.schema:1.14.4'
5353
implementation 'org.json:json:20240303'
5454
implementation 'com.google.protobuf:protobuf-java-util'
@@ -86,7 +86,7 @@ sourceSets {
8686
}
8787

8888
jacoco {
89-
toolVersion = "0.8.6"
89+
toolVersion = "0.8.12"
9090
}
9191

9292
jacocoTestReport {

0 commit comments

Comments
 (0)