-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb2c969
commit 4c7a0a7
Showing
38 changed files
with
580 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../system-impl/src/main/java/cc/elvea/platform/system/message/sender/MessageMailSender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...-server/app-server/src/test/java/cc/elvea/platform/commons/extensions/http/HttpTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package cc.elvea.platform.commons.extensions.http; | ||
|
||
import cc.elvea.platform.BaseTests; | ||
import cc.elvea.platform.commons.http.HttpConfig; | ||
import cc.elvea.platform.commons.http.HttpManger; | ||
import cc.elvea.platform.commons.http.HttpType; | ||
import cc.elvea.platform.commons.http.executor.HttpExecutor; | ||
import cc.elvea.platform.commons.http.executor.HttpGetRequestExecutor; | ||
import com.google.common.collect.Maps; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author elvea | ||
* @since 24.1.0 | ||
*/ | ||
@Slf4j | ||
public class HttpTests extends BaseTests { | ||
|
||
@Test | ||
public void baseTest() throws Exception { | ||
HttpExecutor<String, Map<String, String>> executor = HttpGetRequestExecutor.create(HttpManger.getHttp().getConfig()); | ||
executor.execute("https://google.com", Maps.newHashMap(), response -> { | ||
log.info("google response: {}", response); | ||
}); | ||
} | ||
|
||
@Test | ||
public void baseOkHttpTest() throws Exception { | ||
HttpConfig config = HttpConfig.builder().type(HttpType.OKHTTP).build(); | ||
HttpExecutor<String, Map<String, String>> executor = HttpGetRequestExecutor.create(config); | ||
executor.execute("https://baidu.com", Maps.newHashMap(), response -> { | ||
log.info("okhttp response: {}", response); | ||
}); | ||
} | ||
|
||
@Test | ||
public void baseApacheHttpTest() throws Exception { | ||
HttpConfig config = HttpConfig.builder().type(HttpType.APACHE).build(); | ||
HttpExecutor<String, Map<String, String>> executor = HttpGetRequestExecutor.create(config); | ||
executor.execute("https://baidu.com", Maps.newHashMap(), response -> { | ||
log.info("apache response: {}", response); | ||
}); | ||
} | ||
|
||
} |
2 changes: 2 additions & 0 deletions
2
...r/app-server/src/test/java/cc/elvea/platform/commons/extensions/mail/MailSenderTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...src/test/java/cc/elvea/platform/commons/extensions/template/HtmlTemplateServiceTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ter/src/main/java/cc/elvea/platform/commons/autoconfigure/http/HttpAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cc.elvea.platform.commons.autoconfigure.http; | ||
|
||
import cc.elvea.platform.commons.autoconfigure.http.properties.HttpProperties; | ||
import cc.elvea.platform.commons.http.Http; | ||
import cc.elvea.platform.commons.http.HttpManger; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author elvea | ||
* @since 24.1.0 | ||
*/ | ||
@Slf4j | ||
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnProperty(prefix = HttpProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true) | ||
@EnableConfigurationProperties({HttpProperties.class}) | ||
public class HttpAutoConfiguration { | ||
|
||
public HttpAutoConfiguration() { | ||
log.info("HttpAutoConfiguration is enabled."); | ||
} | ||
|
||
/** | ||
* @return {@link HttpManger} | ||
*/ | ||
@Bean | ||
@ConditionalOnMissingBean | ||
public Http httpManger(HttpProperties properties) { | ||
Http http = new Http(); | ||
HttpManger.setHttp(http); | ||
return http; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...src/main/java/cc/elvea/platform/commons/autoconfigure/http/properties/HttpProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cc.elvea.platform.commons.autoconfigure.http.properties; | ||
|
||
import cc.elvea.platform.commons.http.HttpProxy; | ||
import cc.elvea.platform.commons.http.HttpType; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.NestedConfigurationProperty; | ||
|
||
/** | ||
* @author elvea | ||
* @since 24.1.0 | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@ConfigurationProperties(HttpProperties.PREFIX) | ||
public class HttpProperties { | ||
|
||
public static final String PREFIX = "platform.http"; | ||
|
||
private boolean enabled = true; | ||
|
||
private HttpType type = HttpType.OKHTTP; | ||
|
||
@NestedConfigurationProperty | ||
private HttpProxy proxy = HttpProxy.builder().build(); | ||
|
||
} |
8 changes: 4 additions & 4 deletions
8
...xtensions/mail/MailAutoConfiguration.java → ...configure/mail/MailAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...sions/mail/properties/MailProperties.java → ...igure/mail/properties/MailProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ons/swagger/SwaggerAutoConfiguration.java → ...ure/swagger/SwaggerAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...swagger/properties/SwaggerProperties.java → ...swagger/properties/SwaggerProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...s/template/TemplateAutoConfiguration.java → ...e/template/TemplateAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mplate/properties/TemplateProperties.java → ...mplate/properties/TemplateProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.