Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
touzizhuo03
Dubbo
提交
783ae311
D
Dubbo
项目概览
touzizhuo03
/
Dubbo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dubbo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
783ae311
编写于
7月 05, 2012
作者:
L
liangfei0201
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DUBBO-465 增加单元测试
上级
e7798d9b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
12 deletion
+25
-12
dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
+18
-12
dubbo-registry/dubbo-registry-api/src/test/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactoryTest.java
...a/dubbo/registry/support/AbstractRegistryFactoryTest.java
+7
-0
未找到文件。
dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
浏览文件 @
783ae311
...
...
@@ -1106,17 +1106,17 @@ public final class URL implements Serializable {
}
}
private
String
buildString
(
boolean
u
,
boolean
p
,
String
...
parameters
)
{
return
buildString
(
u
,
p
,
false
,
parameters
);
private
String
buildString
(
boolean
appendUser
,
boolean
appendParameter
,
String
...
parameters
)
{
return
buildString
(
appendUser
,
appendParameter
,
false
,
false
,
parameters
);
}
private
String
buildString
(
boolean
u
,
boolean
p
,
boolean
s
,
String
...
parameters
)
{
private
String
buildString
(
boolean
appendUser
,
boolean
appendParameter
,
boolean
useIP
,
boolean
useService
,
String
...
parameters
)
{
StringBuilder
buf
=
new
StringBuilder
();
if
(
protocol
!=
null
&&
protocol
.
length
()
>
0
)
{
buf
.
append
(
protocol
);
buf
.
append
(
"://"
);
}
if
(
u
&&
username
!=
null
&&
username
.
length
()
>
0
)
{
if
(
appendUser
&&
username
!=
null
&&
username
.
length
()
>
0
)
{
buf
.
append
(
username
);
if
(
password
!=
null
&&
password
.
length
()
>
0
)
{
buf
.
append
(
":"
);
...
...
@@ -1124,6 +1124,12 @@ public final class URL implements Serializable {
}
buf
.
append
(
"@"
);
}
String
host
;
if
(
useIP
)
{
host
=
getIp
();
}
else
{
host
=
getHost
();
}
if
(
host
!=
null
&&
host
.
length
()
>
0
)
{
buf
.
append
(
host
);
if
(
port
>
0
)
{
...
...
@@ -1131,17 +1137,17 @@ public final class URL implements Serializable {
buf
.
append
(
port
);
}
}
String
_
path
;
if
(
s
)
{
_
path
=
getServiceKey
();
String
path
;
if
(
useService
)
{
path
=
getServiceKey
();
}
else
{
_path
=
path
;
path
=
getPath
()
;
}
if
(
_path
!=
null
&&
_
path
.
length
()
>
0
)
{
if
(
path
!=
null
&&
path
.
length
()
>
0
)
{
buf
.
append
(
"/"
);
buf
.
append
(
_
path
);
buf
.
append
(
path
);
}
if
(
p
)
{
if
(
appendParameter
)
{
buildParameters
(
buf
,
true
,
parameters
);
}
return
buf
.
toString
();
...
...
@@ -1176,7 +1182,7 @@ public final class URL implements Serializable {
}
public
String
toServiceString
()
{
return
buildString
(
true
,
false
,
true
);
return
buildString
(
true
,
false
,
true
,
true
);
}
@Deprecated
...
...
dubbo-registry/dubbo-registry-api/src/test/java/com/alibaba/dubbo/registry/support/AbstractRegistryFactoryTest.java
浏览文件 @
783ae311
...
...
@@ -87,4 +87,11 @@ public class AbstractRegistryFactoryTest {
Assert
.
assertEquals
(
registry1
,
registry2
);
}
@Test
public
void
testRegistryFactoryGroupCache
()
throws
Exception
{
Registry
registry1
=
registryFactory
.
getRegistry
(
URL
.
valueOf
(
"dubbo://"
+
NetUtils
.
getLocalHost
()
+
":2233?group=aaa"
));
Registry
registry2
=
registryFactory
.
getRegistry
(
URL
.
valueOf
(
"dubbo://"
+
NetUtils
.
getLocalHost
()
+
":2233?group=bbb"
));
Assert
.
assertNotSame
(
registry1
,
registry2
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录