diff --git a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/AbstractAutoConfiguration.java b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/AbstractAutoConfiguration.java index 0c89c01..ae33761 100644 --- a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/AbstractAutoConfiguration.java +++ b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/AbstractAutoConfiguration.java @@ -53,7 +53,7 @@ public abstract class AbstractAutoConfiguration { .channelNo(getProperties().getChannel().getChannelNo()) .appNo(getProperties().getChannel().getAppNo()); - if (getProperties().getChannel().isChannelGroupMode()) { + if (Boolean.TRUE.equals(getProperties().getChannel().getChannelGroupMode())) { builder.enableChannelGroupMode(); } diff --git a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java index 8c298ca..93cdabc 100644 --- a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java +++ b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java @@ -56,7 +56,7 @@ public class ScfsApiGatewayProperties { /** * 渠道聚合模式,默认false */ - private boolean channelGroupMode = false; + private Boolean channelGroupMode = false; } @Data diff --git a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayPropertiesTest.java b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayPropertiesTest.java index 42f02c1..b7a5487 100644 --- a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayPropertiesTest.java +++ b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayPropertiesTest.java @@ -39,7 +39,7 @@ class ScfsApiGatewayPropertiesTest { properties.setChannel(channel); Assertions.assertNotNull(properties.getChannel()); - Assertions.assertFalse(channel.isChannelGroupMode()); + Assertions.assertFalse(channel.getChannelGroupMode()); assertThatJson("{\"channelNo\":\"000000\",\"appNo\":\"111111\",\"channelGroupMode\":false}").isEqualTo(properties.getChannel()); diff --git a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java index 29ea65f..fa3e75c 100644 --- a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java +++ b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java @@ -19,7 +19,7 @@ class SmConfigurationTest { private SmConfiguration smConfiguration; - private ScfsApiGatewayProperties properties() { + private ScfsApiGatewayProperties properties(boolean channelGroupMode) { ScfsApiGatewayProperties properties = new ScfsApiGatewayProperties(); ScfsApiGatewayProperties.Httpclient httpclient = new ScfsApiGatewayProperties.Httpclient(); @@ -28,7 +28,9 @@ class SmConfigurationTest { httpclient.setHeaders(headers); ScfsApiGatewayProperties.Httpclient.Proxy proxy = new ScfsApiGatewayProperties.Httpclient.Proxy(); - proxy.setEnabled(true); + if (channelGroupMode) { + proxy.setEnabled(true); + } proxy.setHost("128.0.0.1"); proxy.setPort("1000"); proxy.setUsername("name"); @@ -49,6 +51,9 @@ class SmConfigurationTest { ScfsApiGatewayProperties.Channel channel = new ScfsApiGatewayProperties.Channel(); channel.setChannelNo("000000"); channel.setAppNo("111111"); + if (channelGroupMode) { + channel.setChannelGroupMode(true); + } properties.setChannel(channel); ScfsApiGatewayProperties.Cipher cipher = new ScfsApiGatewayProperties.Cipher(); @@ -65,17 +70,17 @@ class SmConfigurationTest { @Test void getProperties() { - smConfiguration = new SmConfiguration(properties()); + smConfiguration = new SmConfiguration(properties(false)); ScfsApiGatewayProperties properties = smConfiguration.getProperties(); Assertions.assertNotNull(properties); } @Test void smProfile() { - smConfiguration = new SmConfiguration(properties()); + smConfiguration = new SmConfiguration(properties(true)); SmProfile smProfile = smConfiguration.smProfile(); Assertions.assertNotNull(smProfile); - assertThatJson("{\"appNo\":\"111111\",\"channelNo\":\"000000\",\"channelGroupMode\":false}").isEqualTo(smProfile.getChannel()); + assertThatJson("{\"appNo\":\"111111\",\"channelNo\":\"000000\",\"channelGroupMode\":true}").isEqualTo(smProfile.getChannel()); assertThatJson("{\"host\":\"http://127.0.0.1\",\"connPool\":{\"maxRequests\":100,\"maxRequestPerHost\":100,\"connectTimeout\":100,\"socketTimeout\":100},\"headers\":{\"aa\":\"123456\"},\"proxy\":{\"enabled\":true,\"host\":\"128.0.0.1\",\"port\":\"1000\",\"username\":\"name\",\"password\":\"123456\",\"scheme\":\"https\"}}\n") .isEqualTo(smProfile.getHttpProfile()); }