Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4064660
refactor: implement Phase 1 and 2 core improvements
Aias00 Jan 13, 2026
6204c3a
refactor: implement Maven profiles for bootstrap dependency slimming
Aias00 Jan 13, 2026
9a6cf86
refactor: centralize dependency versions in parent pom
Aias00 Jan 13, 2026
cfda274
refactor: add ShenyuPluginException class and improve error handling …
Aias00 Jan 14, 2026
0367755
refactor: add classifier configuration to repackage goal in pom.xml
Aias00 Jan 14, 2026
652c8b5
Update shenyu-web/src/main/java/org/apache/shenyu/web/handler/ShenyuW…
Aias00 Jan 14, 2026
d7ecb79
Update shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/sheny…
Aias00 Jan 14, 2026
5161fc9
Update shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/sheny…
Aias00 Jan 14, 2026
00a93c2
Update shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/sheny…
Aias00 Jan 14, 2026
7dd845f
Update shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/sheny…
Aias00 Jan 14, 2026
e308b3b
refactor: use Objects.isNull for null check in ShenyuPlugin
Aias00 Jan 14, 2026
12774f9
refactor: add new plugin types for AI and authentication in Plugin.java
Aias00 Jan 15, 2026
6fb7cc5
refactor: improve code readability and thread safety in ShenyuWebHandler
Aias00 Jan 15, 2026
72648c5
Merge branch 'master' into feat/improve
Aias00 Jan 16, 2026
6f5ffe8
Merge branch 'master' into feat/improve
Aias00 Jan 16, 2026
6095a4a
Merge branch 'master' into feat/improve
Aias00 Jan 16, 2026
edc66cc
refactor: improve code formatting and readability in test classes
Aias00 Jan 16, 2026
cdc5929
Merge branch 'feat/improve' of https://github.com/Aias00/shenyu into …
Aias00 Jan 16, 2026
4535fbf
refactor: simplify index management in DefaultShenyuPluginChain
Aias00 Jan 16, 2026
61e35df
Refactor: adjust ShenyuWebHandler reactive pipeline to remove Mono.de…
Aias00 Jan 16, 2026
bfe9add
Merge branch 'master' into feat/improve
847850277 Jan 20, 2026
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
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
<spring-ai.version>1.0.0</spring-ai.version>
<mcp.version>0.10.0</mcp.version>
<swagger-parser.version>2.1.30</swagger-parser.version>
<nacos-discovery.version>2021.0.1.0</nacos-discovery.version>
<eureka-client.version>4.1.2</eureka-client.version>
<!-- dependency version end -->
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public final class UpstreamCheckServiceTest {
private SelectorConditionMapper selectorConditionMapper;

private SelectorHandleConverterFactor converterFactor;

@Mock
private DiscoveryUpstreamService discoveryUpstreamService;

Expand All @@ -119,7 +119,8 @@ public final class UpstreamCheckServiceTest {
public static void beforeClass() {
loggerSpy = spy(LoggerFactory.getLogger(UpstreamCheckService.class));
loggerFactoryMockedStatic = mockStatic(LoggerFactory.class);
loggerFactoryMockedStatic.when(() -> LoggerFactory.getLogger(UpstreamCheckService.class)).thenReturn(loggerSpy);
loggerFactoryMockedStatic.when(() -> LoggerFactory.getLogger(UpstreamCheckService.class))
.thenReturn(loggerSpy);
loggerFactoryMockedStatic.when(() -> LoggerFactory.getLogger(anyString())).thenReturn(loggerSpy);
}

Expand All @@ -133,12 +134,17 @@ public void setUp() {
shenyuRegisterCenterConfig.setRegisterType("http");
shenyuRegisterCenterConfig.getProps().setProperty(Constants.IS_CHECKED, "true");
// get static variable reference by reflection
upstreamMap = (Map<String, List<DivideUpstream>>) ReflectionTestUtils.getField(UpstreamCheckService.class, "UPSTREAM_MAP");
zombieSet = (Set<ZombieUpstream>) ReflectionTestUtils.getField(UpstreamCheckService.class, "ZOMBIE_SET");
upstreamMap = (Map<String, List<DivideUpstream>>) ReflectionTestUtils
.getField(UpstreamCheckService.class, "UPSTREAM_MAP");
upstreamMap.clear();
zombieSet = (Set<ZombieUpstream>) ReflectionTestUtils.getField(UpstreamCheckService.class,
"ZOMBIE_SET");
zombieSet.clear();
Map<String, SelectorHandleConverter> maps = new HashMap<>();
maps.put(PluginEnum.DIVIDE.getName(), new DivideSelectorHandleConverter());
converterFactor = new SelectorHandleConverterFactor(maps);
upstreamCheckService = new UpstreamCheckService(selectorMapper, eventPublisher, pluginMapper, selectorConditionMapper,
upstreamCheckService = new UpstreamCheckService(selectorMapper, eventPublisher, pluginMapper,
selectorConditionMapper,
shenyuRegisterCenterConfig, converterFactor, discoveryUpstreamService);
}

Expand Down Expand Up @@ -186,20 +192,24 @@ public void testRemoveByKey() {

@Test
public void testSubmit() {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, ShenyuThreadFactory.create("scheduled-upstream-task", false));
ReflectionTestUtils.setField(upstreamCheckService, "executor", executor);
final DivideUpstream divideUpstream = DivideUpstream.builder()
.upstreamUrl("divide-upstream-60")
.weight(60)
.build();
// Test submit when selector name not exists
testSubmitOnce(divideUpstream);
// Test submit when selector name exists
testSubmitOnce(divideUpstream);
// Test service deleted
divideUpstream.setStatus(false);
testSubmitDeleted(divideUpstream);
testSubmitDeleted(divideUpstream);
try (MockedStatic<UpstreamCheckUtils> mocked = mockStatic(UpstreamCheckUtils.class)) {
mocked.when(() -> UpstreamCheckUtils.checkUrl(anyString())).thenReturn(true);
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1,
ShenyuThreadFactory.create("scheduled-upstream-task", false));
ReflectionTestUtils.setField(upstreamCheckService, "executor", executor);
final DivideUpstream divideUpstream = DivideUpstream.builder()
.upstreamUrl("divide-upstream-60")
.weight(60)
.build();
// Test submit when selector name not exists
testSubmitOnce(divideUpstream);
// Test submit when selector name exists
testSubmitOnce(divideUpstream);
// Test service deleted
divideUpstream.setStatus(false);
testSubmitDeleted(divideUpstream);
testSubmitDeleted(divideUpstream);
}
}

private void testSubmitOnce(final DivideUpstream divideUpstream) {
Expand All @@ -214,7 +224,8 @@ private void testSubmitDeleted(final DivideUpstream divideUpstream) {

@Test
public void testReplace() {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, ShenyuThreadFactory.create("scheduled-upstream-task", false));
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1,
ShenyuThreadFactory.create("scheduled-upstream-task", false));
ReflectionTestUtils.setField(upstreamCheckService, "executor", executor);
final DivideUpstream divideUpstream = DivideUpstream.builder()
.upstreamHost("localhost")
Expand Down Expand Up @@ -257,8 +268,10 @@ public void testFetchUpstreamData() {
.status(0)
.build();
when(pluginMapper.selectByNames(anyList())).thenReturn(Lists.newArrayList(pluginDO));
when(selectorMapper.findByPluginIds(anyList())).thenReturn(Lists.newArrayList(selectorDOWithUrlError, selectorDOWithUrlReachable));
when(discoveryUpstreamService.findBySelectorId(anyString())).thenReturn(Lists.newArrayList(discoveryUpstreamData));
when(selectorMapper.findByPluginIds(anyList()))
.thenReturn(Lists.newArrayList(selectorDOWithUrlError, selectorDOWithUrlReachable));
when(discoveryUpstreamService.findBySelectorId(anyString()))
.thenReturn(Lists.newArrayList(discoveryUpstreamData));
upstreamCheckService.fetchUpstreamData();
assertTrue(upstreamMap.containsKey(MOCK_SELECTOR_NAME));
assertEquals(2, upstreamMap.get(MOCK_SELECTOR_NAME).size());
Expand All @@ -271,7 +284,8 @@ public void testClose() {
Properties properties = new Properties();
properties.setProperty(Constants.IS_CHECKED, "true");
shenyuRegisterCenterConfig.setProps(properties);
upstreamCheckService = new UpstreamCheckService(selectorMapper, eventPublisher, pluginMapper, selectorConditionMapper,
upstreamCheckService = new UpstreamCheckService(selectorMapper, eventPublisher, pluginMapper,
selectorConditionMapper,
shenyuRegisterCenterConfig, converterFactor, discoveryUpstreamService);
upstreamCheckService.close();
}
Expand Down
Loading
Loading