Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
536eb044
Commit
536eb044
authored
Apr 26, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #144 from lepdou/bugfix_servicelocator
Bugfix service locator & change default namespace name to application
parents
6f611a78
31cf3311
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
AppNamespaceService.java
...ava/com/ctrip/apollo/biz/service/AppNamespaceService.java
+2
-1
NamespaceService.java
...n/java/com/ctrip/apollo/biz/service/NamespaceService.java
+1
-1
AdminServiceTest.java
...t/java/com/ctrip/apollo/biz/service/AdminServiceTest.java
+1
-1
ServiceLocator.java
.../java/com/ctrip/apollo/portal/service/ServiceLocator.java
+4
-4
No files found.
apollo-biz/src/main/java/com/ctrip/apollo/biz/service/AppNamespaceService.java
View file @
536eb044
...
...
@@ -9,6 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
import
com.ctrip.apollo.biz.entity.AppNamespace
;
import
com.ctrip.apollo.biz.entity.Audit
;
import
com.ctrip.apollo.biz.repository.AppNamespaceRepository
;
import
com.ctrip.apollo.core.ConfigConsts
;
import
com.ctrip.apollo.core.exception.ServiceException
;
@Service
...
...
@@ -33,7 +34,7 @@ public class AppNamespaceService {
}
AppNamespace
appNs
=
new
AppNamespace
();
appNs
.
setAppId
(
appId
);
appNs
.
setName
(
appId
);
appNs
.
setName
(
ConfigConsts
.
NAMESPACE_DEFAULT
);
appNs
.
setComment
(
"default app namespace"
);
appNs
.
setDataChangeCreatedBy
(
createBy
);
appNs
.
setDataChangeLastModifiedBy
(
createBy
);
...
...
apollo-biz/src/main/java/com/ctrip/apollo/biz/service/NamespaceService.java
View file @
536eb044
...
...
@@ -91,7 +91,7 @@ public class NamespaceService {
Namespace
ns
=
new
Namespace
();
ns
.
setAppId
(
appId
);
ns
.
setClusterName
(
ConfigConsts
.
CLUSTER_NAME_DEFAULT
);
ns
.
setNamespaceName
(
appId
);
ns
.
setNamespaceName
(
ConfigConsts
.
NAMESPACE_DEFAULT
);
ns
.
setDataChangeCreatedBy
(
createBy
);
ns
.
setDataChangeLastModifiedBy
(
createBy
);
namespaceRepository
.
save
(
ns
);
...
...
apollo-biz/src/test/java/com/ctrip/apollo/biz/service/AdminServiceTest.java
View file @
536eb044
...
...
@@ -64,7 +64,7 @@ public class AdminServiceTest {
List
<
Namespace
>
namespaces
=
namespaceService
.
findNamespaces
(
appId
,
clusters
.
get
(
0
).
getName
());
Assert
.
assertEquals
(
1
,
namespaces
.
size
());
Assert
.
assertEquals
(
appId
,
namespaces
.
get
(
0
).
getNamespaceName
());
Assert
.
assertEquals
(
ConfigConsts
.
NAMESPACE_DEFAULT
,
namespaces
.
get
(
0
).
getNamespaceName
());
List
<
Audit
>
audits
=
auditService
.
findByOwner
(
owner
);
Assert
.
assertEquals
(
4
,
audits
.
size
());
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ServiceLocator.java
View file @
536eb044
...
...
@@ -41,18 +41,18 @@ public class ServiceLocator {
public
ServiceDTO
getAdminService
(
Env
env
)
throws
ServiceException
{
List
<
ServiceDTO
>
services
=
getServices
(
env
,
"admin"
);
if
(
services
.
size
()
==
0
)
{
if
(
services
==
null
||
services
.
size
()
==
0
)
{
throw
new
ServiceException
(
"No available admin service"
);
}
return
services
.
get
(
adminCallCounts
.
getAndIncrement
(
)
%
services
.
size
());
return
services
.
get
(
Math
.
abs
(
adminCallCounts
.
getAndIncrement
()
)
%
services
.
size
());
}
public
ServiceDTO
getConfigService
(
Env
env
)
throws
ServiceException
{
List
<
ServiceDTO
>
services
=
getServices
(
env
,
"config"
);
if
(
services
.
size
()
==
0
)
{
if
(
services
==
null
||
services
.
size
()
==
0
)
{
throw
new
ServiceException
(
"No available config service"
);
}
return
services
.
get
(
configCallCounts
.
getAndIncrement
(
)
%
services
.
size
());
return
services
.
get
(
Math
.
abs
(
configCallCounts
.
getAndIncrement
()
)
%
services
.
size
());
}
private
List
<
ServiceDTO
>
getServices
(
Env
env
,
String
serviceUrl
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment