File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
main/java/io/github/protocol/bookkeeper/admin/jdk
test/java/io/github/protocol/bookkeeper/admin/jdk Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,10 @@ public AutoRecoveryStatus autoRecoveryStatus() throws BookkeeperAdminException {
3030 @ Override
3131 public void recoveryBookie (RecoveryBookieReqData reqData ) throws BookkeeperAdminException {
3232 try {
33- innerHttpClient .put (UrlConst .AUTO_RECOVERY , reqData );
33+ HttpResponse resp = innerHttpClient .put (UrlConst .AUTO_RECOVERY_BOOKIE , reqData );
34+ if (resp .statusCode () < 200 || resp .statusCode () >= 300 ) {
35+ throw new BookkeeperAdminException (resp .bodyAsString ());
36+ }
3437 } catch (IOException | InterruptedException | ExecutionException e ) {
3538 throw new BookkeeperAdminException (e );
3639 }
Original file line number Diff line number Diff line change 11package io .github .protocol .bookkeeper .admin .jdk ;
22
3+ import com .fasterxml .jackson .annotation .JsonProperty ;
4+ import lombok .Getter ;
5+
36import java .util .List ;
47
8+ @ Getter
59public class RecoveryBookieReqData {
10+ @ JsonProperty ("bookie_src" )
611 private List <String > bookieSrc ;
7- private boolean deleteCookie ;
812
9- public List <String > getBookieSrc () {
10- return bookieSrc ;
11- }
13+ @ JsonProperty ("delete_cookie" )
14+ private boolean deleteCookie ;
1215
1316 public void setBookieSrc (List <String > bookieSrc ) {
1417 this .bookieSrc = bookieSrc ;
1518 }
1619
17- public boolean isDeleteCookie () {
18- return deleteCookie ;
19- }
20-
2120 public void setDeleteCookie (boolean deleteCookie ) {
2221 this .deleteCookie = deleteCookie ;
2322 }
Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ public void testRecoveryBookie() throws BookkeeperAdminException {
4444 autoRecovery .recoveryBookie (reqData );
4545 }
4646
47+ @ Test
48+ public void testRecoveryBookieError () {
49+ RecoveryBookieReqData reqData = new RecoveryBookieReqData ();
50+ // bookie src is required
51+ reqData .setBookieSrc (null );
52+ reqData .setDeleteCookie (false );
53+ Assertions .assertThrows (BookkeeperAdminException .class , () -> autoRecovery .recoveryBookie (reqData ));
54+ }
55+
4756 @ Test
4857 public void testListUnderReplicatedLedger () {
4958 ListUnderReplicatedLedgerReqData reqData = new ListUnderReplicatedLedgerReqData ();
You can’t perform that action at this time.
0 commit comments