mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-15 18:16:09 +00:00
perf[net]: 删除protocol的version,因为现在协议可以兼容老协议了
This commit is contained in:
1 parent
82cf9bf615
commit
1c94c2f311
4 files changed
+14
-114
No files matched your search
@@ -99,7 +99,7 @@ public class RegisterVO {
|
||||
var modules = Arrays.stream(moduleSplits)
|
||||
.map(it -> it.trim())
|
||||
.map(it -> it.split(StringUtils.HYPHEN))
|
||||
.map(it -> new ProtocolModule(Byte.parseByte(it[0]), it[1], it[2], Integer.parseInt(it[3])))
|
||||
.map(it -> new ProtocolModule(Byte.parseByte(it[0]), it[1], Integer.parseInt(it[2])))
|
||||
.collect(Collectors.toList());
|
||||
return modules;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class RegisterVO {
|
||||
}
|
||||
|
||||
public String toConsumerString() {
|
||||
return toString() +
|
||||
return this +
|
||||
StringUtils.SPACE + StringUtils.VERTICAL_BAR + StringUtils.SPACE +
|
||||
uuid;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class RegisterVO {
|
||||
}
|
||||
|
||||
public String joinWith(String sep, ProtocolModule module) {
|
||||
return StringUtils.joinWith(sep, module.getId(), module.getName(), ProtocolModule.versionNumToStr(module.getVersion()), module.getGroup());
|
||||
return StringUtils.joinWith(sep, module.getId(), module.getName(), module.getGroup());
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
||||
@@ -33,8 +33,8 @@ public class RegistryTest {
|
||||
|
||||
@Test
|
||||
public void registerVoTest() {
|
||||
var modules = List.of(new ProtocolModule((byte) 100, "aaa", "1.0.0")
|
||||
, new ProtocolModule((byte) 120, "bbb", "1.0.0"));
|
||||
var modules = List.of(new ProtocolModule((byte) 100, "aaa")
|
||||
, new ProtocolModule((byte) 120, "bbb"));
|
||||
var providerConfig = ProviderConfig.valueOf(HostAndPort.valueOf("127.0.0.1", 80).toHostAndPortStr(), modules);
|
||||
var consumerConfig = ConsumerConfig.valueOf(modules);
|
||||
|
||||
@@ -51,57 +51,4 @@ public class RegistryTest {
|
||||
System.out.println(NetUtil.LOOPBACK_IF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moduleTest() {
|
||||
var moduleId = (byte) 1;
|
||||
var str = "1.0.0";
|
||||
var module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
str = "0.0.0";
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
str = "10.0.0";
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
str = "10.11.10";
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
str = "10.11.101";
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
str = "99.99.999";
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
|
||||
module = null;
|
||||
|
||||
str = "1.00.001";
|
||||
try {
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Assert.assertNull(module);
|
||||
|
||||
str = "1.00.111";
|
||||
try {
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Assert.assertNull(module);
|
||||
|
||||
str = "1.001.0";
|
||||
try {
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Assert.assertNull(module);
|
||||
|
||||
str = "99.999.999";
|
||||
try {
|
||||
module = new ProtocolModule(moduleId, "", str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Assert.assertNotNull(module);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user