forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some test cases for KafkaRequestHandler (apache#40)
- Add some test cases for KafkaRequestHandler. fix error in the tests. - change handleListOffsetRequest to get topic offset from PersistentTopic directly instead of calling admin command to get topic stats. - In topicManager add a Map to cache PersistentTopic.
- Loading branch information
Showing
17 changed files
with
1,453 additions
and
80 deletions.
There are no files selected for viewing
234 changes: 199 additions & 35 deletions
234
src/main/java/io/streamnative/kop/KafkaRequestHandler.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImplWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.bookkeeper.mledger.impl; | ||
|
||
import lombok.Getter; | ||
|
||
/** | ||
* A wrapper to make ManagedLedgerImpl accessible. | ||
*/ | ||
public class ManagedLedgerImplWrapper { | ||
@Getter | ||
private final ManagedLedgerImpl managedLedger; | ||
|
||
public ManagedLedgerImplWrapper(ManagedLedgerImpl managedLedger) { | ||
this.managedLedger = managedLedger; | ||
} | ||
|
||
public PositionImpl getNextValidPosition(final PositionImpl position) { | ||
return managedLedger.getNextValidPosition(position); | ||
} | ||
|
||
// return PositionImpl(firstLedgerId, -1) | ||
public PositionImpl getFirstPosition() { | ||
return managedLedger.getFirstPosition(); | ||
} | ||
|
||
// combine getFirstPosition and getNextValidPosition together. | ||
public PositionImpl getFirstValidPosition() { | ||
PositionImpl firstPosition = managedLedger.getFirstPosition(); | ||
if (firstPosition == null) { | ||
return null; | ||
} else { | ||
return getNextValidPosition(firstPosition); | ||
} | ||
} | ||
|
||
public PositionImpl getPreviousPosition(PositionImpl position) { | ||
return managedLedger.getPreviousPosition(position); | ||
} | ||
|
||
public PositionImpl getLastConfirmedEntry() { | ||
return (PositionImpl) managedLedger.getLastConfirmedEntry(); | ||
} | ||
|
||
} |
Oops, something went wrong.