use of org.apache.pulsar.broker.service.persistent.CompactorSubscription in project incubator-pulsar by apache.
the class PersistentTopicTest method testCompactorSubscriptionUpdatedOnInit.
@Test
public void testCompactorSubscriptionUpdatedOnInit() throws Exception {
long ledgerId = 0xc0bfefeL;
Map<String, Long> properties = ImmutableMap.of(Compactor.COMPACTED_TOPIC_LEDGER_PROPERTY, ledgerId);
PositionImpl position = new PositionImpl(1, 1);
doAnswer((invokactionOnMock) -> properties).when(cursorMock).getProperties();
doAnswer((invokactionOnMock) -> position).when(cursorMock).getMarkDeletedPosition();
PersistentTopic topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
CompactedTopic compactedTopic = mock(CompactedTopic.class);
new CompactorSubscription(topic, compactedTopic, Compactor.COMPACTION_SUBSCRIPTION, cursorMock);
verify(compactedTopic, Mockito.times(1)).newCompactedLedger(position, ledgerId);
}
use of org.apache.pulsar.broker.service.persistent.CompactorSubscription in project incubator-pulsar by apache.
the class PersistentTopicTest method testCompactorSubscription.
@Test
public void testCompactorSubscription() throws Exception {
PersistentTopic topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
CompactedTopic compactedTopic = mock(CompactedTopic.class);
PersistentSubscription sub = new CompactorSubscription(topic, compactedTopic, Compactor.COMPACTION_SUBSCRIPTION, cursorMock);
PositionImpl position = new PositionImpl(1, 1);
long ledgerId = 0xc0bfefeL;
sub.acknowledgeMessage(position, AckType.Cumulative, ImmutableMap.of(Compactor.COMPACTED_TOPIC_LEDGER_PROPERTY, ledgerId));
verify(compactedTopic, Mockito.times(1)).newCompactedLedger(position, ledgerId);
}
Aggregations