Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ comment:

coverage: # https://docs.codecov.com/docs/codecovyml-reference#coverage
precision: 5
range:
- 70.0
- 75.0
range: "80...100"
status:
project:
default:
branches:
- ^master$
target: 70.0 # the minimum coverage ratio that the commit must meet to be considered a success.
threshold: 1% # allow the coverage to drop by X%, and posting a success status.
- ^JDK17/Springboot3$
target: 80.0
threshold: 1%
ignore:
- "**/test/**"
- "**/*Test.java"
- "**/*AuthCenter.java"
- "**/*QappPackage.java"
- "**/*TRPCProtocol.java"
parsers:
jacoco:
partials_as_hits: true
40 changes: 4 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,12 @@ name: Maven Install Test

on:
push:
branches: [ "master" ]
branches: [ "JDK17/Springboot3" ]
pull_request:
branches: [ "master" ]
branches: [ "JDK17/Springboot3" ]
schedule:
- cron: '0 9 * * *'
jobs:
JDK8:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Test with Maven
run: mvn clean install -Dmaven.test.skip=true -B -U --file pom.xml
JDK17:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -64,29 +48,13 @@ jobs:
cache: maven
- name: Test with Maven
run: mvn clean install -Dmaven.test.skip=true -B -U --file pom.xml
JDK8-master:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
with:
ref: "master"
repository: trpc-group/trpc-java
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Test with Maven
run: mvn clean install -Dmaven.test.skip=true -B -U --file pom.xml
JDK17-master:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
with:
ref: "master"
ref: "JDK17/Springboot3"
repository: trpc-group/trpc-java
- name: Set up JDK 17
uses: actions/setup-java@v3
Expand All @@ -102,7 +70,7 @@ jobs:
- name: Checkout codes
uses: actions/checkout@v3
with:
ref: "master"
ref: "JDK17/Springboot3"
repository: trpc-group/trpc-java
- name: Set up JDK 21
uses: actions/setup-java@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: Java CI with Maven

on:
push:
branches: [ "master" ]
branches: [ "JDK17/Springboot3" ]
schedule:
- cron: '0 9 * * *'
jobs:
Expand All @@ -19,10 +19,10 @@ jobs:
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Test with Maven
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Test with Maven
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

package com.tencent.trpc.core.admin;

import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class AdminServiceManagerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

package com.tencent.trpc.core.admin;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TRpcFrameOverviewTest {

@Test
public void test() {
String trpcName = TRpcFrameOverview.getName();
assertEquals(trpcName, "trpc-java");
Assert.assertNotNull(TRpcFrameOverview.getVersion());
Assertions.assertNotNull(TRpcFrameOverview.getVersion());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import com.tencent.trpc.core.rpc.def.DefResponse;
import com.tencent.trpc.core.utils.FutureUtils;
import java.util.concurrent.CompletionStage;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ClusterInterceptorInvokerTest {

Expand All @@ -33,7 +33,7 @@ public class ClusterInterceptorInvokerTest {
/**
* Init clusterInvoker & clusterInvokerNoInterceptors
*/
@Before
@BeforeEach
public void setUp() {
ConsumerConfig<BlankRpcServiceName> consumerConfig = new ConsumerConfig<>();
consumerConfig.setMock(false);
Expand Down Expand Up @@ -80,20 +80,20 @@ public CompletionStage<Response> invoke(Request request) {
public void testNew() {
ClusterInterceptorInvoker<BlankRpcServiceName> invoker = new ClusterInterceptorInvoker<>(clusterInvoker);
ConsumerConfig<BlankRpcServiceName> config = invoker.getConfig();
Assert.assertNotNull(config);
Assert.assertFalse(config.getMock());
Assert.assertTrue(invoker.getInterface().isAssignableFrom(BlankRpcServiceName.class));
Assert.assertNotNull(invoker.getBackendConfig());
Assert.assertEquals(invoker.getBackendConfig().getInterceptors().get(0), "log");
Assert.assertNotNull(invoker.invoke(new DefRequest()));
Assertions.assertNotNull(config);
Assertions.assertFalse(config.getMock());
Assertions.assertTrue(invoker.getInterface().isAssignableFrom(BlankRpcServiceName.class));
Assertions.assertNotNull(invoker.getBackendConfig());
Assertions.assertEquals(invoker.getBackendConfig().getInterceptors().get(0), "log");
Assertions.assertNotNull(invoker.invoke(new DefRequest()));
}

@Test
public void testNewNoInterceptor() {
ClusterInterceptorInvoker<BlankRpcServiceName> invokerWithoutInterceptor = new ClusterInterceptorInvoker<>(
clusterInvokerNoInterceptors);
Assert.assertNotNull(invokerWithoutInterceptor);
Assert.assertTrue(invokerWithoutInterceptor.getBackendConfig().getInterceptors().isEmpty());
Assertions.assertNotNull(invokerWithoutInterceptor);
Assertions.assertTrue(invokerWithoutInterceptor.getBackendConfig().getInterceptors().isEmpty());
}

@TRpcService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@

import com.tencent.trpc.core.cluster.spi.ClusterInterceptor;
import com.tencent.trpc.core.cluster.spi.LogClusterInterceptor;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ClusterInterceptorManagerTest {

@Test
public void testGet() {
ClusterInterceptor log = ClusterInterceptorManager.get("log");
Assert.assertTrue(log instanceof LogClusterInterceptor);
Assertions.assertTrue(log instanceof LogClusterInterceptor);
}

@Test(expected = IllegalArgumentException.class)
@Test
public void testValidate() {
ClusterInterceptorManager.validate("log1");
Assertions.assertThrows(IllegalArgumentException.class, () -> {
ClusterInterceptorManager.validate("log1");
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

package com.tencent.trpc.core.cluster;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

import com.tencent.trpc.core.common.config.BackendConfig;
import com.tencent.trpc.core.common.config.ConsumerConfig;
Expand All @@ -22,8 +22,8 @@
import com.tencent.trpc.core.rpc.RpcClient;
import java.lang.reflect.Field;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class RpcClusterClientManagerTest {

Expand All @@ -35,7 +35,7 @@ public void test() throws IllegalArgumentException, IllegalAccessException, NoSu
backendConfig.setNamingUrl("ip://127.0.0.1");
ProtocolConfigTest config = new ProtocolConfigTest();
RpcClient rpcClient = RpcClusterClientManager.getOrCreateClient(backendConfig, config);
Assert.assertNotNull(rpcClient);
Assertions.assertNotNull(rpcClient);
Field field = RpcClusterClientManager.class.getDeclaredField("CLUSTER_MAP");
field.setAccessible(true);
Map<BackendConfig, Map> clusterMap = (Map<BackendConfig, Map>) field.get(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import com.tencent.trpc.core.cluster.def.DefRpcClusterClient;
import com.tencent.trpc.core.common.config.BackendConfig;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class StandardRpcClusterClientFactoryTest {

Expand All @@ -23,6 +23,6 @@ public void testCreate() {
StandardRpcClusterClientFactory factory = new StandardRpcClusterClientFactory();
BackendConfig config = new BackendConfig();
RpcClusterClient standard = factory.create(config);
Assert.assertTrue(standard instanceof DefRpcClusterClient);
Assertions.assertTrue(standard instanceof DefRpcClusterClient);
}
}
}
Loading
Loading