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
95e8e55c
Commit
95e8e55c
authored
Jul 26, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c954dbd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
20 deletions
+2
-20
ReleaseService.java
...om/ctrip/framework/apollo/biz/service/ReleaseService.java
+1
-10
ReleaseServiceTest.java
...trip/framework/apollo/biz/service/ReleaseServiceTest.java
+0
-9
config.html
apollo-portal/src/main/resources/static/config.html
+1
-1
No files found.
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
View file @
95e8e55c
...
...
@@ -41,9 +41,6 @@ public class ReleaseService {
private
AuditService
auditService
;
@Autowired
private
NamespaceLockService
namespaceLockService
;
@Autowired
private
NamespaceService
namespaceService
;
public
Release
findOne
(
long
releaseId
)
{
Release
release
=
releaseRepository
.
findOne
(
releaseId
);
...
...
@@ -126,17 +123,11 @@ public class ReleaseService {
String
clusterName
=
release
.
getClusterName
();
String
namespaceName
=
release
.
getNamespaceName
();
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
if
(
namespace
==
null
)
{
throw
new
BadRequestException
(
String
.
format
(
"namespace not existed. (appId=%s, cluster=%s, namespace=%s)"
,
appId
,
clusterName
,
namespaceName
));
}
PageRequest
page
=
new
PageRequest
(
0
,
2
);
List
<
Release
>
twoLatestActiveReleases
=
findActiveReleases
(
appId
,
clusterName
,
namespaceName
,
page
);
if
(
twoLatestActiveReleases
==
null
||
twoLatestActiveReleases
.
size
()
<
2
)
{
throw
new
BadRequestException
(
String
.
format
(
"Can't rollback namespace(appId=%s, clusterName=%s, namespaceName=%s) because only one active release"
,
appId
,
"Can't rollback namespace(appId=%s, clusterName=%s, namespaceName=%s) because
there is
only one active release"
,
appId
,
clusterName
,
namespaceName
));
}
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java
View file @
95e8e55c
package
com
.
ctrip
.
framework
.
apollo
.
biz
.
service
;
import
com.ctrip.framework.apollo.biz.AbstractUnitTest
;
import
com.ctrip.framework.apollo.biz.entity.Namespace
;
import
com.ctrip.framework.apollo.biz.entity.Release
;
import
com.ctrip.framework.apollo.biz.repository.ReleaseRepository
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
...
...
@@ -34,7 +33,6 @@ public class ReleaseServiceTest extends AbstractUnitTest {
private
String
clusterName
=
"cluster-test"
;
private
String
namespaceName
=
"namespace-test"
;
private
String
user
=
"user-test"
;
private
Namespace
namespace
;
private
long
releaseId
=
1
;
private
Release
firstRelease
;
private
Release
secondRelease
;
...
...
@@ -42,10 +40,6 @@ public class ReleaseServiceTest extends AbstractUnitTest {
@Before
public
void
init
()
{
namespace
=
new
Namespace
();
namespace
.
setAppId
(
appId
);
namespace
.
setClusterName
(
clusterName
);
namespace
.
setNamespaceName
(
namespaceName
);
firstRelease
=
new
Release
();
firstRelease
.
setId
(
releaseId
);
...
...
@@ -67,7 +61,6 @@ public class ReleaseServiceTest extends AbstractUnitTest {
public
void
testNamespaceNotExist
()
{
when
(
releaseRepository
.
findOne
(
releaseId
)).
thenReturn
(
firstRelease
);
when
(
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
)).
thenThrow
(
new
BadRequestException
(
"xx"
));
releaseService
.
rollback
(
releaseId
,
user
);
}
...
...
@@ -76,7 +69,6 @@ public class ReleaseServiceTest extends AbstractUnitTest {
public
void
testHasNoRelease
()
{
when
(
releaseRepository
.
findOne
(
releaseId
)).
thenReturn
(
firstRelease
);
when
(
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
)).
thenReturn
(
namespace
);
when
(
releaseRepository
.
findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc
(
appId
,
clusterName
,
namespaceName
,
...
...
@@ -90,7 +82,6 @@ public class ReleaseServiceTest extends AbstractUnitTest {
public
void
testRollback
()
{
when
(
releaseRepository
.
findOne
(
releaseId
)).
thenReturn
(
firstRelease
);
when
(
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
)).
thenReturn
(
namespace
);
when
(
releaseRepository
.
findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc
(
appId
,
clusterName
,
namespaceName
,
...
...
apollo-portal/src/main/resources/static/config.html
View file @
95e8e55c
...
...
@@ -384,7 +384,7 @@
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
取消
</button>
<button
type=
"submit"
class=
"btn btn-danger"
ng-if=
"releaseCompareResult.length > 0"
ng-disabled=
"rollbackBtnDisabled"
>
回滚
ng-disabled=
"rollbackBtnDisabled"
>
确定
回滚
</button>
</div>
</div>
...
...
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