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
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private void checkRegistry(PluginConfig config) {
List<Map<String, Object>> services = (List<Map<String, Object>>) config.getProperties()
.get(ConfigConstants.SERVICE);
Assert.assertEquals(services.get(0).get("namespace"), "java-sdk-test-service1");
Assert.assertEquals(services.get(0).get("token"), "5e43887a00c4465085fb89eaa0e414b4");
Assert.assertEquals(services.get(0).get("token"), "xxxx");
Assert.assertEquals(services.get(0).get("instance_id"),
"feda4ceffed0b7b08cf5ec665dcd320e50434549");
Assert.assertEquals(services.get(0).get("name"), "trpc.TestApp.TestServer.Greeter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void after() {

@Test
public void parse() {
ConfigManager.stopTest();
ConfigManager applicationConfig =
new YamlApplicationConfigParser().parseFromClassPath("trpc_java_parse_test.yaml");
assert applicationConfig != null;
Expand Down Expand Up @@ -225,9 +226,9 @@ public void checkServerConfig(ConfigManager applicationConfig) {
assertEquals(serviceConfig.getFilters().get(1), "filter2");
assertEquals(serviceConfig.getWorkerPool(), "woker_pool_provider_test2");
assertEquals(serviceConfig.getRegistries().get("polaris").get("token"),
"5e43887a00c4465085fb89eaa0e414b4");
"xxxx");
assertEquals(serviceConfig.getRegistries().get("polaris2").get("token"),
"5e43887a00c4465085fb89eaa0e414b3");
"xxxx");
ProviderConfig providerConfig = serviceConfig.getProviderConfigs().get(0);
assertEquals(providerConfig.getRefClazz(), "com.tencent.trpc.container.demo.GreeterServiceImp");
assertEquals(serviceConfig.getWorkerPool(), "woker_pool_provider_test2");
Expand Down Expand Up @@ -259,6 +260,7 @@ public void checkServerConfig(ConfigManager applicationConfig) {

@Test
public void testServerIpParse() {
ConfigManager.stopTest();
ConfigManager applicationConfig = new YamlApplicationConfigParser()
.parseFromClassPath("trpc_java_ip_parse_test.yaml");
applicationConfig.setDefault();
Expand All @@ -271,13 +273,15 @@ public void testServerIpParse() {

@Test
public void testParseMap() {
ConfigManager.stopTest();
String path = YamlParser.class.getClassLoader().getResource("trpc_java.yaml").getPath();
Map<String, Object> map = new YamlApplicationConfigParser().parseMap(path);
Assert.assertNotEquals(map.size(), 0);
}

@Test
public void testParseMap_confPath() {
ConfigManager.stopTest();
TRpcSystemProperties.setProperties(TRpcSystemProperties.CONFIG_PATH, "");
Map<String, Object> map1 = new YamlApplicationConfigParser().parseMap("");
Assert.assertNotNull(map1);
Expand Down Expand Up @@ -314,7 +318,7 @@ public void testParseImpls() {

@Test
public void testEx() {

ConfigManager.stopTest();
try {
new YamlApplicationConfigParser().parseMap("abc");
TRpcSystemProperties.setProperties(TRpcSystemProperties.CONFIG_PATH, "abc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ server:
registrys:
polaris2:
namespace: java-sdk-test-service2
token: 5e43887a00c4465085fb89eaa0e414b3
token: xxxx
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549
name: trpc.TestApp.TestServer.Greeter3

Expand Down Expand Up @@ -173,7 +173,7 @@ plugins:
register_self: true
service:
- namespace: java-sdk-test-service2
token: 5e43887a00c4465085fb89eaa0e414b4
token: xxxx
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549
name: trpc.TestApp.TestServer.Greeter
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ plugins:
register_self: false
service:
- namespace: java-sdk-test-service1
token: 5e43887a00c4465085fb89eaa0e414b4
token: xxxx
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549
name: trpc.TestApp.TestServer.Greeter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ server:
registrys:
polaris2:
namespace: java-sdk-test-service2
token: 5e43887a00c4465085fb89eaa0e414b3
token: xxxx
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549
name: trpc.TestApp.TestServer.Greeter3

Expand Down Expand Up @@ -173,7 +173,7 @@ plugins:
register_self: true
service:
- namespace: java-sdk-test-service2
token: 5e43887a00c4465085fb89eaa0e414b4
token: xxxx
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549
name: trpc.TestApp.TestServer.Greeter
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
import org.junit.Assert;
import org.junit.Test;

import java.lang.reflect.InvocationTargetException;

public class IPUtilsTest {

@Test
public void testTransfer() {
String host = "9.12.53.243";
String host = "19.12.53.243";
int ipInt = IPUtils.ip2int(host);
byte[] ipBytes = IPUtils.ip2bytes(host);
String newIp = IPUtils.bytes2ip(ipBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ trpc:
- instance_id: 0938d8c7303d976bafa761ff588fb41e2192740d #服务注册所需要的 id
name: trpc.ep.ods_collector.test
namespace: Development #环境类型,分正式production和非正式development两种类型
token: d70b7d820f6144a2bb42e55cc6567f21 #服务注册所需要的 token
token: xxxx #服务注册所需要的 token
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ plugins:
register_self: true
service:
- namespace: java-sdk-test-service1 #环境类型,分正式production和非正式development两种类型
token: 5e43887a00c4465085fb89eaa0e414b4 #服务注册所需要的 token
token: xxxx #服务注册所需要的 token
instance_id: feda4ceffed0b7b08cf5ec665dcd320e50434549 #服务注册所需要的 id
name: trpc.TestApp.TestServer.Greeter
selector:
Expand Down