Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhangjian1949
apollo
提交
64a609af
apollo
项目概览
zhangjian1949
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
64a609af
编写于
1月 22, 2017
作者:
J
Jason Song
提交者:
GitHub
1月 22, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #526 from lepdou/branch_operation_check_namespace
check namespace and branch exist when update gray rules
上级
e2c8c9ca
bc8ec05d
变更
68
隐藏空白更改
内联
并排
Showing
68 changed file
with
139 addition
and
300 deletion
+139
-300
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
...amework/apollo/adminservice/controller/AppController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
...ork/apollo/adminservice/controller/ClusterController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
...work/apollo/adminservice/controller/CommitController.java
+2
-1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/IndexController.java
...ework/apollo/adminservice/controller/IndexController.java
+2
-1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
...mework/apollo/adminservice/controller/ItemController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
...k/apollo/adminservice/controller/NamespaceController.java
+6
-5
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
...ollo/adminservice/controller/NamespaceLockController.java
+2
-1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/PrivilegeController.java
...k/apollo/adminservice/controller/PrivilegeController.java
+0
-10
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
...ork/apollo/adminservice/controller/ReleaseController.java
+5
-5
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/AllTests.java
...ava/com/ctrip/framework/apollo/adminservice/AllTests.java
+2
-1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/PrivilegeService.java
.../ctrip/framework/apollo/biz/service/PrivilegeService.java
+0
-62
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/AllTests.java
...rc/test/java/com/ctrip/framework/apollo/biz/AllTests.java
+5
-3
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceTest.java
...ip/framework/apollo/biz/service/NamespaceServiceTest.java
+0
-3
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java
...ip/framework/apollo/biz/service/PrivilegeServiceTest.java
+0
-98
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java
...rip/framework/apollo/openapi/service/ConsumerService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/AppController.java
...framework/apollo/openapi/v1/controller/AppController.java
+3
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/API.java
.../main/java/com/ctrip/framework/apollo/portal/api/API.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/AdminServiceAddressLocator.java
...k/apollo/portal/component/AdminServiceAddressLocator.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/ItemsComparator.java
...ip/framework/apollo/portal/component/ItemsComparator.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/PermissionValidator.java
...ramework/apollo/portal/component/PermissionValidator.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/PortalSettings.java
...rip/framework/apollo/portal/component/PortalSettings.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java
...ramework/apollo/portal/component/RestTemplateFactory.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java
...mework/apollo/portal/component/RetryableRestTemplate.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java
...ramework/apollo/portal/component/config/PortalConfig.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/ConfigPublishEmailBuilder.java
...tal/component/emailbuilder/ConfigPublishEmailBuilder.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/GrayPublishEmailBuilder.java
...ortal/component/emailbuilder/GrayPublishEmailBuilder.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/MergeEmailBuilder.java
...ollo/portal/component/emailbuilder/MergeEmailBuilder.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/NormalPublishEmailBuilder.java
...tal/component/emailbuilder/NormalPublishEmailBuilder.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/RollbackEmailBuilder.java
...o/portal/component/emailbuilder/RollbackEmailBuilder.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/ConfigTextResolver.java
...ollo/portal/component/txtresolver/ConfigTextResolver.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolver.java
...apollo/portal/component/txtresolver/FileTextResolver.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java
...apollo/portal/component/txtresolver/PropertyResolver.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
...rip/framework/apollo/portal/controller/AppController.java
+5
-5
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java
.../framework/apollo/portal/controller/CommitController.java
+2
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/EnvController.java
...rip/framework/apollo/portal/controller/EnvController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/FavoriteController.java
...ramework/apollo/portal/controller/FavoriteController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/InstanceController.java
...ramework/apollo/portal/controller/InstanceController.java
+5
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
...ip/framework/apollo/portal/controller/ItemController.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceBranchController.java
...k/apollo/portal/controller/NamespaceBranchController.java
+3
-3
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
...amework/apollo/portal/controller/NamespaceController.java
+6
-6
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java
...ork/apollo/portal/controller/NamespaceLockController.java
+3
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/OrganizationController.java
...work/apollo/portal/controller/OrganizationController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java
...mework/apollo/portal/controller/PermissionController.java
+5
-5
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
...framework/apollo/portal/controller/ReleaseController.java
+4
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/UserInfoController.java
...ramework/apollo/portal/controller/UserInfoController.java
+5
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishListener.java
...amework/apollo/portal/listener/ConfigPublishListener.java
+5
-5
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
...ip/framework/apollo/portal/listener/CreationListener.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ItemService.java
...om/ctrip/framework/apollo/portal/service/ItemService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceBranchService.java
...amework/apollo/portal/service/NamespaceBranchService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java
...framework/apollo/portal/service/NamespaceLockService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java
...rip/framework/apollo/portal/service/NamespaceService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/RolePermissionService.java
...ramework/apollo/portal/service/RolePermissionService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
...rk/apollo/portal/spi/configuration/AuthConfiguration.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/BizLoggingCustomizer.java
...amework/apollo/portal/spi/ctrip/BizLoggingCustomizer.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripEmailRequestBuilder.java
...ork/apollo/portal/spi/ctrip/CtripEmailRequestBuilder.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripEmailService.java
.../framework/apollo/portal/spi/ctrip/CtripEmailService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripLogoutHandler.java
...framework/apollo/portal/spi/ctrip/CtripLogoutHandler.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripUserService.java
...p/framework/apollo/portal/spi/ctrip/CtripUserService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/WebContextConfiguration.java
...work/apollo/portal/spi/ctrip/WebContextConfiguration.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/service/ConsumerServiceTest.java
...framework/apollo/openapi/service/ConsumerServiceTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AllTests.java
...test/java/com/ctrip/framework/apollo/portal/AllTests.java
+8
-3
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java
...ip/framework/apollo/portal/RetryableRestTemplateTest.java
+2
-3
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolverTest.java
...lo/portal/component/txtresolver/FileTextResolverTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolverTest.java
...lo/portal/component/txtresolver/PropertyResolverTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/config/ConfigTest.java
.../com/ctrip/framework/apollo/portal/config/ConfigTest.java
+4
-6
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java
...ip/framework/apollo/portal/service/ConfigServiceTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java
...framework/apollo/portal/service/NamespaceServiceTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripUserServiceTest.java
...amework/apollo/portal/spi/ctrip/CtripUserServiceTest.java
+1
-1
未找到文件。
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
浏览文件 @
64a609af
...
@@ -56,7 +56,7 @@ public class AppController {
...
@@ -56,7 +56,7 @@ public class AppController {
appService
.
delete
(
entity
.
getId
(),
operator
);
appService
.
delete
(
entity
.
getId
(),
operator
);
}
}
@RequestMapping
(
"/apps"
)
@RequestMapping
(
value
=
"/apps"
,
method
=
RequestMethod
.
GET
)
public
List
<
AppDTO
>
find
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
public
List
<
AppDTO
>
find
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
Pageable
pageable
)
{
Pageable
pageable
)
{
List
<
App
>
app
=
null
;
List
<
App
>
app
=
null
;
...
@@ -68,7 +68,7 @@ public class AppController {
...
@@ -68,7 +68,7 @@ public class AppController {
return
BeanUtils
.
batchTransform
(
AppDTO
.
class
,
app
);
return
BeanUtils
.
batchTransform
(
AppDTO
.
class
,
app
);
}
}
@RequestMapping
(
"/apps/{appId}"
)
@RequestMapping
(
value
=
"/apps/{appId}"
,
method
=
RequestMethod
.
GET
)
public
AppDTO
get
(
@PathVariable
(
"appId"
)
String
appId
)
{
public
AppDTO
get
(
@PathVariable
(
"appId"
)
String
appId
)
{
App
app
=
appService
.
findOne
(
appId
);
App
app
=
appService
.
findOne
(
appId
);
if
(
app
==
null
)
{
if
(
app
==
null
)
{
...
@@ -77,7 +77,7 @@ public class AppController {
...
@@ -77,7 +77,7 @@ public class AppController {
return
BeanUtils
.
transfrom
(
AppDTO
.
class
,
app
);
return
BeanUtils
.
transfrom
(
AppDTO
.
class
,
app
);
}
}
@RequestMapping
(
"/apps/{appId}/unique"
)
@RequestMapping
(
value
=
"/apps/{appId}/unique"
,
method
=
RequestMethod
.
GET
)
public
boolean
isAppIdUnique
(
@PathVariable
(
"appId"
)
String
appId
)
{
public
boolean
isAppIdUnique
(
@PathVariable
(
"appId"
)
String
appId
)
{
return
appService
.
isAppIdUnique
(
appId
);
return
appService
.
isAppIdUnique
(
appId
);
}
}
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
浏览文件 @
64a609af
...
@@ -58,13 +58,13 @@ public class ClusterController {
...
@@ -58,13 +58,13 @@ public class ClusterController {
clusterService
.
delete
(
entity
.
getId
(),
operator
);
clusterService
.
delete
(
entity
.
getId
(),
operator
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters"
,
method
=
RequestMethod
.
GET
)
public
List
<
ClusterDTO
>
find
(
@PathVariable
(
"appId"
)
String
appId
)
{
public
List
<
ClusterDTO
>
find
(
@PathVariable
(
"appId"
)
String
appId
)
{
List
<
Cluster
>
clusters
=
clusterService
.
findParentClusters
(
appId
);
List
<
Cluster
>
clusters
=
clusterService
.
findParentClusters
(
appId
);
return
BeanUtils
.
batchTransform
(
ClusterDTO
.
class
,
clusters
);
return
BeanUtils
.
batchTransform
(
ClusterDTO
.
class
,
clusters
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName:.+}"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName:.+}"
,
method
=
RequestMethod
.
GET
)
public
ClusterDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
public
ClusterDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
Cluster
cluster
=
clusterService
.
findOne
(
appId
,
clusterName
);
Cluster
cluster
=
clusterService
.
findOne
(
appId
,
clusterName
);
...
@@ -74,7 +74,7 @@ public class ClusterController {
...
@@ -74,7 +74,7 @@ public class ClusterController {
return
BeanUtils
.
transfrom
(
ClusterDTO
.
class
,
cluster
);
return
BeanUtils
.
transfrom
(
ClusterDTO
.
class
,
cluster
);
}
}
@RequestMapping
(
"/apps/{appId}/cluster/{clusterName}/unique"
)
@RequestMapping
(
value
=
"/apps/{appId}/cluster/{clusterName}/unique"
,
method
=
RequestMethod
.
GET
)
public
boolean
isAppIdUnique
(
@PathVariable
(
"appId"
)
String
appId
,
public
boolean
isAppIdUnique
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
return
clusterService
.
isClusterNameUnique
(
appId
,
clusterName
);
return
clusterService
.
isClusterNameUnique
(
appId
,
clusterName
);
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
浏览文件 @
64a609af
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
...
@@ -20,7 +21,7 @@ public class CommitController {
...
@@ -20,7 +21,7 @@ public class CommitController {
@Autowired
@Autowired
private
CommitService
commitService
;
private
CommitService
commitService
;
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/commit"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/commit"
,
method
=
RequestMethod
.
GET
)
public
List
<
CommitDTO
>
find
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
public
List
<
CommitDTO
>
find
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
Pageable
pageable
){
@PathVariable
String
namespaceName
,
Pageable
pageable
){
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/IndexController.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.adminservice.controller
;
package
com.ctrip.framework.apollo.adminservice.controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
path
=
"/"
)
@RequestMapping
(
path
=
"/"
)
public
class
IndexController
{
public
class
IndexController
{
@RequestMapping
(
path
=
""
)
@RequestMapping
(
path
=
""
,
method
=
RequestMethod
.
GET
)
public
String
index
()
{
public
String
index
()
{
return
"apollo-adminservice"
;
return
"apollo-adminservice"
;
}
}
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
浏览文件 @
64a609af
...
@@ -125,14 +125,14 @@ public class ItemController {
...
@@ -125,14 +125,14 @@ public class ItemController {
commitService
.
save
(
commit
);
commitService
.
save
(
commit
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
method
=
RequestMethod
.
GET
)
public
List
<
ItemDTO
>
findItems
(
@PathVariable
(
"appId"
)
String
appId
,
public
List
<
ItemDTO
>
findItems
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
return
BeanUtils
.
batchTransform
(
ItemDTO
.
class
,
itemService
.
findItems
(
appId
,
clusterName
,
namespaceName
));
return
BeanUtils
.
batchTransform
(
ItemDTO
.
class
,
itemService
.
findItems
(
appId
,
clusterName
,
namespaceName
));
}
}
@RequestMapping
(
"/items/{itemId}"
)
@RequestMapping
(
value
=
"/items/{itemId}"
,
method
=
RequestMethod
.
GET
)
public
ItemDTO
get
(
@PathVariable
(
"itemId"
)
long
itemId
)
{
public
ItemDTO
get
(
@PathVariable
(
"itemId"
)
long
itemId
)
{
Item
item
=
itemService
.
findOne
(
itemId
);
Item
item
=
itemService
.
findOne
(
itemId
);
if
(
item
==
null
)
{
if
(
item
==
null
)
{
...
@@ -141,7 +141,7 @@ public class ItemController {
...
@@ -141,7 +141,7 @@ public class ItemController {
return
BeanUtils
.
transfrom
(
ItemDTO
.
class
,
item
);
return
BeanUtils
.
transfrom
(
ItemDTO
.
class
,
item
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key:.+}"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key:.+}"
,
method
=
RequestMethod
.
GET
)
public
ItemDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
public
ItemDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"key"
)
String
key
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"key"
)
String
key
)
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
浏览文件 @
64a609af
...
@@ -54,14 +54,14 @@ public class NamespaceController {
...
@@ -54,14 +54,14 @@ public class NamespaceController {
namespaceService
.
deleteNamespace
(
entity
,
operator
);
namespaceService
.
deleteNamespace
(
entity
,
operator
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces"
,
method
=
RequestMethod
.
GET
)
public
List
<
NamespaceDTO
>
find
(
@PathVariable
(
"appId"
)
String
appId
,
public
List
<
NamespaceDTO
>
find
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
@PathVariable
(
"clusterName"
)
String
clusterName
)
{
List
<
Namespace
>
groups
=
namespaceService
.
findNamespaces
(
appId
,
clusterName
);
List
<
Namespace
>
groups
=
namespaceService
.
findNamespaces
(
appId
,
clusterName
);
return
BeanUtils
.
batchTransform
(
NamespaceDTO
.
class
,
groups
);
return
BeanUtils
.
batchTransform
(
NamespaceDTO
.
class
,
groups
);
}
}
@RequestMapping
(
"/namespaces/{namespaceId}"
)
@RequestMapping
(
value
=
"/namespaces/{namespaceId}"
,
method
=
RequestMethod
.
GET
)
public
NamespaceDTO
get
(
@PathVariable
(
"namespaceId"
)
Long
namespaceId
)
{
public
NamespaceDTO
get
(
@PathVariable
(
"namespaceId"
)
Long
namespaceId
)
{
Namespace
namespace
=
namespaceService
.
findOne
(
namespaceId
);
Namespace
namespace
=
namespaceService
.
findOne
(
namespaceId
);
if
(
namespace
==
null
)
if
(
namespace
==
null
)
...
@@ -69,7 +69,7 @@ public class NamespaceController {
...
@@ -69,7 +69,7 @@ public class NamespaceController {
return
BeanUtils
.
transfrom
(
NamespaceDTO
.
class
,
namespace
);
return
BeanUtils
.
transfrom
(
NamespaceDTO
.
class
,
namespace
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName:.+}"
,
method
=
RequestMethod
.
GET
)
public
NamespaceDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
public
NamespaceDTO
get
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
...
@@ -79,7 +79,8 @@ public class NamespaceController {
...
@@ -79,7 +79,8 @@ public class NamespaceController {
return
BeanUtils
.
transfrom
(
NamespaceDTO
.
class
,
namespace
);
return
BeanUtils
.
transfrom
(
NamespaceDTO
.
class
,
namespace
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace"
,
method
=
RequestMethod
.
GET
)
public
NamespaceDTO
findPublicNamespaceForAssociatedNamespace
(
@PathVariable
String
appId
,
public
NamespaceDTO
findPublicNamespaceForAssociatedNamespace
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
@PathVariable
String
namespaceName
)
{
...
@@ -95,7 +96,7 @@ public class NamespaceController {
...
@@ -95,7 +96,7 @@ public class NamespaceController {
/**
/**
* cluster -> cluster has not published namespaces?
* cluster -> cluster has not published namespaces?
*/
*/
@RequestMapping
(
"/apps/{appId}/namespaces/publish_info"
)
@RequestMapping
(
value
=
"/apps/{appId}/namespaces/publish_info"
,
method
=
RequestMethod
.
GET
)
public
Map
<
String
,
Boolean
>
namespacePublishInfo
(
@PathVariable
String
appId
)
{
public
Map
<
String
,
Boolean
>
namespacePublishInfo
(
@PathVariable
String
appId
)
{
return
namespaceService
.
namespacePublishInfo
(
appId
);
return
namespaceService
.
namespacePublishInfo
(
appId
);
}
}
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
浏览文件 @
64a609af
...
@@ -12,6 +12,7 @@ import com.ctrip.framework.apollo.common.utils.BeanUtils;
...
@@ -12,6 +12,7 @@ import com.ctrip.framework.apollo.common.utils.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
...
@@ -25,7 +26,7 @@ public class NamespaceLockController {
...
@@ -25,7 +26,7 @@ public class NamespaceLockController {
@Autowired
@Autowired
private
BizConfig
bizConfig
;
private
BizConfig
bizConfig
;
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock"
,
method
=
RequestMethod
.
GET
)
public
NamespaceLockDTO
getNamespaceLockOwner
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
public
NamespaceLockDTO
getNamespaceLockOwner
(
@PathVariable
String
appId
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
@PathVariable
String
namespaceName
)
{
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/PrivilegeController.java
已删除
100644 → 0
浏览文件 @
e2c8c9ca
package
com.ctrip.framework.apollo.adminservice.controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/privileges"
)
public
class
PrivilegeController
{
}
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
浏览文件 @
64a609af
...
@@ -48,7 +48,7 @@ public class ReleaseController {
...
@@ -48,7 +48,7 @@ public class ReleaseController {
private
NamespaceBranchService
namespaceBranchService
;
private
NamespaceBranchService
namespaceBranchService
;
@RequestMapping
(
"/releases/{releaseId}"
)
@RequestMapping
(
value
=
"/releases/{releaseId}"
,
method
=
RequestMethod
.
GET
)
public
ReleaseDTO
get
(
@PathVariable
(
"releaseId"
)
long
releaseId
)
{
public
ReleaseDTO
get
(
@PathVariable
(
"releaseId"
)
long
releaseId
)
{
Release
release
=
releaseService
.
findOne
(
releaseId
);
Release
release
=
releaseService
.
findOne
(
releaseId
);
if
(
release
==
null
)
{
if
(
release
==
null
)
{
...
@@ -57,7 +57,7 @@ public class ReleaseController {
...
@@ -57,7 +57,7 @@ public class ReleaseController {
return
BeanUtils
.
transfrom
(
ReleaseDTO
.
class
,
release
);
return
BeanUtils
.
transfrom
(
ReleaseDTO
.
class
,
release
);
}
}
@RequestMapping
(
"/releases"
)
@RequestMapping
(
value
=
"/releases"
,
method
=
RequestMethod
.
GET
)
public
List
<
ReleaseDTO
>
findReleaseByIds
(
@RequestParam
(
"releaseIds"
)
String
releaseIds
)
{
public
List
<
ReleaseDTO
>
findReleaseByIds
(
@RequestParam
(
"releaseIds"
)
String
releaseIds
)
{
Set
<
Long
>
releaseIdSet
=
RELEASES_SPLITTER
.
splitToList
(
releaseIds
).
stream
().
map
(
Long:
:
parseLong
)
Set
<
Long
>
releaseIdSet
=
RELEASES_SPLITTER
.
splitToList
(
releaseIds
).
stream
().
map
(
Long:
:
parseLong
)
.
collect
(
Collectors
.
toSet
());
.
collect
(
Collectors
.
toSet
());
...
@@ -67,7 +67,7 @@ public class ReleaseController {
...
@@ -67,7 +67,7 @@ public class ReleaseController {
return
BeanUtils
.
batchTransform
(
ReleaseDTO
.
class
,
releases
);
return
BeanUtils
.
batchTransform
(
ReleaseDTO
.
class
,
releases
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all"
,
method
=
RequestMethod
.
GET
)
public
List
<
ReleaseDTO
>
findAllReleases
(
@PathVariable
(
"appId"
)
String
appId
,
public
List
<
ReleaseDTO
>
findAllReleases
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
...
@@ -77,7 +77,7 @@ public class ReleaseController {
...
@@ -77,7 +77,7 @@ public class ReleaseController {
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active"
,
method
=
RequestMethod
.
GET
)
public
List
<
ReleaseDTO
>
findActiveReleases
(
@PathVariable
(
"appId"
)
String
appId
,
public
List
<
ReleaseDTO
>
findActiveReleases
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
...
@@ -86,7 +86,7 @@ public class ReleaseController {
...
@@ -86,7 +86,7 @@ public class ReleaseController {
return
BeanUtils
.
batchTransform
(
ReleaseDTO
.
class
,
releases
);
return
BeanUtils
.
batchTransform
(
ReleaseDTO
.
class
,
releases
);
}
}
@RequestMapping
(
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest"
)
@RequestMapping
(
value
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest"
,
method
=
RequestMethod
.
GET
)
public
ReleaseDTO
getLatest
(
@PathVariable
(
"appId"
)
String
appId
,
public
ReleaseDTO
getLatest
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/AllTests.java
浏览文件 @
64a609af
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.adminservice;
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.adminservice;
import
com.ctrip.framework.apollo.adminservice.aop.NamespaceLockTest
;
import
com.ctrip.framework.apollo.adminservice.aop.NamespaceLockTest
;
import
com.ctrip.framework.apollo.adminservice.controller.AppControllerTest
;
import
com.ctrip.framework.apollo.adminservice.controller.AppControllerTest
;
import
com.ctrip.framework.apollo.adminservice.controller.AppNamespaceControllerTest
;
import
com.ctrip.framework.apollo.adminservice.controller.ControllerExceptionTest
;
import
com.ctrip.framework.apollo.adminservice.controller.ControllerExceptionTest
;
import
com.ctrip.framework.apollo.adminservice.controller.ControllerIntegrationExceptionTest
;
import
com.ctrip.framework.apollo.adminservice.controller.ControllerIntegrationExceptionTest
;
import
com.ctrip.framework.apollo.adminservice.controller.InstanceConfigControllerTest
;
import
com.ctrip.framework.apollo.adminservice.controller.InstanceConfigControllerTest
;
...
@@ -16,7 +17,7 @@ import org.junit.runners.Suite.SuiteClasses;
...
@@ -16,7 +17,7 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses
({
@SuiteClasses
({
AppControllerTest
.
class
,
ReleaseControllerTest
.
class
,
ItemSetControllerTest
.
class
,
AppControllerTest
.
class
,
ReleaseControllerTest
.
class
,
ItemSetControllerTest
.
class
,
ControllerExceptionTest
.
class
,
ControllerIntegrationExceptionTest
.
class
,
ControllerExceptionTest
.
class
,
ControllerIntegrationExceptionTest
.
class
,
NamespaceLockTest
.
class
,
InstanceConfigControllerTest
.
class
NamespaceLockTest
.
class
,
InstanceConfigControllerTest
.
class
,
AppNamespaceControllerTest
.
class
})
})
public
class
AllTests
{
public
class
AllTests
{
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/PrivilegeService.java
已删除
100644 → 0
浏览文件 @
e2c8c9ca
package
com.ctrip.framework.apollo.biz.service
;
import
com.ctrip.framework.apollo.biz.entity.Audit
;
import
com.ctrip.framework.apollo.biz.entity.Privilege
;
import
com.ctrip.framework.apollo.biz.repository.PrivilegeRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
public
class
PrivilegeService
{
enum
PrivilType
{
EDIT
,
REVIEW
,
RELEASE
}
@Autowired
private
PrivilegeRepository
privilRepo
;
@Autowired
private
AuditService
auditService
;
@Transactional
public
Privilege
addPrivilege
(
long
namespaceId
,
String
name
,
PrivilType
privilType
)
{
Privilege
privil
=
privilRepo
.
findByNamespaceIdAndNameAndPrivilType
(
namespaceId
,
name
,
privilType
.
name
());
if
(
privil
==
null
)
{
privil
=
new
Privilege
();
privil
.
setNamespaceId
(
namespaceId
);
privil
.
setPrivilType
(
privilType
.
name
());
privil
.
setName
(
name
);
privilRepo
.
save
(
privil
);
auditService
.
audit
(
Privilege
.
class
.
getSimpleName
(),
privil
.
getId
(),
Audit
.
OP
.
INSERT
,
name
);
}
return
privil
;
}
public
boolean
hasPrivilege
(
long
namespaceId
,
String
name
,
PrivilType
privilType
)
{
Privilege
privil
=
privilRepo
.
findByNamespaceIdAndNameAndPrivilType
(
namespaceId
,
name
,
privilType
.
name
());
return
(
privil
!=
null
)
?
true
:
false
;
}
public
List
<
Privilege
>
listPrivileges
(
long
namespaceId
)
{
return
privilRepo
.
findByNamespaceId
(
namespaceId
);
}
@Transactional
public
void
removePrivilege
(
long
namespaceId
,
String
name
,
PrivilType
privilType
)
{
Privilege
privil
=
privilRepo
.
findByNamespaceIdAndNameAndPrivilType
(
namespaceId
,
name
,
privilType
.
name
());
if
(
privil
!=
null
)
{
privilRepo
.
delete
(
privil
);
auditService
.
audit
(
Privilege
.
class
.
getSimpleName
(),
privil
.
getId
(),
Audit
.
OP
.
DELETE
,
name
);
}
}
}
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/AllTests.java
浏览文件 @
64a609af
...
@@ -10,7 +10,8 @@ import com.ctrip.framework.apollo.biz.service.AdminServiceTransactionTest;
...
@@ -10,7 +10,8 @@ import com.ctrip.framework.apollo.biz.service.AdminServiceTransactionTest;
import
com.ctrip.framework.apollo.biz.service.ClusterServiceTest
;
import
com.ctrip.framework.apollo.biz.service.ClusterServiceTest
;
import
com.ctrip.framework.apollo.biz.service.InstanceServiceTest
;
import
com.ctrip.framework.apollo.biz.service.InstanceServiceTest
;
import
com.ctrip.framework.apollo.biz.service.NamespaceBranchServiceTest
;
import
com.ctrip.framework.apollo.biz.service.NamespaceBranchServiceTest
;
import
com.ctrip.framework.apollo.biz.service.PrivilegeServiceTest
;
import
com.ctrip.framework.apollo.biz.service.NamespacePublishInfoTest
;
import
com.ctrip.framework.apollo.biz.service.NamespaceServiceTest
;
import
com.ctrip.framework.apollo.biz.service.ReleaseCreationTest
;
import
com.ctrip.framework.apollo.biz.service.ReleaseCreationTest
;
import
com.ctrip.framework.apollo.biz.service.ReleaseServiceTest
;
import
com.ctrip.framework.apollo.biz.service.ReleaseServiceTest
;
import
com.ctrip.framework.apollo.biz.service.BizDBPropertySourceTest
;
import
com.ctrip.framework.apollo.biz.service.BizDBPropertySourceTest
;
...
@@ -25,7 +26,6 @@ import org.junit.runners.Suite.SuiteClasses;
...
@@ -25,7 +26,6 @@ import org.junit.runners.Suite.SuiteClasses;
AppRepositoryTest
.
class
,
AppRepositoryTest
.
class
,
AppNamespaceRepositoryTest
.
class
,
AppNamespaceRepositoryTest
.
class
,
AdminServiceTest
.
class
,
AdminServiceTest
.
class
,
PrivilegeServiceTest
.
class
,
AdminServiceTransactionTest
.
class
,
AdminServiceTransactionTest
.
class
,
DatabaseMessageSenderTest
.
class
,
DatabaseMessageSenderTest
.
class
,
BizDBPropertySourceTest
.
class
,
BizDBPropertySourceTest
.
class
,
...
@@ -36,7 +36,9 @@ import org.junit.runners.Suite.SuiteClasses;
...
@@ -36,7 +36,9 @@ import org.junit.runners.Suite.SuiteClasses;
InstanceServiceTest
.
class
,
InstanceServiceTest
.
class
,
GrayReleaseRulesHolderTest
.
class
,
GrayReleaseRulesHolderTest
.
class
,
NamespaceBranchServiceTest
.
class
,
NamespaceBranchServiceTest
.
class
,
ReleaseCreationTest
.
class
ReleaseCreationTest
.
class
,
NamespacePublishInfoTest
.
class
,
NamespaceServiceTest
.
class
})
})
public
class
AllTests
{
public
class
AllTests
{
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceTest.java
浏览文件 @
64a609af
...
@@ -24,9 +24,6 @@ import static org.junit.Assert.assertNotNull;
...
@@ -24,9 +24,6 @@ import static org.junit.Assert.assertNotNull;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* @author lepdou 2016-11-28
*/
public
class
NamespaceServiceTest
extends
AbstractIntegrationTest
{
public
class
NamespaceServiceTest
extends
AbstractIntegrationTest
{
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java
已删除
100644 → 0
浏览文件 @
e2c8c9ca
package
com.ctrip.framework.apollo.biz.service
;
import
com.ctrip.framework.apollo.biz.AbstractIntegrationTest
;
import
com.ctrip.framework.apollo.biz.entity.Cluster
;
import
com.ctrip.framework.apollo.biz.entity.Namespace
;
import
com.ctrip.framework.apollo.biz.entity.Privilege
;
import
com.ctrip.framework.apollo.common.entity.App
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.Date
;
import
java.util.List
;
public
class
PrivilegeServiceTest
extends
AbstractIntegrationTest
{
@Autowired
private
AdminService
adminService
;
@Autowired
private
ClusterService
clusterService
;
@Autowired
private
NamespaceService
namespaceService
;
@Autowired
private
PrivilegeService
privilService
;
@Test
public
void
testAddAndRemovePrivilege
()
{
App
app
=
new
App
();
app
.
setAppId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
app
.
setName
(
"new app "
+
System
.
currentTimeMillis
());
String
owner
=
"owner "
+
System
.
currentTimeMillis
();
app
.
setOwnerName
(
owner
);
app
.
setOwnerEmail
(
"owner "
+
System
.
currentTimeMillis
()
+
"@ctrip.com"
);
app
.
setDataChangeCreatedBy
(
owner
);
app
.
setDataChangeLastModifiedBy
(
owner
);
app
.
setDataChangeCreatedTime
(
new
Date
());
App
newApp
=
adminService
.
createNewApp
(
app
);
List
<
Cluster
>
clusters
=
clusterService
.
findParentClusters
(
newApp
.
getAppId
());
List
<
Namespace
>
namespaces
=
namespaceService
.
findNamespaces
(
newApp
.
getAppId
(),
clusters
.
get
(
0
).
getName
());
Namespace
namespace
=
namespaces
.
get
(
0
);
privilService
.
addPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
EDIT
);
List
<
Privilege
>
privileges
=
privilService
.
listPrivileges
(
namespace
.
getId
());
Assert
.
assertEquals
(
1
,
privileges
.
size
());
Assert
.
assertEquals
(
PrivilegeService
.
PrivilType
.
EDIT
.
name
(),
privileges
.
get
(
0
).
getPrivilType
());
Assert
.
assertEquals
(
newApp
.
getOwnerName
(),
privileges
.
get
(
0
).
getName
());
privilService
.
removePrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
EDIT
);
privileges
=
privilService
.
listPrivileges
(
namespace
.
getId
());
Assert
.
assertEquals
(
0
,
privileges
.
size
());
}
@Test
public
void
testCheckPrivilege
()
{
App
app
=
new
App
();
app
.
setAppId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
app
.
setName
(
"new app "
+
System
.
currentTimeMillis
());
String
owner
=
"owner "
+
System
.
currentTimeMillis
();
app
.
setOwnerName
(
owner
);
app
.
setOwnerEmail
(
"owner "
+
System
.
currentTimeMillis
()
+
"@ctrip.com"
);
app
.
setDataChangeCreatedBy
(
owner
);
app
.
setDataChangeLastModifiedBy
(
owner
);
app
.
setDataChangeCreatedTime
(
new
Date
());
App
newApp
=
adminService
.
createNewApp
(
app
);
List
<
Cluster
>
clusters
=
clusterService
.
findParentClusters
(
newApp
.
getAppId
());
List
<
Namespace
>
namespaces
=
namespaceService
.
findNamespaces
(
newApp
.
getAppId
(),
clusters
.
get
(
0
).
getName
());
Namespace
namespace
=
namespaces
.
get
(
0
);
privilService
.
addPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
EDIT
);
Assert
.
assertTrue
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
EDIT
));
Assert
.
assertFalse
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
REVIEW
));
Assert
.
assertFalse
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
RELEASE
));
privilService
.
addPrivilege
(
namespace
.
getId
(),
"nobody"
,
PrivilegeService
.
PrivilType
.
EDIT
);
Assert
.
assertTrue
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
"nobody"
,
PrivilegeService
.
PrivilType
.
EDIT
));
Assert
.
assertTrue
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
newApp
.
getOwnerName
(),
PrivilegeService
.
PrivilType
.
EDIT
));
privilService
.
addPrivilege
(
namespace
.
getId
(),
"nobody"
,
PrivilegeService
.
PrivilType
.
RELEASE
);
Assert
.
assertTrue
(
privilService
.
hasPrivilege
(
namespace
.
getId
(),
"nobody"
,
PrivilegeService
.
PrivilType
.
RELEASE
));
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java
浏览文件 @
64a609af
...
@@ -12,7 +12,7 @@ import com.ctrip.framework.apollo.openapi.entity.ConsumerToken;
...
@@ -12,7 +12,7 @@ import com.ctrip.framework.apollo.openapi.entity.ConsumerToken;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.apache.commons.lang.time.FastDateFormat
;
import
org.apache.commons.lang.time.FastDateFormat
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/AppController.java
浏览文件 @
64a609af
...
@@ -4,12 +4,13 @@ import com.ctrip.framework.apollo.common.dto.ClusterDTO;
...
@@ -4,12 +4,13 @@ import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO
;
import
com.ctrip.framework.apollo.openapi.dto.OpenEnvClusterDTO
;
import
com.ctrip.framework.apollo.portal.component
s
.PortalSettings
;
import
com.ctrip.framework.apollo.portal.component.PortalSettings
;
import
com.ctrip.framework.apollo.portal.service.ClusterService
;
import
com.ctrip.framework.apollo.portal.service.ClusterService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
...
@@ -24,7 +25,7 @@ public class AppController {
...
@@ -24,7 +25,7 @@ public class AppController {
@Autowired
@Autowired
private
ClusterService
clusterService
;
private
ClusterService
clusterService
;
@RequestMapping
(
"/apps/{appId}/envclusters"
)
@RequestMapping
(
value
=
"/apps/{appId}/envclusters"
,
method
=
RequestMethod
.
GET
)
public
List
<
OpenEnvClusterDTO
>
loadEnvClusterInfo
(
@PathVariable
String
appId
){
public
List
<
OpenEnvClusterDTO
>
loadEnvClusterInfo
(
@PathVariable
String
appId
){
List
<
OpenEnvClusterDTO
>
envClusters
=
new
LinkedList
<>();
List
<
OpenEnvClusterDTO
>
envClusters
=
new
LinkedList
<>();
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/API.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.api
;
package
com.ctrip.framework.apollo.portal.api
;
import
com.ctrip.framework.apollo.portal.component
s
.RetryableRestTemplate
;
import
com.ctrip.framework.apollo.portal.component.RetryableRestTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/AdminServiceAddressLocator.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/AdminServiceAddressLocator.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/ItemsComparator.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/ItemsComparator.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/PermissionValidator.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/PermissionValidator.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.portal.constant.PermissionType
;
import
com.ctrip.framework.apollo.portal.constant.PermissionType
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/PortalSettings.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/PortalSettings.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.ctrip.framework.apollo.core.MetaDomainConsts
;
import
com.ctrip.framework.apollo.core.MetaDomainConsts
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.utils.ApolloThreadFactory
;
import
com.ctrip.framework.apollo.core.utils.ApolloThreadFactory
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/RestTemplateFactory.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.google.common.io.BaseEncoding
;
import
com.google.common.io.BaseEncoding
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.apache.http.Header
;
import
org.apache.http.Header
;
import
org.apache.http.auth.AuthScope
;
import
org.apache.http.auth.AuthScope
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/RetryableRestTemplate.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
;
package
com.ctrip.framework.apollo.portal.component
;
import
com.ctrip.framework.apollo.common.exception.ServiceException
;
import
com.ctrip.framework.apollo.common.exception.ServiceException
;
import
com.ctrip.framework.apollo.core.MetaDomainConsts
;
import
com.ctrip.framework.apollo.core.MetaDomainConsts
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/config/PortalConfig.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.config
;
package
com.ctrip.framework.apollo.portal.component.config
;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
...
@@ -15,7 +15,6 @@ import com.ctrip.framework.apollo.portal.service.PortalDBPropertySource;
...
@@ -15,7 +15,6 @@ import com.ctrip.framework.apollo.portal.service.PortalDBPropertySource;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
import
java.util.Collections
;
import
java.util.Collections
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/emailbuilder/ConfigPublishEmailBuilder.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/ConfigPublishEmailBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.emailbuilder
;
package
com.ctrip.framework.apollo.portal.component.emailbuilder
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
@@ -9,7 +9,7 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
...
@@ -9,7 +9,7 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.constant.RoleType
;
import
com.ctrip.framework.apollo.portal.constant.RoleType
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/emailbuilder/GrayPublishEmailBuilder.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/GrayPublishEmailBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.emailbuilder
;
package
com.ctrip.framework.apollo.portal.component.emailbuilder
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/emailbuilder/MergeEmailBuilder.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/MergeEmailBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.emailbuilder
;
package
com.ctrip.framework.apollo.portal.component.emailbuilder
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/emailbuilder/NormalPublishEmailBuilder.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/NormalPublishEmailBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.emailbuilder
;
package
com.ctrip.framework.apollo.portal.component.emailbuilder
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/emailbuilder/RollbackEmailBuilder.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/RollbackEmailBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.emailbuilder
;
package
com.ctrip.framework.apollo.portal.component.emailbuilder
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/txtresolver/ConfigTextResolver.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/ConfigTextResolver.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.txtresolver
;
package
com.ctrip.framework.apollo.portal.component.txtresolver
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/txtresolver/FileTextResolver.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolver.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.txtresolver
;
package
com.ctrip.framework.apollo.portal.component.txtresolver
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component
s
/txtresolver/PropertyResolver.java
→
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolver.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.txtresolver
;
package
com.ctrip.framework.apollo.portal.component.txtresolver
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
浏览文件 @
64a609af
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.apollo.common.http.RichResponseEntity;
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.apollo.common.http.RichResponseEntity;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.PortalSettings
;
import
com.ctrip.framework.apollo.portal.component.PortalSettings
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo
;
import
com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo
;
import
com.ctrip.framework.apollo.portal.listener.AppCreationEvent
;
import
com.ctrip.framework.apollo.portal.listener.AppCreationEvent
;
...
@@ -50,7 +50,7 @@ public class AppController {
...
@@ -50,7 +50,7 @@ public class AppController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@RequestMapping
(
""
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
List
<
App
>
findApps
(
@RequestParam
(
value
=
"appIds"
,
required
=
false
)
String
appIds
)
{
public
List
<
App
>
findApps
(
@RequestParam
(
value
=
"appIds"
,
required
=
false
)
String
appIds
)
{
if
(
StringUtils
.
isEmpty
(
appIds
)){
if
(
StringUtils
.
isEmpty
(
appIds
)){
return
appService
.
findAll
();
return
appService
.
findAll
();
...
@@ -60,12 +60,12 @@ public class AppController {
...
@@ -60,12 +60,12 @@ public class AppController {
}
}
@RequestMapping
(
"/by-owner"
)
@RequestMapping
(
value
=
"/by-owner"
,
method
=
RequestMethod
.
GET
)
public
List
<
App
>
findAppsByOwner
(
@RequestParam
(
"owner"
)
String
owner
,
Pageable
page
){
public
List
<
App
>
findAppsByOwner
(
@RequestParam
(
"owner"
)
String
owner
,
Pageable
page
){
return
appService
.
findByOwnerName
(
owner
,
page
);
return
appService
.
findByOwnerName
(
owner
,
page
);
}
}
@RequestMapping
(
"/{appId}/navtree"
)
@RequestMapping
(
value
=
"/{appId}/navtree"
,
method
=
RequestMethod
.
GET
)
public
MultiResponseEntity
<
EnvClusterInfo
>
nav
(
@PathVariable
String
appId
)
{
public
MultiResponseEntity
<
EnvClusterInfo
>
nav
(
@PathVariable
String
appId
)
{
MultiResponseEntity
<
EnvClusterInfo
>
response
=
MultiResponseEntity
.
ok
();
MultiResponseEntity
<
EnvClusterInfo
>
response
=
MultiResponseEntity
.
ok
();
...
@@ -130,7 +130,7 @@ public class AppController {
...
@@ -130,7 +130,7 @@ public class AppController {
return
appService
.
load
(
appId
);
return
appService
.
load
(
appId
);
}
}
@RequestMapping
(
value
=
"/{appId}/miss_envs"
)
@RequestMapping
(
value
=
"/{appId}/miss_envs"
,
method
=
RequestMethod
.
GET
)
public
MultiResponseEntity
<
Env
>
findMissEnvs
(
@PathVariable
String
appId
)
{
public
MultiResponseEntity
<
Env
>
findMissEnvs
(
@PathVariable
String
appId
)
{
MultiResponseEntity
<
Env
>
response
=
MultiResponseEntity
.
ok
();
MultiResponseEntity
<
Env
>
response
=
MultiResponseEntity
.
ok
();
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java
浏览文件 @
64a609af
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.service.CommitService;
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.service.CommitService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -20,7 +21,7 @@ public class CommitController {
...
@@ -20,7 +21,7 @@ public class CommitController {
@Autowired
@Autowired
private
CommitService
commitService
;
private
CommitService
commitService
;
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits"
,
method
=
RequestMethod
.
GET
)
public
List
<
CommitDTO
>
find
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
List
<
CommitDTO
>
find
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
defaultValue
=
"10"
)
int
size
)
{
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
defaultValue
=
"10"
)
int
size
)
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/EnvController.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.controller
;
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.PortalSettings
;
import
com.ctrip.framework.apollo.portal.component.PortalSettings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/FavoriteController.java
浏览文件 @
64a609af
...
@@ -27,7 +27,7 @@ public class FavoriteController {
...
@@ -27,7 +27,7 @@ public class FavoriteController {
}
}
@RequestMapping
(
"/favorites"
)
@RequestMapping
(
value
=
"/favorites"
,
method
=
RequestMethod
.
GET
)
public
List
<
Favorite
>
findFavorites
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
,
public
List
<
Favorite
>
findFavorites
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
,
@RequestParam
(
value
=
"appId"
,
required
=
false
)
String
appId
,
@RequestParam
(
value
=
"appId"
,
required
=
false
)
String
appId
,
Pageable
page
)
{
Pageable
page
)
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/InstanceController.java
浏览文件 @
64a609af
...
@@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity;
...
@@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -30,7 +31,7 @@ public class InstanceController {
...
@@ -30,7 +31,7 @@ public class InstanceController {
@Autowired
@Autowired
private
InstanceService
instanceService
;
private
InstanceService
instanceService
;
@RequestMapping
(
"/envs/{env}/instances/by-release"
)
@RequestMapping
(
value
=
"/envs/{env}/instances/by-release"
,
method
=
RequestMethod
.
GET
)
public
PageDTO
<
InstanceDTO
>
getByRelease
(
@PathVariable
String
env
,
@RequestParam
long
releaseId
,
public
PageDTO
<
InstanceDTO
>
getByRelease
(
@PathVariable
String
env
,
@RequestParam
long
releaseId
,
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
defaultValue
=
"20"
)
int
size
)
{
@RequestParam
(
defaultValue
=
"20"
)
int
size
)
{
...
@@ -38,7 +39,7 @@ public class InstanceController {
...
@@ -38,7 +39,7 @@ public class InstanceController {
return
instanceService
.
getByRelease
(
Env
.
valueOf
(
env
),
releaseId
,
page
,
size
);
return
instanceService
.
getByRelease
(
Env
.
valueOf
(
env
),
releaseId
,
page
,
size
);
}
}
@RequestMapping
(
"/envs/{env}/instances/by-namespace"
)
@RequestMapping
(
value
=
"/envs/{env}/instances/by-namespace"
,
method
=
RequestMethod
.
GET
)
public
PageDTO
<
InstanceDTO
>
getByNamespace
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
public
PageDTO
<
InstanceDTO
>
getByNamespace
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
@RequestParam
String
clusterName
,
@RequestParam
String
namespaceName
,
@RequestParam
String
clusterName
,
@RequestParam
String
namespaceName
,
@RequestParam
(
required
=
false
)
String
instanceAppId
,
@RequestParam
(
required
=
false
)
String
instanceAppId
,
...
@@ -48,7 +49,7 @@ public class InstanceController {
...
@@ -48,7 +49,7 @@ public class InstanceController {
return
instanceService
.
getByNamespace
(
Env
.
valueOf
(
env
),
appId
,
clusterName
,
namespaceName
,
instanceAppId
,
page
,
size
);
return
instanceService
.
getByNamespace
(
Env
.
valueOf
(
env
),
appId
,
clusterName
,
namespaceName
,
instanceAppId
,
page
,
size
);
}
}
@RequestMapping
(
"/envs/{env}/instances/by-namespace/count"
)
@RequestMapping
(
value
=
"/envs/{env}/instances/by-namespace/count"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
Number
>
getInstanceCountByNamespace
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
public
ResponseEntity
<
Number
>
getInstanceCountByNamespace
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
@RequestParam
String
clusterName
,
@RequestParam
String
clusterName
,
@RequestParam
String
namespaceName
)
{
@RequestParam
String
namespaceName
)
{
...
@@ -57,7 +58,7 @@ public class InstanceController {
...
@@ -57,7 +58,7 @@ public class InstanceController {
return
ResponseEntity
.
ok
(
new
Number
(
count
));
return
ResponseEntity
.
ok
(
new
Number
(
count
));
}
}
@RequestMapping
(
"/envs/{env}/instances/by-namespace-and-releases-not-in"
)
@RequestMapping
(
value
=
"/envs/{env}/instances/by-namespace-and-releases-not-in"
,
method
=
RequestMethod
.
GET
)
public
List
<
InstanceDTO
>
getByReleasesNotIn
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
public
List
<
InstanceDTO
>
getByReleasesNotIn
(
@PathVariable
String
env
,
@RequestParam
String
appId
,
@RequestParam
String
clusterName
,
@RequestParam
String
namespaceName
,
@RequestParam
String
clusterName
,
@RequestParam
String
namespaceName
,
@RequestParam
String
releaseIds
)
{
@RequestParam
String
releaseIds
)
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
浏览文件 @
64a609af
...
@@ -96,7 +96,7 @@ public class ItemController {
...
@@ -96,7 +96,7 @@ public class ItemController {
}
}
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
method
=
RequestMethod
.
GET
)
public
List
<
ItemDTO
>
findItems
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
List
<
ItemDTO
>
findItems
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@RequestParam
(
defaultValue
=
"lineNum"
)
String
orderBy
)
{
@RequestParam
(
defaultValue
=
"lineNum"
)
String
orderBy
)
{
...
@@ -116,7 +116,7 @@ public class ItemController {
...
@@ -116,7 +116,7 @@ public class ItemController {
return
items
;
return
items
;
}
}
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/items"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/items"
,
method
=
RequestMethod
.
GET
)
public
List
<
ItemDTO
>
findBranchItems
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
String
env
,
public
List
<
ItemDTO
>
findBranchItems
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
String
env
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceBranchController.java
浏览文件 @
64a609af
...
@@ -5,8 +5,8 @@ import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
...
@@ -5,8 +5,8 @@ import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import
com.ctrip.framework.apollo.common.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.common.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.PermissionValidator
;
import
com.ctrip.framework.apollo.portal.component.PermissionValidator
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.listener.ConfigPublishEvent
;
import
com.ctrip.framework.apollo.portal.listener.ConfigPublishEvent
;
...
@@ -38,7 +38,7 @@ public class NamespaceBranchController {
...
@@ -38,7 +38,7 @@ public class NamespaceBranchController {
@Autowired
@Autowired
private
PortalConfig
portalConfig
;
private
PortalConfig
portalConfig
;
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches"
,
method
=
RequestMethod
.
GET
)
public
NamespaceBO
findBranch
(
@PathVariable
String
appId
,
public
NamespaceBO
findBranch
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
clusterName
,
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
浏览文件 @
64a609af
...
@@ -62,26 +62,27 @@ public class NamespaceController {
...
@@ -62,26 +62,27 @@ public class NamespaceController {
@Autowired
@Autowired
private
RolePermissionService
rolePermissionService
;
private
RolePermissionService
rolePermissionService
;
@RequestMapping
(
"/appnamespaces/public"
)
@RequestMapping
(
value
=
"/appnamespaces/public"
,
method
=
RequestMethod
.
GET
)
public
List
<
AppNamespace
>
findPublicAppNamespaces
()
{
public
List
<
AppNamespace
>
findPublicAppNamespaces
()
{
return
appNamespaceService
.
findPublicAppNamespaces
();
return
appNamespaceService
.
findPublicAppNamespaces
();
}
}
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces"
,
method
=
RequestMethod
.
GET
)
public
List
<
NamespaceBO
>
findNamespaces
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
List
<
NamespaceBO
>
findNamespaces
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
)
{
@PathVariable
String
clusterName
)
{
return
namespaceService
.
findNamespaceBOs
(
appId
,
Env
.
valueOf
(
env
),
clusterName
);
return
namespaceService
.
findNamespaceBOs
(
appId
,
Env
.
valueOf
(
env
),
clusterName
);
}
}
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}"
,
method
=
RequestMethod
.
GET
)
public
NamespaceBO
findNamespace
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
NamespaceBO
findNamespace
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
return
namespaceService
.
loadNamespaceBO
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
);
return
namespaceService
.
loadNamespaceBO
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
);
}
}
@RequestMapping
(
"/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace"
)
@RequestMapping
(
value
=
"/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace"
,
method
=
RequestMethod
.
GET
)
public
NamespaceBO
findPublicNamespaceForAssociatedNamespace
(
@PathVariable
String
env
,
public
NamespaceBO
findPublicNamespaceForAssociatedNamespace
(
@PathVariable
String
env
,
@PathVariable
String
appId
,
@PathVariable
String
appId
,
@PathVariable
String
namespaceName
,
@PathVariable
String
namespaceName
,
...
@@ -170,7 +171,6 @@ public class NamespaceController {
...
@@ -170,7 +171,6 @@ public class NamespaceController {
return
createdAppNamespace
;
return
createdAppNamespace
;
}
}
/**
/**
* env -> cluster -> cluster has not published namespace?
* env -> cluster -> cluster has not published namespace?
* Example:
* Example:
...
@@ -178,7 +178,7 @@ public class NamespaceController {
...
@@ -178,7 +178,7 @@ public class NamespaceController {
* default -> true (default cluster has not published namespace)
* default -> true (default cluster has not published namespace)
* customCluster -> false (customCluster cluster's all namespaces had published)
* customCluster -> false (customCluster cluster's all namespaces had published)
*/
*/
@RequestMapping
(
"/apps/{appId}/namespaces/publish_info"
)
@RequestMapping
(
value
=
"/apps/{appId}/namespaces/publish_info"
,
method
=
RequestMethod
.
GET
)
public
Map
<
String
,
Map
<
String
,
Boolean
>>
getNamespacesPublishInfo
(
@PathVariable
String
appId
)
{
public
Map
<
String
,
Map
<
String
,
Boolean
>>
getNamespacesPublishInfo
(
@PathVariable
String
appId
)
{
return
namespaceService
.
getNamespacesPublishInfo
(
appId
);
return
namespaceService
.
getNamespacesPublishInfo
(
appId
);
}
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java
浏览文件 @
64a609af
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.service.NamespaceLockService;
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.service.NamespaceLockService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
...
@@ -17,14 +18,14 @@ public class NamespaceLockController {
...
@@ -17,14 +18,14 @@ public class NamespaceLockController {
private
NamespaceLockService
namespaceLockService
;
private
NamespaceLockService
namespaceLockService
;
@Deprecated
@Deprecated
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/lock"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/lock"
,
method
=
RequestMethod
.
GET
)
public
NamespaceLockDTO
getNamespaceLock
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
NamespaceLockDTO
getNamespaceLock
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
return
namespaceLockService
.
getNamespaceLock
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
);
return
namespaceLockService
.
getNamespaceLock
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
);
}
}
@RequestMapping
(
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/lock-info"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/lock-info"
,
method
=
RequestMethod
.
GET
)
public
LockInfo
getNamespaceLockInfo
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
LockInfo
getNamespaceLockInfo
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
)
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/OrganizationController.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.controller
;
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.vo.Organization
;
import
com.ctrip.framework.apollo.portal.entity.vo.Organization
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java
浏览文件 @
64a609af
...
@@ -38,7 +38,7 @@ public class PermissionController {
...
@@ -38,7 +38,7 @@ public class PermissionController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@RequestMapping
(
"/apps/{appId}/permissions/{permissionType}"
)
@RequestMapping
(
value
=
"/apps/{appId}/permissions/{permissionType}"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
PermissionCondition
>
hasPermission
(
@PathVariable
String
appId
,
@PathVariable
String
permissionType
)
{
public
ResponseEntity
<
PermissionCondition
>
hasPermission
(
@PathVariable
String
appId
,
@PathVariable
String
permissionType
)
{
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
...
@@ -48,7 +48,7 @@ public class PermissionController {
...
@@ -48,7 +48,7 @@ public class PermissionController {
return
ResponseEntity
.
ok
().
body
(
permissionCondition
);
return
ResponseEntity
.
ok
().
body
(
permissionCondition
);
}
}
@RequestMapping
(
"/apps/{appId}/namespaces/{namespaceName}/permissions/{permissionType}"
)
@RequestMapping
(
value
=
"/apps/{appId}/namespaces/{namespaceName}/permissions/{permissionType}"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
PermissionCondition
>
hasPermission
(
@PathVariable
String
appId
,
@PathVariable
String
namespaceName
,
public
ResponseEntity
<
PermissionCondition
>
hasPermission
(
@PathVariable
String
appId
,
@PathVariable
String
namespaceName
,
@PathVariable
String
permissionType
)
{
@PathVariable
String
permissionType
)
{
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
...
@@ -60,7 +60,7 @@ public class PermissionController {
...
@@ -60,7 +60,7 @@ public class PermissionController {
return
ResponseEntity
.
ok
().
body
(
permissionCondition
);
return
ResponseEntity
.
ok
().
body
(
permissionCondition
);
}
}
@RequestMapping
(
"/permissions/root"
)
@RequestMapping
(
value
=
"/permissions/root"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
PermissionCondition
>
hasRootPermission
()
{
public
ResponseEntity
<
PermissionCondition
>
hasRootPermission
()
{
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
PermissionCondition
permissionCondition
=
new
PermissionCondition
();
...
@@ -70,7 +70,7 @@ public class PermissionController {
...
@@ -70,7 +70,7 @@ public class PermissionController {
}
}
@RequestMapping
(
"/apps/{appId}/namespaces/{namespaceName}/role_users"
)
@RequestMapping
(
value
=
"/apps/{appId}/namespaces/{namespaceName}/role_users"
,
method
=
RequestMethod
.
GET
)
public
NamespaceRolesAssignedUsers
getNamespaceRoles
(
@PathVariable
String
appId
,
@PathVariable
String
namespaceName
)
{
public
NamespaceRolesAssignedUsers
getNamespaceRoles
(
@PathVariable
String
appId
,
@PathVariable
String
namespaceName
)
{
NamespaceRolesAssignedUsers
assignedUsers
=
new
NamespaceRolesAssignedUsers
();
NamespaceRolesAssignedUsers
assignedUsers
=
new
NamespaceRolesAssignedUsers
();
...
@@ -121,7 +121,7 @@ public class PermissionController {
...
@@ -121,7 +121,7 @@ public class PermissionController {
return
ResponseEntity
.
ok
().
build
();
return
ResponseEntity
.
ok
().
build
();
}
}
@RequestMapping
(
value
=
"/apps/{appId}/role_users"
)
@RequestMapping
(
value
=
"/apps/{appId}/role_users"
,
method
=
RequestMethod
.
GET
)
public
AppRolesAssignedUsers
getAppRoles
(
@PathVariable
String
appId
)
{
public
AppRolesAssignedUsers
getAppRoles
(
@PathVariable
String
appId
)
{
AppRolesAssignedUsers
users
=
new
AppRolesAssignedUsers
();
AppRolesAssignedUsers
users
=
new
AppRolesAssignedUsers
();
users
.
setAppId
(
appId
);
users
.
setAppId
(
appId
);
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
浏览文件 @
64a609af
...
@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
...
@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseBO
;
...
@@ -100,7 +100,7 @@ public class ReleaseController {
...
@@ -100,7 +100,7 @@ public class ReleaseController {
}
}
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all"
,
method
=
RequestMethod
.
GET
)
public
List
<
ReleaseBO
>
findAllReleases
(
@PathVariable
String
appId
,
public
List
<
ReleaseBO
>
findAllReleases
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
clusterName
,
...
@@ -114,7 +114,7 @@ public class ReleaseController {
...
@@ -114,7 +114,7 @@ public class ReleaseController {
return
releaseService
.
findAllReleases
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
,
page
,
size
);
return
releaseService
.
findAllReleases
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
,
page
,
size
);
}
}
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active"
)
@RequestMapping
(
value
=
"/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active"
,
method
=
RequestMethod
.
GET
)
public
List
<
ReleaseDTO
>
findActiveReleases
(
@PathVariable
String
appId
,
public
List
<
ReleaseDTO
>
findActiveReleases
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
clusterName
,
...
@@ -128,7 +128,7 @@ public class ReleaseController {
...
@@ -128,7 +128,7 @@ public class ReleaseController {
return
releaseService
.
findActiveReleases
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
,
page
,
size
);
return
releaseService
.
findActiveReleases
(
appId
,
Env
.
valueOf
(
env
),
clusterName
,
namespaceName
,
page
,
size
);
}
}
@RequestMapping
(
value
=
"/envs/{env}/releases/compare"
)
@RequestMapping
(
value
=
"/envs/{env}/releases/compare"
,
method
=
RequestMethod
.
GET
)
public
ReleaseCompareResult
compareRelease
(
@PathVariable
String
env
,
public
ReleaseCompareResult
compareRelease
(
@PathVariable
String
env
,
@RequestParam
long
baseReleaseId
,
@RequestParam
long
baseReleaseId
,
@RequestParam
long
toCompareReleaseId
)
{
@RequestParam
long
toCompareReleaseId
)
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/UserInfoController.java
浏览文件 @
64a609af
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.spi.UserService;
...
@@ -8,6 +8,7 @@ import com.ctrip.framework.apollo.portal.spi.UserService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -28,24 +29,24 @@ public class UserInfoController {
...
@@ -28,24 +29,24 @@ public class UserInfoController {
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@RequestMapping
(
"/user"
)
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
GET
)
public
UserInfo
getCurrentUserName
()
{
public
UserInfo
getCurrentUserName
()
{
return
userInfoHolder
.
getUser
();
return
userInfoHolder
.
getUser
();
}
}
@RequestMapping
(
"/user/logout"
)
@RequestMapping
(
value
=
"/user/logout"
,
method
=
RequestMethod
.
GET
)
public
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
public
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
logoutHandler
.
logout
(
request
,
response
);
logoutHandler
.
logout
(
request
,
response
);
}
}
@RequestMapping
(
"/users"
)
@RequestMapping
(
value
=
"/users"
,
method
=
RequestMethod
.
GET
)
public
List
<
UserInfo
>
searchUsersByKeyword
(
@RequestParam
(
value
=
"keyword"
)
String
keyword
,
public
List
<
UserInfo
>
searchUsersByKeyword
(
@RequestParam
(
value
=
"keyword"
)
String
keyword
,
@RequestParam
(
value
=
"offset"
,
defaultValue
=
"0"
)
int
offset
,
@RequestParam
(
value
=
"offset"
,
defaultValue
=
"0"
)
int
offset
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
int
limit
)
{
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"10"
)
int
limit
)
{
return
userService
.
searchUsers
(
keyword
,
offset
,
limit
);
return
userService
.
searchUsers
(
keyword
,
offset
,
limit
);
}
}
@RequestMapping
(
"/users/{userId}"
)
@RequestMapping
(
value
=
"/users/{userId}"
,
method
=
RequestMethod
.
GET
)
public
UserInfo
getUserByUserId
(
@PathVariable
String
userId
)
{
public
UserInfo
getUserByUserId
(
@PathVariable
String
userId
)
{
return
userService
.
findByUserId
(
userId
);
return
userService
.
findByUserId
(
userId
);
}
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishListener.java
浏览文件 @
64a609af
...
@@ -2,11 +2,11 @@ package com.ctrip.framework.apollo.portal.listener;
...
@@ -2,11 +2,11 @@ package com.ctrip.framework.apollo.portal.listener;
import
com.ctrip.framework.apollo.common.constants.ReleaseOperation
;
import
com.ctrip.framework.apollo.common.constants.ReleaseOperation
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component
s
.emailbuilder.GrayPublishEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component.emailbuilder.GrayPublishEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component
s
.emailbuilder.MergeEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component.emailbuilder.MergeEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component
s
.emailbuilder.NormalPublishEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component.emailbuilder.NormalPublishEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component
s
.emailbuilder.RollbackEmailBuilder
;
import
com.ctrip.framework.apollo.portal.component.emailbuilder.RollbackEmailBuilder
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.ReleaseHistoryBO
;
import
com.ctrip.framework.apollo.portal.service.ReleaseHistoryService
;
import
com.ctrip.framework.apollo.portal.service.ReleaseHistoryService
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
浏览文件 @
64a609af
...
@@ -5,7 +5,7 @@ import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO;
...
@@ -5,7 +5,7 @@ import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.PortalSettings
;
import
com.ctrip.framework.apollo.portal.component.PortalSettings
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ItemService.java
浏览文件 @
64a609af
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.txtresolver.ConfigTextResolver
;
import
com.ctrip.framework.apollo.portal.component.txtresolver.ConfigTextResolver
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceBranchService.java
浏览文件 @
64a609af
...
@@ -8,8 +8,8 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
...
@@ -8,8 +8,8 @@ import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.ItemsComparator
;
import
com.ctrip.framework.apollo.portal.component.ItemsComparator
;
import
com.ctrip.framework.apollo.portal.component
s
.PermissionValidator
;
import
com.ctrip.framework.apollo.portal.component.PermissionValidator
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java
浏览文件 @
64a609af
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service;
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service;
import
com.ctrip.framework.apollo.common.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.common.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.vo.LockInfo
;
import
com.ctrip.framework.apollo.portal.entity.vo.LockInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.service
;
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -15,7 +15,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
...
@@ -15,7 +15,7 @@ import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.PortalSettings
;
import
com.ctrip.framework.apollo.portal.component.PortalSettings
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.entity.bo.ItemBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.ItemBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/RolePermissionService.java
浏览文件 @
64a609af
...
@@ -6,7 +6,7 @@ import com.google.common.collect.HashMultimap;
...
@@ -6,7 +6,7 @@ import com.google.common.collect.HashMultimap;
import
com.google.common.collect.Multimap
;
import
com.google.common.collect.Multimap
;
import
com.google.common.collect.Sets
;
import
com.google.common.collect.Sets
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.po.Permission
;
import
com.ctrip.framework.apollo.portal.entity.po.Permission
;
import
com.ctrip.framework.apollo.portal.entity.po.Role
;
import
com.ctrip.framework.apollo.portal.entity.po.Role
;
import
com.ctrip.framework.apollo.portal.entity.po.RolePermission
;
import
com.ctrip.framework.apollo.portal.entity.po.RolePermission
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
浏览文件 @
64a609af
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.spi.configuration;
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.spi.configuration;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.spi.LogoutHandler
;
import
com.ctrip.framework.apollo.portal.spi.LogoutHandler
;
import
com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler
;
import
com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/BizLoggingCustomizer.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
import
com.ctrip.framework.apollo.common.customize.LoggingCustomizer
;
import
com.ctrip.framework.apollo.common.customize.LoggingCustomizer
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.context.annotation.Profile
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripEmailRequestBuilder.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
...
@@ -8,7 +8,6 @@ import org.apache.commons.lang.time.DateUtils;
...
@@ -8,7 +8,6 @@ import org.apache.commons.lang.time.DateUtils;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripEmailService.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.entity.bo.Email
;
import
com.ctrip.framework.apollo.portal.spi.EmailService
;
import
com.ctrip.framework.apollo.portal.spi.EmailService
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripLogoutHandler.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
package
com.ctrip.framework.apollo.portal.spi.ctrip
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.spi.LogoutHandler
;
import
com.ctrip.framework.apollo.portal.spi.LogoutHandler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripUserService.java
浏览文件 @
64a609af
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.spi.UserService
;
import
com.ctrip.framework.apollo.portal.spi.UserService
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/WebContextConfiguration.java
浏览文件 @
64a609af
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.spi.ctrip;
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.spi.ctrip;
import
com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter
;
import
com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter
;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/service/ConsumerServiceTest.java
浏览文件 @
64a609af
...
@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.openapi.entity.Consumer;
...
@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.openapi.entity.Consumer;
import
com.ctrip.framework.apollo.openapi.entity.ConsumerToken
;
import
com.ctrip.framework.apollo.openapi.entity.ConsumerToken
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository
;
import
com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.Test
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AllTests.java
浏览文件 @
64a609af
...
@@ -6,14 +6,17 @@ import com.ctrip.framework.apollo.openapi.service.ConsumerRolePermissionServiceT
...
@@ -6,14 +6,17 @@ import com.ctrip.framework.apollo.openapi.service.ConsumerRolePermissionServiceT
import
com.ctrip.framework.apollo.openapi.service.ConsumerServiceTest
;
import
com.ctrip.framework.apollo.openapi.service.ConsumerServiceTest
;
import
com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtilTest
;
import
com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtilTest
;
import
com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtilTest
;
import
com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtilTest
;
import
com.ctrip.framework.apollo.portal.components.txtresolver.FileTextResolverTest
;
import
com.ctrip.framework.apollo.portal.component.txtresolver.FileTextResolverTest
;
import
com.ctrip.framework.apollo.portal.components.txtresolver.PropertyResolverTest
;
import
com.ctrip.framework.apollo.portal.component.txtresolver.PropertyResolverTest
;
import
com.ctrip.framework.apollo.portal.config.ConfigTest
;
import
com.ctrip.framework.apollo.portal.controller.ConsumerControllerTest
;
import
com.ctrip.framework.apollo.portal.controller.ConsumerControllerTest
;
import
com.ctrip.framework.apollo.portal.service.AppNamespaceServiceTest
;
import
com.ctrip.framework.apollo.portal.service.AppNamespaceServiceTest
;
import
com.ctrip.framework.apollo.portal.service.ConfigServiceTest
;
import
com.ctrip.framework.apollo.portal.service.ConfigServiceTest
;
import
com.ctrip.framework.apollo.portal.service.FavoriteServiceTest
;
import
com.ctrip.framework.apollo.portal.service.NamespaceServiceTest
;
import
com.ctrip.framework.apollo.portal.service.NamespaceServiceTest
;
import
com.ctrip.framework.apollo.portal.service.RoleInitializationServiceTest
;
import
com.ctrip.framework.apollo.portal.service.RoleInitializationServiceTest
;
import
com.ctrip.framework.apollo.portal.service.RolePermissionServiceTest
;
import
com.ctrip.framework.apollo.portal.service.RolePermissionServiceTest
;
import
com.ctrip.framework.apollo.portal.spi.ctrip.CtripUserServiceTest
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Suite
;
import
org.junit.runners.Suite
;
...
@@ -26,7 +29,9 @@ import org.junit.runners.Suite.SuiteClasses;
...
@@ -26,7 +29,9 @@ import org.junit.runners.Suite.SuiteClasses;
AppNamespaceServiceTest
.
class
,
RoleInitializationServiceTest
.
class
,
FileTextResolverTest
.
class
,
AppNamespaceServiceTest
.
class
,
RoleInitializationServiceTest
.
class
,
FileTextResolverTest
.
class
,
RetryableRestTemplateTest
.
class
,
ConsumerRolePermissionServiceTest
.
class
,
RetryableRestTemplateTest
.
class
,
ConsumerRolePermissionServiceTest
.
class
,
ConsumerAuthenticationFilterTest
.
class
,
ConsumerAuthUtilTest
.
class
,
ConsumerServiceTest
.
class
,
ConsumerAuthenticationFilterTest
.
class
,
ConsumerAuthUtilTest
.
class
,
ConsumerServiceTest
.
class
,
ConsumerControllerTest
.
class
,
ConsumerAuditUtilTest
.
class
ConsumerControllerTest
.
class
,
ConsumerAuditUtilTest
.
class
,
ConfigTest
.
class
,
FavoriteServiceTest
.
class
,
CtripUserServiceTest
.
class
})
})
public
class
AllTests
{
public
class
AllTests
{
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java
浏览文件 @
64a609af
...
@@ -3,8 +3,8 @@ package com.ctrip.framework.apollo.portal;
...
@@ -3,8 +3,8 @@ package com.ctrip.framework.apollo.portal;
import
com.ctrip.framework.apollo.common.exception.ServiceException
;
import
com.ctrip.framework.apollo.common.exception.ServiceException
;
import
com.ctrip.framework.apollo.core.dto.ServiceDTO
;
import
com.ctrip.framework.apollo.core.dto.ServiceDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.component
s
.AdminServiceAddressLocator
;
import
com.ctrip.framework.apollo.portal.component.AdminServiceAddressLocator
;
import
com.ctrip.framework.apollo.portal.component
s
.RetryableRestTemplate
;
import
com.ctrip.framework.apollo.portal.component.RetryableRestTemplate
;
import
org.apache.http.HttpHost
;
import
org.apache.http.HttpHost
;
import
org.apache.http.conn.ConnectTimeoutException
;
import
org.apache.http.conn.ConnectTimeoutException
;
...
@@ -19,7 +19,6 @@ import org.springframework.http.ResponseEntity;
...
@@ -19,7 +19,6 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.web.client.ResourceAccessException
;
import
org.springframework.web.client.ResourceAccessException
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.net.ConnectException
;
import
java.net.SocketTimeoutException
;
import
java.net.SocketTimeoutException
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component
s
/txtresolver/FileTextResolverTest.java
→
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolverTest.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.txtresolver
;
package
com.ctrip.framework.apollo.portal.component.txtresolver
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
import
com.ctrip.framework.apollo.common.dto.ItemDTO
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component
s
/txtresolver/PropertyResolverTest.java
→
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/component/txtresolver/PropertyResolverTest.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.component
s
.txtresolver
;
package
com.ctrip.framework.apollo.portal.component.txtresolver
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.common.dto.ItemChangeSets
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/config/ConfigTest.java
浏览文件 @
64a609af
package
com.ctrip.framework.apollo.portal.config
;
package
com.ctrip.framework.apollo.portal.config
;
import
com.ctrip.framework.apollo.portal.components.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.AbstractUnitTest
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.InjectMocks
;
import
org.mockito.Mock
;
import
org.mockito.Mock
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
ConfigTest
extends
AbstractUnitTest
{
public
class
ConfigTest
{
@Mock
@Mock
private
ConfigurableEnvironment
environment
;
private
ConfigurableEnvironment
environment
;
...
@@ -27,7 +25,7 @@ public class ConfigTest {
...
@@ -27,7 +25,7 @@ public class ConfigTest {
String
testKey
=
"key"
;
String
testKey
=
"key"
;
String
testDefaultValue
=
"value"
;
String
testDefaultValue
=
"value"
;
when
(
environment
.
getProperty
(
testKey
)).
thenReturn
(
null
);
when
(
environment
.
getProperty
(
testKey
,
testDefaultValue
)).
thenReturn
(
testDefaultValue
);
Assert
.
assertEquals
(
testDefaultValue
,
config
.
getValue
(
testKey
,
testDefaultValue
));
Assert
.
assertEquals
(
testDefaultValue
,
config
.
getValue
(
testKey
,
testDefaultValue
));
}
}
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java
浏览文件 @
64a609af
...
@@ -9,7 +9,7 @@ import com.ctrip.framework.apollo.core.enums.Env;
...
@@ -9,7 +9,7 @@ import com.ctrip.framework.apollo.core.enums.Env;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.spi.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.component
s
.txtresolver.PropertyResolver
;
import
com.ctrip.framework.apollo.portal.component.txtresolver.PropertyResolver
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel
;
import
com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifier
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifier
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java
浏览文件 @
64a609af
...
@@ -7,7 +7,7 @@ import com.ctrip.framework.apollo.common.entity.AppNamespace;
...
@@ -7,7 +7,7 @@ import com.ctrip.framework.apollo.common.entity.AppNamespace;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.component
s
.txtresolver.PropertyResolver
;
import
com.ctrip.framework.apollo.portal.component.txtresolver.PropertyResolver
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO
;
import
org.junit.Before
;
import
org.junit.Before
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripUserServiceTest.java
浏览文件 @
64a609af
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
...
@@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableMap;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.ctrip.framework.apollo.portal.AbstractUnitTest
;
import
com.ctrip.framework.apollo.portal.AbstractUnitTest
;
import
com.ctrip.framework.apollo.portal.component
s
.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.component.config.PortalConfig
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.bo.UserInfo
;
import
org.junit.Before
;
import
org.junit.Before
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录