Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
2ca1a7a9
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2ca1a7a9
编写于
6月 21, 2017
作者:
R
Rajan
提交者:
GitHub
6月 21, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix AdminApi test by creating separate mock-pulsar instances for different broker (#512)
上级
c7d982be
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
23 deletion
+35
-23
pulsar-broker/src/test/java/com/yahoo/pulsar/broker/admin/AdminApiTest.java
...test/java/com/yahoo/pulsar/broker/admin/AdminApiTest.java
+35
-23
未找到文件。
pulsar-broker/src/test/java/com/yahoo/pulsar/broker/admin/AdminApiTest.java
浏览文件 @
2ca1a7a9
...
...
@@ -16,8 +16,8 @@
package
com.yahoo.pulsar.broker.admin
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertFalse
;
import
static
org
.
testng
.
Assert
.
assertNotEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
fail
;
...
...
@@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit;
import
javax.ws.rs.client.InvocationCallback
;
import
javax.ws.rs.client.WebTarget
;
import
org.apache.bookkeeper.test.PortManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.testng.Assert
;
...
...
@@ -53,7 +52,6 @@ import com.google.common.collect.Sets;
import
com.google.common.hash.Hashing
;
import
com.yahoo.pulsar.broker.PulsarServerException
;
import
com.yahoo.pulsar.broker.PulsarService
;
import
com.yahoo.pulsar.broker.ServiceConfiguration
;
import
com.yahoo.pulsar.broker.auth.MockedPulsarServiceBaseTest
;
import
com.yahoo.pulsar.broker.namespace.NamespaceEphemeralData
;
import
com.yahoo.pulsar.broker.namespace.NamespaceService
;
...
...
@@ -67,7 +65,6 @@ import com.yahoo.pulsar.client.admin.PulsarAdminException.PreconditionFailedExce
import
com.yahoo.pulsar.client.admin.internal.LookupImpl
;
import
com.yahoo.pulsar.client.admin.internal.PersistentTopicsImpl
;
import
com.yahoo.pulsar.client.admin.internal.PropertiesImpl
;
import
com.yahoo.pulsar.client.api.Authentication
;
import
com.yahoo.pulsar.client.api.ClientConfiguration
;
import
com.yahoo.pulsar.client.api.Consumer
;
import
com.yahoo.pulsar.client.api.ConsumerConfiguration
;
...
...
@@ -108,15 +105,14 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AdminApiTest
.
class
);
private
MockedPulsarService
mockPulsarSetup
;
private
PulsarService
otherPulsar
;
private
PulsarAdmin
otheradmin
;
private
NamespaceBundleFactory
bundleFactory
;
private
final
int
SECONDARY_BROKER_PORT
=
PortManager
.
nextFreePort
();
private
final
int
SECONDARY_BROKER_WEBSERVICE_PORT
=
PortManager
.
nextFreePort
();
@BeforeMethod
@Override
public
void
setup
()
throws
Exception
{
...
...
@@ -127,16 +123,10 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
// create otherbroker to test redirect on calls that need
// namespace ownership
ServiceConfiguration
otherconfig
=
new
ServiceConfiguration
();
otherconfig
.
setBrokerServicePort
(
SECONDARY_BROKER_PORT
);
otherconfig
.
setWebServicePort
(
SECONDARY_BROKER_WEBSERVICE_PORT
);
otherconfig
.
setLoadBalancerEnabled
(
false
);
otherconfig
.
setClusterName
(
"test"
);
otherPulsar
=
startBroker
(
otherconfig
);
otheradmin
=
new
PulsarAdmin
(
new
URL
(
"http://127.0.0.1"
+
":"
+
SECONDARY_BROKER_WEBSERVICE_PORT
),
(
Authentication
)
null
);
mockPulsarSetup
=
new
MockedPulsarService
();
mockPulsarSetup
.
setup
();
otherPulsar
=
mockPulsarSetup
.
getPulsar
();
otheradmin
=
mockPulsarSetup
.
getAdmin
();
// Setup namespaces
admin
.
clusters
().
createCluster
(
"use"
,
new
ClusterData
(
"http://127.0.0.1"
+
":"
+
BROKER_WEBSERVICE_PORT
));
...
...
@@ -149,9 +139,7 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
@Override
public
void
cleanup
()
throws
Exception
{
super
.
internalCleanup
();
otheradmin
.
close
();
otherPulsar
.
close
();
mockPulsarSetup
.
cleanup
();
}
@DataProvider
(
name
=
"numBundles"
)
...
...
@@ -361,7 +349,11 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
public
void
brokers
()
throws
Exception
{
List
<
String
>
list
=
admin
.
brokers
().
getActiveBrokers
(
"use"
);
Assert
.
assertNotNull
(
list
);
Assert
.
assertEquals
(
list
.
size
(),
2
);
Assert
.
assertEquals
(
list
.
size
(),
1
);
List
<
String
>
list2
=
otheradmin
.
brokers
().
getActiveBrokers
(
"test"
);
Assert
.
assertNotNull
(
list2
);
Assert
.
assertEquals
(
list2
.
size
(),
1
);
Map
<
String
,
NamespaceOwnershipStatus
>
nsMap
=
admin
.
brokers
().
getOwnedNamespaces
(
"use"
,
list
.
get
(
0
));
// since sla-monitor ns is not created nsMap.size() == 1 (for HeartBeat Namespace)
...
...
@@ -1713,7 +1705,6 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
*/
@Test
(
dataProvider
=
"topicName"
)
public
void
testIncrementPartitionsOfTopic
(
String
topicName
)
throws
Exception
{
final
String
subName1
=
topicName
+
"-my-sub 1"
;
final
String
subName2
=
topicName
+
"-my-sub 2"
;
final
int
startPartitions
=
4
;
...
...
@@ -1793,7 +1784,28 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
consumer1
.
close
();
consumer2
.
close
();
consumer2
.
close
();
}
class
MockedPulsarService
extends
MockedPulsarServiceBaseTest
{
@Override
protected
void
setup
()
throws
Exception
{
conf
.
setLoadBalancerEnabled
(
false
);
conf
.
setClusterName
(
"test"
);
super
.
internalSetup
();
}
@Override
protected
void
cleanup
()
throws
Exception
{
super
.
internalCleanup
();
}
public
PulsarService
getPulsar
()
{
return
pulsar
;
}
public
PulsarAdmin
getAdmin
()
{
return
admin
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录