Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Apache RocketMQ
Rocketmq
提交
da09320d
R
Rocketmq
项目概览
Apache RocketMQ
/
Rocketmq
上一次同步 大约 3 年
通知
268
Star
16139
Fork
68
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
da09320d
编写于
10月 11, 2018
作者:
H
hujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean Attention: delete line 37 of the MixAllTest.java
上级
f2dcde94
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
38 addition
and
40 deletion
+38
-40
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/AclPlugController.java
.../java/org/apache/rocketmq/acl/plug/AclPlugController.java
+10
-10
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/AclRemotingService.java
...java/org/apache/rocketmq/acl/plug/AclRemotingService.java
+1
-1
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/DefaultAclRemotingServiceImpl.java
...ache/rocketmq/acl/plug/DefaultAclRemotingServiceImpl.java
+2
-2
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java
...lug/engine/AuthenticationInfoManagementAclPlugEngine.java
+5
-5
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/LoginInfoAclPlugEngine.java
...ache/rocketmq/acl/plug/engine/LoginInfoAclPlugEngine.java
+3
-3
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngine.java
...g/apache/rocketmq/acl/plug/engine/PlainAclPlugEngine.java
+4
-4
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/entity/ControllerParameters.java
...apache/rocketmq/acl/plug/entity/ControllerParameters.java
+1
-1
acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java
...ache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java
+3
-3
broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
...ain/java/org/apache/rocketmq/broker/BrokerController.java
+7
-8
common/src/test/java/org/apache/rocketmq/common/MixAllTest.java
.../src/test/java/org/apache/rocketmq/common/MixAllTest.java
+2
-3
未找到文件。
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/AclPlugController.java
浏览文件 @
da09320d
...
...
@@ -18,32 +18,32 @@ package org.apache.rocketmq.acl.plug;
import
org.apache.rocketmq.acl.plug.engine.AclPlugEngine
;
import
org.apache.rocketmq.acl.plug.engine.PlainAclPlugEngine
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.acl.plug.exception.AclPlugRuntimeException
;
public
class
AclPlugController
{
private
ControllerParameters
Entity
controllerParametersEntity
;
private
ControllerParameters
controllerParameters
;
private
AclPlugEngine
aclPlugEngine
;
private
AclRemotingServ
er
aclRemotingServer
;
private
AclRemotingServ
ice
aclRemotingService
;
private
boolean
startSucceed
=
false
;
public
AclPlugController
(
ControllerParameters
Entity
controllerParametersEntity
)
throws
AclPlugRuntimeException
{
public
AclPlugController
(
ControllerParameters
controllerParameters
)
throws
AclPlugRuntimeException
{
try
{
this
.
controllerParameters
Entity
=
controllerParametersEntity
;
aclPlugEngine
=
new
PlainAclPlugEngine
(
controllerParameters
Entity
);
aclRemotingServ
er
=
new
DefaultAclRemotingServer
Impl
(
aclPlugEngine
);
this
.
controllerParameters
=
controllerParameters
;
aclPlugEngine
=
new
PlainAclPlugEngine
(
controllerParameters
);
aclRemotingServ
ice
=
new
DefaultAclRemotingService
Impl
(
aclPlugEngine
);
this
.
startSucceed
=
true
;
}
catch
(
Exception
e
)
{
throw
new
AclPlugRuntimeException
(
String
.
format
(
"Start the abnormal , Launch parameters is %s"
,
this
.
controllerParameters
Entity
.
toString
()),
e
);
throw
new
AclPlugRuntimeException
(
String
.
format
(
"Start the abnormal , Launch parameters is %s"
,
this
.
controllerParameters
.
toString
()),
e
);
}
}
public
AclRemotingServ
er
getAclRemotingServer
()
{
return
this
.
aclRemotingServ
er
;
public
AclRemotingServ
ice
getAclRemotingService
()
{
return
this
.
aclRemotingServ
ice
;
}
public
void
doChannelCloseEvent
(
String
remoteAddr
)
{
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/AclRemotingServ
er
.java
→
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/AclRemotingServ
ice
.java
浏览文件 @
da09320d
...
...
@@ -19,7 +19,7 @@ package org.apache.rocketmq.acl.plug;
import
org.apache.rocketmq.acl.plug.entity.AccessControl
;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationResult
;
public
interface
AclRemotingServ
er
{
public
interface
AclRemotingServ
ice
{
public
AuthenticationResult
check
(
AccessControl
accessControl
);
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/DefaultAclRemotingServ
er
Impl.java
→
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/DefaultAclRemotingServ
ice
Impl.java
浏览文件 @
da09320d
...
...
@@ -21,11 +21,11 @@ import org.apache.rocketmq.acl.plug.entity.AccessControl;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationResult
;
import
org.apache.rocketmq.acl.plug.exception.AclPlugRuntimeException
;
public
class
DefaultAclRemotingServ
erImpl
implements
AclRemotingServer
{
public
class
DefaultAclRemotingServ
iceImpl
implements
AclRemotingService
{
private
AclPlugEngine
aclPlugEngine
;
public
DefaultAclRemotingServ
er
Impl
(
AclPlugEngine
aclPlugEngine
)
{
public
DefaultAclRemotingServ
ice
Impl
(
AclPlugEngine
aclPlugEngine
)
{
this
.
aclPlugEngine
=
aclPlugEngine
;
}
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java
浏览文件 @
da09320d
...
...
@@ -25,7 +25,7 @@ import org.apache.rocketmq.acl.plug.entity.AccessControl;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationInfo
;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationResult
;
import
org.apache.rocketmq.acl.plug.entity.BorkerAccessControlTransport
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.acl.plug.exception.AclPlugRuntimeException
;
import
org.apache.rocketmq.acl.plug.strategy.NetaddressStrategy
;
import
org.apache.rocketmq.acl.plug.strategy.NetaddressStrategyFactory
;
...
...
@@ -36,16 +36,16 @@ import org.apache.rocketmq.logging.InternalLoggerFactory;
public
abstract
class
AuthenticationInfoManagementAclPlugEngine
implements
AclPlugEngine
{
private
static
final
InternalLogger
log
=
InternalLoggerFactory
.
getLogger
(
LoggerName
.
ACL_PLUG_LOGGER_NAME
);
ControllerParameters
Entity
controllerParametersEntity
;
ControllerParameters
controllerParameters
;
private
Map
<
String
/** account **/
,
Map
<
String
/** netaddress **/
,
AuthenticationInfo
>>
accessControlMap
=
new
HashMap
<>();
private
AuthenticationInfo
authenticationInfo
;
private
NetaddressStrategyFactory
netaddressStrategyFactory
=
new
NetaddressStrategyFactory
();
private
AccessContralAnalysis
accessContralAnalysis
=
new
AccessContralAnalysis
();
private
Authentication
authentication
=
new
Authentication
();
public
AuthenticationInfoManagementAclPlugEngine
(
ControllerParameters
Entity
controllerParametersEntity
)
{
this
.
controllerParameters
Entity
=
controllerParametersEntity
;
accessContralAnalysis
.
analysisClass
(
controllerParameters
Entity
.
getAccessContralAnalysisClass
());
public
AuthenticationInfoManagementAclPlugEngine
(
ControllerParameters
controllerParameters
)
{
this
.
controllerParameters
=
controllerParameters
;
accessContralAnalysis
.
analysisClass
(
controllerParameters
.
getAccessContralAnalysisClass
());
}
public
void
setAccessControl
(
AccessControl
accessControl
)
throws
AclPlugRuntimeException
{
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/LoginInfoAclPlugEngine.java
浏览文件 @
da09320d
...
...
@@ -21,15 +21,15 @@ import java.util.concurrent.ConcurrentHashMap;
import
org.apache.rocketmq.acl.plug.entity.AccessControl
;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationInfo
;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationResult
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.acl.plug.entity.LoginInfo
;
public
abstract
class
LoginInfoAclPlugEngine
extends
AuthenticationInfoManagementAclPlugEngine
{
private
Map
<
String
,
LoginInfo
>
loginInfoMap
=
new
ConcurrentHashMap
<>();
public
LoginInfoAclPlugEngine
(
ControllerParameters
Entity
controllerParametersEntity
)
{
super
(
controllerParameters
Entity
);
public
LoginInfoAclPlugEngine
(
ControllerParameters
controllerParameters
)
{
super
(
controllerParameters
);
}
public
LoginInfo
getLoginInfo
(
AccessControl
accessControl
)
{
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngine.java
浏览文件 @
da09320d
...
...
@@ -20,20 +20,20 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
org.apache.rocketmq.acl.plug.entity.BorkerAccessControlTransport
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.acl.plug.exception.AclPlugRuntimeException
;
import
org.yaml.snakeyaml.Yaml
;
public
class
PlainAclPlugEngine
extends
LoginInfoAclPlugEngine
{
public
PlainAclPlugEngine
(
ControllerParameters
Entity
controllerParametersEntity
)
throws
AclPlugRuntimeException
{
super
(
controllerParameters
Entity
);
ControllerParameters
controllerParameters
)
throws
AclPlugRuntimeException
{
super
(
controllerParameters
);
init
();
}
void
init
()
throws
AclPlugRuntimeException
{
String
filePath
=
controllerParameters
Entity
.
getFileHome
()
+
"/conf/transport.yml"
;
String
filePath
=
controllerParameters
.
getFileHome
()
+
"/conf/transport.yml"
;
Yaml
ymal
=
new
Yaml
();
FileInputStream
fis
=
null
;
BorkerAccessControlTransport
transport
;
...
...
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/entity/ControllerParameters
Entity
.java
→
acl-plug/src/main/java/org/apache/rocketmq/acl/plug/entity/ControllerParameters.java
浏览文件 @
da09320d
...
...
@@ -18,7 +18,7 @@ package org.apache.rocketmq.acl.plug.entity;
import
org.apache.rocketmq.common.protocol.RequestCode
;
public
class
ControllerParameters
Entity
{
public
class
ControllerParameters
{
private
String
fileHome
;
...
...
acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java
浏览文件 @
da09320d
...
...
@@ -28,7 +28,7 @@ import org.apache.rocketmq.acl.plug.entity.AuthenticationInfo;
import
org.apache.rocketmq.acl.plug.entity.AuthenticationResult
;
import
org.apache.rocketmq.acl.plug.entity.BorkerAccessControl
;
import
org.apache.rocketmq.acl.plug.entity.BorkerAccessControlTransport
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.acl.plug.entity.LoginInfo
;
import
org.apache.rocketmq.acl.plug.exception.AclPlugRuntimeException
;
import
org.apache.rocketmq.common.MixAll
;
...
...
@@ -61,7 +61,7 @@ public class PlainAclPlugEngineTest {
FileInputStream
fis
=
new
FileInputStream
(
new
File
(
filePath
));
transport
=
ymal
.
loadAs
(
fis
,
BorkerAccessControlTransport
.
class
);
ControllerParameters
Entity
controllerParametersEntity
=
new
ControllerParametersEntity
();
ControllerParameters
controllerParametersEntity
=
new
ControllerParameters
();
controllerParametersEntity
.
setFileHome
(
home
);
plainAclPlugEngine
=
new
PlainAclPlugEngine
(
controllerParametersEntity
);
...
...
@@ -108,7 +108,7 @@ public class PlainAclPlugEngineTest {
@Test
(
expected
=
AclPlugRuntimeException
.
class
)
public
void
testPlainAclPlugEngineInit
()
{
ControllerParameters
Entity
controllerParametersEntity
=
new
ControllerParametersEntity
();
ControllerParameters
controllerParametersEntity
=
new
ControllerParameters
();
new
PlainAclPlugEngine
(
controllerParametersEntity
);
}
...
...
broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java
浏览文件 @
da09320d
...
...
@@ -32,12 +32,11 @@ import java.util.concurrent.LinkedBlockingQueue;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.rocketmq.acl.plug.AclPlugController
;
import
org.apache.rocketmq.acl.plug.AclRemotingServ
er
;
import
org.apache.rocketmq.acl.plug.AclRemotingServ
ice
;
import
org.apache.rocketmq.acl.plug.entity.AccessControl
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
Entity
;
import
org.apache.rocketmq.acl.plug.entity.ControllerParameters
;
import
org.apache.rocketmq.broker.client.ClientHousekeepingService
;
import
org.apache.rocketmq.broker.client.ConsumerIdsChangeListener
;
import
org.apache.rocketmq.broker.client.ConsumerManager
;
...
...
@@ -503,14 +502,14 @@ public class BrokerController {
log
.
info
(
"Default does not start acl plug"
);
return
;
}
ControllerParameters
Entity
controllerParametersEntity
=
new
ControllerParametersEntity
();
controllerParameters
Entity
.
setFileHome
(
brokerConfig
.
getRocketmqHome
());
aclPlugController
=
new
AclPlugController
(
controllerParameters
Entity
);
ControllerParameters
controllerParameters
=
new
ControllerParameters
();
controllerParameters
.
setFileHome
(
brokerConfig
.
getRocketmqHome
());
aclPlugController
=
new
AclPlugController
(
controllerParameters
);
if
(!
aclPlugController
.
isStartSucceed
())
{
log
.
error
(
"start acl plug failure"
);
return
;
}
final
AclRemotingServ
er
aclRemotingServe
=
aclPlugController
.
getAclRemotingServer
();
final
AclRemotingServ
ice
aclRemotingService
=
aclPlugController
.
getAclRemotingService
();
this
.
registerServerRPCHook
(
new
RPCHook
()
{
@Override
...
...
@@ -525,7 +524,7 @@ public class BrokerController {
accessControl
.
setNetaddress
(
StringUtils
.
split
(
remoteAddr
,
":"
)[
0
]);
accessControl
.
setTopic
(
extFields
.
get
(
"topic"
));
}
aclRemotingServe
.
check
(
accessControl
);
aclRemotingServ
ic
e
.
check
(
accessControl
);
}
@Override
...
...
common/src/test/java/org/apache/rocketmq/common/MixAllTest.java
浏览文件 @
da09320d
...
...
@@ -17,14 +17,13 @@
package
org.apache.rocketmq.common
;
import
org.junit.Test
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.net.InetAddress
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicLong
;
import
org.junit.Test
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -34,7 +33,7 @@ public class MixAllTest {
List
<
String
>
localInetAddress
=
MixAll
.
getLocalInetAddress
();
String
local
=
InetAddress
.
getLocalHost
().
getHostAddress
();
assertThat
(
localInetAddress
).
contains
(
"127.0.0.1"
);
assertThat
(
localInetAddress
).
contains
(
local
);
}
@Test
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录