Skip to content

Commit 756f823

Browse files
kyonRayCopilot
andauthored
<fix>(build): update dependencies version, add UT with AI. (#945)
* <fix>(build): update dependencies version, add UT with AI. * Add unit tests to increase JaCoCo coverage from 30.1% to 30.7% (#1) * Initial plan * Initial setup: Upgrade Gradle to 7.6.4 for Java 17 compatibility and fix duplicate resources handling Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for model classes and exceptions to improve coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add more unit tests for model and enum classes to increase coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for crypto exception classes to increase coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Downgrade Gradle version to 6.3 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for SDK v3 client and transaction packages (#2) * Initial plan * Add unit tests for client and transaction packages - part 1 Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add more unit tests for client protocol response and transaction dto classes Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for LogFilterRequest, model BO classes and CommonConstant Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Fix ResultCodeEnumTest to avoid mutating enum state in tests Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * <fix>(test): fixed tests path. * Add comprehensive test coverage for uncovered utility, protocol, and codec classes (#4) * Initial plan * Add comprehensive tests for ByteUtils, ThreadPoolService, SystemInformation, SecureRandomUtils, and LinuxSecureRandom Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add comprehensive tests for JsonRpcRequest and TopicTools Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Address code review feedback - fix resource cleanup and remove redundant tests Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * <fix>(CI): fix windows ci version to 2025. * <fix>(build): update publish url to central.sonatype. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 9837e92 commit 756f823

File tree

72 files changed

+7625
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+7625
-207
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
os: [ ubuntu-22.04, windows-2019, macos-latest ]
18+
os: [ ubuntu-22.04, windows-2025, macos-latest ]
1919
steps:
2020
- uses: actions/checkout@v3
2121
with:

build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ ext {
1616
if (!project.hasProperty("ossrhPassword")) {
1717
ossrhPassword = "xxx"
1818
}
19-
jacksonVersion = '2.14.3'
20-
commonsIOVersion = '2.11.0'
21-
commonsLang3Version = '3.12.0'
19+
jacksonVersion = '2.20.1'
20+
commonsIOVersion = '2.20.0'
21+
commonsLang3Version = '3.19.0'
2222
toml4jVersion = "0.7.2"
2323
bcprovJDK18onVersion = '1.78'
2424
webankJavaCryptoVersion = "1.0.3"
@@ -114,6 +114,10 @@ sourceSets {
114114
}
115115
}
116116

117+
tasks.withType(ProcessResources) {
118+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
119+
}
120+
117121
googleJavaFormat {
118122
toolVersion = '1.7'
119123
options style: 'AOSP'
@@ -135,6 +139,7 @@ dependencies {
135139
api("com.google.code.gson:gson:${gsonVersion}")
136140
api("org.apache.commons:commons-lang3:${commonsLang3Version}")
137141
api("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
142+
api("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jacksonVersion}")
138143
api("commons-io:commons-io:${commonsIOVersion}")
139144
api("com.webank:webank-blockchain-java-crypto:${webankJavaCryptoVersion}")
140145
api("com.moandjiezana.toml:toml4j:${toml4jVersion}") {
@@ -249,10 +254,10 @@ publishing {
249254
}
250255
repositories {
251256
maven {
252-
def releasesRepoURL = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
253-
def snapshotsRepoURL = "https://oss.sonatype.org/content/repositories/snapshots"
257+
name = 'ossrh-staging-api'
258+
def releasesRepoURL = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
259+
def snapshotsRepoURL = "https://central.sonatype.com/repository/maven-snapshots/"
254260
url = !version.endsWith("SNAPSHOT") ? releasesRepoURL : snapshotsRepoURL
255-
256261
credentials {
257262
username ossrhUsername
258263
password ossrhPassword

src/integration-test/java/org/fisco/bcos/sdk/v3/test/transaction/manager/AssembleTransactionProcessorTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.fisco.bcos.sdk.v3.codec.ContractCodecException;
2727
import org.fisco.bcos.sdk.v3.codec.datatypes.DynamicBytes;
2828
import org.fisco.bcos.sdk.v3.codec.datatypes.Type;
29-
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Bytes4;
3029
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Int256;
3130
import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair;
3231
import org.fisco.bcos.sdk.v3.model.ConstantConfig;
@@ -46,7 +45,6 @@
4645
import org.junit.FixMethodOrder;
4746
import org.junit.Test;
4847
import org.junit.runners.MethodSorters;
49-
import org.mockito.internal.matchers.Null;
5048

5149
/**
5250
* TransactionProcessorTest @Description: TransactionProcessorTest

src/integration-wasm-test/java/org/fisco/bcos/sdk/v3/test/wasm/BcosSDKTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.List;
2222
import java.util.Random;
2323
import org.fisco.bcos.sdk.jni.common.JniException;
24-
import org.fisco.bcos.sdk.jni.utilities.tx.TransactionBuilderJniObj;
2524
import org.fisco.bcos.sdk.v3.client.Client;
2625
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock;
2726
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfo;
@@ -42,16 +41,11 @@
4241
import org.fisco.bcos.sdk.v3.config.exceptions.ConfigException;
4342
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
4443
import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair;
45-
import org.fisco.bcos.sdk.v3.crypto.signature.SignatureResult;
4644
import org.fisco.bcos.sdk.v3.model.ConstantConfig;
4745
import org.fisco.bcos.sdk.v3.model.TransactionReceipt;
4846
import org.fisco.bcos.sdk.v3.test.wasm.liquid.Asset;
49-
import org.fisco.bcos.sdk.v3.test.wasm.liquid.HelloWorld;
5047
import org.fisco.bcos.sdk.v3.test.wasm.liquid.HelloWorld2;
51-
import org.fisco.bcos.sdk.v3.transaction.codec.decode.TransactionDecoderService;
5248
import org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException;
53-
import org.fisco.bcos.sdk.v3.transaction.pusher.TransactionPusherService;
54-
import org.fisco.bcos.sdk.v3.utils.Hex;
5549
import org.junit.Assert;
5650
import org.junit.Test;
5751

src/main/java/org/fisco/bcos/sdk/v3/client/ClientImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,8 @@ public <T extends JsonRpcResponse<?>> T callRemoteMethod(
16641664

16651665
future.complete(response);
16661666
});
1667-
Response response = future.get();
1667+
Response response =
1668+
future.get(configOption.getNetworkConfig().getTimeout(), TimeUnit.MILLISECONDS);
16681669
return ClientImpl.parseResponseIntoJsonRpcResponse(
16691670
request.getMethod(), response, responseType);
16701671
} catch (ClientException e) {
@@ -1675,7 +1676,10 @@ public <T extends JsonRpcResponse<?>> T callRemoteMethod(
16751676
"callRemoteMethod failed for decode the message exception, error message:"
16761677
+ e.getMessage(),
16771678
e);
1678-
} catch (JsonProcessingException | InterruptedException | ExecutionException e) {
1679+
} catch (JsonProcessingException
1680+
| InterruptedException
1681+
| ExecutionException
1682+
| TimeoutException e) {
16791683
logger.error("callRemoteMethod exception, raw request:{} ", request, e);
16801684
throw new ClientException(
16811685
"callRemoteMethod failed for decode the message exception, error message:"

src/main/java/org/fisco/bcos/sdk/v3/crypto/keypair/ECDSAKeyPair.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ public CryptoKeyPair createKeyPair(KeyPair javaKeyPair) {
9191
return new ECDSAKeyPair(javaKeyPair);
9292
}
9393

94+
public static CryptoKeyPair cryptoKeyPair(KeyPair javaKeyPair) {
95+
if (javaKeyPair == null) {
96+
return new ECDSAKeyPair();
97+
}
98+
return new ECDSAKeyPair(javaKeyPair);
99+
}
100+
94101
public static String getAddressByPublicKey(String publicKey) {
95102
return getAddress(publicKey, ECDSAKeyPair.DefaultHashAlgorithm);
96103
}

0 commit comments

Comments
 (0)